@atlaskit/smart-card 27.8.4 → 27.9.1

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 (67) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/cjs/utils/analytics/analytics.js +1 -1
  3. package/dist/cjs/view/CardWithUrl/component.js +3 -0
  4. package/dist/cjs/view/CardWithUrl/loader.js +2 -0
  5. package/dist/cjs/view/EmbedCard/components/ExpandedFrame.js +6 -5
  6. package/dist/cjs/view/EmbedCard/views/ResolvedView.js +2 -1
  7. package/dist/cjs/view/EmbedCard/views/unresolved-view/index.js +5 -2
  8. package/dist/cjs/view/FlexibleCard/components/container/hover-card-control/index.js +4 -2
  9. package/dist/cjs/view/FlexibleCard/components/container/index.js +3 -1
  10. package/dist/cjs/view/FlexibleCard/index.js +2 -0
  11. package/dist/cjs/view/HoverCard/components/HoverCardComponent.js +6 -3
  12. package/dist/cjs/view/InlineCard/ResolvedView/index.js +3 -1
  13. package/dist/cjs/view/InlineCard/index.js +2 -0
  14. package/dist/cjs/view/LinkUrl/index.js +1 -1
  15. package/dist/es2019/utils/analytics/analytics.js +1 -1
  16. package/dist/es2019/view/CardWithUrl/component.js +3 -0
  17. package/dist/es2019/view/CardWithUrl/loader.js +2 -0
  18. package/dist/es2019/view/EmbedCard/components/ExpandedFrame.js +6 -6
  19. package/dist/es2019/view/EmbedCard/views/ResolvedView.js +2 -1
  20. package/dist/es2019/view/EmbedCard/views/unresolved-view/index.js +5 -2
  21. package/dist/es2019/view/FlexibleCard/components/container/hover-card-control/index.js +4 -2
  22. package/dist/es2019/view/FlexibleCard/components/container/index.js +3 -1
  23. package/dist/es2019/view/FlexibleCard/index.js +2 -0
  24. package/dist/es2019/view/HoverCard/components/HoverCardComponent.js +6 -3
  25. package/dist/es2019/view/InlineCard/ResolvedView/index.js +3 -1
  26. package/dist/es2019/view/InlineCard/index.js +2 -0
  27. package/dist/es2019/view/LinkUrl/index.js +1 -1
  28. package/dist/esm/utils/analytics/analytics.js +1 -1
  29. package/dist/esm/view/CardWithUrl/component.js +3 -0
  30. package/dist/esm/view/CardWithUrl/loader.js +2 -0
  31. package/dist/esm/view/EmbedCard/components/ExpandedFrame.js +7 -6
  32. package/dist/esm/view/EmbedCard/views/ResolvedView.js +2 -1
  33. package/dist/esm/view/EmbedCard/views/unresolved-view/index.js +5 -2
  34. package/dist/esm/view/FlexibleCard/components/container/hover-card-control/index.js +4 -2
  35. package/dist/esm/view/FlexibleCard/components/container/index.js +3 -1
  36. package/dist/esm/view/FlexibleCard/index.js +2 -0
  37. package/dist/esm/view/HoverCard/components/HoverCardComponent.js +6 -3
  38. package/dist/esm/view/InlineCard/ResolvedView/index.js +3 -1
  39. package/dist/esm/view/InlineCard/index.js +2 -0
  40. package/dist/esm/view/LinkUrl/index.js +1 -1
  41. package/dist/types/view/Card/index.d.ts +1 -1
  42. package/dist/types/view/Card/types.d.ts +2 -0
  43. package/dist/types/view/CardWithUrl/types.d.ts +2 -0
  44. package/dist/types/view/EmbedCard/components/ExpandedFrame.d.ts +17 -1
  45. package/dist/types/view/EmbedCard/components/styled.d.ts +7 -0
  46. package/dist/types/view/FlexibleCard/components/container/hover-card-control/index.d.ts +1 -1
  47. package/dist/types/view/FlexibleCard/components/container/hover-card-control/types.d.ts +1 -1
  48. package/dist/types/view/FlexibleCard/components/container/index.d.ts +1 -1
  49. package/dist/types/view/FlexibleCard/components/container/types.d.ts +1 -1
  50. package/dist/types/view/FlexibleCard/types.d.ts +5 -0
  51. package/dist/types/view/HoverCard/types.d.ts +7 -0
  52. package/dist/types/view/InlineCard/ResolvedView/index.d.ts +2 -0
  53. package/dist/types/view/InlineCard/types.d.ts +2 -0
  54. package/dist/types-ts4.5/view/Card/index.d.ts +1 -1
  55. package/dist/types-ts4.5/view/Card/types.d.ts +2 -0
  56. package/dist/types-ts4.5/view/CardWithUrl/types.d.ts +2 -0
  57. package/dist/types-ts4.5/view/EmbedCard/components/ExpandedFrame.d.ts +17 -1
  58. package/dist/types-ts4.5/view/EmbedCard/components/styled.d.ts +7 -0
  59. package/dist/types-ts4.5/view/FlexibleCard/components/container/hover-card-control/index.d.ts +1 -1
  60. package/dist/types-ts4.5/view/FlexibleCard/components/container/hover-card-control/types.d.ts +1 -1
  61. package/dist/types-ts4.5/view/FlexibleCard/components/container/index.d.ts +1 -1
  62. package/dist/types-ts4.5/view/FlexibleCard/components/container/types.d.ts +1 -1
  63. package/dist/types-ts4.5/view/FlexibleCard/types.d.ts +5 -0
  64. package/dist/types-ts4.5/view/HoverCard/types.d.ts +7 -0
  65. package/dist/types-ts4.5/view/InlineCard/ResolvedView/index.d.ts +2 -0
  66. package/dist/types-ts4.5/view/InlineCard/types.d.ts +2 -0
  67. package/package.json +11 -10
@@ -79,8 +79,11 @@ var UnresolvedView = function UnresolvedView(_ref) {
79
79
  "data-testid": imageTestId
80
80
  }, imageUrlOrElement);
81
81
  }, [imageUrlOrElement, testId]);
82
- return jsx(ExpandedFrame, {
83
- allowScrollBar: true
82
+ return jsx(ExpandedFrame
83
+ // Scroll bar must be shown for unresolved views to display the connect account button
84
+ , {
85
+ allowScrollBar: true,
86
+ setOverflow: true
84
87
  // EDM-9259: Fix embed frame showing on unresolved views when frameStyle is set to hide.
85
88
  // Set fallback to 'show' here to maintain the current behaviour when platform.editor.show-embed-card-frame-renderer is OFF.
86
89
  // Remove 'show' on platform.editor.show-embed-card-frame-renderer cleanup as frameStyle will be set to 'show' both in renderer and editor.
@@ -12,7 +12,8 @@ var HoverCardControl = function HoverCardControl(_ref) {
12
12
  testId = _ref.testId,
13
13
  url = _ref.url,
14
14
  _ref$delay = _ref.delay,
15
- delay = _ref$delay === void 0 ? FLEXIBLE_HOVER_CARD_CAN_OPEN_DELAY : _ref$delay;
15
+ delay = _ref$delay === void 0 ? FLEXIBLE_HOVER_CARD_CAN_OPEN_DELAY : _ref$delay,
16
+ hoverPreviewOptions = _ref.hoverPreviewOptions;
16
17
  var _useState = useState(true),
17
18
  _useState2 = _slicedToArray(_useState, 2),
18
19
  canOpen = _useState2[0],
@@ -59,7 +60,8 @@ var HoverCardControl = function HoverCardControl(_ref) {
59
60
  closeOnChildClick: true,
60
61
  hidePreviewButton: hideHoverCardPreviewButton,
61
62
  actionOptions: actionOptions,
62
- url: url
63
+ url: url,
64
+ hoverPreviewOptions: hoverPreviewOptions
63
65
  }, /*#__PURE__*/React.createElement("span", {
64
66
  onMouseLeave: onMouseLeave,
65
67
  onMouseMove: onMouseMove,
@@ -177,6 +177,7 @@ var Container = function Container(_ref3) {
177
177
  showAuthTooltip = _ref3$showAuthTooltip === void 0 ? false : _ref3$showAuthTooltip,
178
178
  _ref3$showHoverPrevie = _ref3.showHoverPreview,
179
179
  showHoverPreview = _ref3$showHoverPrevie === void 0 ? false : _ref3$showHoverPrevie,
180
+ hoverPreviewOptions = _ref3.hoverPreviewOptions,
180
181
  actionOptions = _ref3.actionOptions,
181
182
  _ref3$size = _ref3.size,
182
183
  size = _ref3$size === void 0 ? SmartLinkSize.Medium : _ref3$size,
@@ -204,7 +205,8 @@ var Container = function Container(_ref3) {
204
205
  isAuthTooltip: canShowAuthTooltip,
205
206
  actionOptions: actionOptions,
206
207
  testId: testId,
207
- url: context.url
208
+ url: context.url,
209
+ hoverPreviewOptions: hoverPreviewOptions
208
210
  }, container);
209
211
  }
210
212
  return container;
@@ -30,6 +30,7 @@ var FlexibleCard = function FlexibleCard(_ref) {
30
30
  renderers = _ref.renderers,
31
31
  showAuthTooltip = _ref.showAuthTooltip,
32
32
  showHoverPreview = _ref.showHoverPreview,
33
+ hoverPreviewOptions = _ref.hoverPreviewOptions,
33
34
  actionOptions = _ref.actionOptions,
34
35
  testId = _ref.testId,
35
36
  ui = _ref.ui,
@@ -95,6 +96,7 @@ var FlexibleCard = function FlexibleCard(_ref) {
95
96
  onClick: onClick,
96
97
  retry: retry,
97
98
  showHoverPreview: showHoverPreview,
99
+ hoverPreviewOptions: hoverPreviewOptions,
98
100
  actionOptions: actionOptions,
99
101
  showAuthTooltip: showAuthTooltip,
100
102
  status: status
@@ -21,6 +21,7 @@ var FADE_IN_DELAY = 500;
21
21
  var FADE_OUT_DELAY = 300;
22
22
  var RESOLVE_DELAY = 100;
23
23
  export var HoverCardComponent = function HoverCardComponent(_ref) {
24
+ var _hoverPreviewOptions$;
24
25
  var children = _ref.children,
25
26
  url = _ref.url,
26
27
  _ref$id = _ref.id,
@@ -39,7 +40,9 @@ export var HoverCardComponent = function HoverCardComponent(_ref) {
39
40
  _ref$zIndex = _ref.zIndex,
40
41
  zIndex = _ref$zIndex === void 0 ? HOVER_CARD_Z_INDEX : _ref$zIndex,
41
42
  _ref$noFadeDelay = _ref.noFadeDelay,
42
- noFadeDelay = _ref$noFadeDelay === void 0 ? false : _ref$noFadeDelay;
43
+ noFadeDelay = _ref$noFadeDelay === void 0 ? false : _ref$noFadeDelay,
44
+ hoverPreviewOptions = _ref.hoverPreviewOptions;
45
+ var fadeInDelay = (_hoverPreviewOptions$ = hoverPreviewOptions === null || hoverPreviewOptions === void 0 ? void 0 : hoverPreviewOptions.fadeInDelay) !== null && _hoverPreviewOptions$ !== void 0 ? _hoverPreviewOptions$ : FADE_IN_DELAY;
43
46
  var _React$useState = React.useState(false),
44
47
  _React$useState2 = _slicedToArray(_React$useState, 2),
45
48
  isOpen = _React$useState2[0],
@@ -149,10 +152,10 @@ export var HoverCardComponent = function HoverCardComponent(_ref) {
149
152
  } else {
150
153
  fadeInTimeoutId.current = setTimeout(function () {
151
154
  setIsOpen(true);
152
- }, FADE_IN_DELAY);
155
+ }, fadeInDelay);
153
156
  }
154
157
  }
155
- }, [initResolve, isOpen, setMousePosition, noFadeDelay]);
158
+ }, [initResolve, isOpen, setMousePosition, noFadeDelay, fadeInDelay]);
156
159
  var linkActions = useSmartLinkActions({
157
160
  url: url,
158
161
  appearance: CardDisplay.HoverCardPreview,
@@ -53,6 +53,7 @@ export var InlineCardResolvedView = /*#__PURE__*/function (_React$Component) {
53
53
  titlePrefix = _this$props.titlePrefix,
54
54
  _this$props$showHover = _this$props.showHoverPreview,
55
55
  showHoverPreview = _this$props$showHover === void 0 ? false : _this$props$showHover,
56
+ hoverPreviewOptions = _this$props.hoverPreviewOptions,
56
57
  actionOptions = _this$props.actionOptions;
57
58
  var inlineCardResolvedView = /*#__PURE__*/React.createElement(Frame, {
58
59
  testId: testId,
@@ -70,7 +71,8 @@ export var InlineCardResolvedView = /*#__PURE__*/function (_React$Component) {
70
71
  return /*#__PURE__*/React.createElement(HoverCard, {
71
72
  id: id,
72
73
  url: link,
73
- actionOptions: actionOptions
74
+ actionOptions: actionOptions,
75
+ hoverPreviewOptions: hoverPreviewOptions
74
76
  }, inlineCardResolvedView);
75
77
  }
76
78
  return inlineCardResolvedView;
@@ -31,6 +31,7 @@ export var InlineCard = function InlineCard(_ref) {
31
31
  testId = _ref.testId,
32
32
  inlinePreloaderStyle = _ref.inlinePreloaderStyle,
33
33
  showHoverPreview = _ref.showHoverPreview,
34
+ hoverPreviewOptions = _ref.hoverPreviewOptions,
34
35
  showAuthTooltip = _ref.showAuthTooltip,
35
36
  actionOptions = _ref.actionOptions;
36
37
  var _useAnalyticsEvents = useAnalyticsEvents(),
@@ -81,6 +82,7 @@ export var InlineCard = function InlineCard(_ref) {
81
82
  return /*#__PURE__*/React.createElement(InlineCardResolvedView, _extends({}, resolvedProps, {
82
83
  id: id,
83
84
  showHoverPreview: showHoverPreview,
85
+ hoverPreviewOptions: hoverPreviewOptions,
84
86
  actionOptions: actionOptions,
85
87
  link: url,
86
88
  isSelected: isSelected,
@@ -10,7 +10,7 @@ import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-m
10
10
  import LinkWarningModal from './LinkWarningModal';
11
11
  var PACKAGE_DATA = {
12
12
  packageName: "@atlaskit/smart-card",
13
- packageVersion: "27.8.4",
13
+ packageVersion: "27.9.1",
14
14
  componentName: 'linkUrl'
15
15
  };
16
16
  var Link = withLinkClickedEvent('a');
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
2
  import { type CardAppearance, type CardPlatform, type CardProps } from './types';
3
3
  import { type WrappedComponentProps } from 'react-intl-next';
4
- export declare const Card: React.ForwardRefExoticComponent<Pick<Omit<import("react-intl-next").WithIntlProps<CardProps & WrappedComponentProps>, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "url" | "appearance" | "container" | "children" | "data" | "key" | "id" | "placeholder" | "onError" | "onClick" | "testId" | "analyticsContext" | "isSelected" | "inheritDimensions" | "actionOptions" | "onResolve" | "ui" | "showHoverPreview" | "showAuthTooltip" | "platform" | "isHovered" | "isFrameVisible" | "frameStyle" | "importer" | "showActions" | "showServerActions" | "fallbackComponent" | "embedIframeRef" | "embedIframeUrlType" | "inlinePreloaderStyle" | "analyticsEvents" | "useLegacyBlockCard" | "forwardedRef"> & React.RefAttributes<any>>;
4
+ export declare const Card: React.ForwardRefExoticComponent<Pick<Omit<import("react-intl-next").WithIntlProps<CardProps & WrappedComponentProps>, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "url" | "appearance" | "container" | "children" | "data" | "key" | "id" | "placeholder" | "onError" | "onClick" | "testId" | "analyticsContext" | "isSelected" | "inheritDimensions" | "actionOptions" | "onResolve" | "ui" | "showHoverPreview" | "hoverPreviewOptions" | "showAuthTooltip" | "platform" | "isHovered" | "isFrameVisible" | "frameStyle" | "importer" | "showActions" | "showServerActions" | "fallbackComponent" | "embedIframeRef" | "embedIframeUrlType" | "inlinePreloaderStyle" | "analyticsEvents" | "useLegacyBlockCard" | "forwardedRef"> & React.RefAttributes<any>>;
5
5
  export type { CardAppearance, CardProps, CardPlatform };
@@ -6,6 +6,7 @@ import { type AnalyticsFacade } from '../../state/analytics';
6
6
  import { type FlexibleUiOptions } from '../FlexibleCard/types';
7
7
  import { type InlinePreloaderStyle, type OnErrorCallback } from '../types';
8
8
  import { type FrameStyle } from '../EmbedCard/types';
9
+ import { type HoverPreviewOptions } from '../HoverCard/types';
9
10
  export type { CardAppearance, CardPlatform };
10
11
  export type CardInnerAppearance = CardAppearance | 'embedPreview' | 'flexible' | 'hoverCardPreview';
11
12
  export type EmbedIframeUrlType = 'href' | 'interactiveHref';
@@ -96,6 +97,7 @@ export interface CardProps extends WithAnalyticsEventsProps {
96
97
  ui?: FlexibleUiOptions;
97
98
  children?: React.ReactNode;
98
99
  showHoverPreview?: boolean;
100
+ hoverPreviewOptions?: HoverPreviewOptions;
99
101
  showAuthTooltip?: boolean;
100
102
  /**
101
103
  * @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-2681 Internal documentation for deprecation (no external access)}
@@ -5,6 +5,7 @@ import { type FlexibleUiOptions } from '../FlexibleCard/types';
5
5
  import { type InlinePreloaderStyle, type OnErrorCallback } from '../types';
6
6
  import { type AnalyticsFacade } from '../../state/analytics';
7
7
  import { type FrameStyle } from '../EmbedCard/types';
8
+ import { type HoverPreviewOptions } from '../HoverCard/types';
8
9
  export type CardWithUrlContentProps = {
9
10
  id: string;
10
11
  url: string;
@@ -44,6 +45,7 @@ export type CardWithUrlContentProps = {
44
45
  ui?: FlexibleUiOptions;
45
46
  children?: React.ReactNode;
46
47
  showHoverPreview?: boolean;
48
+ hoverPreviewOptions?: HoverPreviewOptions;
47
49
  showAuthTooltip?: boolean;
48
50
  analyticsEvents?: AnalyticsFacade;
49
51
  placeholder?: string;
@@ -18,7 +18,23 @@ export interface ExpandedFrameProps {
18
18
  testId?: string;
19
19
  /** If dimensions of the card are to be inherited from the parent */
20
20
  inheritDimensions?: boolean;
21
- /** To enable scrolling in use cases where the content will not have it's own scrollbar */
21
+ /**
22
+ * To enable scrolling in use cases where the content will not have it's own scrollbar.
23
+ *
24
+ * Requires `setOverflow` to be set to true.
25
+ *
26
+ * Always enable this when when the card is not resolved so the connect account button is not hiddden.
27
+ */
22
28
  allowScrollBar?: boolean;
29
+ /**
30
+ * Should the CSS `overflow` property be set to hidden or auto (clipping or
31
+ * supporting a scroll bar), or left out altogether.
32
+ *
33
+ * Set to true when embed is unresolved to prevent account connection button being unreachable.
34
+ *
35
+ * Set to false when the card is resolved to mitigate blurry embed card issue (EDM-7188).
36
+ * @default true
37
+ */
38
+ setOverflow?: boolean;
23
39
  }
24
40
  export declare const ExpandedFrame: FC<ExpandedFrameProps>;
@@ -45,7 +45,14 @@ export declare const TooltipWrapper: import("@emotion/styled").StyledComponent<{
45
45
  }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
46
46
  export interface ContentProps {
47
47
  isInteractive: boolean;
48
+ /**
49
+ * Whether to show a scroll bar (use overflow: auto) or hide overflow (overflow:hidden).
50
+ * Always set to true for unresolved embeds, otherwise the connect account button may be hidden and unreachable.
51
+ */
48
52
  allowScrollBar: boolean;
53
+ /**
54
+ * Remove the overflow: ... CSS property altogether.
55
+ */
49
56
  removeOverflow?: boolean;
50
57
  frameStyle?: FrameStyle;
51
58
  }
@@ -1,4 +1,4 @@
1
1
  /// <reference types="react" />
2
2
  import { type HoverCardDelayProps } from './types';
3
- declare const HoverCardControl: ({ children, hideHoverCardPreviewButton, isHoverPreview, isAuthTooltip, actionOptions, testId, url, delay, }: HoverCardDelayProps) => JSX.Element;
3
+ declare const HoverCardControl: ({ children, hideHoverCardPreviewButton, isHoverPreview, isAuthTooltip, actionOptions, testId, url, delay, hoverPreviewOptions, }: HoverCardDelayProps) => JSX.Element;
4
4
  export default HoverCardControl;
@@ -1,6 +1,6 @@
1
1
  import { type PropsWithChildren } from 'react';
2
2
  import { type ContainerProps } from '../types';
3
- export type HoverCardDelayProps = PropsWithChildren<Pick<ContainerProps, 'hideHoverCardPreviewButton' | 'actionOptions'> & {
3
+ export type HoverCardDelayProps = PropsWithChildren<Pick<ContainerProps, 'hideHoverCardPreviewButton' | 'actionOptions' | 'hoverPreviewOptions'> & {
4
4
  isHoverPreview?: boolean;
5
5
  isAuthTooltip?: boolean;
6
6
  testId?: string;
@@ -10,5 +10,5 @@ export declare const getContainerStyles: (size: SmartLinkSize, hideBackground: b
10
10
  * @internal
11
11
  * @see Block
12
12
  */
13
- declare const Container: ({ children, clickableContainer, hideBackground, hideElevation, hideHoverCardPreviewButton, hidePadding, onClick, retry, showAuthTooltip, showHoverPreview, actionOptions, size, status, testId, theme, }: ContainerProps) => jsx.JSX.Element;
13
+ declare const Container: ({ children, clickableContainer, hideBackground, hideElevation, hideHoverCardPreviewButton, hidePadding, onClick, retry, showAuthTooltip, showHoverPreview, hoverPreviewOptions, actionOptions, size, status, testId, theme, }: ContainerProps) => jsx.JSX.Element;
14
14
  export default Container;
@@ -1,7 +1,7 @@
1
1
  import { type PropsWithChildren } from 'react';
2
2
  import { type SmartLinkStatus } from '../../../../constants';
3
3
  import { type FlexibleCardProps, type FlexibleUiOptions, type RetryOptions } from '../../types';
4
- export type ContainerProps = PropsWithChildren<Pick<FlexibleCardProps, 'onClick' | 'showHoverPreview' | 'actionOptions' | 'showAuthTooltip'> & FlexibleUiOptions & {
4
+ export type ContainerProps = PropsWithChildren<Pick<FlexibleCardProps, 'onClick' | 'showHoverPreview' | 'hoverPreviewOptions' | 'actionOptions' | 'showAuthTooltip'> & FlexibleUiOptions & {
5
5
  /**
6
6
  * The options that determine the retry behaviour when a Smart Link errors.
7
7
  */
@@ -8,6 +8,7 @@ import type { CardInnerAppearance, OnResolveCallback, CardActionOptions } from '
8
8
  import { type OnErrorCallback } from '../types';
9
9
  import { type AnalyticsFacade } from '../../state/analytics';
10
10
  import { type AISummaryConfig } from '../../state/hooks/use-ai-summary-config/types';
11
+ import { type HoverPreviewOptions } from '../HoverCard/types';
11
12
  export type FlexibleCardProps = {
12
13
  /**
13
14
  * @internal A unique ID for a Smart Link.
@@ -81,6 +82,10 @@ export type FlexibleCardProps = {
81
82
  * over the smartlink. Default value is false.
82
83
  */
83
84
  showHoverPreview?: boolean;
85
+ /**
86
+ * Configuration options for hover preview
87
+ */
88
+ hoverPreviewOptions?: HoverPreviewOptions;
84
89
  /**
85
90
  * Determines whether to show an unauthorised view of the hover card
86
91
  * when a user hovers over a smartlink.
@@ -55,6 +55,7 @@ export interface HoverCardProps extends WithAnalyticsEventsProps {
55
55
  * This is passed to the portal component.
56
56
  */
57
57
  zIndex?: number;
58
+ hoverPreviewOptions?: HoverPreviewOptions;
58
59
  }
59
60
  /**
60
61
  * An internal props that internal smart-card components can use to configure
@@ -103,3 +104,9 @@ export type ImagePreviewProps = {
103
104
  data: JsonLd.Data.BaseData;
104
105
  fallbackElementHeight: number;
105
106
  };
107
+ export interface HoverPreviewOptions {
108
+ /**
109
+ * Delay (in milliseconds) between hovering over the trigger element and the hover card opening. Defaults to 500ms.
110
+ */
111
+ fadeInDelay?: number;
112
+ }
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import { type LozengeProps } from '../../../types';
3
3
  import type { CardActionOptions } from '../../Card/types';
4
+ import { type HoverPreviewOptions } from '../../HoverCard/types';
4
5
  export interface InlineCardResolvedViewProps {
5
6
  /** A unique ID for a Smart Link. */
6
7
  id?: string;
@@ -26,6 +27,7 @@ export interface InlineCardResolvedViewProps {
26
27
  titlePrefix?: React.ReactNode;
27
28
  /** Enables showing a custom preview on hover of link */
28
29
  showHoverPreview?: boolean;
30
+ hoverPreviewOptions?: HoverPreviewOptions;
29
31
  /** Configure visibility of server and client actions */
30
32
  actionOptions?: CardActionOptions;
31
33
  }
@@ -4,6 +4,7 @@ import { type CardState } from '../../state/types';
4
4
  import { type InlinePreloaderStyle, type OnErrorCallback } from '../types';
5
5
  import { type AnalyticsFacade } from '../../state/analytics';
6
6
  import type { CardActionOptions } from '../Card/types';
7
+ import { type HoverPreviewOptions } from '../HoverCard/types';
7
8
  export type InlineCardProps = {
8
9
  id: string;
9
10
  url: string;
@@ -21,6 +22,7 @@ export type InlineCardProps = {
21
22
  inlinePreloaderStyle?: InlinePreloaderStyle;
22
23
  renderers?: CardProviderRenderers;
23
24
  showHoverPreview?: boolean;
25
+ hoverPreviewOptions?: HoverPreviewOptions;
24
26
  showAuthTooltip?: boolean;
25
27
  actionOptions?: CardActionOptions;
26
28
  analytics: AnalyticsFacade;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
2
  import { type CardAppearance, type CardPlatform, type CardProps } from './types';
3
3
  import { type WrappedComponentProps } from 'react-intl-next';
4
- export declare const Card: React.ForwardRefExoticComponent<Pick<Omit<import("react-intl-next").WithIntlProps<CardProps & WrappedComponentProps>, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "url" | "appearance" | "container" | "children" | "data" | "key" | "id" | "placeholder" | "onError" | "onClick" | "testId" | "analyticsContext" | "isSelected" | "inheritDimensions" | "actionOptions" | "onResolve" | "ui" | "showHoverPreview" | "showAuthTooltip" | "platform" | "isHovered" | "isFrameVisible" | "frameStyle" | "importer" | "showActions" | "showServerActions" | "fallbackComponent" | "embedIframeRef" | "embedIframeUrlType" | "inlinePreloaderStyle" | "analyticsEvents" | "useLegacyBlockCard" | "forwardedRef"> & React.RefAttributes<any>>;
4
+ export declare const Card: React.ForwardRefExoticComponent<Pick<Omit<import("react-intl-next").WithIntlProps<CardProps & WrappedComponentProps>, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "url" | "appearance" | "container" | "children" | "data" | "key" | "id" | "placeholder" | "onError" | "onClick" | "testId" | "analyticsContext" | "isSelected" | "inheritDimensions" | "actionOptions" | "onResolve" | "ui" | "showHoverPreview" | "hoverPreviewOptions" | "showAuthTooltip" | "platform" | "isHovered" | "isFrameVisible" | "frameStyle" | "importer" | "showActions" | "showServerActions" | "fallbackComponent" | "embedIframeRef" | "embedIframeUrlType" | "inlinePreloaderStyle" | "analyticsEvents" | "useLegacyBlockCard" | "forwardedRef"> & React.RefAttributes<any>>;
5
5
  export type { CardAppearance, CardProps, CardPlatform };
@@ -6,6 +6,7 @@ import { type AnalyticsFacade } from '../../state/analytics';
6
6
  import { type FlexibleUiOptions } from '../FlexibleCard/types';
7
7
  import { type InlinePreloaderStyle, type OnErrorCallback } from '../types';
8
8
  import { type FrameStyle } from '../EmbedCard/types';
9
+ import { type HoverPreviewOptions } from '../HoverCard/types';
9
10
  export type { CardAppearance, CardPlatform };
10
11
  export type CardInnerAppearance = CardAppearance | 'embedPreview' | 'flexible' | 'hoverCardPreview';
11
12
  export type EmbedIframeUrlType = 'href' | 'interactiveHref';
@@ -96,6 +97,7 @@ export interface CardProps extends WithAnalyticsEventsProps {
96
97
  ui?: FlexibleUiOptions;
97
98
  children?: React.ReactNode;
98
99
  showHoverPreview?: boolean;
100
+ hoverPreviewOptions?: HoverPreviewOptions;
99
101
  showAuthTooltip?: boolean;
100
102
  /**
101
103
  * @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-2681 Internal documentation for deprecation (no external access)}
@@ -5,6 +5,7 @@ import { type FlexibleUiOptions } from '../FlexibleCard/types';
5
5
  import { type InlinePreloaderStyle, type OnErrorCallback } from '../types';
6
6
  import { type AnalyticsFacade } from '../../state/analytics';
7
7
  import { type FrameStyle } from '../EmbedCard/types';
8
+ import { type HoverPreviewOptions } from '../HoverCard/types';
8
9
  export type CardWithUrlContentProps = {
9
10
  id: string;
10
11
  url: string;
@@ -44,6 +45,7 @@ export type CardWithUrlContentProps = {
44
45
  ui?: FlexibleUiOptions;
45
46
  children?: React.ReactNode;
46
47
  showHoverPreview?: boolean;
48
+ hoverPreviewOptions?: HoverPreviewOptions;
47
49
  showAuthTooltip?: boolean;
48
50
  analyticsEvents?: AnalyticsFacade;
49
51
  placeholder?: string;
@@ -18,7 +18,23 @@ export interface ExpandedFrameProps {
18
18
  testId?: string;
19
19
  /** If dimensions of the card are to be inherited from the parent */
20
20
  inheritDimensions?: boolean;
21
- /** To enable scrolling in use cases where the content will not have it's own scrollbar */
21
+ /**
22
+ * To enable scrolling in use cases where the content will not have it's own scrollbar.
23
+ *
24
+ * Requires `setOverflow` to be set to true.
25
+ *
26
+ * Always enable this when when the card is not resolved so the connect account button is not hiddden.
27
+ */
22
28
  allowScrollBar?: boolean;
29
+ /**
30
+ * Should the CSS `overflow` property be set to hidden or auto (clipping or
31
+ * supporting a scroll bar), or left out altogether.
32
+ *
33
+ * Set to true when embed is unresolved to prevent account connection button being unreachable.
34
+ *
35
+ * Set to false when the card is resolved to mitigate blurry embed card issue (EDM-7188).
36
+ * @default true
37
+ */
38
+ setOverflow?: boolean;
23
39
  }
24
40
  export declare const ExpandedFrame: FC<ExpandedFrameProps>;
@@ -45,7 +45,14 @@ export declare const TooltipWrapper: import("@emotion/styled").StyledComponent<{
45
45
  }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
46
46
  export interface ContentProps {
47
47
  isInteractive: boolean;
48
+ /**
49
+ * Whether to show a scroll bar (use overflow: auto) or hide overflow (overflow:hidden).
50
+ * Always set to true for unresolved embeds, otherwise the connect account button may be hidden and unreachable.
51
+ */
48
52
  allowScrollBar: boolean;
53
+ /**
54
+ * Remove the overflow: ... CSS property altogether.
55
+ */
49
56
  removeOverflow?: boolean;
50
57
  frameStyle?: FrameStyle;
51
58
  }
@@ -1,4 +1,4 @@
1
1
  /// <reference types="react" />
2
2
  import { type HoverCardDelayProps } from './types';
3
- declare const HoverCardControl: ({ children, hideHoverCardPreviewButton, isHoverPreview, isAuthTooltip, actionOptions, testId, url, delay, }: HoverCardDelayProps) => JSX.Element;
3
+ declare const HoverCardControl: ({ children, hideHoverCardPreviewButton, isHoverPreview, isAuthTooltip, actionOptions, testId, url, delay, hoverPreviewOptions, }: HoverCardDelayProps) => JSX.Element;
4
4
  export default HoverCardControl;
@@ -1,6 +1,6 @@
1
1
  import { type PropsWithChildren } from 'react';
2
2
  import { type ContainerProps } from '../types';
3
- export type HoverCardDelayProps = PropsWithChildren<Pick<ContainerProps, 'hideHoverCardPreviewButton' | 'actionOptions'> & {
3
+ export type HoverCardDelayProps = PropsWithChildren<Pick<ContainerProps, 'hideHoverCardPreviewButton' | 'actionOptions' | 'hoverPreviewOptions'> & {
4
4
  isHoverPreview?: boolean;
5
5
  isAuthTooltip?: boolean;
6
6
  testId?: string;
@@ -10,5 +10,5 @@ export declare const getContainerStyles: (size: SmartLinkSize, hideBackground: b
10
10
  * @internal
11
11
  * @see Block
12
12
  */
13
- declare const Container: ({ children, clickableContainer, hideBackground, hideElevation, hideHoverCardPreviewButton, hidePadding, onClick, retry, showAuthTooltip, showHoverPreview, actionOptions, size, status, testId, theme, }: ContainerProps) => jsx.JSX.Element;
13
+ declare const Container: ({ children, clickableContainer, hideBackground, hideElevation, hideHoverCardPreviewButton, hidePadding, onClick, retry, showAuthTooltip, showHoverPreview, hoverPreviewOptions, actionOptions, size, status, testId, theme, }: ContainerProps) => jsx.JSX.Element;
14
14
  export default Container;
@@ -1,7 +1,7 @@
1
1
  import { type PropsWithChildren } from 'react';
2
2
  import { type SmartLinkStatus } from '../../../../constants';
3
3
  import { type FlexibleCardProps, type FlexibleUiOptions, type RetryOptions } from '../../types';
4
- export type ContainerProps = PropsWithChildren<Pick<FlexibleCardProps, 'onClick' | 'showHoverPreview' | 'actionOptions' | 'showAuthTooltip'> & FlexibleUiOptions & {
4
+ export type ContainerProps = PropsWithChildren<Pick<FlexibleCardProps, 'onClick' | 'showHoverPreview' | 'hoverPreviewOptions' | 'actionOptions' | 'showAuthTooltip'> & FlexibleUiOptions & {
5
5
  /**
6
6
  * The options that determine the retry behaviour when a Smart Link errors.
7
7
  */
@@ -8,6 +8,7 @@ import type { CardInnerAppearance, OnResolveCallback, CardActionOptions } from '
8
8
  import { type OnErrorCallback } from '../types';
9
9
  import { type AnalyticsFacade } from '../../state/analytics';
10
10
  import { type AISummaryConfig } from '../../state/hooks/use-ai-summary-config/types';
11
+ import { type HoverPreviewOptions } from '../HoverCard/types';
11
12
  export type FlexibleCardProps = {
12
13
  /**
13
14
  * @internal A unique ID for a Smart Link.
@@ -81,6 +82,10 @@ export type FlexibleCardProps = {
81
82
  * over the smartlink. Default value is false.
82
83
  */
83
84
  showHoverPreview?: boolean;
85
+ /**
86
+ * Configuration options for hover preview
87
+ */
88
+ hoverPreviewOptions?: HoverPreviewOptions;
84
89
  /**
85
90
  * Determines whether to show an unauthorised view of the hover card
86
91
  * when a user hovers over a smartlink.
@@ -55,6 +55,7 @@ export interface HoverCardProps extends WithAnalyticsEventsProps {
55
55
  * This is passed to the portal component.
56
56
  */
57
57
  zIndex?: number;
58
+ hoverPreviewOptions?: HoverPreviewOptions;
58
59
  }
59
60
  /**
60
61
  * An internal props that internal smart-card components can use to configure
@@ -103,3 +104,9 @@ export type ImagePreviewProps = {
103
104
  data: JsonLd.Data.BaseData;
104
105
  fallbackElementHeight: number;
105
106
  };
107
+ export interface HoverPreviewOptions {
108
+ /**
109
+ * Delay (in milliseconds) between hovering over the trigger element and the hover card opening. Defaults to 500ms.
110
+ */
111
+ fadeInDelay?: number;
112
+ }
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import { type LozengeProps } from '../../../types';
3
3
  import type { CardActionOptions } from '../../Card/types';
4
+ import { type HoverPreviewOptions } from '../../HoverCard/types';
4
5
  export interface InlineCardResolvedViewProps {
5
6
  /** A unique ID for a Smart Link. */
6
7
  id?: string;
@@ -26,6 +27,7 @@ export interface InlineCardResolvedViewProps {
26
27
  titlePrefix?: React.ReactNode;
27
28
  /** Enables showing a custom preview on hover of link */
28
29
  showHoverPreview?: boolean;
30
+ hoverPreviewOptions?: HoverPreviewOptions;
29
31
  /** Configure visibility of server and client actions */
30
32
  actionOptions?: CardActionOptions;
31
33
  }
@@ -4,6 +4,7 @@ import { type CardState } from '../../state/types';
4
4
  import { type InlinePreloaderStyle, type OnErrorCallback } from '../types';
5
5
  import { type AnalyticsFacade } from '../../state/analytics';
6
6
  import type { CardActionOptions } from '../Card/types';
7
+ import { type HoverPreviewOptions } from '../HoverCard/types';
7
8
  export type InlineCardProps = {
8
9
  id: string;
9
10
  url: string;
@@ -21,6 +22,7 @@ export type InlineCardProps = {
21
22
  inlinePreloaderStyle?: InlinePreloaderStyle;
22
23
  renderers?: CardProviderRenderers;
23
24
  showHoverPreview?: boolean;
25
+ hoverPreviewOptions?: HoverPreviewOptions;
24
26
  showAuthTooltip?: boolean;
25
27
  actionOptions?: CardActionOptions;
26
28
  analytics: AnalyticsFacade;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "27.8.4",
3
+ "version": "27.9.1",
4
4
  "description": "Smart card component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -33,13 +33,13 @@
33
33
  "@atlaskit/avatar": "^21.11.0",
34
34
  "@atlaskit/avatar-group": "^9.9.0",
35
35
  "@atlaskit/badge": "^16.3.0",
36
- "@atlaskit/button": "^18.1.0",
36
+ "@atlaskit/button": "^18.2.0",
37
37
  "@atlaskit/checkbox": "^13.5.0",
38
- "@atlaskit/dropdown-menu": "^12.13.0",
38
+ "@atlaskit/dropdown-menu": "^12.14.0",
39
39
  "@atlaskit/form": "^10.4.0",
40
40
  "@atlaskit/frontend-utilities": "^2.7.0",
41
41
  "@atlaskit/heading": "^2.4.0",
42
- "@atlaskit/icon": "^22.5.0",
42
+ "@atlaskit/icon": "^22.6.0",
43
43
  "@atlaskit/icon-file-type": "^6.4.0",
44
44
  "@atlaskit/icon-object": "^6.4.0",
45
45
  "@atlaskit/icon-priority": "^6.3.0",
@@ -50,12 +50,12 @@
50
50
  "@atlaskit/linking-types": "^8.9.0",
51
51
  "@atlaskit/logo": "^14.1.0",
52
52
  "@atlaskit/lozenge": "^11.8.0",
53
- "@atlaskit/menu": "^2.6.0",
53
+ "@atlaskit/menu": "^2.7.0",
54
54
  "@atlaskit/modal-dialog": "^12.14.0",
55
55
  "@atlaskit/outbound-auth-flow-client": "^3.4.0",
56
56
  "@atlaskit/platform-feature-flags": "^0.3.0",
57
57
  "@atlaskit/popup": "^1.20.0",
58
- "@atlaskit/primitives": "^10.0.0",
58
+ "@atlaskit/primitives": "^10.1.0",
59
59
  "@atlaskit/section-message": "^6.5.0",
60
60
  "@atlaskit/select": "^17.11.0",
61
61
  "@atlaskit/spinner": "^16.2.0",
@@ -98,7 +98,7 @@
98
98
  "@atlaskit/visual-regression": "*",
99
99
  "@atlassian/analytics-tooling": "*",
100
100
  "@atlassian/feature-flags-test-utils": "^0.2.0",
101
- "@testing-library/dom": "^8.17.1",
101
+ "@testing-library/dom": "^10.1.0",
102
102
  "@testing-library/jest-dom": "^6.4.5",
103
103
  "@testing-library/react": "^12.1.5",
104
104
  "@testing-library/react-hooks": "^8.0.1",
@@ -112,9 +112,10 @@
112
112
  "brace": "^0.11.1",
113
113
  "fetch-mock": "^8.0.0",
114
114
  "jest-emotion": "^10.0.32",
115
- "jest-extended": "^0.11.2",
115
+ "jest-extended": "^4.0.2",
116
116
  "jest-fetch-mock": "^3.0.3",
117
- "jsdom": "^17.0.0",
117
+ "jest-mock": "^29.7.0",
118
+ "jsdom": "^22.0.0",
118
119
  "lorem-ipsum": "^1.0.6",
119
120
  "react": "^16.8.0",
120
121
  "react-ace": "^6.1.0",
@@ -122,7 +123,7 @@
122
123
  "react-dom": "^16.8.0",
123
124
  "react-intl-next": "npm:react-intl@^5.18.1",
124
125
  "react-test-renderer": "^16.8.0",
125
- "ts-jest": "26.5.6",
126
+ "ts-jest": "29.1.2",
126
127
  "typescript": "~5.4.2",
127
128
  "xhr-mock": "^2.4.0"
128
129
  },