@atlaskit/smart-card 23.4.7 → 23.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/cjs/constants.js +10 -2
  3. package/dist/cjs/index.js +6 -0
  4. package/dist/cjs/state/flexible-ui-context/utils.js +16 -0
  5. package/dist/cjs/utils/flexible.js +8 -2
  6. package/dist/cjs/version.json +1 -1
  7. package/dist/cjs/view/BlockCard/components/flexible/footer/index.js +2 -2
  8. package/dist/cjs/view/BlockCard/index.js +83 -12
  9. package/dist/cjs/view/BlockCard/views/flexible/FlexibleResolvedView.js +108 -0
  10. package/dist/cjs/view/BlockCard/views/flexible/FlexibleUnauthorisedView.js +1 -1
  11. package/dist/cjs/view/CardWithUrl/component.js +4 -2
  12. package/dist/cjs/view/EmbedModal/components/link-info/index.js +2 -1
  13. package/dist/cjs/view/FlexibleCard/components/blocks/preview-block/index.js +6 -9
  14. package/dist/cjs/view/FlexibleCard/components/blocks/preview-block/resolved/index.js +109 -0
  15. package/dist/cjs/view/FlexibleCard/components/common/image-icon/index.js +4 -2
  16. package/dist/cjs/view/FlexibleCard/components/container/index.js +40 -4
  17. package/dist/cjs/view/FlexibleCard/components/elements/media/index.js +2 -0
  18. package/dist/es2019/constants.js +8 -1
  19. package/dist/es2019/index.js +1 -1
  20. package/dist/es2019/state/flexible-ui-context/utils.js +5 -0
  21. package/dist/es2019/utils/flexible.js +3 -2
  22. package/dist/es2019/version.json +1 -1
  23. package/dist/es2019/view/BlockCard/components/flexible/footer/index.js +2 -2
  24. package/dist/es2019/view/BlockCard/index.js +80 -13
  25. package/dist/es2019/view/BlockCard/views/flexible/FlexibleErroredView.js +2 -2
  26. package/dist/es2019/view/BlockCard/views/flexible/FlexibleForbiddenView.js +2 -2
  27. package/dist/es2019/view/BlockCard/views/flexible/FlexibleNotFoundView.js +2 -2
  28. package/dist/es2019/view/BlockCard/views/flexible/FlexibleResolvedView.js +81 -0
  29. package/dist/es2019/view/BlockCard/views/flexible/FlexibleUnauthorisedView.js +3 -3
  30. package/dist/es2019/view/CardWithUrl/component.js +4 -2
  31. package/dist/es2019/view/EmbedModal/components/link-info/index.js +2 -1
  32. package/dist/es2019/view/FlexibleCard/components/blocks/preview-block/index.js +6 -7
  33. package/dist/es2019/view/FlexibleCard/components/blocks/preview-block/resolved/index.js +103 -0
  34. package/dist/es2019/view/FlexibleCard/components/common/image-icon/index.js +4 -2
  35. package/dist/es2019/view/FlexibleCard/components/container/index.js +73 -21
  36. package/dist/es2019/view/FlexibleCard/components/elements/media/index.js +2 -0
  37. package/dist/esm/constants.js +8 -1
  38. package/dist/esm/index.js +1 -1
  39. package/dist/esm/state/flexible-ui-context/utils.js +7 -0
  40. package/dist/esm/utils/flexible.js +4 -1
  41. package/dist/esm/version.json +1 -1
  42. package/dist/esm/view/BlockCard/components/flexible/footer/index.js +2 -2
  43. package/dist/esm/view/BlockCard/index.js +77 -12
  44. package/dist/esm/view/BlockCard/views/flexible/FlexibleErroredView.js +2 -2
  45. package/dist/esm/view/BlockCard/views/flexible/FlexibleForbiddenView.js +2 -2
  46. package/dist/esm/view/BlockCard/views/flexible/FlexibleNotFoundView.js +2 -2
  47. package/dist/esm/view/BlockCard/views/flexible/FlexibleResolvedView.js +87 -0
  48. package/dist/esm/view/BlockCard/views/flexible/FlexibleUnauthorisedView.js +3 -3
  49. package/dist/esm/view/CardWithUrl/component.js +4 -2
  50. package/dist/esm/view/EmbedModal/components/link-info/index.js +2 -1
  51. package/dist/esm/view/FlexibleCard/components/blocks/preview-block/index.js +7 -8
  52. package/dist/esm/view/FlexibleCard/components/blocks/preview-block/resolved/index.js +86 -0
  53. package/dist/esm/view/FlexibleCard/components/common/image-icon/index.js +4 -2
  54. package/dist/esm/view/FlexibleCard/components/container/index.js +42 -6
  55. package/dist/esm/view/FlexibleCard/components/elements/media/index.js +2 -0
  56. package/dist/types/constants.d.ts +4 -0
  57. package/dist/types/index.d.ts +1 -1
  58. package/dist/types/state/flexible-ui-context/utils.d.ts +6 -0
  59. package/dist/types/utils/flexible.d.ts +1 -0
  60. package/dist/types/view/BlockCard/components/flexible/footer/index.d.ts +2 -2
  61. package/dist/types/view/BlockCard/index.d.ts +1 -0
  62. package/dist/types/view/BlockCard/types.d.ts +1 -0
  63. package/dist/types/view/BlockCard/views/flexible/FlexibleResolvedView.d.ts +9 -0
  64. package/dist/types/view/BlockCard/views/flexible/FlexibleUnauthorisedView.d.ts +1 -1
  65. package/dist/types/view/FlexibleCard/components/blocks/preview-block/index.d.ts +1 -0
  66. package/dist/types/view/FlexibleCard/components/blocks/preview-block/resolved/index.d.ts +11 -0
  67. package/dist/types/view/FlexibleCard/components/blocks/preview-block/types.d.ts +15 -0
  68. package/dist/types/view/FlexibleCard/components/common/image-icon/types.d.ts +1 -0
  69. package/dist/types/view/FlexibleCard/components/container/index.d.ts +2 -2
  70. package/dist/types/view/FlexibleCard/components/container/types.d.ts +4 -0
  71. package/dist/types/view/FlexibleCard/components/elements/media/types.d.ts +1 -0
  72. package/package.json +2 -2
  73. package/report.api.md +10 -0
  74. package/tmp/api-report-tmp.d.ts +10 -0
@@ -0,0 +1,86 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
5
+ var _excluded = ["ignoreContainerPadding", "onError", "overrideCss", "placement", "testId"];
6
+
7
+ var _templateObject, _templateObject2, _templateObject3;
8
+
9
+ /** @jsx jsx */
10
+ import React, { useCallback, useEffect, useState } from 'react';
11
+ import { css, jsx } from '@emotion/react';
12
+ import { MediaPlacement } from '../../../../../../constants';
13
+ import Block from '../../block';
14
+ import { Preview } from '../../../elements';
15
+ /**
16
+ * Due to its placement on the left/right and ignoreContainerPadding prop
17
+ * rely on its parent container styling, css variables are declared in
18
+ * <Container /> to preset the base values for the preview block styling.
19
+ *
20
+ * `--container-padding` is the padding of the Container. This value is based
21
+ * on size and hidePadding.
22
+ * `--container-gap-left` and `--container-gap-right` are the gap or padding of
23
+ * the Container depending on whether the container has other preview blocks
24
+ * with left/right positioning.
25
+ * `--preview-block-width` is the size of the preview image in relation to
26
+ * the Container width when the placement is left/right.
27
+ * @param placement
28
+ * @param ignoreContainerPadding
29
+ */
30
+
31
+ var getPreviewBlockStyles = function getPreviewBlockStyles(placement, ignoreContainerPadding) {
32
+ if (placement === MediaPlacement.Left || placement === MediaPlacement.Right) {
33
+ var containerPadding = ignoreContainerPadding ? '0rem' : 'var(--container-padding)';
34
+ return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: absolute;\n top: ", ";\n bottom: ", ";\n width: calc(var(--preview-block-width) - ", ");\n\n ", "\n ", "\n\n [data-smart-element-media='image'] {\n aspect-ratio: unset;\n padding-top: unset;\n width: 100%;\n height: 100%;\n object-fit: cover;\n }\n "])), containerPadding, containerPadding, containerPadding, placement === MediaPlacement.Left ? "left: ".concat(containerPadding, ";") : '', placement === MediaPlacement.Right ? "right: ".concat(containerPadding, ";") : '');
35
+ }
36
+
37
+ if (ignoreContainerPadding) {
38
+ return css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n margin-left: calc(var(--container-gap-left) * -1);\n margin-right: calc(var(--container-gap-right) * -1);\n &:first-of-type {\n margin-top: calc(var(--container-padding) * -1);\n }\n &:last-of-type {\n margin-bottom: calc(var(--container-padding) * -1);\n }\n "])));
39
+ }
40
+ };
41
+ /**
42
+ * Represents a resolved PreviewBlock, which typically contains media or other large format content.
43
+ * @public
44
+ * @param {PreviewBlock} PreviewBlock
45
+ * @see Block
46
+ */
47
+
48
+
49
+ var PreviewBlockResolvedView = function PreviewBlockResolvedView(_ref) {
50
+ var _ref$ignoreContainerP = _ref.ignoreContainerPadding,
51
+ ignoreContainerPadding = _ref$ignoreContainerP === void 0 ? false : _ref$ignoreContainerP,
52
+ onError = _ref.onError,
53
+ overrideCss = _ref.overrideCss,
54
+ placement = _ref.placement,
55
+ testId = _ref.testId,
56
+ blockProps = _objectWithoutProperties(_ref, _excluded);
57
+
58
+ var _useState = useState(overrideCss),
59
+ _useState2 = _slicedToArray(_useState, 2),
60
+ styles = _useState2[0],
61
+ setStyles = _useState2[1];
62
+
63
+ var updateStyles = useCallback(function () {
64
+ setStyles(css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n ", "\n ", "\n "])), getPreviewBlockStyles(placement, ignoreContainerPadding), overrideCss));
65
+ }, [ignoreContainerPadding, overrideCss, placement]);
66
+ useEffect(function () {
67
+ updateStyles();
68
+ }, [ignoreContainerPadding, overrideCss, placement, updateStyles]);
69
+ var handleOnLoad = useCallback(function () {
70
+ updateStyles();
71
+ }, [updateStyles]);
72
+ var handleOnError = useCallback(function () {
73
+ if (onError) {
74
+ onError();
75
+ }
76
+ }, [onError]);
77
+ return jsx(Block, _extends({}, blockProps, {
78
+ overrideCss: styles,
79
+ testId: "".concat(testId, "-resolved-view")
80
+ }), jsx(Preview, {
81
+ onError: handleOnError,
82
+ onLoad: handleOnLoad
83
+ }));
84
+ };
85
+
86
+ export default PreviewBlockResolvedView;
@@ -8,7 +8,8 @@ var ImageIcon = function ImageIcon(_ref) {
8
8
  var defaultIcon = _ref.defaultIcon,
9
9
  testId = _ref.testId,
10
10
  url = _ref.url,
11
- onError = _ref.onError;
11
+ onError = _ref.onError,
12
+ onLoad = _ref.onLoad;
12
13
  return jsx(ImageLoader, {
13
14
  src: url,
14
15
  loading: jsx(LoadingSkeleton, {
@@ -19,7 +20,8 @@ var ImageIcon = function ImageIcon(_ref) {
19
20
  "data-testid": "".concat(testId, "-image")
20
21
  }),
21
22
  errored: defaultIcon,
22
- onError: onError
23
+ onError: onError,
24
+ onLoad: onLoad
23
25
  });
24
26
  };
25
27
 
@@ -1,15 +1,16 @@
1
1
  import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
2
 
3
- var _templateObject, _templateObject2, _templateObject3;
3
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4;
4
4
 
5
5
  /** @jsx jsx */
6
6
  import React, { useContext } from 'react';
7
7
  import { css, jsx } from '@emotion/react';
8
- import { SmartLinkSize, SmartLinkTheme } from '../../../../constants';
9
- import { isFlexibleUiBlock, isFlexibleUiTitleBlock } from '../../../../utils/flexible';
8
+ import { MediaPlacement, SmartLinkSize, SmartLinkTheme } from '../../../../constants';
9
+ import { isFlexibleUiBlock, isFlexibleUiPreviewBlock, isFlexibleUiTitleBlock } from '../../../../utils/flexible';
10
10
  import { tokens } from '../../../../utils/token';
11
11
  import { FlexibleUiContext } from '../../../../state/flexible-ui-context';
12
12
  import LayeredLink from './layered-link';
13
+ import { isFlexUiPreviewPresent } from '../../../../state/flexible-ui-context/utils';
13
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
15
 
15
16
  var getGap = function getGap(size) {
@@ -47,8 +48,42 @@ var getPadding = function getPadding(size) {
47
48
  };
48
49
 
49
50
  var clickableContainerStyles = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n // Position any interactive elements at the top of the z-index stack.\n a,\n button,\n .has-action {\n position: relative;\n z-index: 1;\n }\n"])));
50
- export var getContainerStyles = function getContainerStyles(size, hideBackground, hideElevation, hidePadding, clickableContainer) {
51
- return css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n display: flex;\n gap: ", " 0;\n flex-direction: column;\n min-width: 0;\n overflow-x: hidden;\n position: relative;\n ", "\n ", "\n ", "\n ", "\n &:hover ~ .actions-button-group {\n opacity: 1;\n }\n a:focus,\n .has-action:focus {\n outline-offset: -2px;\n }\n"])), getGap(size), hideBackground ? '' : "background-color: ".concat(tokens.background, ";"), hidePadding ? '' : "padding: ".concat(getPadding(size), ";"), hideElevation ? '' : elevationStyles, clickableContainer ? clickableContainerStyles : '');
51
+
52
+ var getContainerPaddingStyles = function getContainerPaddingStyles(size, hidePadding, childrenOptions) {
53
+ var padding = hidePadding ? '0rem' : getPadding(size);
54
+ var gap = getGap(size);
55
+ var previewOnLeft = childrenOptions.previewOnLeft,
56
+ previewOnRight = childrenOptions.previewOnRight;
57
+ return css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n // Set variables for PreviewBlock to use.\n --container-padding: ", ";\n --container-gap-left: ", ";\n --container-gap-right: ", ";\n --preview-block-width: 30%;\n\n padding: ", ";\n ", "\n ", "\n "])), padding, previewOnLeft ? gap : padding, previewOnRight ? gap : padding, padding, previewOnLeft ? "padding-left: calc(var(--preview-block-width) + ".concat(gap, ");") : '', previewOnRight ? "padding-right: calc(var(--preview-block-width) + ".concat(gap, ");") : '');
58
+ };
59
+
60
+ var getChildrenOptions = function getChildrenOptions(children, context) {
61
+ var options = {};
62
+
63
+ if (isFlexUiPreviewPresent(context)) {
64
+ React.Children.map(children, function (child) {
65
+ if ( /*#__PURE__*/React.isValidElement(child)) {
66
+ if (isFlexibleUiPreviewBlock(child)) {
67
+ var placement = child.props.placement;
68
+
69
+ if (placement === MediaPlacement.Left) {
70
+ options.previewOnLeft = true;
71
+ }
72
+
73
+ if (placement === MediaPlacement.Right) {
74
+ options.previewOnRight = true;
75
+ }
76
+ }
77
+ }
78
+ });
79
+ }
80
+
81
+ return options;
82
+ };
83
+
84
+ export var getContainerStyles = function getContainerStyles(size, hideBackground, hideElevation, hidePadding, clickableContainer, childrenOptions) {
85
+ var paddingCss = getContainerPaddingStyles(size, hidePadding, childrenOptions);
86
+ return css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n display: flex;\n gap: ", " 0;\n flex-direction: column;\n min-width: 0;\n overflow-x: hidden;\n position: relative;\n ", "\n ", "\n ", "\n ", "\n &:hover ~ .actions-button-group {\n opacity: 1;\n }\n a:focus,\n .has-action:focus {\n outline-offset: -2px;\n }\n "])), getGap(size), hideBackground ? '' : "background-color: ".concat(tokens.background, ";"), paddingCss, hideElevation ? '' : elevationStyles, clickableContainer ? clickableContainerStyles : '');
52
87
  };
53
88
 
54
89
  var renderChildren = function renderChildren(children, containerSize, containerTheme, status, retry, onClick) {
@@ -133,8 +168,9 @@ var Container = function Container(_ref3) {
133
168
  _ref3$theme = _ref3.theme,
134
169
  theme = _ref3$theme === void 0 ? SmartLinkTheme.Link : _ref3$theme;
135
170
  var context = useContext(FlexibleUiContext);
171
+ var childrenOptions = getChildrenOptions(children, context);
136
172
  return jsx("div", {
137
- css: getContainerStyles(size, hideBackground, hideElevation, hidePadding, clickableContainer),
173
+ css: getContainerStyles(size, hideBackground, hideElevation, hidePadding, clickableContainer, childrenOptions),
138
174
  "data-smart-link-container": true,
139
175
  "data-testid": testId
140
176
  }, clickableContainer ? getLayeredLink(testId, context, children, onClick) : null, renderChildren(children, size, theme, status, retry, onClick));
@@ -32,6 +32,7 @@ var Media = function Media(_ref) {
32
32
  testId = _ref$testId === void 0 ? 'smart-element-media' : _ref$testId,
33
33
  type = _ref.type,
34
34
  url = _ref.url,
35
+ onLoad = _ref.onLoad,
35
36
  onError = _ref.onError;
36
37
 
37
38
  if (!type || !url) {
@@ -47,6 +48,7 @@ var Media = function Media(_ref) {
47
48
  testId: "".concat(testId, "-image"),
48
49
  url: url,
49
50
  onError: onError,
51
+ onLoad: onLoad,
50
52
  defaultIcon: null
51
53
  }));
52
54
  };
@@ -189,3 +189,7 @@ export declare enum IconType {
189
189
  export declare enum MediaType {
190
190
  Image = "image"
191
191
  }
192
+ export declare enum MediaPlacement {
193
+ Left = "left",
194
+ Right = "right"
195
+ }
@@ -16,7 +16,7 @@ export { SmartLinkEvents } from './utils/analytics/analytics';
16
16
  export { useSmartLinkEvents } from './view/SmartLinkEvents/useSmartLinkEvents';
17
17
  export { contentFooterClassName, metadataListClassName, blockCardResolvingViewClassName, blockCardResolvedViewClassName, blockCardForbiddenViewClassName, blockCardIconImageClassName, blockCardResolvedViewByClassName, blockCardForbiddenViewLinkClassName, blockCardContentClassName, blockCardContentHeaderClassName, blockCardContentHeaderNameClassName, blockCardNotFoundViewClassName, blockCardErroredViewClassName, } from './classNames';
18
18
  export { loadingPlaceholderClassName } from './view/CardWithUrl/component-lazy/LazyFallback';
19
- export { ActionName, ElementName, SmartLinkDirection, SmartLinkPosition, SmartLinkSize, SmartLinkTheme, } from './constants';
19
+ export { ActionName, ElementName, MediaPlacement, SmartLinkDirection, SmartLinkPosition, SmartLinkSize, SmartLinkTheme, } from './constants';
20
20
  export { MetadataBlock, PreviewBlock, SnippetBlock, TitleBlock, FooterBlock, } from './view/FlexibleCard/components/blocks';
21
21
  export type { ActionItem, ElementItem, OnActionMenuOpenChangeOptions, } from './view/FlexibleCard/components/blocks/types';
22
22
  export type { AnalyticsAction, AnalyticsActionSubject, AnalyticsPayload, AnalyticsHandler, } from './utils/types';
@@ -0,0 +1,6 @@
1
+ import { FlexibleUiDataContext } from './types';
2
+ /**
3
+ * Returns true if preview data is available in the FlexibleUiDataContext
4
+ * @param context is the FlexibleUiDataContext
5
+ */
6
+ export declare const isFlexUiPreviewPresent: (context?: FlexibleUiDataContext | undefined) => boolean;
@@ -3,3 +3,4 @@ export declare const isFlexibleUiCard: (children?: React.ReactNode) => boolean;
3
3
  export declare const isFlexibleUiBlock: (node: React.ReactNode) => boolean;
4
4
  export declare const isFlexibleUiElement: (node: React.ReactNode) => boolean;
5
5
  export declare const isFlexibleUiTitleBlock: (node: React.ReactNode) => boolean;
6
+ export declare const isFlexibleUiPreviewBlock: (node: React.ReactNode) => boolean;
@@ -8,5 +8,5 @@ import { FooterBlockProps } from '../../../../FlexibleCard/components/blocks/foo
8
8
  * @see CustomBlock
9
9
  * @param props are the data required for the block, such as actions to be displayed.
10
10
  */
11
- declare const Footer: React.FC<FooterBlockProps>;
12
- export default Footer;
11
+ declare const BlockCardFooter: React.FC<FooterBlockProps>;
12
+ export default BlockCardFooter;
@@ -1,3 +1,4 @@
1
+ /** @jsx jsx */
1
2
  import { FC } from 'react';
2
3
  import { BlockCardProps } from './types';
3
4
  import { AuthorizeAction } from './actions/AuthorizeAction';
@@ -22,4 +22,5 @@ export declare type BlockCardProps = {
22
22
  renderers?: CardProviderRenderers;
23
23
  platform?: CardPlatform;
24
24
  analytics: AnalyticsFacade;
25
+ enableFlexibleBlockCard?: boolean;
25
26
  };
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import { FlexibleBlockCardProps } from './types';
3
+ /**
4
+ * This view represents a Block card that has an 'Resolved' status.
5
+ * @see SmartLinkStatus
6
+ * @see FlexibleCardProps
7
+ */
8
+ declare const FlexibleResolvedView: ({ cardState, onClick, onError, testId, ui, url, }: FlexibleBlockCardProps) => JSX.Element;
9
+ export default FlexibleResolvedView;
@@ -5,7 +5,7 @@ import { FlexibleBlockCardProps } from './types';
5
5
  * It should have a "Connect" button that will allow a user to connect their account and view the block card.
6
6
  *
7
7
  * @see SmartLinkStatus
8
- * @see UnauthorisedViewProps
8
+ * @see FlexibleCardProps
9
9
  */
10
10
  declare const FlexibleUnauthorisedView: ({ cardState, providerName, onAuthorize, onClick, onError, testId, ui, url, }: FlexibleBlockCardProps) => JSX.Element;
11
11
  export default FlexibleUnauthorisedView;
@@ -1,3 +1,4 @@
1
+ /** @jsx jsx */
1
2
  import React from 'react';
2
3
  import { PreviewBlockProps } from './types';
3
4
  /**
@@ -0,0 +1,11 @@
1
+ /** @jsx jsx */
2
+ import React from 'react';
3
+ import { PreviewBlockProps } from '../types';
4
+ /**
5
+ * Represents a resolved PreviewBlock, which typically contains media or other large format content.
6
+ * @public
7
+ * @param {PreviewBlock} PreviewBlock
8
+ * @see Block
9
+ */
10
+ declare const PreviewBlockResolvedView: React.FC<PreviewBlockProps>;
11
+ export default PreviewBlockResolvedView;
@@ -1,8 +1,23 @@
1
1
  import { BlockProps } from '../types';
2
+ import { MediaPlacement } from '../../../../../constants';
3
+ export declare type OnPreviewRenderOptions = {
4
+ placement?: MediaPlacement;
5
+ };
2
6
  export declare type PreviewBlockProps = {
7
+ /**
8
+ * Indicate whether preview block should ignore the padding its parent container.
9
+ * Default is false.
10
+ */
11
+ ignoreContainerPadding?: boolean;
3
12
  /**
4
13
  * Function to be called on error loading media.
5
14
  * @internal
6
15
  */
7
16
  onError?: () => void;
17
+ /**
18
+ * The placement of the preview block in relation of its container.
19
+ * This makes the preview block leave flex layout to absolute positioning
20
+ * to the left/right of the container.
21
+ */
22
+ placement?: MediaPlacement;
8
23
  } & BlockProps;
@@ -4,4 +4,5 @@ export declare type ImageIconProps = {
4
4
  testId?: string;
5
5
  url: string;
6
6
  onError?: () => void;
7
+ onLoad?: () => void;
7
8
  };
@@ -2,8 +2,8 @@
2
2
  import React from 'react';
3
3
  import { SerializedStyles } from '@emotion/react';
4
4
  import { SmartLinkSize } from '../../../../constants';
5
- import { ContainerProps } from './types';
6
- export declare const getContainerStyles: (size: SmartLinkSize, hideBackground: boolean, hideElevation: boolean, hidePadding: boolean, clickableContainer: boolean) => SerializedStyles;
5
+ import { ChildrenOptions, ContainerProps } from './types';
6
+ export declare const getContainerStyles: (size: SmartLinkSize, hideBackground: boolean, hideElevation: boolean, hidePadding: boolean, clickableContainer: boolean, childrenOptions: ChildrenOptions) => SerializedStyles;
7
7
  /**
8
8
  * A container is a hidden component that build the Flexible Smart Link.
9
9
  * All of the Flexible UI components are wrapped inside the container.
@@ -23,3 +23,7 @@ export declare type ContainerProps = FlexibleUiOptions & {
23
23
  */
24
24
  testId?: string;
25
25
  };
26
+ export declare type ChildrenOptions = {
27
+ previewOnLeft?: boolean;
28
+ previewOnRight?: boolean;
29
+ };
@@ -14,4 +14,5 @@ export declare type MediaProps = ElementProps & {
14
14
  * @internal
15
15
  */
16
16
  onError?: () => void;
17
+ onLoad?: () => void;
17
18
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "23.4.7",
3
+ "version": "23.5.0",
4
4
  "description": "Smart card component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -33,7 +33,7 @@
33
33
  "@atlaskit/icon-object": "^6.2.0",
34
34
  "@atlaskit/icon-priority": "^6.3.0",
35
35
  "@atlaskit/in-product-testing": "^0.1.0",
36
- "@atlaskit/linking-common": "^1.12.0",
36
+ "@atlaskit/linking-common": "^1.13.0",
37
37
  "@atlaskit/logo": "^13.10.0",
38
38
  "@atlaskit/lozenge": "^11.3.0",
39
39
  "@atlaskit/media-common": "^2.17.0",
package/report.api.md CHANGED
@@ -571,6 +571,14 @@ type LinkIcon = {
571
571
  // @public (undocumented)
572
572
  export const loadingPlaceholderClassName = 'smart-link-loading-placeholder';
573
573
 
574
+ // @public (undocumented)
575
+ export enum MediaPlacement {
576
+ // (undocumented)
577
+ Left = 'left',
578
+ // (undocumented)
579
+ Right = 'right',
580
+ }
581
+
574
582
  // @public
575
583
  export const MetadataBlock: React_2.FC<MetadataBlockProps>;
576
584
 
@@ -636,7 +644,9 @@ export const PreviewBlock: React_2.FC<PreviewBlockProps>;
636
644
 
637
645
  // @public (undocumented)
638
646
  type PreviewBlockProps = {
647
+ ignoreContainerPadding?: boolean;
639
648
  onError?: () => void;
649
+ placement?: MediaPlacement;
640
650
  } & BlockProps;
641
651
 
642
652
  // @public (undocumented)
@@ -457,6 +457,14 @@ type LinkIcon = {
457
457
  // @public (undocumented)
458
458
  export const loadingPlaceholderClassName = "smart-link-loading-placeholder";
459
459
 
460
+ // @public (undocumented)
461
+ export enum MediaPlacement {
462
+ // (undocumented)
463
+ Left = "left",
464
+ // (undocumented)
465
+ Right = "right"
466
+ }
467
+
460
468
  // @public
461
469
  export const MetadataBlock: React_2.FC<MetadataBlockProps>;
462
470
 
@@ -519,7 +527,9 @@ export const PreviewBlock: React_2.FC<PreviewBlockProps>;
519
527
 
520
528
  // @public (undocumented)
521
529
  type PreviewBlockProps = {
530
+ ignoreContainerPadding?: boolean;
522
531
  onError?: () => void;
532
+ placement?: MediaPlacement;
523
533
  } & BlockProps;
524
534
 
525
535
  // @public (undocumented)