@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,13 +1,15 @@
1
1
  import { css } from '@emotion/react';
2
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage-spacing
2
3
  export const containerStyles = css`
3
4
  align-items: center;
4
5
  display: flex;
5
- gap: 8px;
6
+ gap: ${"var(--ds-space-100, 8px)"};
6
7
  justify-content: space-between;
7
8
  // AK ModalBody has 2px padding top and bottom.
8
9
  // Using 14px here to create 16px gap between
9
10
  // link info and iframe
10
- padding: 24px 24px 14px 24px;
11
+ padding: ${"var(--ds-space-300, 24px)"} ${"var(--ds-space-300, 24px)"} 14px
12
+ ${"var(--ds-space-300, 24px)"};
11
13
  `;
12
14
  const iconSize = '24px';
13
15
  export const iconCss = css`
@@ -48,7 +50,7 @@ export const titleCss = css`
48
50
  export const actionCss = css`
49
51
  display: flex;
50
52
  flex: 0 0 auto;
51
- gap: 4px;
53
+ gap: ${"var(--ds-space-050, 4px)"};
52
54
  line-height: ${height};
53
55
  span {
54
56
  line-height: ${height};
@@ -33,6 +33,8 @@ export const contentStyles = css`
33
33
  color: ${`var(--ds-text, ${N800})`};
34
34
  }
35
35
  `;
36
+
37
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage-spacing
36
38
  export const linkStyles = css`
37
39
  ${sharedBlockStyles};
38
40
 
@@ -14,7 +14,7 @@ export const triggerButtonStyles = css`
14
14
  text-transform: unset;
15
15
 
16
16
  border: 2px solid transparent;
17
- margin: 2px;
17
+ margin: ${"var(--ds-space-025, 2px)"};
18
18
 
19
19
  &:focus-visible,
20
20
  &:focus-within,
@@ -24,12 +24,16 @@ export const triggerButtonStyles = css`
24
24
  border-radius: 5px;
25
25
  }
26
26
  `;
27
+
28
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage-spacing
27
29
  export const triggerLozengeStyles = css`
28
30
  align-items: center;
29
31
  display: flex;
30
32
 
31
33
  span[role='img'] {
32
- margin: -4px -8px -4px -1px;
34
+ margin: calc(-1 * ${"var(--ds-space-050, 4px)"})
35
+ calc(-1 * ${"var(--ds-space-100, 8px)"})
36
+ calc(-1 * ${"var(--ds-space-050, 4px)"}) -1px;
33
37
  }
34
38
  `;
35
39
  export const dropdownItemGroupStyles = css`
@@ -37,7 +41,7 @@ export const dropdownItemGroupStyles = css`
37
41
  overflow-y: auto;
38
42
 
39
43
  button {
40
- padding: 6px 12px;
44
+ padding: ${"var(--ds-space-075, 6px)"} ${"var(--ds-space-150, 12px)"};
41
45
  min-height: 28px;
42
46
  width: 220px;
43
47
 
@@ -12,7 +12,7 @@ const elevationStyles = css`
12
12
  border: 1px solid transparent;
13
13
  border-radius: 1.5px;
14
14
  box-shadow: ${tokens.elevation};
15
- margin: 2px;
15
+ margin: ${"var(--ds-space-025, 2px)"};
16
16
  `;
17
17
  const getGap = size => {
18
18
  switch (size) {
@@ -11,6 +11,7 @@ import HoverCardContent from '../components/HoverCardContent';
11
11
  import { CARD_GAP_PX, HOVER_CARD_Z_INDEX } from '../styled';
12
12
  import { CardDisplay } from '../../../constants';
13
13
  import { SmartLinkAnalyticsContext } from '../../../utils/analytics/SmartLinkAnalyticsContext';
14
+ const HOVER_CARD_SOURCE = 'smartLinkPreviewHoverCard';
14
15
  export const HoverCardComponent = ({
15
16
  children,
16
17
  url,
@@ -45,18 +46,24 @@ export const HoverCardComponent = ({
45
46
  };
46
47
  }, [isOpen]);
47
48
  const hideCard = useCallback(() => {
48
- //Check its previously open to avoid firing events when moving between the child and hover card components
49
- if (isOpen === true && cardOpenTime.current) {
50
- const hoverTime = Date.now() - cardOpenTime.current;
51
- analytics.ui.hoverCardDismissedEvent({
52
- previewDisplay: 'card',
53
- hoverTime,
54
- previewInvokeMethod: 'mouse_hover',
55
- status: linkStatus
56
- });
49
+ if (getBooleanFF('platform.linking-platform.smart-card.refactor-hover-card-analytics')) {
50
+ /**
51
+ * Defer to inner HoverCardContent to fire this event
52
+ */
53
+ } else {
54
+ //Check its previously open to avoid firing events when moving between the child and hover card components
55
+ if (isOpen === true && cardOpenTime.current) {
56
+ const hoverTime = Date.now() - cardOpenTime.current;
57
+ analytics === null || analytics === void 0 ? void 0 : analytics.ui.hoverCardDismissedEvent({
58
+ previewDisplay: 'card',
59
+ hoverTime,
60
+ previewInvokeMethod: 'mouse_hover',
61
+ status: linkStatus
62
+ });
63
+ }
57
64
  }
58
65
  setIsOpen(false);
59
- }, [analytics.ui, isOpen, linkStatus]);
66
+ }, [analytics, isOpen, linkStatus]);
60
67
  const initHideCard = useCallback(() => {
61
68
  if (fadeInTimeoutId.current) {
62
69
  clearTimeout(fadeInTimeoutId.current);
@@ -70,14 +77,20 @@ export const HoverCardComponent = ({
70
77
  //Set mouse position in the case it's not already set by onMouseMove, as in the case of scrolling
71
78
  setMousePosition(event);
72
79
  fadeInTimeoutId.current = setTimeout(() => {
73
- //Check if its previously closed to avoid firing events when moving between the child and hover card components
74
- if (isOpen === false) {
75
- cardOpenTime.current = Date.now();
76
- analytics.ui.hoverCardViewedEvent({
77
- previewDisplay: hoverDisplay,
78
- previewInvokeMethod: invokeMethod,
79
- status: linkStatus
80
- });
80
+ if (getBooleanFF('platform.linking-platform.smart-card.refactor-hover-card-analytics')) {
81
+ /**
82
+ * Defer to inner HoverCardContent to fire this event
83
+ */
84
+ } else {
85
+ //Check if its previously closed to avoid firing events when moving between the child and hover card components
86
+ if (isOpen === false) {
87
+ cardOpenTime.current = Date.now();
88
+ analytics === null || analytics === void 0 ? void 0 : analytics.ui.hoverCardViewedEvent({
89
+ previewDisplay: hoverDisplay,
90
+ previewInvokeMethod: invokeMethod,
91
+ status: linkStatus
92
+ });
93
+ }
81
94
  }
82
95
  //If these are undefined then popupOffset is undefined and we fallback to default bottom-start placement
83
96
  if (parentSpan.current && mousePos.current) {
@@ -89,12 +102,12 @@ export const HoverCardComponent = ({
89
102
  }
90
103
  setIsOpen(true);
91
104
  }, delay);
92
- }, [isOpen, setMousePosition, analytics.ui, linkStatus]);
105
+ }, [isOpen, setMousePosition, analytics, linkStatus]);
93
106
  const linkActions = useSmartLinkActions({
94
107
  url,
95
108
  appearance: CardDisplay.HoverCardPreview,
96
109
  analyticsHandler,
97
- origin: 'smartLinkPreviewHoverCard'
110
+ origin: HOVER_CARD_SOURCE
98
111
  });
99
112
  const filteredActions = useMemo(() => {
100
113
  return hidePreviewButton ? linkActions.filter(action => action.id !== 'preview-content') : linkActions;
@@ -115,34 +128,29 @@ export const HoverCardComponent = ({
115
128
  }, [closeOnChildClick, hideCard]);
116
129
  const content = useCallback(({
117
130
  update
118
- }) => getBooleanFF('platform.linking-platform.smart-card.enable-analytics-context') ? jsx(SmartLinkAnalyticsContext, {
119
- url: url,
120
- appearance: CardDisplay.HoverCardPreview,
121
- id: id
122
- }, jsx(HoverCardContent, {
123
- onMouseEnter: initShowCard,
124
- onMouseLeave: initHideCard,
125
- analytics: analytics,
126
- cardActions: filteredActions,
127
- cardState: linkState,
128
- onActionClick: onActionClick,
129
- onResolve: update,
130
- renderers: renderers,
131
- showServerActions: showServerActions,
132
- url: url,
133
- id: id
134
- })) : jsx(HoverCardContent, {
135
- onMouseEnter: initShowCard,
136
- onMouseLeave: initHideCard,
137
- analytics: analytics,
138
- cardActions: filteredActions,
139
- cardState: linkState,
140
- onActionClick: onActionClick,
141
- onResolve: update,
142
- renderers: renderers,
143
- showServerActions: showServerActions,
144
- url: url
145
- }), [analytics, initHideCard, initShowCard, filteredActions, linkState, onActionClick, renderers, showServerActions, url, id]);
131
+ }) => {
132
+ const hoverCardContentProps = {
133
+ onMouseEnter: initShowCard,
134
+ onMouseLeave: initHideCard,
135
+ cardActions: filteredActions,
136
+ cardState: linkState,
137
+ onActionClick,
138
+ onResolve: update,
139
+ renderers,
140
+ showServerActions,
141
+ url,
142
+ id,
143
+ ...(getBooleanFF('platform.linking-platform.smart-card.refactor-hover-card-analytics') ? {} : {
144
+ analytics
145
+ })
146
+ };
147
+ return getBooleanFF('platform.linking-platform.smart-card.enable-analytics-context') ? jsx(SmartLinkAnalyticsContext, {
148
+ url: url,
149
+ appearance: CardDisplay.HoverCardPreview,
150
+ id: id,
151
+ source: HOVER_CARD_SOURCE
152
+ }, jsx(HoverCardContent, hoverCardContentProps)) : jsx(HoverCardContent, hoverCardContentProps);
153
+ }, [analytics, initHideCard, initShowCard, filteredActions, linkState, onActionClick, renderers, showServerActions, url, id]);
146
154
  const trigger = useCallback(triggerProps => jsx("span", {
147
155
  ref: parentSpan
148
156
  }, jsx("span", _extends({}, triggerProps, {
@@ -1,11 +1,13 @@
1
1
  /** @jsx jsx */
2
2
  import { jsx } from '@emotion/react';
3
+ import { useAnalyticsEvents } from '@atlaskit/analytics-next';
4
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
3
5
  import ShortcutIcon from '@atlaskit/icon/glyph/shortcut';
4
6
  import CopyIcon from '@atlaskit/icon/glyph/copy';
5
- import { useAnalyticsEvents } from '@atlaskit/analytics-next';
6
- import React, { useCallback, useEffect, useMemo } from 'react';
7
+ import React, { useCallback, useEffect, useMemo, useRef } from 'react';
7
8
  import { ActionName, CardDisplay, SmartLinkPosition, SmartLinkSize } from '../../../constants';
8
9
  import { extractMetadata } from '../../../extractors/hover/extractMetadata';
10
+ import { useSmartLinkAnalytics } from '../../../state/analytics';
9
11
  import { getExtensionKey } from '../../../state/helpers';
10
12
  import { isSpecialEvent } from '../../../utils';
11
13
  import { HoverCardContainer, flexibleUiOptions, titleBlockCss } from '../styled';
@@ -17,6 +19,7 @@ import { FormattedMessage } from 'react-intl-next';
17
19
  import { messages } from '../../../messages';
18
20
  import { useSmartCardActions } from '../../../state/actions';
19
21
  import { fireLinkClickedEvent } from '../../../utils/analytics/click';
22
+ import { useSmartCardState } from '../../../state/store';
20
23
  export const hoverCardClassName = 'smart-links-hover-preview';
21
24
  export const getOpenAction = (url, analytics, onActionClick) => ({
22
25
  name: ActionName.CustomAction,
@@ -50,7 +53,7 @@ export const getCopyAction = url => ({
50
53
  });
51
54
  const HoverCardContent = ({
52
55
  id = '',
53
- analytics,
56
+ analytics: _analytics,
54
57
  cardActions = [],
55
58
  cardState,
56
59
  onActionClick,
@@ -65,11 +68,50 @@ const HoverCardContent = ({
65
68
  const {
66
69
  createAnalyticsEvent
67
70
  } = useAnalyticsEvents();
71
+ const defaultAnalytics = useSmartLinkAnalytics(url, undefined, id);
72
+ const analytics = _analytics !== null && _analytics !== void 0 ? _analytics : defaultAnalytics;
68
73
  const extensionKey = useMemo(() => getExtensionKey(cardState.details), [cardState.details]);
69
74
  const actions = useSmartCardActions(id, url, analytics);
75
+ const linkState = useSmartCardState(url);
76
+ const linkStatus = linkState.status;
77
+ const statusRef = useRef(linkStatus);
78
+ const analyticsRef = useRef(analytics);
70
79
  useEffect(() => {
71
80
  actions.loadMetadata();
72
81
  }, [actions]);
82
+ useEffect(() => {
83
+ /**
84
+ * Must access current analytics object value via ref because its not stable
85
+ * and it can trigger useEffect to re-run below
86
+ */
87
+ if (analyticsRef.current !== analytics) {
88
+ analyticsRef.current = analytics;
89
+ }
90
+ if (statusRef.current !== linkStatus) {
91
+ statusRef.current = linkStatus;
92
+ }
93
+ }, [analytics, linkStatus]);
94
+ useEffect(() => {
95
+ if (getBooleanFF('platform.linking-platform.smart-card.refactor-hover-card-analytics')) {
96
+ const previewDisplay = 'card';
97
+ const previewInvokeMethod = 'mouse_hover';
98
+ const cardOpenTime = Date.now();
99
+ analyticsRef.current.ui.hoverCardViewedEvent({
100
+ previewDisplay,
101
+ previewInvokeMethod,
102
+ status: statusRef.current
103
+ });
104
+ return () => {
105
+ const hoverTime = Date.now() - cardOpenTime;
106
+ analyticsRef.current.ui.hoverCardDismissedEvent({
107
+ previewDisplay,
108
+ previewInvokeMethod,
109
+ hoverTime,
110
+ status: statusRef.current
111
+ });
112
+ };
113
+ }
114
+ }, []);
73
115
  const onClick = useCallback(event => {
74
116
  const isModifierKeyPressed = isSpecialEvent(event);
75
117
  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';
@@ -18,7 +19,11 @@ const HoverCardWithErrorBoundary = props => {
18
19
  const analyticsHandler = useCallback(analyticsPayload => {
19
20
  fireSmartLinkEvent(analyticsPayload, createAnalyticsEvent);
20
21
  }, [createAnalyticsEvent]);
21
- const analytics = useSmartLinkAnalytics(url, analyticsHandler, id);
22
+
23
+ /**
24
+ * Feature flag disables prop drilling of analytics handlers
25
+ */
26
+ const analytics = useSmartLinkAnalytics(url, getBooleanFF('platform.linking-platform.smart-card.refactor-hover-card-analytics') ? undefined : analyticsHandler, id);
22
27
  const onError = useCallback((error, info) => {
23
28
  analytics.ui.renderFailedEvent({
24
29
  display: CardDisplay.HoverCardPreview,
@@ -27,17 +32,29 @@ const HoverCardWithErrorBoundary = props => {
27
32
  errorInfo: info
28
33
  });
29
34
  }, [analytics.ui, id]);
35
+
36
+ /**
37
+ * Feature flag disables the prop drilling of analytics handlers to hover card component
38
+ */
39
+ const analyticsProps = getBooleanFF('platform.linking-platform.smart-card.refactor-hover-card-analytics') ? {} : {
40
+ analyticsHandler,
41
+ analytics
42
+ };
30
43
  return jsx(ErrorBoundary, {
31
44
  fallback: children,
32
45
  onError: onError
33
- }, jsx(HoverCardComponent, _extends({}, props, {
34
- analyticsHandler: analyticsHandler,
35
- analytics: analytics
36
- }), children));
46
+ }, jsx(HoverCardComponent, _extends({}, props, analyticsProps), children));
37
47
  };
38
- export const HoverCard = withAnalyticsContext({
48
+ const HoverCardWithAnalyticsContext = withAnalyticsContext({
39
49
  source: 'smartLinkPreviewHoverCard',
40
50
  attributes: {
41
51
  display: CardDisplay.HoverCardPreview
42
52
  }
43
- })(withAnalyticsEvents()(HoverCardWithErrorBoundary));
53
+ })(withAnalyticsEvents()(HoverCardWithErrorBoundary));
54
+ const HoverCardWithoutAnalyticsContext = withAnalyticsEvents()(HoverCardWithErrorBoundary);
55
+ export const HoverCard = props => {
56
+ if (getBooleanFF('platform.linking-platform.smart-card.refactor-hover-card-analytics')) {
57
+ return jsx(HoverCardWithoutAnalyticsContext, props);
58
+ }
59
+ return jsx(HoverCardWithAnalyticsContext, props);
60
+ };
@@ -10,7 +10,7 @@ import React from 'react';
10
10
  export const Icon = styled.img`
11
11
  height: 14px;
12
12
  width: 14px;
13
- margin-right: 4px;
13
+ margin-right: ${"var(--ds-space-050, 4px)"};
14
14
  border-radius: 2px;
15
15
  user-select: none;
16
16
  position: absolute;
@@ -23,7 +23,7 @@ export const Icon = styled.img`
23
23
  // are less than that in height/width.
24
24
  // TODO: Replace this override with proper AtlasKit solution.
25
25
  export const AKIconWrapper = styled.span`
26
- margin-right: -2px;
26
+ margin-right: calc(-1 * ${"var(--ds-space-025, 2px)"});
27
27
  `;
28
28
  export const Shimmer = ({
29
29
  testId
@@ -1,5 +1,4 @@
1
1
  import styled from '@emotion/styled';
2
-
3
2
  // TODO: remove this override behaviour for @atlaskit/icon-object
4
3
  export const IconObjectOverrides = `
5
4
  & > span {
@@ -49,7 +48,7 @@ export const IconWrapper = styled.span`
49
48
  // Wraps all emoji in Inline Links similar to icon
50
49
  export const EmojiWrapper = styled.span`
51
50
  display: inline-block;
52
- margin-right: 2px;
51
+ margin-right: ${"var(--ds-space-025, 2px)"};
53
52
  user-select: none;
54
53
  ${IconOverrides}
55
54
  ${IconObjectOverrides}
@@ -71,12 +70,12 @@ export const LozengeWrapper = styled.span`
71
70
  // TODO: Replace overrides with proper AtlasKit solution.
72
71
  export const LozengeBlockWrapper = styled.span`
73
72
  & > span {
74
- margin-left: 4px;
73
+ margin-left: ${"var(--ds-space-050, 4px)"};
75
74
  }
76
75
  `;
77
76
  export const RightIconPositionWrapper = styled.span`
78
- margin-left: 2px;
79
- margin-right: 4px;
77
+ margin-left: ${"var(--ds-space-025, 2px)"};
78
+ margin-right: ${"var(--ds-space-050, 4px)"};
80
79
  position: relative;
81
80
  display: inline-block;
82
81
  `;
@@ -85,7 +84,7 @@ export const RightIconPositionWrapper = styled.span`
85
84
  // - IconPositionWrapper: the `relative` parent which has no height in itself.
86
85
  // - IconEmptyWrapper: the child which forces `IconPositionWrapper` to have a height.
87
86
  export const IconPositionWrapper = styled.span`
88
- margin-right: 4px;
87
+ margin-right: ${"var(--ds-space-050, 4px)"};
89
88
  position: relative;
90
89
  display: inline-block;
91
90
  `;
@@ -2,5 +2,5 @@ import styled from '@emotion/styled';
2
2
  import { IconTitleWrapper } from '../IconAndTitleLayout/styled';
3
3
  export const SpinnerWrapper = styled(IconTitleWrapper)`
4
4
  vertical-align: text-top;
5
- margin-left: 2px;
5
+ margin-left: ${"var(--ds-space-025, 2px)"};
6
6
  `;
@@ -11,7 +11,8 @@ export var SmartLinkAnalyticsContext = function SmartLinkAnalyticsContext(_ref)
11
11
  var children = _ref.children,
12
12
  url = _ref.url,
13
13
  appearance = _ref.appearance,
14
- id = _ref.id;
14
+ id = _ref.id,
15
+ source = _ref.source;
15
16
  var _useSmartLinkState = useSmartLinkState(url),
16
17
  details = _useSmartLinkState.details,
17
18
  status = _useSmartLinkState.status;
@@ -26,6 +27,7 @@ export var SmartLinkAnalyticsContext = function SmartLinkAnalyticsContext(_ref)
26
27
  var display = isFlexibleUi ? CardDisplay.Flexible : appearance;
27
28
  return /*#__PURE__*/React.createElement(AnalyticsContext, {
28
29
  data: {
30
+ source: source,
29
31
  attributes: _objectSpread(_objectSpread({}, resolvedAttributes), {}, {
30
32
  urlHash: urlHash,
31
33
  display: display,
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "26.3.2",
3
+ "version": "26.3.4",
4
4
  "sideEffects": false
5
5
  }
@@ -27,7 +27,7 @@ import { handleClickCommon } from './utils/handlers';
27
27
  import { useFeatureFlag } from '@atlaskit/link-provider';
28
28
  export { default as PreviewAction } from './actions/PreviewAction';
29
29
  export { ForbiddenAction, AuthorizeAction, BlockCardResolvedView, BlockCardResolvingView, BlockCardUnauthorisedView, BlockCardForbiddenView, BlockCardErroredView, BlockCardNotFoundView };
30
- var flexibleBlockCardElevationStyle = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n border-radius: 1.5px;\n box-shadow: ", ";\n margin: 2px;\n"])), tokens.elevation);
30
+ var flexibleBlockCardElevationStyle = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n border-radius: 1.5px;\n box-shadow: ", ";\n margin: ", ";\n"])), tokens.elevation, "var(--ds-space-025, 2px)");
31
31
  export var BlockCard = function BlockCard(_ref) {
32
32
  var _details$meta, _forbiddenViewProps$c;
33
33
  var id = _ref.id,
@@ -58,6 +58,8 @@ function visible(_ref6) {
58
58
  export var LinkWrapper = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n ", " &:hover {\n text-decoration: none;\n }\n"])), function (props) {
59
59
  return wrapperStyles(props);
60
60
  });
61
+
62
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage-spacing
61
63
  export var Wrapper = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n ", ";\n margin-top: 10px;\n"])), function (props) {
62
64
  return wrapperStyles(props);
63
65
  });
@@ -101,15 +103,17 @@ export var Image = styled.img(_templateObject7 || (_templateObject7 = _taggedTem
101
103
  return csssize(size);
102
104
  }, borderRadius);
103
105
  export var maxAvatarCount = 6;
104
- export var ContentWrapper = styled.div(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: row;\n box-sizing: border-box;\n padding: 8px 12px 12px 12px;\n"])));
106
+ export var ContentWrapper = styled.div(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: row;\n box-sizing: border-box;\n padding: ", " ", "\n ", " ", ";\n"])), "var(--ds-space-100, 8px)", "var(--ds-space-150, 12px)", "var(--ds-space-150, 12px)", "var(--ds-space-150, 12px)");
105
107
  export var Title = styled.div(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n color: ", ";\n font-size: 16px;\n font-weight: 500;\n line-height: ", ";\n max-height: ", "px;\n overflow: hidden;\n"])), "var(--ds-text, ".concat(colors.N900, ")"), 20 / 16, 20 * 4);
106
- export var Byline = styled.div(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n margin-top: 4px;\n color: ", ";\n font-size: 12px;\n font-weight: normal;\n line-height: ", ";\n ", ";\n"])), "var(--ds-text-subtlest, ".concat(colors.N300, ")"), 16 / 12, ellipsis('100%'));
108
+ export var Byline = styled.div(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n margin-top: ", ";\n color: ", ";\n font-size: 12px;\n font-weight: normal;\n line-height: ", ";\n ", ";\n"])), "var(--ds-space-050, 4px)", "var(--ds-text-subtlest, ".concat(colors.N300, ")"), 16 / 12, ellipsis('100%'));
109
+
110
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage-spacing
107
111
  export var Description = styled.div(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n margin-top: 7px;\n color: ", ";\n font-size: 12px;\n font-weight: normal;\n line-height: ", ";\n max-height: ", "px;\n overflow: hidden;\n"])), "var(--ds-text, ".concat(colors.N800, ")"), 18 / 12, 18 * 3);
108
- export var ResolvedViewIconWrapper = styled.div(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n margin-top: 4px;\n"])));
109
- export var Thumbnail = styled.div(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n ", "\n ", "\n float: right;\n margin: 4px 0 12px 12px;\n background-color: ", ";\n background-image: url(", ");\n background-size: cover;\n"])), borderRadius, csssize(48), "var(--ds-skeleton, ".concat(colors.N30, ")"), function (_ref13) {
112
+ export var ResolvedViewIconWrapper = styled.div(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n margin-top: ", ";\n"])), "var(--ds-space-050, 4px)");
113
+ export var Thumbnail = styled.div(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n ", "\n ", "\n float: right;\n margin: ", " 0 ", "\n ", ";\n background-color: ", ";\n background-image: url(", ");\n background-size: cover;\n"])), borderRadius, csssize(48), "var(--ds-space-050, 4px)", "var(--ds-space-150, 12px)", "var(--ds-space-150, 12px)", "var(--ds-skeleton, ".concat(colors.N30, ")"), function (_ref13) {
110
114
  var src = _ref13.src;
111
115
  return src;
112
116
  });
113
- export var UsersWrapper = styled.div(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["\n margin-top: 8px;\n"])));
114
- export var ActionsWrapper = styled.div(_templateObject15 || (_templateObject15 = _taggedTemplateLiteral(["\n margin-top: 8px;\n text-align: right;\n\n > * {\n margin-top: 4px;\n }\n\n > * + * {\n margin-left: 4px;\n }\n"])));
117
+ export var UsersWrapper = styled.div(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["\n margin-top: ", ";\n"])), "var(--ds-space-100, 8px)");
118
+ export var ActionsWrapper = styled.div(_templateObject15 || (_templateObject15 = _taggedTemplateLiteral(["\n margin-top: ", ";\n text-align: right;\n\n > * {\n margin-top: ", ";\n }\n\n > * + * {\n margin-left: ", ";\n }\n"])), "var(--ds-space-100, 8px)", "var(--ds-space-050, 4px)", "var(--ds-space-050, 4px)");
115
119
  export var AlertWrapper = styled.div(_templateObject16 || (_templateObject16 = _taggedTemplateLiteral(["\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n overflow: hidden;\n pointer-events: none;\n /* z-index has to be 1 higher than the number of avatars in the avatar stack */\n z-index: ", ";\n"])), maxAvatarCount + 1);
@@ -1,9 +1,10 @@
1
1
  import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
2
  var _templateObject, _templateObject2, _templateObject3, _templateObject4;
3
3
  import { css } from '@emotion/react';
4
- export var containerStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n align-items: center;\n display: flex;\n gap: 8px;\n justify-content: space-between;\n // AK ModalBody has 2px padding top and bottom.\n // Using 14px here to create 16px gap between\n // link info and iframe\n padding: 24px 24px 14px 24px;\n"])));
4
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage-spacing
5
+ export var containerStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n align-items: center;\n display: flex;\n gap: ", ";\n justify-content: space-between;\n // AK ModalBody has 2px padding top and bottom.\n // Using 14px here to create 16px gap between\n // link info and iframe\n padding: ", " ", " 14px\n ", ";\n"])), "var(--ds-space-100, 8px)", "var(--ds-space-300, 24px)", "var(--ds-space-300, 24px)", "var(--ds-space-300, 24px)");
5
6
  var iconSize = '24px';
6
7
  export var iconCss = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n img,\n span,\n svg {\n height: ", ";\n min-height: ", ";\n max-height: ", ";\n width: ", ";\n min-width: ", ";\n max-width: ", ";\n }\n"])), iconSize, iconSize, iconSize, iconSize, iconSize, iconSize);
7
8
  var height = '20px';
8
9
  export var titleCss = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n flex: 1 1 auto;\n\n h3 {\n flex: 1 1 auto;\n font-size: 16px;\n font-weight: 400;\n line-height: ", ";\n\n display: -webkit-box;\n margin-bottom: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n word-break: break-word;\n -webkit-line-clamp: 1;\n -webkit-box-orient: vertical;\n // Fallback options\n @supports not (-webkit-line-clamp: 1) {\n max-height: ", ";\n }\n }\n"])), height, height);
9
- export var actionCss = css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n display: flex;\n flex: 0 0 auto;\n gap: 4px;\n line-height: ", ";\n span {\n line-height: ", ";\n }\n\n @media only screen and (max-width: 980px) {\n // Hide resize button if the screen is smaller than the min width\n // or too small to have enough impact to matter.\n .smart-link-resize-button {\n display: none;\n }\n }\n"])), height, height);
10
+ export var actionCss = css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n display: flex;\n flex: 0 0 auto;\n gap: ", ";\n line-height: ", ";\n span {\n line-height: ", ";\n }\n\n @media only screen and (max-width: 980px) {\n // Hide resize button if the screen is smaller than the min width\n // or too small to have enough impact to matter.\n .smart-link-resize-button {\n display: none;\n }\n }\n"])), "var(--ds-space-050, 4px)", height, height);
@@ -6,6 +6,8 @@ import { getTruncateStyles } from '../../../utils';
6
6
  export var dropdownItemGroupStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n button {\n width: 220px;\n\n &:hover {\n background-color: inherit;\n cursor: default;\n }\n }\n"])));
7
7
  var sharedBlockStyles = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n gap: 0.5rem;\n line-height: 1rem;\n min-width: 0;\n overflow: hidden;\n flex-direction: row;\n align-items: center;\n"])));
8
8
  export var contentStyles = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n ", ";\n\n margin-top: ", ";\n align-items: flex-start;\n\n > span,\n > div {\n font-size: 0.875rem;\n line-height: 1.25rem;\n color: ", ";\n }\n"])), sharedBlockStyles, "var(--ds-space-025, 2px)", "var(--ds-text, ".concat(N800, ")"));
9
+
10
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage-spacing
9
11
  export var linkStyles = css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n ", ";\n\n cursor: pointer;\n font-size: 0.875rem;\n margin-top: 10px;\n margin-left: ", ";\n margin-bottom: ", ";\n"])), sharedBlockStyles, "var(--ds-space-400, 32px)", "var(--ds-space-025, 2px)");
10
12
  export var textStyles = function textStyles(maxLines) {
11
13
  return css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n line-height: 1rem;\n white-space: normal;\n ", ";\n"])), getTruncateStyles(maxLines));
@@ -1,6 +1,8 @@
1
1
  import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
2
  var _templateObject, _templateObject2, _templateObject3;
3
3
  import { css } from '@emotion/react';
4
- export var triggerButtonStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n all: unset;\n background-color: transparent;\n color: unset;\n cursor: pointer;\n font-family: unset;\n font-size: unset;\n font-style: unset;\n font-weight: unset;\n font-variant: unset;\n line-height: 0;\n padding: 0;\n text-transform: unset;\n\n border: 2px solid transparent;\n margin: 2px;\n\n &:focus-visible,\n &:focus-within,\n &[aria-expanded='true'] {\n outline: none;\n box-shadow: 0 0 0 2px ", ";\n border-radius: 5px;\n }\n"])), "var(--ds-border-focused, #388BFF)");
5
- export var triggerLozengeStyles = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n align-items: center;\n display: flex;\n\n span[role='img'] {\n margin: -4px -8px -4px -1px;\n }\n"])));
6
- export var dropdownItemGroupStyles = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n max-height: 300px;\n overflow-y: auto;\n\n button {\n padding: 6px 12px;\n min-height: 28px;\n width: 220px;\n\n &:hover {\n background-color: inherit;\n }\n\n &:focus,\n &:focus-visible {\n background-color: ", ";\n box-sizing: border-box;\n box-shadow: inset 2px 0 0 ", ";\n outline: none;\n }\n }\n"])), "var(--ds-background-neutral-subtle-hovered, #091E420F)", "var(--ds-border-selected, #0C66E4)");
4
+ export var triggerButtonStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n all: unset;\n background-color: transparent;\n color: unset;\n cursor: pointer;\n font-family: unset;\n font-size: unset;\n font-style: unset;\n font-weight: unset;\n font-variant: unset;\n line-height: 0;\n padding: 0;\n text-transform: unset;\n\n border: 2px solid transparent;\n margin: ", ";\n\n &:focus-visible,\n &:focus-within,\n &[aria-expanded='true'] {\n outline: none;\n box-shadow: 0 0 0 2px ", ";\n border-radius: 5px;\n }\n"])), "var(--ds-space-025, 2px)", "var(--ds-border-focused, #388BFF)");
5
+
6
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage-spacing
7
+ export var triggerLozengeStyles = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n align-items: center;\n display: flex;\n\n span[role='img'] {\n margin: calc(-1 * ", ")\n calc(-1 * ", ")\n calc(-1 * ", ") -1px;\n }\n"])), "var(--ds-space-050, 4px)", "var(--ds-space-100, 8px)", "var(--ds-space-050, 4px)");
8
+ export var dropdownItemGroupStyles = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n max-height: 300px;\n overflow-y: auto;\n\n button {\n padding: ", " ", ";\n min-height: 28px;\n width: 220px;\n\n &:hover {\n background-color: inherit;\n }\n\n &:focus,\n &:focus-visible {\n background-color: ", ";\n box-sizing: border-box;\n box-shadow: inset 2px 0 0 ", ";\n outline: none;\n }\n }\n"])), "var(--ds-space-075, 6px)", "var(--ds-space-150, 12px)", "var(--ds-background-neutral-subtle-hovered, #091E420F)", "var(--ds-border-selected, #0C66E4)");
@@ -11,7 +11,7 @@ import { FlexibleUiContext } from '../../../../state/flexible-ui-context';
11
11
  import LayeredLink from './layered-link';
12
12
  import { HoverCard } from '../../../HoverCard';
13
13
  import { isFlexUiPreviewPresent } from '../../../../state/flexible-ui-context/utils';
14
- var elevationStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n border: 1px solid transparent;\n border-radius: 1.5px;\n box-shadow: ", ";\n margin: 2px;\n"])), tokens.elevation);
14
+ var elevationStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n border: 1px solid transparent;\n border-radius: 1.5px;\n box-shadow: ", ";\n margin: ", ";\n"])), tokens.elevation, "var(--ds-space-025, 2px)");
15
15
  var getGap = function getGap(size) {
16
16
  switch (size) {
17
17
  case SmartLinkSize.XLarge: