@atlaskit/smart-card 18.0.12 → 18.0.15
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 +25 -0
- package/dist/cjs/state/analytics/useSmartLinkAnalytics.js +9 -0
- package/dist/cjs/state/flexible-ui-context/index.js +4 -0
- package/dist/cjs/utils/analytics/analytics.js +52 -2
- package/dist/cjs/utils/analytics/index.js +18 -0
- package/dist/cjs/version.json +1 -1
- package/dist/cjs/view/CardWithUrl/component.js +4 -2
- package/dist/cjs/view/CardWithUrl/loader.js +4 -2
- package/dist/cjs/view/FlexibleCard/components/actions/action/index.js +26 -4
- package/dist/cjs/view/FlexibleCard/components/actions/index.js +18 -2
- package/dist/cjs/view/FlexibleCard/components/blocks/action-group/index.js +6 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/block/index.js +9 -2
- package/dist/cjs/view/FlexibleCard/components/blocks/element-group/index.js +9 -2
- package/dist/cjs/view/FlexibleCard/components/blocks/footer-block/index.js +6 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/metadata-block/index.js +9 -2
- package/dist/cjs/view/FlexibleCard/components/blocks/preview-block/index.js +5 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/snippet-block/index.js +5 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/title-block/errored/index.js +39 -19
- package/dist/cjs/view/FlexibleCard/components/blocks/title-block/index.js +92 -17
- package/dist/cjs/view/FlexibleCard/components/blocks/title-block/resolved/index.js +45 -9
- package/dist/cjs/view/FlexibleCard/components/blocks/title-block/resolving/index.js +23 -12
- package/dist/cjs/view/FlexibleCard/components/container/index.js +5 -0
- package/dist/cjs/view/FlexibleCard/components/elements/avatar-group/index.js +12 -1
- package/dist/cjs/view/FlexibleCard/components/elements/badge/index.js +18 -3
- package/dist/cjs/view/FlexibleCard/components/elements/date-time/index.js +9 -1
- package/dist/cjs/view/FlexibleCard/components/elements/icon/index.js +9 -1
- package/dist/cjs/view/FlexibleCard/components/elements/index.js +96 -0
- package/dist/cjs/view/FlexibleCard/components/elements/link/index.js +9 -1
- package/dist/cjs/view/FlexibleCard/components/elements/lozenge/index.js +11 -3
- package/dist/cjs/view/FlexibleCard/components/elements/media/index.js +9 -2
- package/dist/cjs/view/FlexibleCard/components/elements/text/index.js +12 -6
- package/dist/cjs/view/FlexibleCard/components/elements/utils.js +7 -3
- package/dist/cjs/view/FlexibleCard/index.js +6 -0
- package/dist/cjs/view/HoverCard/index.js +48 -10
- package/dist/cjs/view/HoverCard/styled.js +3 -1
- package/dist/es2019/state/analytics/useSmartLinkAnalytics.js +7 -2
- package/dist/es2019/state/flexible-ui-context/index.js +5 -0
- package/dist/es2019/utils/analytics/analytics.js +35 -0
- package/dist/es2019/utils/analytics/index.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/es2019/view/CardWithUrl/component.js +4 -2
- package/dist/es2019/view/CardWithUrl/loader.js +4 -2
- package/dist/es2019/view/FlexibleCard/components/actions/action/index.js +37 -4
- package/dist/es2019/view/FlexibleCard/components/actions/index.js +18 -2
- package/dist/es2019/view/FlexibleCard/components/blocks/action-group/index.js +6 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/block/index.js +9 -2
- package/dist/es2019/view/FlexibleCard/components/blocks/element-group/index.js +8 -2
- package/dist/es2019/view/FlexibleCard/components/blocks/footer-block/index.js +6 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/metadata-block/index.js +9 -2
- package/dist/es2019/view/FlexibleCard/components/blocks/preview-block/index.js +5 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/snippet-block/index.js +5 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/title-block/errored/index.js +31 -15
- package/dist/es2019/view/FlexibleCard/components/blocks/title-block/index.js +77 -15
- package/dist/es2019/view/FlexibleCard/components/blocks/title-block/resolved/index.js +35 -8
- package/dist/es2019/view/FlexibleCard/components/blocks/title-block/resolving/index.js +20 -11
- package/dist/es2019/view/FlexibleCard/components/container/index.js +5 -0
- package/dist/es2019/view/FlexibleCard/components/elements/avatar-group/index.js +12 -1
- package/dist/es2019/view/FlexibleCard/components/elements/badge/index.js +18 -3
- package/dist/es2019/view/FlexibleCard/components/elements/date-time/index.js +9 -1
- package/dist/es2019/view/FlexibleCard/components/elements/icon/index.js +9 -1
- package/dist/es2019/view/FlexibleCard/components/elements/index.js +96 -0
- package/dist/es2019/view/FlexibleCard/components/elements/link/index.js +9 -1
- package/dist/es2019/view/FlexibleCard/components/elements/lozenge/index.js +11 -3
- package/dist/es2019/view/FlexibleCard/components/elements/media/index.js +8 -1
- package/dist/es2019/view/FlexibleCard/components/elements/text/index.js +11 -4
- package/dist/es2019/view/FlexibleCard/components/elements/utils.js +5 -2
- package/dist/es2019/view/FlexibleCard/index.js +6 -0
- package/dist/es2019/view/HoverCard/index.js +40 -10
- package/dist/es2019/view/HoverCard/styled.js +6 -1
- package/dist/esm/state/analytics/useSmartLinkAnalytics.js +10 -1
- package/dist/esm/state/flexible-ui-context/index.js +5 -0
- package/dist/esm/utils/analytics/analytics.js +41 -0
- package/dist/esm/utils/analytics/index.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/esm/view/CardWithUrl/component.js +4 -2
- package/dist/esm/view/CardWithUrl/loader.js +4 -2
- package/dist/esm/view/FlexibleCard/components/actions/action/index.js +25 -4
- package/dist/esm/view/FlexibleCard/components/actions/index.js +18 -2
- package/dist/esm/view/FlexibleCard/components/blocks/action-group/index.js +6 -0
- package/dist/esm/view/FlexibleCard/components/blocks/block/index.js +9 -2
- package/dist/esm/view/FlexibleCard/components/blocks/element-group/index.js +8 -2
- package/dist/esm/view/FlexibleCard/components/blocks/footer-block/index.js +6 -0
- package/dist/esm/view/FlexibleCard/components/blocks/metadata-block/index.js +9 -2
- package/dist/esm/view/FlexibleCard/components/blocks/preview-block/index.js +5 -0
- package/dist/esm/view/FlexibleCard/components/blocks/snippet-block/index.js +5 -0
- package/dist/esm/view/FlexibleCard/components/blocks/title-block/errored/index.js +33 -16
- package/dist/esm/view/FlexibleCard/components/blocks/title-block/index.js +79 -17
- package/dist/esm/view/FlexibleCard/components/blocks/title-block/resolved/index.js +39 -8
- package/dist/esm/view/FlexibleCard/components/blocks/title-block/resolving/index.js +22 -11
- package/dist/esm/view/FlexibleCard/components/container/index.js +5 -0
- package/dist/esm/view/FlexibleCard/components/elements/avatar-group/index.js +12 -1
- package/dist/esm/view/FlexibleCard/components/elements/badge/index.js +18 -3
- package/dist/esm/view/FlexibleCard/components/elements/date-time/index.js +9 -1
- package/dist/esm/view/FlexibleCard/components/elements/icon/index.js +9 -1
- package/dist/esm/view/FlexibleCard/components/elements/index.js +96 -0
- package/dist/esm/view/FlexibleCard/components/elements/link/index.js +9 -1
- package/dist/esm/view/FlexibleCard/components/elements/lozenge/index.js +11 -3
- package/dist/esm/view/FlexibleCard/components/elements/media/index.js +9 -2
- package/dist/esm/view/FlexibleCard/components/elements/text/index.js +12 -6
- package/dist/esm/view/FlexibleCard/components/elements/utils.js +5 -3
- package/dist/esm/view/FlexibleCard/index.js +6 -0
- package/dist/esm/view/HoverCard/index.js +42 -10
- package/dist/esm/view/HoverCard/styled.js +2 -1
- package/dist/types/client/errors.d.ts +3 -2
- package/dist/types/extractors/block/index.d.ts +2 -2
- package/dist/types/extractors/common/__mocks__/jsonld.d.ts +46 -66
- package/dist/types/extractors/common/actions/extractPreviewAction.d.ts +1 -1
- package/dist/types/extractors/common/title-prefix/extractTitlePrefix.d.ts +2 -1
- package/dist/types/extractors/embed/index.d.ts +1 -1
- package/dist/types/extractors/flexible/icon/extract-url-icon.d.ts +1 -1
- package/dist/types/state/analytics/useSmartLinkAnalytics.d.ts +4 -0
- package/dist/types/state/flexible-ui-context/index.d.ts +4 -0
- package/dist/types/state/flexible-ui-context/types.d.ts +102 -0
- package/dist/types/state/hooks/useSmartLink.d.ts +3 -0
- package/dist/types/utils/analytics/analytics.d.ts +5 -1
- package/dist/types/utils/analytics/index.d.ts +1 -1
- package/dist/types/utils/types.d.ts +2 -2
- package/dist/types/view/BlockCard/utils/handlers.d.ts +1 -1
- package/dist/types/view/Card/index.d.ts +1 -1
- package/dist/types/view/Card/types.d.ts +1 -0
- package/dist/types/view/CardWithUrl/component.d.ts +1 -1
- package/dist/types/view/CardWithUrl/types.d.ts +1 -0
- package/dist/types/view/EmbedCard/components/styled.d.ts +9 -9
- package/dist/types/view/FlexibleCard/components/actions/action/index.d.ts +8 -0
- package/dist/types/view/FlexibleCard/components/actions/action/types.d.ts +4 -2
- package/dist/types/view/FlexibleCard/components/actions/index.d.ts +15 -0
- package/dist/types/view/FlexibleCard/components/blocks/action-group/index.d.ts +6 -0
- package/dist/types/view/FlexibleCard/components/blocks/action-group/types.d.ts +1 -1
- package/dist/types/view/FlexibleCard/components/blocks/block/index.d.ts +6 -0
- package/dist/types/view/FlexibleCard/components/blocks/element-group/index.d.ts +6 -0
- package/dist/types/view/FlexibleCard/components/blocks/element-group/types.d.ts +2 -2
- package/dist/types/view/FlexibleCard/components/blocks/footer-block/index.d.ts +6 -0
- package/dist/types/view/FlexibleCard/components/blocks/metadata-block/index.d.ts +6 -0
- package/dist/types/view/FlexibleCard/components/blocks/preview-block/index.d.ts +5 -0
- package/dist/types/view/FlexibleCard/components/blocks/snippet-block/index.d.ts +5 -0
- package/dist/types/view/FlexibleCard/components/blocks/title-block/errored/index.d.ts +9 -2
- package/dist/types/view/FlexibleCard/components/blocks/title-block/index.d.ts +11 -0
- package/dist/types/view/FlexibleCard/components/blocks/title-block/resolved/index.d.ts +7 -3
- package/dist/types/view/FlexibleCard/components/blocks/title-block/resolving/index.d.ts +8 -2
- package/dist/types/view/FlexibleCard/components/blocks/title-block/types.d.ts +10 -1
- package/dist/types/view/FlexibleCard/components/blocks/types.d.ts +7 -5
- package/dist/types/view/FlexibleCard/components/blocks/utils.d.ts +2 -1
- package/dist/types/view/FlexibleCard/components/container/index.d.ts +4 -0
- package/dist/types/view/FlexibleCard/components/container/types.d.ts +2 -2
- package/dist/types/view/FlexibleCard/components/elements/avatar-group/index.d.ts +7 -0
- package/dist/types/view/FlexibleCard/components/elements/badge/index.d.ts +13 -0
- package/dist/types/view/FlexibleCard/components/elements/date-time/index.d.ts +7 -0
- package/dist/types/view/FlexibleCard/components/elements/icon/index.d.ts +6 -0
- package/dist/types/view/FlexibleCard/components/elements/icon/types.d.ts +5 -1
- package/dist/types/view/FlexibleCard/components/elements/index.d.ts +77 -0
- package/dist/types/view/FlexibleCard/components/elements/link/index.d.ts +6 -0
- package/dist/types/view/FlexibleCard/components/elements/lozenge/index.d.ts +6 -0
- package/dist/types/view/FlexibleCard/components/elements/media/index.d.ts +6 -0
- package/dist/types/view/FlexibleCard/components/elements/text/index.d.ts +6 -0
- package/dist/types/view/FlexibleCard/components/elements/text/types.d.ts +1 -2
- package/dist/types/view/FlexibleCard/components/elements/types.d.ts +2 -0
- package/dist/types/view/FlexibleCard/index.d.ts +6 -0
- package/dist/types/view/HoverCard/index.d.ts +3 -2
- package/dist/types/view/HoverCard/types.d.ts +5 -2
- package/dist/types/view/InlineCard/Icon.d.ts +3 -3
- package/dist/types/view/InlineCard/IconAndTitleLayout/styled.d.ts +9 -9
- package/dist/types/view/InlineCard/ResolvingView/styled.d.ts +3 -3
- package/dist/types/view/InlineCard/styled.d.ts +4 -4
- package/package.json +8 -8
- package/dist/cjs/view/FlexibleCard/components/blocks/title-block/utils.js +0 -105
- package/dist/es2019/view/FlexibleCard/components/blocks/title-block/utils.js +0 -71
- package/dist/esm/view/FlexibleCard/components/blocks/title-block/utils.js +0 -76
- package/dist/types/view/FlexibleCard/components/blocks/title-block/utils.d.ts +0 -11
|
@@ -19,17 +19,23 @@ var _token = require("../../../../../utils/token");
|
|
|
19
19
|
|
|
20
20
|
var _templateObject;
|
|
21
21
|
|
|
22
|
-
var getStyles = function getStyles(maxLines
|
|
23
|
-
return (0, _core.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n color: ", ";\n font-size: 0.75rem;\n line-height: 1rem;\n ", "\n"])),
|
|
22
|
+
var getStyles = function getStyles(maxLines) {
|
|
23
|
+
return (0, _core.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n color: ", ";\n font-size: 0.75rem;\n line-height: 1rem;\n ", "\n"])), _token.tokens.text, (0, _utils.getTruncateStyles)(maxLines));
|
|
24
24
|
};
|
|
25
|
+
/**
|
|
26
|
+
* An element that displays some Text.
|
|
27
|
+
* @public
|
|
28
|
+
* @param {TextProps} TextProps - The props necessary for the Text element.
|
|
29
|
+
* @see Title
|
|
30
|
+
*/
|
|
31
|
+
|
|
25
32
|
|
|
26
33
|
var Text = function Text(_ref) {
|
|
27
|
-
var
|
|
28
|
-
color = _ref$color === void 0 ? _token.tokens.text : _ref$color,
|
|
29
|
-
content = _ref.content,
|
|
34
|
+
var content = _ref.content,
|
|
30
35
|
_ref$maxLines = _ref.maxLines,
|
|
31
36
|
maxLines = _ref$maxLines === void 0 ? 1 : _ref$maxLines,
|
|
32
37
|
message = _ref.message,
|
|
38
|
+
overrideCss = _ref.overrideCss,
|
|
33
39
|
_ref$testId = _ref.testId,
|
|
34
40
|
testId = _ref$testId === void 0 ? 'smart-element-text' : _ref$testId;
|
|
35
41
|
|
|
@@ -38,7 +44,7 @@ var Text = function Text(_ref) {
|
|
|
38
44
|
}
|
|
39
45
|
|
|
40
46
|
return (0, _core.jsx)("span", {
|
|
41
|
-
css: getStyles(maxLines,
|
|
47
|
+
css: [getStyles(maxLines), overrideCss],
|
|
42
48
|
"data-separator": true,
|
|
43
49
|
"data-smart-element-text": true,
|
|
44
50
|
"data-testid": testId
|
|
@@ -13,8 +13,12 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
13
13
|
|
|
14
14
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
15
|
|
|
16
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
17
|
+
|
|
16
18
|
var _react = _interopRequireWildcard(require("react"));
|
|
17
19
|
|
|
20
|
+
var _core = require("@emotion/core");
|
|
21
|
+
|
|
18
22
|
var _constants = require("../../../../constants");
|
|
19
23
|
|
|
20
24
|
var _icon = _interopRequireDefault(require("./icon"));
|
|
@@ -39,7 +43,7 @@ var _dateTime = _interopRequireDefault(require("./date-time"));
|
|
|
39
43
|
|
|
40
44
|
var _token = require("../../../../utils/token");
|
|
41
45
|
|
|
42
|
-
var _elementMappings;
|
|
46
|
+
var _templateObject, _elementMappings;
|
|
43
47
|
|
|
44
48
|
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); }
|
|
45
49
|
|
|
@@ -88,8 +92,8 @@ var elementMappings = (_elementMappings = {}, (0, _defineProperty2.default)(_ele
|
|
|
88
92
|
}), (0, _defineProperty2.default)(_elementMappings, _constants.ElementName.Snippet, {
|
|
89
93
|
component: _text.default,
|
|
90
94
|
props: {
|
|
91
|
-
|
|
92
|
-
|
|
95
|
+
maxLines: SNIPPET_DEFAULT_MAX_LINES,
|
|
96
|
+
overrideCss: (0, _core.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n color: ", ";\n "])), _token.tokens.snippet)
|
|
93
97
|
}
|
|
94
98
|
}), (0, _defineProperty2.default)(_elementMappings, _constants.ElementName.State, {
|
|
95
99
|
component: _lozenge.default
|
|
@@ -17,6 +17,12 @@ var _flexibleUiContext = require("../../state/flexible-ui-context");
|
|
|
17
17
|
|
|
18
18
|
var _utils = require("./utils");
|
|
19
19
|
|
|
20
|
+
/**
|
|
21
|
+
* This represents a Flexible Card: a link represented by a card with metadata.
|
|
22
|
+
* This is the container in which all Flexible UI Blocks and Elements exist.
|
|
23
|
+
* Note: TitleBlock is mandatory for a Flexible Card to render.
|
|
24
|
+
* @see Container
|
|
25
|
+
*/
|
|
20
26
|
var FlexibleCard = function FlexibleCard(_ref) {
|
|
21
27
|
var cardState = _ref.cardState,
|
|
22
28
|
children = _ref.children,
|
|
@@ -7,7 +7,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
7
7
|
Object.defineProperty(exports, "__esModule", {
|
|
8
8
|
value: true
|
|
9
9
|
});
|
|
10
|
-
exports.HoverCard = void 0;
|
|
10
|
+
exports.HoverCardComponent = exports.HoverCard = void 0;
|
|
11
11
|
|
|
12
12
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
13
|
|
|
@@ -31,14 +31,28 @@ var _styled = require("./styled");
|
|
|
31
31
|
|
|
32
32
|
var _shortcut = _interopRequireDefault(require("@atlaskit/icon/glyph/shortcut"));
|
|
33
33
|
|
|
34
|
+
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
35
|
+
|
|
36
|
+
var _analytics = require("../../utils/analytics");
|
|
37
|
+
|
|
38
|
+
var _store = require("../../state/store");
|
|
39
|
+
|
|
40
|
+
var _analytics2 = require("../../state/analytics");
|
|
41
|
+
|
|
42
|
+
var _helpers = require("../../state/helpers");
|
|
43
|
+
|
|
34
44
|
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); }
|
|
35
45
|
|
|
36
46
|
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; }
|
|
37
47
|
|
|
38
48
|
/** @jsx jsx */
|
|
39
|
-
var
|
|
49
|
+
var HoverCardComponent = function HoverCardComponent(_ref) {
|
|
40
50
|
var children = _ref.children,
|
|
41
|
-
url = _ref.url
|
|
51
|
+
url = _ref.url,
|
|
52
|
+
createAnalyticsEvent = _ref.createAnalyticsEvent;
|
|
53
|
+
var analyticsHandler = (0, _react.useCallback)(function (analyticsPayload) {
|
|
54
|
+
(0, _analytics.fireSmartLinkEvent)(analyticsPayload, createAnalyticsEvent);
|
|
55
|
+
}, [createAnalyticsEvent]);
|
|
42
56
|
var delay = 300;
|
|
43
57
|
|
|
44
58
|
var _React$useState = _react.default.useState(false),
|
|
@@ -48,26 +62,45 @@ var HoverCard = function HoverCard(_ref) {
|
|
|
48
62
|
|
|
49
63
|
var fadeOutTimeoutId = (0, _react.useRef)();
|
|
50
64
|
var fadeInTimeoutId = (0, _react.useRef)();
|
|
65
|
+
var cardOpenTime = (0, _react.useRef)();
|
|
66
|
+
var linkState = (0, _store.useSmartCardState)(url);
|
|
67
|
+
var analytics = (0, _analytics2.useSmartLinkAnalytics)(analyticsHandler);
|
|
68
|
+
var extensionKey = (0, _react.useMemo)(function () {
|
|
69
|
+
return (0, _helpers.getExtensionKey)(linkState.details);
|
|
70
|
+
}, [linkState]);
|
|
71
|
+
var definitionId = (0, _react.useMemo)(function () {
|
|
72
|
+
return (0, _helpers.getDefinitionId)(linkState.details);
|
|
73
|
+
}, [linkState]);
|
|
51
74
|
var initHideCard = (0, _react.useCallback)(function () {
|
|
52
75
|
if (fadeInTimeoutId.current) {
|
|
53
76
|
clearTimeout(fadeInTimeoutId.current);
|
|
54
77
|
}
|
|
55
78
|
|
|
56
79
|
fadeOutTimeoutId.current = setTimeout(function () {
|
|
80
|
+
//Check its previously open to avoid firing events when moving between the child and hover card components
|
|
81
|
+
if (isOpen === true && cardOpenTime.current) {
|
|
82
|
+
var hoverTime = Date.now() - cardOpenTime.current;
|
|
83
|
+
analytics.ui.hoverCardDismissedEvent('card', hoverTime, definitionId, extensionKey);
|
|
84
|
+
}
|
|
85
|
+
|
|
57
86
|
setIsOpen(false);
|
|
58
87
|
}, delay);
|
|
59
|
-
}, [delay]);
|
|
88
|
+
}, [delay, isOpen, definitionId, extensionKey, analytics]);
|
|
60
89
|
var initShowCard = (0, _react.useCallback)(function () {
|
|
61
90
|
if (fadeOutTimeoutId.current) {
|
|
62
91
|
clearTimeout(fadeOutTimeoutId.current);
|
|
63
92
|
}
|
|
64
93
|
|
|
65
94
|
fadeInTimeoutId.current = setTimeout(function () {
|
|
95
|
+
//Check if its previously closed to avoid firing events when moving between the child and hover card components
|
|
96
|
+
if (isOpen === false) {
|
|
97
|
+
cardOpenTime.current = Date.now();
|
|
98
|
+
analytics.ui.hoverCardViewedEvent('card', definitionId, extensionKey);
|
|
99
|
+
}
|
|
100
|
+
|
|
66
101
|
setIsOpen(true);
|
|
67
102
|
}, delay);
|
|
68
|
-
}, [delay
|
|
69
|
-
|
|
70
|
-
var analyticsHandler = (0, _react.useCallback)(function () {}, []);
|
|
103
|
+
}, [delay, isOpen, definitionId, extensionKey, analytics]);
|
|
71
104
|
var linkActions = (0, _useSmartLinkActions.useSmartLinkActions)({
|
|
72
105
|
url: url,
|
|
73
106
|
appearance: 'block',
|
|
@@ -94,11 +127,12 @@ var HoverCard = function HoverCard(_ref) {
|
|
|
94
127
|
}),
|
|
95
128
|
iconPosition: 'before',
|
|
96
129
|
onClick: function onClick() {
|
|
97
|
-
|
|
130
|
+
window.open(url, '_blank');
|
|
131
|
+
analytics.ui.hoverCardOpenLinkClickedEvent('card', definitionId, extensionKey);
|
|
98
132
|
},
|
|
99
133
|
testId: 'hover-card-open-button'
|
|
100
134
|
};
|
|
101
|
-
}, [url]);
|
|
135
|
+
}, [url, definitionId, extensionKey, analytics]);
|
|
102
136
|
|
|
103
137
|
var cardComponent = function cardComponent() {
|
|
104
138
|
return (0, _core.jsx)("div", {
|
|
@@ -126,7 +160,7 @@ var HoverCard = function HoverCard(_ref) {
|
|
|
126
160
|
testId: "hover-card",
|
|
127
161
|
isOpen: isOpen,
|
|
128
162
|
onClose: onClose,
|
|
129
|
-
placement: "bottom",
|
|
163
|
+
placement: "bottom-start",
|
|
130
164
|
content: cardComponent,
|
|
131
165
|
trigger: function trigger(triggerProps) {
|
|
132
166
|
return (0, _core.jsx)("span", (0, _extends2.default)({}, triggerProps, {
|
|
@@ -137,4 +171,8 @@ var HoverCard = function HoverCard(_ref) {
|
|
|
137
171
|
});
|
|
138
172
|
};
|
|
139
173
|
|
|
174
|
+
exports.HoverCardComponent = HoverCardComponent;
|
|
175
|
+
var HoverCard = (0, _analyticsNext.withAnalyticsContext)({
|
|
176
|
+
source: 'smartLinkPreviewHoverCard'
|
|
177
|
+
})((0, _analyticsNext.withAnalyticsEvents)()(HoverCardComponent));
|
|
140
178
|
exports.HoverCard = HoverCard;
|
|
@@ -11,7 +11,9 @@ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/hel
|
|
|
11
11
|
|
|
12
12
|
var _core = require("@emotion/core");
|
|
13
13
|
|
|
14
|
+
var _index = require("../../index");
|
|
15
|
+
|
|
14
16
|
var _templateObject;
|
|
15
17
|
|
|
16
|
-
var HoverCardContainer = (0, _core.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n background: none;\n border-width: 0;\n max-width:
|
|
18
|
+
var HoverCardContainer = (0, _core.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n background: none;\n border-width: 0;\n max-width: 350px;\n padding: 0;\n\n .", " {\n display: none;\n }\n"])), _index.loadingPlaceholderClassName);
|
|
17
19
|
exports.HoverCardContainer = HoverCardContainer;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { uiAuthEvent, uiAuthAlternateAccountEvent, uiCardClickedEvent, uiActionClickedEvent, uiClosedAuthEvent, uiRenderSuccessEvent, resolvedEvent, unresolvedEvent, invokeSucceededEvent, invokeFailedEvent, connectSucceededEvent, connectFailedEvent, trackAppAccountConnected, screenAuthPopupEvent, instrumentEvent } from '../../utils/analytics';
|
|
1
|
+
import { uiAuthEvent, uiAuthAlternateAccountEvent, uiCardClickedEvent, uiActionClickedEvent, uiClosedAuthEvent, uiRenderSuccessEvent, uiHoverCardViewedEvent, uiHoverCardDismissedEvent, uiHoverCardOpenLinkClickedEvent, resolvedEvent, unresolvedEvent, invokeSucceededEvent, invokeFailedEvent, connectSucceededEvent, connectFailedEvent, trackAppAccountConnected, screenAuthPopupEvent, instrumentEvent } from '../../utils/analytics';
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
3
|
import { failUfoExperience, startUfoExperience, succeedUfoExperience } from './ufoExperiences';
|
|
4
4
|
export const useSmartLinkAnalytics = dispatchAnalytics => {
|
|
@@ -15,6 +15,9 @@ export const useSmartLinkAnalytics = dispatchAnalytics => {
|
|
|
15
15
|
});
|
|
16
16
|
dispatchAnalytics(uiActionClickedEvent(extensionKey, actionType, display));
|
|
17
17
|
},
|
|
18
|
+
hoverCardOpenLinkClickedEvent: (previewDisplay, definitionId, extensionKey, previewInvokeMethod) => {
|
|
19
|
+
dispatchAnalytics(uiHoverCardOpenLinkClickedEvent(previewDisplay, definitionId, extensionKey, previewInvokeMethod));
|
|
20
|
+
},
|
|
18
21
|
closedAuthEvent: (display, definitionId, extensionKey) => dispatchAnalytics(uiClosedAuthEvent(display, definitionId, extensionKey)),
|
|
19
22
|
renderSuccessEvent: (display, id, definitionId, extensionKey) => {
|
|
20
23
|
succeedUfoExperience('smart-link-rendered', id, {
|
|
@@ -26,7 +29,9 @@ export const useSmartLinkAnalytics = dispatchAnalytics => {
|
|
|
26
29
|
display
|
|
27
30
|
});
|
|
28
31
|
dispatchAnalytics(uiRenderSuccessEvent(display, definitionId, extensionKey));
|
|
29
|
-
}
|
|
32
|
+
},
|
|
33
|
+
hoverCardViewedEvent: (hoverDisplay, definitionId, extensionKey, previewInvokeMethod) => dispatchAnalytics(uiHoverCardViewedEvent(hoverDisplay, definitionId, extensionKey, previewInvokeMethod)),
|
|
34
|
+
hoverCardDismissedEvent: (hoverDisplay, hoverTime, definitionId, extensionKey, previewInvokeMethod) => dispatchAnalytics(uiHoverCardDismissedEvent(hoverDisplay, hoverTime, definitionId, extensionKey, previewInvokeMethod))
|
|
30
35
|
}), [dispatchAnalytics]);
|
|
31
36
|
const operational = useMemo(() => ({
|
|
32
37
|
resolvedEvent: (id, definitionId, extensionKey, resourceType) => dispatchAnalytics(resolvedEvent(id, definitionId, extensionKey, resourceType)),
|
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
import { useContext, createContext } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* This provides the data that will be used by Smart Links Flexible UI to populate it's
|
|
5
|
+
* underlying elements.
|
|
6
|
+
*/
|
|
2
7
|
export const FlexibleUiContext = /*#__PURE__*/createContext(undefined);
|
|
3
8
|
export const useFlexibleUiContext = () => useContext(FlexibleUiContext);
|
|
@@ -227,4 +227,39 @@ export const uiRenderFailedEvent = (display, error, errorInfo) => ({
|
|
|
227
227
|
errorInfo,
|
|
228
228
|
display
|
|
229
229
|
}
|
|
230
|
+
});
|
|
231
|
+
export const uiHoverCardViewedEvent = (hoverDisplay, definitionId, extensionKey, previewInvokeMethod) => ({
|
|
232
|
+
action: 'viewed',
|
|
233
|
+
actionSubject: 'hoverCard',
|
|
234
|
+
eventType: 'ui',
|
|
235
|
+
attributes: { ...context,
|
|
236
|
+
definitionId: definitionId || '',
|
|
237
|
+
extensionKey: extensionKey || '',
|
|
238
|
+
hoverDisplay,
|
|
239
|
+
previewInvokeMethod
|
|
240
|
+
}
|
|
241
|
+
});
|
|
242
|
+
export const uiHoverCardDismissedEvent = (hoverDisplay, hoverTime, definitionId, extensionKey, previewInvokeMethod) => ({
|
|
243
|
+
action: 'dismissed',
|
|
244
|
+
actionSubject: 'hoverCard',
|
|
245
|
+
eventType: 'ui',
|
|
246
|
+
attributes: { ...context,
|
|
247
|
+
definitionId: definitionId || '',
|
|
248
|
+
extensionKey: extensionKey || '',
|
|
249
|
+
hoverTime,
|
|
250
|
+
hoverDisplay,
|
|
251
|
+
previewInvokeMethod
|
|
252
|
+
}
|
|
253
|
+
});
|
|
254
|
+
export const uiHoverCardOpenLinkClickedEvent = (previewDisplay, definitionId, extensionKey, previewInvokeMethod) => ({
|
|
255
|
+
action: 'clicked',
|
|
256
|
+
actionSubject: 'button',
|
|
257
|
+
actionSubjectId: 'shortcutGoToLink',
|
|
258
|
+
eventType: 'ui',
|
|
259
|
+
attributes: { ...context,
|
|
260
|
+
definitionId: definitionId || '',
|
|
261
|
+
extensionKey: extensionKey || '',
|
|
262
|
+
previewDisplay,
|
|
263
|
+
previewInvokeMethod
|
|
264
|
+
}
|
|
230
265
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { resolvedEvent, unresolvedEvent } from './analytics';
|
|
2
2
|
import { getMeasure } from '../performance';
|
|
3
|
-
export { ANALYTICS_CHANNEL, context, fireSmartLinkEvent, resolvedEvent, unresolvedEvent, invokeSucceededEvent, invokeFailedEvent, connectSucceededEvent, connectFailedEvent, trackAppAccountConnected, uiAuthEvent, uiAuthAlternateAccountEvent, uiCardClickedEvent, uiActionClickedEvent, uiClosedAuthEvent, screenAuthPopupEvent, uiRenderSuccessEvent, uiRenderFailedEvent } from './analytics';
|
|
3
|
+
export { ANALYTICS_CHANNEL, context, fireSmartLinkEvent, resolvedEvent, unresolvedEvent, invokeSucceededEvent, invokeFailedEvent, connectSucceededEvent, connectFailedEvent, trackAppAccountConnected, uiAuthEvent, uiAuthAlternateAccountEvent, uiCardClickedEvent, uiActionClickedEvent, uiClosedAuthEvent, screenAuthPopupEvent, uiRenderSuccessEvent, uiRenderFailedEvent, uiHoverCardViewedEvent, uiHoverCardDismissedEvent, uiHoverCardOpenLinkClickedEvent } from './analytics';
|
|
4
4
|
export const instrumentEvent = (id, status, definitionId, extensionKey, resourceType, error) => {
|
|
5
5
|
const measure = getMeasure(id, status) || {
|
|
6
6
|
duration: undefined
|
package/dist/es2019/version.json
CHANGED
|
@@ -25,7 +25,8 @@ export function CardWithUrlContent({
|
|
|
25
25
|
embedIframeRef,
|
|
26
26
|
inlinePreloaderStyle,
|
|
27
27
|
ui,
|
|
28
|
-
children
|
|
28
|
+
children,
|
|
29
|
+
showHoverPreview
|
|
29
30
|
}) {
|
|
30
31
|
// Get state, actions for this card.
|
|
31
32
|
const {
|
|
@@ -123,7 +124,8 @@ export function CardWithUrlContent({
|
|
|
123
124
|
isSelected: isSelected,
|
|
124
125
|
onResolve: onResolve,
|
|
125
126
|
testId: testId,
|
|
126
|
-
inlinePreloaderStyle: inlinePreloaderStyle
|
|
127
|
+
inlinePreloaderStyle: inlinePreloaderStyle,
|
|
128
|
+
showHoverPreview: showHoverPreview
|
|
127
129
|
});
|
|
128
130
|
|
|
129
131
|
case 'block':
|
|
@@ -38,7 +38,8 @@ export function CardWithURLRenderer(props) {
|
|
|
38
38
|
inlinePreloaderStyle,
|
|
39
39
|
createAnalyticsEvent,
|
|
40
40
|
children,
|
|
41
|
-
ui
|
|
41
|
+
ui,
|
|
42
|
+
showHoverPreview
|
|
42
43
|
} = props; // Wrapper around analytics.
|
|
43
44
|
|
|
44
45
|
const dispatchAnalytics = useCallback(analyticsPayload => {
|
|
@@ -94,7 +95,8 @@ export function CardWithURLRenderer(props) {
|
|
|
94
95
|
platform,
|
|
95
96
|
embedIframeRef,
|
|
96
97
|
inlinePreloaderStyle,
|
|
97
|
-
ui
|
|
98
|
+
ui,
|
|
99
|
+
showHoverPreview
|
|
98
100
|
};
|
|
99
101
|
return /*#__PURE__*/React.createElement(ErrorBoundary, {
|
|
100
102
|
FallbackComponent: ErrorFallback,
|
|
@@ -27,7 +27,23 @@ const getIconStyles = size => css`
|
|
|
27
27
|
${getIconSizeStyles(getIconWidth(size))};
|
|
28
28
|
`;
|
|
29
29
|
|
|
30
|
-
const getButtonStyle = (size, iconOnly) =>
|
|
30
|
+
const getButtonStyle = (size, iconOnly) => {
|
|
31
|
+
switch (size) {
|
|
32
|
+
case SmartLinkSize.Large:
|
|
33
|
+
return iconOnly ? css`
|
|
34
|
+
button,
|
|
35
|
+
button:hover,
|
|
36
|
+
button:focus,
|
|
37
|
+
button:active {
|
|
38
|
+
padding: 0;
|
|
39
|
+
> span {
|
|
40
|
+
margin: 0;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
` : '';
|
|
44
|
+
|
|
45
|
+
case SmartLinkSize.Small:
|
|
46
|
+
return css`
|
|
31
47
|
font-size: 0.75rem;
|
|
32
48
|
font-weight: 500;
|
|
33
49
|
line-height: 1rem;
|
|
@@ -43,7 +59,14 @@ const getButtonStyle = (size, iconOnly) => size === SmartLinkSize.Small ? css`
|
|
|
43
59
|
padding-right: 0.25rem;
|
|
44
60
|
`}
|
|
45
61
|
}
|
|
46
|
-
|
|
62
|
+
`;
|
|
63
|
+
|
|
64
|
+
case SmartLinkSize.XLarge:
|
|
65
|
+
case SmartLinkSize.Medium:
|
|
66
|
+
default:
|
|
67
|
+
return '';
|
|
68
|
+
}
|
|
69
|
+
};
|
|
47
70
|
|
|
48
71
|
const ActionIcon = ({
|
|
49
72
|
size,
|
|
@@ -60,6 +83,14 @@ export const sizeToSpacing = {
|
|
|
60
83
|
[SmartLinkSize.Large]: 'compact',
|
|
61
84
|
[SmartLinkSize.XLarge]: 'default'
|
|
62
85
|
};
|
|
86
|
+
/**
|
|
87
|
+
* An action that can be triggered with an on click.
|
|
88
|
+
* @public
|
|
89
|
+
* @param {ActionProps} ActionProps - The props necessary for the Action.
|
|
90
|
+
* @see DeleteAction
|
|
91
|
+
* @see EditAction
|
|
92
|
+
* @see CustomAction
|
|
93
|
+
*/
|
|
63
94
|
|
|
64
95
|
const Action = ({
|
|
65
96
|
appearance = 'subtle',
|
|
@@ -70,7 +101,8 @@ const Action = ({
|
|
|
70
101
|
icon,
|
|
71
102
|
iconPosition = 'before',
|
|
72
103
|
tooltipMessage,
|
|
73
|
-
asDropDownItem
|
|
104
|
+
asDropDownItem,
|
|
105
|
+
overrideCss
|
|
74
106
|
}) => {
|
|
75
107
|
if (!onClick) {
|
|
76
108
|
return null;
|
|
@@ -99,7 +131,8 @@ const Action = ({
|
|
|
99
131
|
return jsx(Tooltip, {
|
|
100
132
|
content: tooltipMessage
|
|
101
133
|
}, jsx("div", {
|
|
102
|
-
css: getButtonStyle(size, iconOnly)
|
|
134
|
+
css: [getButtonStyle(size, iconOnly), overrideCss],
|
|
135
|
+
"data-testid": `${testId}-button-wrapper`
|
|
103
136
|
}, jsx(Button, {
|
|
104
137
|
spacing: sizeToSpacing[size],
|
|
105
138
|
appearance: appearance,
|
|
@@ -2,9 +2,25 @@ import { ActionName } from '../../../../constants';
|
|
|
2
2
|
import { createUIAction } from './utils'; // Attention: Keep the export name and action name the same.
|
|
3
3
|
// This will help reducing the code for mapping action inside
|
|
4
4
|
// createAction and renderActionItems
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Creates a DeleteAction component. Accepts default ActionProps, but defaults
|
|
8
|
+
* the icon to a cross icon.
|
|
9
|
+
* @see Action
|
|
10
|
+
*/
|
|
7
11
|
|
|
8
12
|
export const DeleteAction = createUIAction(ActionName.DeleteAction);
|
|
13
|
+
/**
|
|
14
|
+
* Creates a EditAction component. Accepts default ActionProps, but defaults
|
|
15
|
+
* the icon to an edit (pencil) icon.
|
|
16
|
+
* @see Action
|
|
17
|
+
*/
|
|
18
|
+
|
|
9
19
|
export const EditAction = createUIAction(ActionName.EditAction);
|
|
20
|
+
/**
|
|
21
|
+
* Creates a CustomAction component. Accepts default ActionProps. Required to provide
|
|
22
|
+
* your own icon or text.
|
|
23
|
+
* @see Action
|
|
24
|
+
*/
|
|
25
|
+
|
|
10
26
|
export const CustomAction = createUIAction(ActionName.CustomAction);
|
|
@@ -13,6 +13,12 @@ const styles = css`
|
|
|
13
13
|
display: inline-flex;
|
|
14
14
|
line-height: 1rem;
|
|
15
15
|
`;
|
|
16
|
+
/**
|
|
17
|
+
* Creates a group of Action components. Accepts an array of Actions, in addition to some styling
|
|
18
|
+
* preferences.
|
|
19
|
+
* @param {ActionGroupProps} ActionGroupProps
|
|
20
|
+
* @see Action
|
|
21
|
+
*/
|
|
16
22
|
|
|
17
23
|
const ActionGroup = ({
|
|
18
24
|
items = [],
|
|
@@ -12,15 +12,22 @@ const getBlockStyles = (direction, size) => css`
|
|
|
12
12
|
margin-right: ${getGapSize(size)}rem;
|
|
13
13
|
}
|
|
14
14
|
`;
|
|
15
|
+
/**
|
|
16
|
+
* A block represents a collection of elements and actions that are arranged in a row.
|
|
17
|
+
* All elements and actions should be contained within a Block.
|
|
18
|
+
* @param {ActionGroupProps} ActionGroupProps
|
|
19
|
+
* @see Action
|
|
20
|
+
*/
|
|
21
|
+
|
|
15
22
|
|
|
16
23
|
const Block = ({
|
|
17
24
|
children,
|
|
18
25
|
direction = SmartLinkDirection.Horizontal,
|
|
19
26
|
size = SmartLinkSize.Medium,
|
|
20
27
|
testId = 'smart-block',
|
|
21
|
-
|
|
28
|
+
overrideCss
|
|
22
29
|
}) => jsx("div", {
|
|
23
|
-
css: [getBlockStyles(direction, size),
|
|
30
|
+
css: [getBlockStyles(direction, size), overrideCss],
|
|
24
31
|
"data-smart-block": true,
|
|
25
32
|
"data-testid": testId
|
|
26
33
|
}, renderChildren(children, size));
|
|
@@ -27,17 +27,23 @@ export const getElementGroupStyles = (direction, size, align, width) => css`
|
|
|
27
27
|
min-width: 10%;
|
|
28
28
|
${width === SmartLinkWidth.Flexible ? `flex: 1 3;` : ''}
|
|
29
29
|
`;
|
|
30
|
+
/**
|
|
31
|
+
* Creates a group of Action components. Accepts an array of Actions, in addition to some styling
|
|
32
|
+
* preferences.
|
|
33
|
+
* @param {ActionGroupProps} ActionGroupProps
|
|
34
|
+
* @see Action
|
|
35
|
+
*/
|
|
30
36
|
|
|
31
37
|
const ElementGroup = ({
|
|
32
38
|
align = SmartLinkAlignment.Left,
|
|
33
39
|
children,
|
|
34
|
-
|
|
40
|
+
overrideCss,
|
|
35
41
|
direction = SmartLinkDirection.Horizontal,
|
|
36
42
|
size = SmartLinkSize.Medium,
|
|
37
43
|
testId = 'smart-element-group',
|
|
38
44
|
width = SmartLinkWidth.FitToContent
|
|
39
45
|
}) => jsx("div", {
|
|
40
|
-
css: [getElementGroupStyles(direction, size, align, width),
|
|
46
|
+
css: [getElementGroupStyles(direction, size, align, width), overrideCss],
|
|
41
47
|
"data-smart-element-group": true,
|
|
42
48
|
"data-testid": testId
|
|
43
49
|
}, renderChildren(children, size));
|
|
@@ -5,6 +5,12 @@ import Block from '../block';
|
|
|
5
5
|
import ElementGroup from '../element-group';
|
|
6
6
|
import { Provider } from '../../elements';
|
|
7
7
|
import ActionGroup from '../action-group';
|
|
8
|
+
/**
|
|
9
|
+
* Represents a FooterBlock, designed to contain elements and actions that should appear
|
|
10
|
+
* at the bottom of a link card.
|
|
11
|
+
* @param {FooterBlockProps} FooterBlockProps
|
|
12
|
+
* @see Block
|
|
13
|
+
*/
|
|
8
14
|
|
|
9
15
|
const FooterBlock = props => {
|
|
10
16
|
const {
|
|
@@ -60,6 +60,13 @@ const getMaxLines = maxLines => {
|
|
|
60
60
|
|
|
61
61
|
return maxLines;
|
|
62
62
|
};
|
|
63
|
+
/**
|
|
64
|
+
* Represents a MetadataBlock, designed to contain groups of metadata in the form of elements.
|
|
65
|
+
* Accepts an array of elements to be shown either primary (left hand side) or secondary (right hand side).
|
|
66
|
+
* @param {MetadataBlockProps} MetadataBlockProps
|
|
67
|
+
* @see Block
|
|
68
|
+
*/
|
|
69
|
+
|
|
63
70
|
|
|
64
71
|
const MetadataBlock = ({
|
|
65
72
|
maxLines = DEFAULT_MAX_LINES,
|
|
@@ -83,12 +90,12 @@ const MetadataBlock = ({
|
|
|
83
90
|
testId: `${testId}-resolved-view`
|
|
84
91
|
}), primaryElements && /*#__PURE__*/React.createElement(ElementGroup, {
|
|
85
92
|
align: SmartLinkAlignment.Left,
|
|
86
|
-
|
|
93
|
+
overrideCss: elementGroupStyles,
|
|
87
94
|
direction: SmartLinkDirection.Horizontal,
|
|
88
95
|
width: SmartLinkWidth.Flexible
|
|
89
96
|
}, primaryElements), secondaryElements && /*#__PURE__*/React.createElement(ElementGroup, {
|
|
90
97
|
align: SmartLinkAlignment.Right,
|
|
91
|
-
|
|
98
|
+
overrideCss: elementGroupStyles,
|
|
92
99
|
direction: SmartLinkDirection.Horizontal,
|
|
93
100
|
width: SmartLinkWidth.Flexible
|
|
94
101
|
}, secondaryElements));
|
|
@@ -3,6 +3,11 @@ import React from 'react';
|
|
|
3
3
|
import { SmartLinkStatus } from '../../../../../constants';
|
|
4
4
|
import Block from '../block';
|
|
5
5
|
import { Preview } from '../../elements';
|
|
6
|
+
/**
|
|
7
|
+
* Represents a PreviewBlock, which typically contains media or other large format content.
|
|
8
|
+
* @param {PreviewBlock} PreviewBlock
|
|
9
|
+
* @see Block
|
|
10
|
+
*/
|
|
6
11
|
|
|
7
12
|
const PreviewBlock = ({
|
|
8
13
|
status = SmartLinkStatus.Fallback,
|
|
@@ -7,6 +7,11 @@ import { getMaxLines } from '../../utils';
|
|
|
7
7
|
const DEFAULT_MAX_LINES = 3;
|
|
8
8
|
const MAXIMUM_MAX_LINES = 3;
|
|
9
9
|
const MINIMUM_MAX_LINES = 1;
|
|
10
|
+
/**
|
|
11
|
+
* Represents a SnippetBlock, which is used to display longer form text content, like descriptions.
|
|
12
|
+
* @param {SnippetBlock} SnippetBlock
|
|
13
|
+
* @see Block
|
|
14
|
+
*/
|
|
10
15
|
|
|
11
16
|
const SnippetBlock = ({
|
|
12
17
|
maxLines = DEFAULT_MAX_LINES,
|