@atlaskit/smart-card 26.16.0 → 26.17.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/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/{SnippetOrPreview.js → ImagePreview.js} +19 -17
- package/dist/cjs/view/HoverCard/components/views/resolved/index.js +5 -5
- package/dist/cjs/view/HoverCard/components/views/resolving/styled.js +2 -1
- package/dist/cjs/view/HoverCard/styled.js +10 -6
- 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/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/ImagePreview.js +43 -0
- package/dist/es2019/view/HoverCard/components/views/resolved/index.js +5 -5
- package/dist/es2019/view/HoverCard/components/views/resolving/styled.js +2 -0
- package/dist/es2019/view/HoverCard/styled.js +10 -3
- 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/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/ImagePreview.js +49 -0
- package/dist/esm/view/HoverCard/components/views/resolved/index.js +5 -5
- package/dist/esm/view/HoverCard/components/views/resolving/styled.js +2 -1
- package/dist/esm/view/HoverCard/styled.js +8 -5
- package/dist/esm/view/LinkUrl/index.js +1 -1
- 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/view/HoverCard/components/ImagePreview.d.ts +4 -0
- package/dist/types/view/HoverCard/styled.d.ts +1 -0
- package/dist/types/view/HoverCard/types.d.ts +2 -2
- 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/dist/types-ts4.5/view/HoverCard/components/ImagePreview.d.ts +4 -0
- package/dist/types-ts4.5/view/HoverCard/styled.d.ts +1 -0
- package/dist/types-ts4.5/view/HoverCard/types.d.ts +2 -2
- package/package.json +2 -2
- package/report.api.md +3 -0
- package/tmp/api-report-tmp.d.ts +3 -0
- package/dist/es2019/view/HoverCard/components/SnippetOrPreview.js +0 -41
- package/dist/esm/view/HoverCard/components/SnippetOrPreview.js +0 -47
- package/dist/types/view/HoverCard/components/SnippetOrPreview.d.ts +0 -4
- package/dist/types-ts4.5/view/HoverCard/components/SnippetOrPreview.d.ts +0 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/smart-card
|
|
2
2
|
|
|
3
|
+
## 26.17.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`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.
|
|
8
|
+
|
|
9
|
+
## 26.16.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`8e0d75e3666`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8e0d75e3666) - Update Image preview styles for Hover Card
|
|
14
|
+
|
|
3
15
|
## 26.16.0
|
|
4
16
|
|
|
5
17
|
### Minor 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.17.0"
|
|
25
25
|
};
|
|
26
26
|
exports.context = context;
|
|
27
27
|
var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
@@ -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
|
};
|
|
@@ -6,25 +6,24 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
|
-
var
|
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
10
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
12
|
-
var _react2 = require("@emotion/react");
|
|
13
12
|
var _extractPreview = _interopRequireDefault(require("../../../extractors/flexible/extract-preview"));
|
|
14
13
|
var _blocks = require("../../FlexibleCard/components/blocks");
|
|
15
14
|
var _styled = require("../styled");
|
|
16
|
-
var
|
|
15
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
17
16
|
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); }
|
|
18
17
|
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; }
|
|
19
|
-
var
|
|
18
|
+
var ImagePreview = function ImagePreview(_ref) {
|
|
20
19
|
var data = _ref.data,
|
|
21
|
-
|
|
20
|
+
fallbackElementHeight = _ref.fallbackElementHeight;
|
|
22
21
|
var transitionStarted = (0, _react.useRef)(false);
|
|
23
22
|
var previewBlockRef = (0, _react.useRef)(null);
|
|
24
|
-
var _useState = (0, _react.useState)(
|
|
23
|
+
var _useState = (0, _react.useState)(true),
|
|
25
24
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
showPreview = _useState2[0],
|
|
26
|
+
setShowPreview = _useState2[1];
|
|
28
27
|
var _useState3 = (0, _react.useState)(),
|
|
29
28
|
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
30
29
|
previewCss = _useState4[0],
|
|
@@ -33,26 +32,29 @@ var SnippetOrPreview = function SnippetOrPreview(_ref) {
|
|
|
33
32
|
// Set Preview to a fixed height to enable transitions
|
|
34
33
|
var onPreviewRender = (0, _react.useCallback)(function () {
|
|
35
34
|
var _previewBlockRef$curr;
|
|
36
|
-
previewBlockRef.current && setPreviewCss((0,
|
|
35
|
+
previewBlockRef.current && setPreviewCss((0, _styled.getPreviewBlockStyles)((_previewBlockRef$curr = previewBlockRef.current) === null || _previewBlockRef$curr === void 0 ? void 0 : _previewBlockRef$curr.getBoundingClientRect().height));
|
|
37
36
|
}, []);
|
|
38
37
|
|
|
39
|
-
// On error set Preview to
|
|
38
|
+
// On error set Preview to Fallback height with transition
|
|
40
39
|
var onPreviewError = (0, _react.useCallback)(function () {
|
|
41
40
|
if (transitionStarted.current === false) {
|
|
42
|
-
setPreviewCss((0, _styled.getTransitionStyles)(
|
|
41
|
+
setPreviewCss((0, _styled.getTransitionStyles)(fallbackElementHeight));
|
|
43
42
|
transitionStarted.current = true;
|
|
44
43
|
}
|
|
45
|
-
}, [
|
|
44
|
+
}, [fallbackElementHeight]);
|
|
46
45
|
var onPreviewTransitionEnd = (0, _react.useCallback)(function () {
|
|
47
|
-
|
|
46
|
+
setShowPreview(false);
|
|
48
47
|
}, []);
|
|
49
|
-
return
|
|
50
|
-
onError: onPreviewError
|
|
48
|
+
return showPreview && data && (0, _extractPreview.default)(data) ? /*#__PURE__*/_react.default.createElement(_blocks.PreviewBlock, (0, _extends2.default)({
|
|
49
|
+
onError: onPreviewError
|
|
50
|
+
}, (0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.smart-card.enable-better-metadata_iojwg') && {
|
|
51
|
+
ignoreContainerPadding: true
|
|
52
|
+
}, {
|
|
51
53
|
overrideCss: previewCss,
|
|
52
54
|
onTransitionEnd: onPreviewTransitionEnd,
|
|
53
55
|
blockRef: previewBlockRef,
|
|
54
56
|
onRender: onPreviewRender
|
|
55
|
-
}) :
|
|
57
|
+
})) : null;
|
|
56
58
|
};
|
|
57
|
-
var _default =
|
|
59
|
+
var _default = ImagePreview;
|
|
58
60
|
exports.default = _default;
|
|
@@ -13,7 +13,7 @@ var _blocks = require("../../../../FlexibleCard/components/blocks");
|
|
|
13
13
|
var _styled = require("./styled");
|
|
14
14
|
var _FlexibleCard = _interopRequireDefault(require("../../../../FlexibleCard"));
|
|
15
15
|
var _utils = require("../../../utils");
|
|
16
|
-
var
|
|
16
|
+
var _ImagePreview = _interopRequireDefault(require("../../ImagePreview"));
|
|
17
17
|
var _extractMetadata = require("../../../../../extractors/hover/extractMetadata");
|
|
18
18
|
var _messages = require("../../../../../messages");
|
|
19
19
|
var _reactIntlNext = require("react-intl-next");
|
|
@@ -100,11 +100,11 @@ var HoverCardResolvedView = function HoverCardResolvedView(_ref) {
|
|
|
100
100
|
var _snippetBlockRef$curr, _snippetBlockRef$curr2;
|
|
101
101
|
snippetHeight.current = (_snippetBlockRef$curr = (_snippetBlockRef$curr2 = snippetBlockRef.current) === null || _snippetBlockRef$curr2 === void 0 ? void 0 : _snippetBlockRef$curr2.getBoundingClientRect().height) !== null && _snippetBlockRef$curr !== void 0 ? _snippetBlockRef$curr : 0;
|
|
102
102
|
}, []);
|
|
103
|
-
var
|
|
103
|
+
var imagePreview = (0, _ImagePreview.default)({
|
|
104
104
|
data: data,
|
|
105
|
-
|
|
105
|
+
fallbackElementHeight: snippetHeight.current
|
|
106
106
|
});
|
|
107
|
-
return /*#__PURE__*/_react.default.createElement(_FlexibleCard.default, flexibleCardProps, /*#__PURE__*/_react.default.createElement(_blocks.TitleBlock, (0, _extends2.default)({}, titleBlockProps, {
|
|
107
|
+
return /*#__PURE__*/_react.default.createElement(_FlexibleCard.default, flexibleCardProps, (0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.smart-card.enable-better-metadata_iojwg') && imagePreview, /*#__PURE__*/_react.default.createElement(_blocks.TitleBlock, (0, _extends2.default)({}, titleBlockProps, {
|
|
108
108
|
metadataPosition: _constants.SmartLinkPosition.Top
|
|
109
109
|
})), /*#__PURE__*/_react.default.createElement(_blocks.MetadataBlock, (0, _extends2.default)({
|
|
110
110
|
primary: topPrimary,
|
|
@@ -114,7 +114,7 @@ var HoverCardResolvedView = function HoverCardResolvedView(_ref) {
|
|
|
114
114
|
size: _constants.SmartLinkSize.Large
|
|
115
115
|
}, (0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.smart-card.enable-better-metadata_iojwg') && {
|
|
116
116
|
size: _constants.SmartLinkSize.Medium
|
|
117
|
-
})),
|
|
117
|
+
})), !imagePreview && /*#__PURE__*/_react.default.createElement(_blocks.SnippetBlock, null), !(0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.smart-card.enable-better-metadata_iojwg') && imagePreview, /*#__PURE__*/_react.default.createElement(_blocks.SnippetBlock, {
|
|
118
118
|
testId: 'hidden-snippet',
|
|
119
119
|
onRender: onSnippetRender,
|
|
120
120
|
blockRef: snippetBlockRef,
|
|
@@ -7,8 +7,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.titleBlockStyles = exports.skeletonContainer = exports.loadingViewContainer = exports.getTitleStyles = void 0;
|
|
8
8
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
9
9
|
var _react = require("@emotion/react");
|
|
10
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
10
11
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
11
|
-
var loadingViewContainer = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n flex-direction: column;\n"])));
|
|
12
|
+
var loadingViewContainer = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n flex-direction: column;\n ", "\n"])), (0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.smart-card.enable-better-metadata_iojwg') ? "padding: 1rem;" : "");
|
|
12
13
|
exports.loadingViewContainer = loadingViewContainer;
|
|
13
14
|
var skeletonContainer = (0, _react.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n flex-direction: column;\n gap: 0.625rem;\n align-items: center;\n"])));
|
|
14
15
|
exports.skeletonContainer = skeletonContainer;
|
|
@@ -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.titleBlockCss = exports.separatorCss = exports.popupContainerStyles = exports.getTransitionStyles = exports.flexibleUiOptions = exports.HoverCardContainer = exports.HOVER_CARD_Z_INDEX = exports.CARD_WIDTH_REM = exports.CARD_GAP_PX = void 0;
|
|
7
|
+
exports.titleBlockCss = exports.separatorCss = exports.popupContainerStyles = exports.getTransitionStyles = exports.getPreviewBlockStyles = exports.flexibleUiOptions = exports.HoverCardContainer = exports.HOVER_CARD_Z_INDEX = exports.CARD_WIDTH_REM = exports.CARD_GAP_PX = void 0;
|
|
8
8
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
9
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
10
|
var _react = require("@emotion/react");
|
|
@@ -13,7 +13,7 @@ var _constants = require("../../constants");
|
|
|
13
13
|
var _constants2 = require("@atlaskit/theme/constants");
|
|
14
14
|
var _components = require("@atlaskit/theme/components");
|
|
15
15
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
16
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
16
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
|
|
17
17
|
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; }
|
|
18
18
|
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; }
|
|
19
19
|
// Temporary fix for Confluence inline comment on editor mod has z-index of 500, Jira issue view has z-index of 510
|
|
@@ -23,11 +23,11 @@ var flexibleUiOptions = _objectSpread({
|
|
|
23
23
|
hideBackground: true,
|
|
24
24
|
hideElevation: true,
|
|
25
25
|
size: _constants.SmartLinkSize.Medium,
|
|
26
|
-
hidePadding: true,
|
|
27
26
|
hideHoverCardPreviewButton: false,
|
|
28
27
|
zIndex: HOVER_CARD_Z_INDEX + 1
|
|
29
28
|
}, !(0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.smart-card.enable-better-metadata_iojwg') && {
|
|
30
|
-
theme: _constants.SmartLinkTheme.Black
|
|
29
|
+
theme: _constants.SmartLinkTheme.Black,
|
|
30
|
+
hidePadding: true
|
|
31
31
|
});
|
|
32
32
|
exports.flexibleUiOptions = flexibleUiOptions;
|
|
33
33
|
var CARD_WIDTH_REM = 24;
|
|
@@ -39,7 +39,7 @@ var blockGap = '0.5rem';
|
|
|
39
39
|
var elementGap = '0.5rem';
|
|
40
40
|
var separatorCss = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n [data-separator] + [data-separator]:before {\n margin-right: ", ";\n }\n ", "\n"])), elementGap, (0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.smart-card.enable-better-metadata_iojwg') ? " [data-smart-element-avatar-group] + [data-separator]:before {\n content: '\u2022';\n margin-right: ".concat(elementGap, ";\n }") : "");
|
|
41
41
|
exports.separatorCss = separatorCss;
|
|
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
|
|
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;
|
|
44
44
|
var titleBlockCss = (0, _react.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\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, (0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.smart-card.show-smart-links-refreshed-design') ? "[data-smart-element=\"Title\"] {\n font-weight: 600;\n }" : "");
|
|
45
45
|
exports.titleBlockCss = titleBlockCss;
|
|
@@ -54,4 +54,8 @@ var popupContainerStyles = (0, _react.css)(_templateObject5 || (_templateObject5
|
|
|
54
54
|
light: "var(--ds-shadow-overlay, 0px 8px 12px rgba(9, 30, 66, 0.15),0px 0px 1px rgba(9, 30, 66, 0.31))",
|
|
55
55
|
dark: "var(--ds-shadow-overlay, 0px 0px 0px rgba(188, 214, 240, 0.12),0px 8px 12px rgba(3, 4, 4, 0.36),0px 0px 1px rgba(3, 4, 4, 0.5))"
|
|
56
56
|
})());
|
|
57
|
-
exports.popupContainerStyles = popupContainerStyles;
|
|
57
|
+
exports.popupContainerStyles = popupContainerStyles;
|
|
58
|
+
var getPreviewBlockStyles = function getPreviewBlockStyles(snippetHeight) {
|
|
59
|
+
return (0, _react.css)(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2.default)(["\n height: ", "px;\n ", "\n"])), snippetHeight, (0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.smart-card.show-smart-links-refreshed-design') ? " border-top-left-radius: ".concat("var(--ds-border-radius-300, 12px)", ";\n border-top-right-radius: ", "var(--ds-border-radius-300, 12px)", ";\n margin-bottom: ", blockGap, ";\n }") : "");
|
|
60
|
+
};
|
|
61
|
+
exports.getPreviewBlockStyles = getPreviewBlockStyles;
|
|
@@ -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.17.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.17.0"
|
|
7
7
|
};
|
|
8
8
|
export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
9
9
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -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};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React, { useCallback, useState, useRef } from 'react';
|
|
3
|
+
import extractPreview from '../../../extractors/flexible/extract-preview';
|
|
4
|
+
import { PreviewBlock } from '../../FlexibleCard/components/blocks';
|
|
5
|
+
import { getTransitionStyles, getPreviewBlockStyles } from '../styled';
|
|
6
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
7
|
+
const ImagePreview = ({
|
|
8
|
+
data,
|
|
9
|
+
fallbackElementHeight
|
|
10
|
+
}) => {
|
|
11
|
+
const transitionStarted = useRef(false);
|
|
12
|
+
const previewBlockRef = useRef(null);
|
|
13
|
+
const [showPreview, setShowPreview] = useState(true);
|
|
14
|
+
const [previewCss, setPreviewCss] = useState();
|
|
15
|
+
|
|
16
|
+
// Set Preview to a fixed height to enable transitions
|
|
17
|
+
const onPreviewRender = useCallback(() => {
|
|
18
|
+
var _previewBlockRef$curr;
|
|
19
|
+
previewBlockRef.current && setPreviewCss(getPreviewBlockStyles((_previewBlockRef$curr = previewBlockRef.current) === null || _previewBlockRef$curr === void 0 ? void 0 : _previewBlockRef$curr.getBoundingClientRect().height));
|
|
20
|
+
}, []);
|
|
21
|
+
|
|
22
|
+
// On error set Preview to Fallback height with transition
|
|
23
|
+
const onPreviewError = useCallback(() => {
|
|
24
|
+
if (transitionStarted.current === false) {
|
|
25
|
+
setPreviewCss(getTransitionStyles(fallbackElementHeight));
|
|
26
|
+
transitionStarted.current = true;
|
|
27
|
+
}
|
|
28
|
+
}, [fallbackElementHeight]);
|
|
29
|
+
const onPreviewTransitionEnd = useCallback(() => {
|
|
30
|
+
setShowPreview(false);
|
|
31
|
+
}, []);
|
|
32
|
+
return showPreview && data && extractPreview(data) ? /*#__PURE__*/React.createElement(PreviewBlock, _extends({
|
|
33
|
+
onError: onPreviewError
|
|
34
|
+
}, getBooleanFF('platform.linking-platform.smart-card.enable-better-metadata_iojwg') && {
|
|
35
|
+
ignoreContainerPadding: true
|
|
36
|
+
}, {
|
|
37
|
+
overrideCss: previewCss,
|
|
38
|
+
onTransitionEnd: onPreviewTransitionEnd,
|
|
39
|
+
blockRef: previewBlockRef,
|
|
40
|
+
onRender: onPreviewRender
|
|
41
|
+
})) : null;
|
|
42
|
+
};
|
|
43
|
+
export default ImagePreview;
|
|
@@ -5,7 +5,7 @@ import { FooterBlock, MetadataBlock, SnippetBlock, TitleBlock } from '../../../.
|
|
|
5
5
|
import { footerBlockCss, hiddenSnippetStyles, metadataBlockCss } from './styled';
|
|
6
6
|
import FlexibleCard from '../../../../FlexibleCard';
|
|
7
7
|
import { getSimulatedMetadata, getSimulatedBetterMetadata } from '../../../utils';
|
|
8
|
-
import
|
|
8
|
+
import ImagePreview from '../../ImagePreview';
|
|
9
9
|
import { extractMetadata, elementNamesToItems } from '../../../../../extractors/hover/extractMetadata';
|
|
10
10
|
import { messages } from '../../../../../messages';
|
|
11
11
|
import { FormattedMessage } from 'react-intl-next';
|
|
@@ -87,11 +87,11 @@ const HoverCardResolvedView = ({
|
|
|
87
87
|
var _snippetBlockRef$curr, _snippetBlockRef$curr2;
|
|
88
88
|
snippetHeight.current = (_snippetBlockRef$curr = (_snippetBlockRef$curr2 = snippetBlockRef.current) === null || _snippetBlockRef$curr2 === void 0 ? void 0 : _snippetBlockRef$curr2.getBoundingClientRect().height) !== null && _snippetBlockRef$curr !== void 0 ? _snippetBlockRef$curr : 0;
|
|
89
89
|
}, []);
|
|
90
|
-
const
|
|
90
|
+
const imagePreview = ImagePreview({
|
|
91
91
|
data: data,
|
|
92
|
-
|
|
92
|
+
fallbackElementHeight: snippetHeight.current
|
|
93
93
|
});
|
|
94
|
-
return /*#__PURE__*/React.createElement(FlexibleCard, flexibleCardProps, /*#__PURE__*/React.createElement(TitleBlock, _extends({}, titleBlockProps, {
|
|
94
|
+
return /*#__PURE__*/React.createElement(FlexibleCard, flexibleCardProps, getBooleanFF('platform.linking-platform.smart-card.enable-better-metadata_iojwg') && imagePreview, /*#__PURE__*/React.createElement(TitleBlock, _extends({}, titleBlockProps, {
|
|
95
95
|
metadataPosition: SmartLinkPosition.Top
|
|
96
96
|
})), /*#__PURE__*/React.createElement(MetadataBlock, _extends({
|
|
97
97
|
primary: topPrimary,
|
|
@@ -101,7 +101,7 @@ const HoverCardResolvedView = ({
|
|
|
101
101
|
size: SmartLinkSize.Large
|
|
102
102
|
}, getBooleanFF('platform.linking-platform.smart-card.enable-better-metadata_iojwg') && {
|
|
103
103
|
size: SmartLinkSize.Medium
|
|
104
|
-
})),
|
|
104
|
+
})), !imagePreview && /*#__PURE__*/React.createElement(SnippetBlock, null), !getBooleanFF('platform.linking-platform.smart-card.enable-better-metadata_iojwg') && imagePreview, /*#__PURE__*/React.createElement(SnippetBlock, {
|
|
105
105
|
testId: 'hidden-snippet',
|
|
106
106
|
onRender: onSnippetRender,
|
|
107
107
|
blockRef: snippetBlockRef,
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { css } from '@emotion/react';
|
|
2
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
2
3
|
export const loadingViewContainer = css`
|
|
3
4
|
display: flex;
|
|
4
5
|
flex-direction: column;
|
|
6
|
+
${getBooleanFF('platform.linking-platform.smart-card.enable-better-metadata_iojwg') ? `padding: 1rem;` : ``}
|
|
5
7
|
`;
|
|
6
8
|
export const skeletonContainer = css`
|
|
7
9
|
display: flex;
|
|
@@ -11,11 +11,11 @@ export const flexibleUiOptions = {
|
|
|
11
11
|
hideBackground: true,
|
|
12
12
|
hideElevation: true,
|
|
13
13
|
size: SmartLinkSize.Medium,
|
|
14
|
-
hidePadding: true,
|
|
15
14
|
hideHoverCardPreviewButton: false,
|
|
16
15
|
zIndex: HOVER_CARD_Z_INDEX + 1,
|
|
17
16
|
...(!getBooleanFF('platform.linking-platform.smart-card.enable-better-metadata_iojwg') && {
|
|
18
|
-
theme: SmartLinkTheme.Black
|
|
17
|
+
theme: SmartLinkTheme.Black,
|
|
18
|
+
hidePadding: true
|
|
19
19
|
})
|
|
20
20
|
};
|
|
21
21
|
export const CARD_WIDTH_REM = 24;
|
|
@@ -37,7 +37,7 @@ export const HoverCardContainer = css`
|
|
|
37
37
|
border-width: 0;
|
|
38
38
|
box-sizing: border-box;
|
|
39
39
|
width: ${CARD_WIDTH_REM}rem;
|
|
40
|
-
padding: 1rem
|
|
40
|
+
${!getBooleanFF('platform.linking-platform.smart-card.enable-better-metadata_iojwg') ? `padding: 1rem;` : ``}
|
|
41
41
|
|
|
42
42
|
.${loadingPlaceholderClassName} {
|
|
43
43
|
display: none;
|
|
@@ -79,4 +79,11 @@ export const popupContainerStyles = css`
|
|
|
79
79
|
light: "var(--ds-shadow-overlay, 0px 8px 12px rgba(9, 30, 66, 0.15),0px 0px 1px rgba(9, 30, 66, 0.31))",
|
|
80
80
|
dark: "var(--ds-shadow-overlay, 0px 0px 0px rgba(188, 214, 240, 0.12),0px 8px 12px rgba(3, 4, 4, 0.36),0px 0px 1px rgba(3, 4, 4, 0.5))"
|
|
81
81
|
})()};
|
|
82
|
+
`;
|
|
83
|
+
export const getPreviewBlockStyles = snippetHeight => css`
|
|
84
|
+
height: ${snippetHeight}px;
|
|
85
|
+
${getBooleanFF('platform.linking-platform.smart-card.show-smart-links-refreshed-design') ? ` border-top-left-radius: ${"var(--ds-border-radius-300, 12px)"};
|
|
86
|
+
border-top-right-radius: ${"var(--ds-border-radius-300, 12px)"};
|
|
87
|
+
margin-bottom: ${blockGap};
|
|
88
|
+
}` : ``}
|
|
82
89
|
`;
|
|
@@ -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.17.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.17.0"
|
|
17
17
|
};
|
|
18
18
|
export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
19
19
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -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
|
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
+
import React, { useCallback, useState, useRef } from 'react';
|
|
4
|
+
import extractPreview from '../../../extractors/flexible/extract-preview';
|
|
5
|
+
import { PreviewBlock } from '../../FlexibleCard/components/blocks';
|
|
6
|
+
import { getTransitionStyles, getPreviewBlockStyles } from '../styled';
|
|
7
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
8
|
+
var ImagePreview = function ImagePreview(_ref) {
|
|
9
|
+
var data = _ref.data,
|
|
10
|
+
fallbackElementHeight = _ref.fallbackElementHeight;
|
|
11
|
+
var transitionStarted = useRef(false);
|
|
12
|
+
var previewBlockRef = useRef(null);
|
|
13
|
+
var _useState = useState(true),
|
|
14
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
15
|
+
showPreview = _useState2[0],
|
|
16
|
+
setShowPreview = _useState2[1];
|
|
17
|
+
var _useState3 = useState(),
|
|
18
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
19
|
+
previewCss = _useState4[0],
|
|
20
|
+
setPreviewCss = _useState4[1];
|
|
21
|
+
|
|
22
|
+
// Set Preview to a fixed height to enable transitions
|
|
23
|
+
var onPreviewRender = useCallback(function () {
|
|
24
|
+
var _previewBlockRef$curr;
|
|
25
|
+
previewBlockRef.current && setPreviewCss(getPreviewBlockStyles((_previewBlockRef$curr = previewBlockRef.current) === null || _previewBlockRef$curr === void 0 ? void 0 : _previewBlockRef$curr.getBoundingClientRect().height));
|
|
26
|
+
}, []);
|
|
27
|
+
|
|
28
|
+
// On error set Preview to Fallback height with transition
|
|
29
|
+
var onPreviewError = useCallback(function () {
|
|
30
|
+
if (transitionStarted.current === false) {
|
|
31
|
+
setPreviewCss(getTransitionStyles(fallbackElementHeight));
|
|
32
|
+
transitionStarted.current = true;
|
|
33
|
+
}
|
|
34
|
+
}, [fallbackElementHeight]);
|
|
35
|
+
var onPreviewTransitionEnd = useCallback(function () {
|
|
36
|
+
setShowPreview(false);
|
|
37
|
+
}, []);
|
|
38
|
+
return showPreview && data && extractPreview(data) ? /*#__PURE__*/React.createElement(PreviewBlock, _extends({
|
|
39
|
+
onError: onPreviewError
|
|
40
|
+
}, getBooleanFF('platform.linking-platform.smart-card.enable-better-metadata_iojwg') && {
|
|
41
|
+
ignoreContainerPadding: true
|
|
42
|
+
}, {
|
|
43
|
+
overrideCss: previewCss,
|
|
44
|
+
onTransitionEnd: onPreviewTransitionEnd,
|
|
45
|
+
blockRef: previewBlockRef,
|
|
46
|
+
onRender: onPreviewRender
|
|
47
|
+
})) : null;
|
|
48
|
+
};
|
|
49
|
+
export default ImagePreview;
|
|
@@ -5,7 +5,7 @@ import { FooterBlock, MetadataBlock, SnippetBlock, TitleBlock } from '../../../.
|
|
|
5
5
|
import { footerBlockCss, hiddenSnippetStyles, metadataBlockCss } from './styled';
|
|
6
6
|
import FlexibleCard from '../../../../FlexibleCard';
|
|
7
7
|
import { getSimulatedMetadata, getSimulatedBetterMetadata } from '../../../utils';
|
|
8
|
-
import
|
|
8
|
+
import ImagePreview from '../../ImagePreview';
|
|
9
9
|
import { extractMetadata, elementNamesToItems } from '../../../../../extractors/hover/extractMetadata';
|
|
10
10
|
import { messages } from '../../../../../messages';
|
|
11
11
|
import { FormattedMessage } from 'react-intl-next';
|
|
@@ -89,11 +89,11 @@ var HoverCardResolvedView = function HoverCardResolvedView(_ref) {
|
|
|
89
89
|
var _snippetBlockRef$curr, _snippetBlockRef$curr2;
|
|
90
90
|
snippetHeight.current = (_snippetBlockRef$curr = (_snippetBlockRef$curr2 = snippetBlockRef.current) === null || _snippetBlockRef$curr2 === void 0 ? void 0 : _snippetBlockRef$curr2.getBoundingClientRect().height) !== null && _snippetBlockRef$curr !== void 0 ? _snippetBlockRef$curr : 0;
|
|
91
91
|
}, []);
|
|
92
|
-
var
|
|
92
|
+
var imagePreview = ImagePreview({
|
|
93
93
|
data: data,
|
|
94
|
-
|
|
94
|
+
fallbackElementHeight: snippetHeight.current
|
|
95
95
|
});
|
|
96
|
-
return /*#__PURE__*/React.createElement(FlexibleCard, flexibleCardProps, /*#__PURE__*/React.createElement(TitleBlock, _extends({}, titleBlockProps, {
|
|
96
|
+
return /*#__PURE__*/React.createElement(FlexibleCard, flexibleCardProps, getBooleanFF('platform.linking-platform.smart-card.enable-better-metadata_iojwg') && imagePreview, /*#__PURE__*/React.createElement(TitleBlock, _extends({}, titleBlockProps, {
|
|
97
97
|
metadataPosition: SmartLinkPosition.Top
|
|
98
98
|
})), /*#__PURE__*/React.createElement(MetadataBlock, _extends({
|
|
99
99
|
primary: topPrimary,
|
|
@@ -103,7 +103,7 @@ var HoverCardResolvedView = function HoverCardResolvedView(_ref) {
|
|
|
103
103
|
size: SmartLinkSize.Large
|
|
104
104
|
}, getBooleanFF('platform.linking-platform.smart-card.enable-better-metadata_iojwg') && {
|
|
105
105
|
size: SmartLinkSize.Medium
|
|
106
|
-
})),
|
|
106
|
+
})), !imagePreview && /*#__PURE__*/React.createElement(SnippetBlock, null), !getBooleanFF('platform.linking-platform.smart-card.enable-better-metadata_iojwg') && imagePreview, /*#__PURE__*/React.createElement(SnippetBlock, {
|
|
107
107
|
testId: 'hidden-snippet',
|
|
108
108
|
onRender: onSnippetRender,
|
|
109
109
|
blockRef: snippetBlockRef,
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
2
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
3
3
|
import { css } from '@emotion/react';
|
|
4
|
-
|
|
4
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
5
|
+
export var loadingViewContainer = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n ", "\n"])), getBooleanFF('platform.linking-platform.smart-card.enable-better-metadata_iojwg') ? "padding: 1rem;" : "");
|
|
5
6
|
export var skeletonContainer = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n gap: 0.625rem;\n align-items: center;\n"])));
|
|
6
7
|
export var getTitleStyles = function getTitleStyles(height) {
|
|
7
8
|
return css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n flex: 1 0 auto;\n height: ", "rem;\n\n span {\n width: 100%;\n }\n "])), height);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
3
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
|
|
4
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
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; }
|
|
6
6
|
import { css } from '@emotion/react';
|
|
@@ -16,11 +16,11 @@ export var flexibleUiOptions = _objectSpread({
|
|
|
16
16
|
hideBackground: true,
|
|
17
17
|
hideElevation: true,
|
|
18
18
|
size: SmartLinkSize.Medium,
|
|
19
|
-
hidePadding: true,
|
|
20
19
|
hideHoverCardPreviewButton: false,
|
|
21
20
|
zIndex: HOVER_CARD_Z_INDEX + 1
|
|
22
21
|
}, !getBooleanFF('platform.linking-platform.smart-card.enable-better-metadata_iojwg') && {
|
|
23
|
-
theme: SmartLinkTheme.Black
|
|
22
|
+
theme: SmartLinkTheme.Black,
|
|
23
|
+
hidePadding: true
|
|
24
24
|
});
|
|
25
25
|
export var CARD_WIDTH_REM = 24;
|
|
26
26
|
// gap between mouse cursor and hover card
|
|
@@ -28,7 +28,7 @@ export var CARD_GAP_PX = 10;
|
|
|
28
28
|
var blockGap = '0.5rem';
|
|
29
29
|
var elementGap = '0.5rem';
|
|
30
30
|
export var separatorCss = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n [data-separator] + [data-separator]:before {\n margin-right: ", ";\n }\n ", "\n"])), elementGap, getBooleanFF('platform.linking-platform.smart-card.enable-better-metadata_iojwg') ? " [data-smart-element-avatar-group] + [data-separator]:before {\n content: '\u2022';\n margin-right: ".concat(elementGap, ";\n }") : "");
|
|
31
|
-
export var HoverCardContainer = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n background: none;\n border-width: 0;\n box-sizing: border-box;\n width: ", "rem;\n
|
|
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) {
|
|
34
34
|
return css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n transition: height 300ms ease-in-out;\n height: ", "px;\n"])), snippetHeight);
|
|
@@ -39,4 +39,7 @@ export var popupContainerStyles = css(_templateObject5 || (_templateObject5 = _t
|
|
|
39
39
|
})(), themed({
|
|
40
40
|
light: "var(--ds-shadow-overlay, 0px 8px 12px rgba(9, 30, 66, 0.15),0px 0px 1px rgba(9, 30, 66, 0.31))",
|
|
41
41
|
dark: "var(--ds-shadow-overlay, 0px 0px 0px rgba(188, 214, 240, 0.12),0px 8px 12px rgba(3, 4, 4, 0.36),0px 0px 1px rgba(3, 4, 4, 0.5))"
|
|
42
|
-
})());
|
|
42
|
+
})());
|
|
43
|
+
export var getPreviewBlockStyles = function getPreviewBlockStyles(snippetHeight) {
|
|
44
|
+
return css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n height: ", "px;\n ", "\n"])), snippetHeight, getBooleanFF('platform.linking-platform.smart-card.show-smart-links-refreshed-design') ? " border-top-left-radius: ".concat("var(--ds-border-radius-300, 12px)", ";\n border-top-right-radius: ", "var(--ds-border-radius-300, 12px)", ";\n margin-bottom: ", blockGap, ";\n }") : "");
|
|
45
|
+
};
|
|
@@ -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.17.0",
|
|
15
15
|
componentName: 'linkUrl'
|
|
16
16
|
};
|
|
17
17
|
var Link = withLinkClickedEvent('a');
|
|
@@ -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;
|
|
@@ -8,3 +8,4 @@ export declare const HoverCardContainer: import("@emotion/react").SerializedStyl
|
|
|
8
8
|
export declare const titleBlockCss: import("@emotion/react").SerializedStyles;
|
|
9
9
|
export declare const getTransitionStyles: (snippetHeight: number) => import("@emotion/react").SerializedStyles;
|
|
10
10
|
export declare const popupContainerStyles: import("@emotion/react").SerializedStyles;
|
|
11
|
+
export declare const getPreviewBlockStyles: (snippetHeight: number) => import("@emotion/react").SerializedStyles;
|
|
@@ -92,7 +92,7 @@ export type HoverCardContentProps = {
|
|
|
92
92
|
onMouseLeave?: MouseEventHandler;
|
|
93
93
|
showServerActions?: boolean;
|
|
94
94
|
};
|
|
95
|
-
export type
|
|
95
|
+
export type ImagePreviewProps = {
|
|
96
96
|
data: JsonLd.Data.BaseData;
|
|
97
|
-
|
|
97
|
+
fallbackElementHeight: number;
|
|
98
98
|
};
|
|
@@ -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;
|
|
@@ -8,3 +8,4 @@ export declare const HoverCardContainer: import("@emotion/react").SerializedStyl
|
|
|
8
8
|
export declare const titleBlockCss: import("@emotion/react").SerializedStyles;
|
|
9
9
|
export declare const getTransitionStyles: (snippetHeight: number) => import("@emotion/react").SerializedStyles;
|
|
10
10
|
export declare const popupContainerStyles: import("@emotion/react").SerializedStyles;
|
|
11
|
+
export declare const getPreviewBlockStyles: (snippetHeight: number) => import("@emotion/react").SerializedStyles;
|
|
@@ -92,7 +92,7 @@ export type HoverCardContentProps = {
|
|
|
92
92
|
onMouseLeave?: MouseEventHandler;
|
|
93
93
|
showServerActions?: boolean;
|
|
94
94
|
};
|
|
95
|
-
export type
|
|
95
|
+
export type ImagePreviewProps = {
|
|
96
96
|
data: JsonLd.Data.BaseData;
|
|
97
|
-
|
|
97
|
+
fallbackElementHeight: number;
|
|
98
98
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/smart-card",
|
|
3
|
-
"version": "26.
|
|
3
|
+
"version": "26.17.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
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import React, { useCallback, useState, useRef } from 'react';
|
|
2
|
-
import { css } from '@emotion/react';
|
|
3
|
-
import extractPreview from '../../../extractors/flexible/extract-preview';
|
|
4
|
-
import { PreviewBlock, SnippetBlock } from '../../FlexibleCard/components/blocks';
|
|
5
|
-
import { getTransitionStyles } from '../styled';
|
|
6
|
-
const SnippetOrPreview = ({
|
|
7
|
-
data,
|
|
8
|
-
snippetHeight
|
|
9
|
-
}) => {
|
|
10
|
-
const transitionStarted = useRef(false);
|
|
11
|
-
const previewBlockRef = useRef(null);
|
|
12
|
-
const [showSnippet, setShowSnippet] = useState(false);
|
|
13
|
-
const [previewCss, setPreviewCss] = useState();
|
|
14
|
-
|
|
15
|
-
// Set Preview to a fixed height to enable transitions
|
|
16
|
-
const onPreviewRender = useCallback(() => {
|
|
17
|
-
var _previewBlockRef$curr;
|
|
18
|
-
previewBlockRef.current && setPreviewCss(css`
|
|
19
|
-
height: ${(_previewBlockRef$curr = previewBlockRef.current) === null || _previewBlockRef$curr === void 0 ? void 0 : _previewBlockRef$curr.getBoundingClientRect().height}px;
|
|
20
|
-
`);
|
|
21
|
-
}, []);
|
|
22
|
-
|
|
23
|
-
// On error set Preview to Snippet height with transition
|
|
24
|
-
const onPreviewError = useCallback(() => {
|
|
25
|
-
if (transitionStarted.current === false) {
|
|
26
|
-
setPreviewCss(getTransitionStyles(snippetHeight));
|
|
27
|
-
transitionStarted.current = true;
|
|
28
|
-
}
|
|
29
|
-
}, [snippetHeight]);
|
|
30
|
-
const onPreviewTransitionEnd = useCallback(() => {
|
|
31
|
-
setShowSnippet(true);
|
|
32
|
-
}, []);
|
|
33
|
-
return !showSnippet && data && extractPreview(data) ? /*#__PURE__*/React.createElement(PreviewBlock, {
|
|
34
|
-
onError: onPreviewError,
|
|
35
|
-
overrideCss: previewCss,
|
|
36
|
-
onTransitionEnd: onPreviewTransitionEnd,
|
|
37
|
-
blockRef: previewBlockRef,
|
|
38
|
-
onRender: onPreviewRender
|
|
39
|
-
}) : /*#__PURE__*/React.createElement(SnippetBlock, null);
|
|
40
|
-
};
|
|
41
|
-
export default SnippetOrPreview;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
-
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
-
var _templateObject;
|
|
4
|
-
import React, { useCallback, useState, useRef } from 'react';
|
|
5
|
-
import { css } from '@emotion/react';
|
|
6
|
-
import extractPreview from '../../../extractors/flexible/extract-preview';
|
|
7
|
-
import { PreviewBlock, SnippetBlock } from '../../FlexibleCard/components/blocks';
|
|
8
|
-
import { getTransitionStyles } from '../styled';
|
|
9
|
-
var SnippetOrPreview = function SnippetOrPreview(_ref) {
|
|
10
|
-
var data = _ref.data,
|
|
11
|
-
snippetHeight = _ref.snippetHeight;
|
|
12
|
-
var transitionStarted = useRef(false);
|
|
13
|
-
var previewBlockRef = useRef(null);
|
|
14
|
-
var _useState = useState(false),
|
|
15
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
16
|
-
showSnippet = _useState2[0],
|
|
17
|
-
setShowSnippet = _useState2[1];
|
|
18
|
-
var _useState3 = useState(),
|
|
19
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
20
|
-
previewCss = _useState4[0],
|
|
21
|
-
setPreviewCss = _useState4[1];
|
|
22
|
-
|
|
23
|
-
// Set Preview to a fixed height to enable transitions
|
|
24
|
-
var onPreviewRender = useCallback(function () {
|
|
25
|
-
var _previewBlockRef$curr;
|
|
26
|
-
previewBlockRef.current && setPreviewCss(css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n height: ", "px;\n "])), (_previewBlockRef$curr = previewBlockRef.current) === null || _previewBlockRef$curr === void 0 ? void 0 : _previewBlockRef$curr.getBoundingClientRect().height));
|
|
27
|
-
}, []);
|
|
28
|
-
|
|
29
|
-
// On error set Preview to Snippet height with transition
|
|
30
|
-
var onPreviewError = useCallback(function () {
|
|
31
|
-
if (transitionStarted.current === false) {
|
|
32
|
-
setPreviewCss(getTransitionStyles(snippetHeight));
|
|
33
|
-
transitionStarted.current = true;
|
|
34
|
-
}
|
|
35
|
-
}, [snippetHeight]);
|
|
36
|
-
var onPreviewTransitionEnd = useCallback(function () {
|
|
37
|
-
setShowSnippet(true);
|
|
38
|
-
}, []);
|
|
39
|
-
return !showSnippet && data && extractPreview(data) ? /*#__PURE__*/React.createElement(PreviewBlock, {
|
|
40
|
-
onError: onPreviewError,
|
|
41
|
-
overrideCss: previewCss,
|
|
42
|
-
onTransitionEnd: onPreviewTransitionEnd,
|
|
43
|
-
blockRef: previewBlockRef,
|
|
44
|
-
onRender: onPreviewRender
|
|
45
|
-
}) : /*#__PURE__*/React.createElement(SnippetBlock, null);
|
|
46
|
-
};
|
|
47
|
-
export default SnippetOrPreview;
|