@atlaskit/smart-card 26.3.2 → 26.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/cjs/utils/analytics/SmartLinkAnalyticsContext.js +3 -1
  3. package/dist/cjs/version.json +1 -1
  4. package/dist/cjs/view/BlockCard/index.js +1 -1
  5. package/dist/cjs/view/EmbedCard/components/styled.js +10 -6
  6. package/dist/cjs/view/EmbedModal/components/link-info/styled.js +3 -2
  7. package/dist/cjs/view/FlexibleCard/components/common/lozenge-action/lozenge-action-error/styled.js +2 -0
  8. package/dist/cjs/view/FlexibleCard/components/common/lozenge-action/styled.js +5 -3
  9. package/dist/cjs/view/FlexibleCard/components/container/index.js +1 -1
  10. package/dist/cjs/view/HoverCard/components/HoverCardComponent.js +45 -39
  11. package/dist/cjs/view/HoverCard/components/HoverCardContent.js +44 -2
  12. package/dist/cjs/view/HoverCard/index.js +23 -6
  13. package/dist/cjs/view/InlineCard/Icon.js +2 -2
  14. package/dist/cjs/view/InlineCard/IconAndTitleLayout/styled.js +4 -4
  15. package/dist/cjs/view/InlineCard/ResolvingView/styled.js +1 -1
  16. package/dist/es2019/utils/analytics/SmartLinkAnalyticsContext.js +3 -1
  17. package/dist/es2019/version.json +1 -1
  18. package/dist/es2019/view/BlockCard/index.js +1 -1
  19. package/dist/es2019/view/EmbedCard/components/styled.js +14 -8
  20. package/dist/es2019/view/EmbedModal/components/link-info/styled.js +5 -3
  21. package/dist/es2019/view/FlexibleCard/components/common/lozenge-action/lozenge-action-error/styled.js +2 -0
  22. package/dist/es2019/view/FlexibleCard/components/common/lozenge-action/styled.js +7 -3
  23. package/dist/es2019/view/FlexibleCard/components/container/index.js +1 -1
  24. package/dist/es2019/view/HoverCard/components/HoverCardComponent.js +56 -48
  25. package/dist/es2019/view/HoverCard/components/HoverCardContent.js +45 -3
  26. package/dist/es2019/view/HoverCard/index.js +24 -7
  27. package/dist/es2019/view/InlineCard/Icon.js +2 -2
  28. package/dist/es2019/view/InlineCard/IconAndTitleLayout/styled.js +5 -6
  29. package/dist/es2019/view/InlineCard/ResolvingView/styled.js +1 -1
  30. package/dist/esm/utils/analytics/SmartLinkAnalyticsContext.js +3 -1
  31. package/dist/esm/version.json +1 -1
  32. package/dist/esm/view/BlockCard/index.js +1 -1
  33. package/dist/esm/view/EmbedCard/components/styled.js +10 -6
  34. package/dist/esm/view/EmbedModal/components/link-info/styled.js +3 -2
  35. package/dist/esm/view/FlexibleCard/components/common/lozenge-action/lozenge-action-error/styled.js +2 -0
  36. package/dist/esm/view/FlexibleCard/components/common/lozenge-action/styled.js +5 -3
  37. package/dist/esm/view/FlexibleCard/components/container/index.js +1 -1
  38. package/dist/esm/view/HoverCard/components/HoverCardComponent.js +45 -37
  39. package/dist/esm/view/HoverCard/components/HoverCardContent.js +45 -3
  40. package/dist/esm/view/HoverCard/index.js +24 -7
  41. package/dist/esm/view/InlineCard/Icon.js +2 -2
  42. package/dist/esm/view/InlineCard/IconAndTitleLayout/styled.js +4 -5
  43. package/dist/esm/view/InlineCard/ResolvingView/styled.js +1 -1
  44. package/dist/types/utils/analytics/SmartLinkAnalyticsContext.d.ts +1 -0
  45. package/dist/types/view/HoverCard/index.d.ts +2 -2
  46. package/dist/types/view/HoverCard/types.d.ts +4 -4
  47. package/dist/types-ts4.5/utils/analytics/SmartLinkAnalyticsContext.d.ts +1 -0
  48. package/dist/types-ts4.5/view/HoverCard/index.d.ts +2 -2
  49. package/dist/types-ts4.5/view/HoverCard/types.d.ts +4 -4
  50. package/package.json +9 -5
@@ -1,5 +1,8 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
3
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
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
7
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
5
8
  import Popup from '@atlaskit/popup';
@@ -12,6 +15,7 @@ import HoverCardContent from '../components/HoverCardContent';
12
15
  import { CARD_GAP_PX, HOVER_CARD_Z_INDEX } from '../styled';
13
16
  import { CardDisplay } from '../../../constants';
14
17
  import { SmartLinkAnalyticsContext } from '../../../utils/analytics/SmartLinkAnalyticsContext';
18
+ var HOVER_CARD_SOURCE = 'smartLinkPreviewHoverCard';
15
19
  export var HoverCardComponent = function HoverCardComponent(_ref) {
16
20
  var children = _ref.children,
17
21
  url = _ref.url,
@@ -52,18 +56,24 @@ export var HoverCardComponent = function HoverCardComponent(_ref) {
52
56
  };
53
57
  }, [isOpen]);
54
58
  var hideCard = useCallback(function () {
55
- //Check its previously open to avoid firing events when moving between the child and hover card components
56
- if (isOpen === true && cardOpenTime.current) {
57
- var hoverTime = Date.now() - cardOpenTime.current;
58
- analytics.ui.hoverCardDismissedEvent({
59
- previewDisplay: 'card',
60
- hoverTime: hoverTime,
61
- previewInvokeMethod: 'mouse_hover',
62
- status: linkStatus
63
- });
59
+ if (getBooleanFF('platform.linking-platform.smart-card.refactor-hover-card-analytics')) {
60
+ /**
61
+ * Defer to inner HoverCardContent to fire this event
62
+ */
63
+ } else {
64
+ //Check its previously open to avoid firing events when moving between the child and hover card components
65
+ if (isOpen === true && cardOpenTime.current) {
66
+ var hoverTime = Date.now() - cardOpenTime.current;
67
+ analytics === null || analytics === void 0 ? void 0 : analytics.ui.hoverCardDismissedEvent({
68
+ previewDisplay: 'card',
69
+ hoverTime: hoverTime,
70
+ previewInvokeMethod: 'mouse_hover',
71
+ status: linkStatus
72
+ });
73
+ }
64
74
  }
65
75
  setIsOpen(false);
66
- }, [analytics.ui, isOpen, linkStatus]);
76
+ }, [analytics, isOpen, linkStatus]);
67
77
  var initHideCard = useCallback(function () {
68
78
  if (fadeInTimeoutId.current) {
69
79
  clearTimeout(fadeInTimeoutId.current);
@@ -79,14 +89,20 @@ export var HoverCardComponent = function HoverCardComponent(_ref) {
79
89
  //Set mouse position in the case it's not already set by onMouseMove, as in the case of scrolling
80
90
  setMousePosition(event);
81
91
  fadeInTimeoutId.current = setTimeout(function () {
82
- //Check if its previously closed to avoid firing events when moving between the child and hover card components
83
- if (isOpen === false) {
84
- cardOpenTime.current = Date.now();
85
- analytics.ui.hoverCardViewedEvent({
86
- previewDisplay: hoverDisplay,
87
- previewInvokeMethod: invokeMethod,
88
- status: linkStatus
89
- });
92
+ if (getBooleanFF('platform.linking-platform.smart-card.refactor-hover-card-analytics')) {
93
+ /**
94
+ * Defer to inner HoverCardContent to fire this event
95
+ */
96
+ } else {
97
+ //Check if its previously closed to avoid firing events when moving between the child and hover card components
98
+ if (isOpen === false) {
99
+ cardOpenTime.current = Date.now();
100
+ analytics === null || analytics === void 0 ? void 0 : analytics.ui.hoverCardViewedEvent({
101
+ previewDisplay: hoverDisplay,
102
+ previewInvokeMethod: invokeMethod,
103
+ status: linkStatus
104
+ });
105
+ }
90
106
  }
91
107
  //If these are undefined then popupOffset is undefined and we fallback to default bottom-start placement
92
108
  if (parentSpan.current && mousePos.current) {
@@ -97,12 +113,12 @@ export var HoverCardComponent = function HoverCardComponent(_ref) {
97
113
  }
98
114
  setIsOpen(true);
99
115
  }, delay);
100
- }, [isOpen, setMousePosition, analytics.ui, linkStatus]);
116
+ }, [isOpen, setMousePosition, analytics, linkStatus]);
101
117
  var linkActions = useSmartLinkActions({
102
118
  url: url,
103
119
  appearance: CardDisplay.HoverCardPreview,
104
120
  analyticsHandler: analyticsHandler,
105
- origin: 'smartLinkPreviewHoverCard'
121
+ origin: HOVER_CARD_SOURCE
106
122
  });
107
123
  var filteredActions = useMemo(function () {
108
124
  return hidePreviewButton ? linkActions.filter(function (action) {
@@ -125,14 +141,9 @@ export var HoverCardComponent = function HoverCardComponent(_ref) {
125
141
  }, [closeOnChildClick, hideCard]);
126
142
  var content = useCallback(function (_ref2) {
127
143
  var update = _ref2.update;
128
- return getBooleanFF('platform.linking-platform.smart-card.enable-analytics-context') ? jsx(SmartLinkAnalyticsContext, {
129
- url: url,
130
- appearance: CardDisplay.HoverCardPreview,
131
- id: id
132
- }, jsx(HoverCardContent, {
144
+ var hoverCardContentProps = _objectSpread({
133
145
  onMouseEnter: initShowCard,
134
146
  onMouseLeave: initHideCard,
135
- analytics: analytics,
136
147
  cardActions: filteredActions,
137
148
  cardState: linkState,
138
149
  onActionClick: onActionClick,
@@ -141,18 +152,15 @@ export var HoverCardComponent = function HoverCardComponent(_ref) {
141
152
  showServerActions: showServerActions,
142
153
  url: url,
143
154
  id: id
144
- })) : jsx(HoverCardContent, {
145
- onMouseEnter: initShowCard,
146
- onMouseLeave: initHideCard,
147
- analytics: analytics,
148
- cardActions: filteredActions,
149
- cardState: linkState,
150
- onActionClick: onActionClick,
151
- onResolve: update,
152
- renderers: renderers,
153
- showServerActions: showServerActions,
154
- url: url
155
+ }, getBooleanFF('platform.linking-platform.smart-card.refactor-hover-card-analytics') ? {} : {
156
+ analytics: analytics
155
157
  });
158
+ return getBooleanFF('platform.linking-platform.smart-card.enable-analytics-context') ? jsx(SmartLinkAnalyticsContext, {
159
+ url: url,
160
+ appearance: CardDisplay.HoverCardPreview,
161
+ id: id,
162
+ source: HOVER_CARD_SOURCE
163
+ }, jsx(HoverCardContent, hoverCardContentProps)) : jsx(HoverCardContent, hoverCardContentProps);
156
164
  }, [analytics, initHideCard, initShowCard, filteredActions, linkState, onActionClick, renderers, showServerActions, url, id]);
157
165
  var trigger = useCallback(function (triggerProps) {
158
166
  return jsx("span", {
@@ -2,12 +2,14 @@ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
2
  import _regeneratorRuntime from "@babel/runtime/regenerator";
3
3
  /** @jsx jsx */
4
4
  import { jsx } from '@emotion/react';
5
+ import { useAnalyticsEvents } from '@atlaskit/analytics-next';
6
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
5
7
  import ShortcutIcon from '@atlaskit/icon/glyph/shortcut';
6
8
  import CopyIcon from '@atlaskit/icon/glyph/copy';
7
- import { useAnalyticsEvents } from '@atlaskit/analytics-next';
8
- import React, { useCallback, useEffect, useMemo } from 'react';
9
+ import React, { useCallback, useEffect, useMemo, useRef } from 'react';
9
10
  import { ActionName, CardDisplay, SmartLinkPosition, SmartLinkSize } from '../../../constants';
10
11
  import { extractMetadata } from '../../../extractors/hover/extractMetadata';
12
+ import { useSmartLinkAnalytics } from '../../../state/analytics';
11
13
  import { getExtensionKey } from '../../../state/helpers';
12
14
  import { isSpecialEvent } from '../../../utils';
13
15
  import { HoverCardContainer, flexibleUiOptions, titleBlockCss } from '../styled';
@@ -19,6 +21,7 @@ import { FormattedMessage } from 'react-intl-next';
19
21
  import { messages } from '../../../messages';
20
22
  import { useSmartCardActions } from '../../../state/actions';
21
23
  import { fireLinkClickedEvent } from '../../../utils/analytics/click';
24
+ import { useSmartCardState } from '../../../state/store';
22
25
  export var hoverCardClassName = 'smart-links-hover-preview';
23
26
  export var getOpenAction = function getOpenAction(url, analytics, onActionClick) {
24
27
  return {
@@ -77,7 +80,7 @@ var HoverCardContent = function HoverCardContent(_ref) {
77
80
  var _cardState$details;
78
81
  var _ref$id = _ref.id,
79
82
  id = _ref$id === void 0 ? '' : _ref$id,
80
- analytics = _ref.analytics,
83
+ _analytics = _ref.analytics,
81
84
  _ref$cardActions = _ref.cardActions,
82
85
  cardActions = _ref$cardActions === void 0 ? [] : _ref$cardActions,
83
86
  cardState = _ref.cardState,
@@ -90,13 +93,52 @@ var HoverCardContent = function HoverCardContent(_ref) {
90
93
  showServerActions = _ref.showServerActions;
91
94
  var _useAnalyticsEvents = useAnalyticsEvents(),
92
95
  createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
96
+ var defaultAnalytics = useSmartLinkAnalytics(url, undefined, id);
97
+ var analytics = _analytics !== null && _analytics !== void 0 ? _analytics : defaultAnalytics;
93
98
  var extensionKey = useMemo(function () {
94
99
  return getExtensionKey(cardState.details);
95
100
  }, [cardState.details]);
96
101
  var actions = useSmartCardActions(id, url, analytics);
102
+ var linkState = useSmartCardState(url);
103
+ var linkStatus = linkState.status;
104
+ var statusRef = useRef(linkStatus);
105
+ var analyticsRef = useRef(analytics);
97
106
  useEffect(function () {
98
107
  actions.loadMetadata();
99
108
  }, [actions]);
109
+ useEffect(function () {
110
+ /**
111
+ * Must access current analytics object value via ref because its not stable
112
+ * and it can trigger useEffect to re-run below
113
+ */
114
+ if (analyticsRef.current !== analytics) {
115
+ analyticsRef.current = analytics;
116
+ }
117
+ if (statusRef.current !== linkStatus) {
118
+ statusRef.current = linkStatus;
119
+ }
120
+ }, [analytics, linkStatus]);
121
+ useEffect(function () {
122
+ if (getBooleanFF('platform.linking-platform.smart-card.refactor-hover-card-analytics')) {
123
+ var previewDisplay = 'card';
124
+ var previewInvokeMethod = 'mouse_hover';
125
+ var cardOpenTime = Date.now();
126
+ analyticsRef.current.ui.hoverCardViewedEvent({
127
+ previewDisplay: previewDisplay,
128
+ previewInvokeMethod: previewInvokeMethod,
129
+ status: statusRef.current
130
+ });
131
+ return function () {
132
+ var hoverTime = Date.now() - cardOpenTime;
133
+ analyticsRef.current.ui.hoverCardDismissedEvent({
134
+ previewDisplay: previewDisplay,
135
+ previewInvokeMethod: previewInvokeMethod,
136
+ hoverTime: hoverTime,
137
+ status: statusRef.current
138
+ });
139
+ };
140
+ }
141
+ }, []);
100
142
  var onClick = useCallback(function (event) {
101
143
  var isModifierKeyPressed = isSpecialEvent(event);
102
144
  analytics.ui.cardClickedEvent({
@@ -4,6 +4,7 @@ import { withAnalyticsContext, withAnalyticsEvents } from '@atlaskit/analytics-n
4
4
  import { jsx } from '@emotion/react';
5
5
  import { useCallback } from 'react';
6
6
  import { ErrorBoundary } from 'react-error-boundary';
7
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
7
8
  import { useSmartLinkAnalytics } from '../../state/analytics';
8
9
  import { fireSmartLinkEvent } from '../../utils/analytics';
9
10
  import { HoverCardComponent } from './components/HoverCardComponent';
@@ -16,7 +17,11 @@ var HoverCardWithErrorBoundary = function HoverCardWithErrorBoundary(props) {
16
17
  var analyticsHandler = useCallback(function (analyticsPayload) {
17
18
  fireSmartLinkEvent(analyticsPayload, createAnalyticsEvent);
18
19
  }, [createAnalyticsEvent]);
19
- var analytics = useSmartLinkAnalytics(url, analyticsHandler, id);
20
+
21
+ /**
22
+ * Feature flag disables prop drilling of analytics handlers
23
+ */
24
+ var analytics = useSmartLinkAnalytics(url, getBooleanFF('platform.linking-platform.smart-card.refactor-hover-card-analytics') ? undefined : analyticsHandler, id);
20
25
  var onError = useCallback(function (error, info) {
21
26
  analytics.ui.renderFailedEvent({
22
27
  display: CardDisplay.HoverCardPreview,
@@ -25,17 +30,29 @@ var HoverCardWithErrorBoundary = function HoverCardWithErrorBoundary(props) {
25
30
  errorInfo: info
26
31
  });
27
32
  }, [analytics.ui, id]);
33
+
34
+ /**
35
+ * Feature flag disables the prop drilling of analytics handlers to hover card component
36
+ */
37
+ var analyticsProps = getBooleanFF('platform.linking-platform.smart-card.refactor-hover-card-analytics') ? {} : {
38
+ analyticsHandler: analyticsHandler,
39
+ analytics: analytics
40
+ };
28
41
  return jsx(ErrorBoundary, {
29
42
  fallback: children,
30
43
  onError: onError
31
- }, jsx(HoverCardComponent, _extends({}, props, {
32
- analyticsHandler: analyticsHandler,
33
- analytics: analytics
34
- }), children));
44
+ }, jsx(HoverCardComponent, _extends({}, props, analyticsProps), children));
35
45
  };
36
- export var HoverCard = withAnalyticsContext({
46
+ var HoverCardWithAnalyticsContext = withAnalyticsContext({
37
47
  source: 'smartLinkPreviewHoverCard',
38
48
  attributes: {
39
49
  display: CardDisplay.HoverCardPreview
40
50
  }
41
- })(withAnalyticsEvents()(HoverCardWithErrorBoundary));
51
+ })(withAnalyticsEvents()(HoverCardWithErrorBoundary));
52
+ var HoverCardWithoutAnalyticsContext = withAnalyticsEvents()(HoverCardWithErrorBoundary);
53
+ export var HoverCard = function HoverCard(props) {
54
+ if (getBooleanFF('platform.linking-platform.smart-card.refactor-hover-card-analytics')) {
55
+ return jsx(HoverCardWithoutAnalyticsContext, props);
56
+ }
57
+ return jsx(HoverCardWithAnalyticsContext, props);
58
+ };
@@ -9,12 +9,12 @@ import React from 'react';
9
9
  // Current rationale: vertically positioned at the top of
10
10
  // the smart card container (when set to 0). Offset this
11
11
  // to position it with appropriate whitespace from the top.
12
- export var Icon = styled.img(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n height: 14px;\n width: 14px;\n margin-right: 4px;\n border-radius: 2px;\n user-select: none;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n"])));
12
+ export var Icon = styled.img(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n height: 14px;\n width: 14px;\n margin-right: ", ";\n border-radius: 2px;\n user-select: none;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n"])), "var(--ds-space-050, 4px)");
13
13
 
14
14
  // Used for 'untrue' icons which claim to be 16x16 but
15
15
  // are less than that in height/width.
16
16
  // TODO: Replace this override with proper AtlasKit solution.
17
- export var AKIconWrapper = styled.span(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n margin-right: -2px;\n"])));
17
+ export var AKIconWrapper = styled.span(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n margin-right: calc(-1 * ", ");\n"])), "var(--ds-space-025, 2px)");
18
18
  export var Shimmer = function Shimmer(_ref) {
19
19
  var testId = _ref.testId;
20
20
  var skeletonCustomStyles = {
@@ -1,7 +1,6 @@
1
1
  import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
2
  var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9;
3
3
  import styled from '@emotion/styled';
4
-
5
4
  // TODO: remove this override behaviour for @atlaskit/icon-object
6
5
  export var IconObjectOverrides = "\n & > span {\n height: 16px;\n width: 14px;\n position: absolute;\n top: 0;\n left: 0;\n line-height: 14px;\n & > svg {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n }\n }\n";
7
6
  // TODO: remove this override behaviour for @atlaskit/icon
@@ -16,7 +15,7 @@ export var IconOverrides = "\n & > * > span {\n height: 16px;\n width: 14
16
15
  export var IconWrapper = styled.span(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n user-select: none;\n ", "\n ", "\n"])), IconOverrides, IconObjectOverrides);
17
16
 
18
17
  // Wraps all emoji in Inline Links similar to icon
19
- export var EmojiWrapper = styled.span(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: inline-block;\n margin-right: 2px;\n user-select: none;\n ", "\n ", "\n"])), IconOverrides, IconObjectOverrides);
18
+ export var EmojiWrapper = styled.span(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: inline-block;\n margin-right: ", ";\n user-select: none;\n ", "\n ", "\n"])), "var(--ds-space-025, 2px)", IconOverrides, IconObjectOverrides);
20
19
 
21
20
  // The main 'wrapping' element, title of the content.
22
21
  // NB: `white-space` adds little whitespace before wrapping.
@@ -26,13 +25,13 @@ export var IconTitleWrapper = styled.span(_templateObject3 || (_templateObject3
26
25
  // TODO: Replace overrides with proper AtlasKit solution.
27
26
  export var LozengeWrapper = styled.span(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n display: inline-block;\n vertical-align: 1px;\n"])));
28
27
  // TODO: Replace overrides with proper AtlasKit solution.
29
- export var LozengeBlockWrapper = styled.span(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n & > span {\n margin-left: 4px;\n }\n"])));
30
- export var RightIconPositionWrapper = styled.span(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n margin-left: 2px;\n margin-right: 4px;\n position: relative;\n display: inline-block;\n"])));
28
+ export var LozengeBlockWrapper = styled.span(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n & > span {\n margin-left: ", ";\n }\n"])), "var(--ds-space-050, 4px)");
29
+ export var RightIconPositionWrapper = styled.span(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n margin-left: ", ";\n margin-right: ", ";\n position: relative;\n display: inline-block;\n"])), "var(--ds-space-025, 2px)", "var(--ds-space-050, 4px)");
31
30
 
32
31
  // The following components are used to absolutely position icons in the vertical center.
33
32
  // - IconPositionWrapper: the `relative` parent which has no height in itself.
34
33
  // - IconEmptyWrapper: the child which forces `IconPositionWrapper` to have a height.
35
- export var IconPositionWrapper = styled.span(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n margin-right: 4px;\n position: relative;\n display: inline-block;\n"])));
34
+ export var IconPositionWrapper = styled.span(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n margin-right: ", ";\n position: relative;\n display: inline-block;\n"])), "var(--ds-space-050, 4px)");
36
35
  export var IconEmptyWrapper = styled.span(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n width: 14px;\n height: 100%;\n display: inline-block;\n opacity: 0;\n"])));
37
36
 
38
37
  // With emotion it's not possible to use reference to `TitleWrapper` as part of a selector,
@@ -2,4 +2,4 @@ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral
2
2
  var _templateObject;
3
3
  import styled from '@emotion/styled';
4
4
  import { IconTitleWrapper } from '../IconAndTitleLayout/styled';
5
- export var SpinnerWrapper = styled(IconTitleWrapper)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n vertical-align: text-top;\n margin-left: 2px;\n"])));
5
+ export var SpinnerWrapper = styled(IconTitleWrapper)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n vertical-align: text-top;\n margin-left: ", ";\n"])), "var(--ds-space-025, 2px)");
@@ -4,6 +4,7 @@ type SmartLinkAnalyticsContextProps = {
4
4
  url: string;
5
5
  appearance: CardInnerAppearance;
6
6
  id: string | undefined;
7
+ source?: string;
7
8
  };
8
9
  export declare const SmartLinkAnalyticsContext: FC<SmartLinkAnalyticsContextProps>;
9
10
  export {};
@@ -1,3 +1,3 @@
1
- /// <reference types="react" />
1
+ import { jsx } from '@emotion/react';
2
2
  import { HoverCardProps } from './types';
3
- export declare const HoverCard: import("react").ForwardRefExoticComponent<Pick<Omit<import("react").PropsWithChildren<HoverCardProps>, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps> & import("react").RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "url" | "children" | "key" | "id" | "analyticsContext" | "showServerActions" | "onAuthorize" | "canOpen" | "closeOnChildClick" | "hidePreviewButton"> & import("react").RefAttributes<any>>;
3
+ export declare const HoverCard: (props: HoverCardProps) => jsx.JSX.Element;
@@ -3,8 +3,8 @@ import { ElementItem } from '../FlexibleCard/components/blocks/types';
3
3
  import { AnalyticsFacade } from '../../state/analytics';
4
4
  import { LinkAction } from '../../state/hooks-external/useSmartLinkActions';
5
5
  import { CardState } from '@atlaskit/linking-common';
6
- import { CardProviderRenderers } from '@atlaskit/link-provider';
7
6
  import { AnalyticsHandler } from '../../utils/types';
7
+ import { CardProviderRenderers } from '@atlaskit/link-provider';
8
8
  import { ReactElement, MouseEventHandler } from 'react';
9
9
  import { JsonLd } from 'json-ld-types';
10
10
  export interface HoverCardProps extends WithAnalyticsEventsProps {
@@ -44,8 +44,8 @@ export interface HoverCardProps extends WithAnalyticsEventsProps {
44
44
  showServerActions?: boolean;
45
45
  }
46
46
  export interface HoverCardComponentProps extends HoverCardProps {
47
- analyticsHandler: AnalyticsHandler;
48
- analytics: AnalyticsFacade;
47
+ analyticsHandler?: AnalyticsHandler;
48
+ analytics?: AnalyticsFacade;
49
49
  canOpen?: boolean;
50
50
  closeOnChildClick?: boolean;
51
51
  }
@@ -58,7 +58,7 @@ export interface MetadataOptions {
58
58
  }
59
59
  export type HoverCardContentProps = {
60
60
  id?: string;
61
- analytics: AnalyticsFacade;
61
+ analytics?: AnalyticsFacade;
62
62
  cardActions?: LinkAction[];
63
63
  cardState: CardState;
64
64
  renderers?: CardProviderRenderers;
@@ -4,6 +4,7 @@ type SmartLinkAnalyticsContextProps = {
4
4
  url: string;
5
5
  appearance: CardInnerAppearance;
6
6
  id: string | undefined;
7
+ source?: string;
7
8
  };
8
9
  export declare const SmartLinkAnalyticsContext: FC<SmartLinkAnalyticsContextProps>;
9
10
  export {};
@@ -1,3 +1,3 @@
1
- /// <reference types="react" />
1
+ import { jsx } from '@emotion/react';
2
2
  import { HoverCardProps } from './types';
3
- export declare const HoverCard: import("react").ForwardRefExoticComponent<Pick<Omit<import("react").PropsWithChildren<HoverCardProps>, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps> & import("react").RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "url" | "children" | "key" | "id" | "analyticsContext" | "showServerActions" | "onAuthorize" | "canOpen" | "closeOnChildClick" | "hidePreviewButton"> & import("react").RefAttributes<any>>;
3
+ export declare const HoverCard: (props: HoverCardProps) => jsx.JSX.Element;
@@ -3,8 +3,8 @@ import { ElementItem } from '../FlexibleCard/components/blocks/types';
3
3
  import { AnalyticsFacade } from '../../state/analytics';
4
4
  import { LinkAction } from '../../state/hooks-external/useSmartLinkActions';
5
5
  import { CardState } from '@atlaskit/linking-common';
6
- import { CardProviderRenderers } from '@atlaskit/link-provider';
7
6
  import { AnalyticsHandler } from '../../utils/types';
7
+ import { CardProviderRenderers } from '@atlaskit/link-provider';
8
8
  import { ReactElement, MouseEventHandler } from 'react';
9
9
  import { JsonLd } from 'json-ld-types';
10
10
  export interface HoverCardProps extends WithAnalyticsEventsProps {
@@ -44,8 +44,8 @@ export interface HoverCardProps extends WithAnalyticsEventsProps {
44
44
  showServerActions?: boolean;
45
45
  }
46
46
  export interface HoverCardComponentProps extends HoverCardProps {
47
- analyticsHandler: AnalyticsHandler;
48
- analytics: AnalyticsFacade;
47
+ analyticsHandler?: AnalyticsHandler;
48
+ analytics?: AnalyticsFacade;
49
49
  canOpen?: boolean;
50
50
  closeOnChildClick?: boolean;
51
51
  }
@@ -58,7 +58,7 @@ export interface MetadataOptions {
58
58
  }
59
59
  export type HoverCardContentProps = {
60
60
  id?: string;
61
- analytics: AnalyticsFacade;
61
+ analytics?: AnalyticsFacade;
62
62
  cardActions?: LinkAction[];
63
63
  cardState: CardState;
64
64
  renderers?: CardProviderRenderers;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "26.3.2",
3
+ "version": "26.3.4",
4
4
  "description": "Smart card component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -44,7 +44,7 @@
44
44
  "@atlaskit/link-analytics": "^8.0.2",
45
45
  "@atlaskit/link-client-extension": "^1.1.0",
46
46
  "@atlaskit/linking-common": "^2.12.0",
47
- "@atlaskit/linking-types": "^2.0.0",
47
+ "@atlaskit/linking-types": "^3.0.0",
48
48
  "@atlaskit/logo": "^13.14.0",
49
49
  "@atlaskit/lozenge": "^11.4.0",
50
50
  "@atlaskit/media-common": "^4.1.0",
@@ -85,7 +85,7 @@
85
85
  "@atlaskit/field-base": "^15.2.0",
86
86
  "@atlaskit/form": "^8.11.0",
87
87
  "@atlaskit/inline-message": "^11.5.0",
88
- "@atlaskit/link-test-helpers": "^3.0.0",
88
+ "@atlaskit/link-test-helpers": "^4.0.0",
89
89
  "@atlaskit/lozenge": "^11.4.0",
90
90
  "@atlaskit/media-integration-test-helpers": "^2.6.0",
91
91
  "@atlaskit/media-test-helpers": "^33.0.0",
@@ -93,7 +93,7 @@
93
93
  "@atlaskit/radio": "^5.6.0",
94
94
  "@atlaskit/range": "^7.1.0",
95
95
  "@atlaskit/section-message": "^6.4.0",
96
- "@atlaskit/select": "^16.2.0",
96
+ "@atlaskit/select": "^16.3.0",
97
97
  "@atlaskit/table-tree": "^9.4.0",
98
98
  "@atlaskit/tabs": "^13.4.0",
99
99
  "@atlaskit/textarea": "^4.6.0",
@@ -141,13 +141,17 @@
141
141
  "platform-feature-flags": {
142
142
  "platform.linking-platform.smart-card.enable-analytics-context": {
143
143
  "type": "boolean"
144
+ },
145
+ "platform.linking-platform.smart-card.refactor-hover-card-analytics": {
146
+ "type": "boolean"
144
147
  }
145
148
  },
146
149
  "prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1",
147
150
  "techstack": {
148
151
  "@repo/internal": {
149
152
  "design-tokens": [
150
- "color"
153
+ "color",
154
+ "spacing"
151
155
  ]
152
156
  }
153
157
  }