@atlaskit/media-card 72.0.0 → 73.1.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 (157) hide show
  1. package/CHANGELOG.md +92 -0
  2. package/dist/cjs/actions.js +2 -2
  3. package/dist/cjs/errors.js +35 -11
  4. package/dist/cjs/files/cardImageView/cardOverlay/styled.js +1 -1
  5. package/dist/cjs/files/cardImageView/index.js +1 -1
  6. package/dist/cjs/files/cardImageView/styled.js +1 -1
  7. package/dist/cjs/index.js +8 -8
  8. package/dist/cjs/root/card/cardAnalytics.js +2 -2
  9. package/dist/cjs/root/card/cardLoader.js +66 -124
  10. package/dist/cjs/root/card/cardState.js +2 -2
  11. package/dist/cjs/root/card/getCardPreview/cache.js +5 -5
  12. package/dist/cjs/root/card/getCardPreview/filePreviewStatus.js +4 -1
  13. package/dist/cjs/root/card/getCardPreview/helpers.js +1 -1
  14. package/dist/cjs/root/card/getCardPreview/index.js +101 -18
  15. package/dist/cjs/root/card/getCardStatus.js +1 -1
  16. package/dist/cjs/root/card/index.js +191 -97
  17. package/dist/cjs/root/cardView.js +44 -57
  18. package/dist/cjs/root/inline/loader.js +45 -14
  19. package/dist/cjs/root/inline/mediaInlineCard.js +31 -11
  20. package/dist/cjs/root/inlinePlayer.js +77 -24
  21. package/dist/cjs/root/styled.js +7 -3
  22. package/dist/cjs/root/ui/actionsBar/styled.js +1 -1
  23. package/dist/cjs/root/ui/blanket/styled.js +1 -1
  24. package/dist/cjs/root/ui/common.js +11 -5
  25. package/dist/cjs/root/ui/iconMessage/index.js +5 -3
  26. package/dist/cjs/root/ui/iconWrapper/styled.js +1 -1
  27. package/dist/cjs/root/ui/imageRenderer/imageRenderer.js +6 -2
  28. package/dist/cjs/root/ui/loadingRateLimited/loadingRateLimited.js +6 -4
  29. package/dist/cjs/root/ui/loadingRateLimited/styled.js +2 -2
  30. package/dist/cjs/root/ui/playButton/styled.js +1 -1
  31. package/dist/cjs/root/ui/progressBar/progressBar.js +7 -4
  32. package/dist/cjs/root/ui/progressBar/styled.js +8 -9
  33. package/dist/cjs/root/ui/styled.js +80 -17
  34. package/dist/cjs/root/ui/tickBox/styled.js +1 -1
  35. package/dist/cjs/root/ui/titleBox/failedTitleBox.js +4 -2
  36. package/dist/cjs/root/ui/titleBox/styled.js +2 -4
  37. package/dist/cjs/root/ui/titleBox/titleBox.js +2 -2
  38. package/dist/cjs/styles/index.js +25 -23
  39. package/dist/cjs/styles/mixins.js +1 -1
  40. package/dist/cjs/utils/analytics.js +2 -1
  41. package/dist/cjs/utils/breakpoint.js +1 -1
  42. package/dist/cjs/utils/cardActions/cardActionsDropdownMenu.js +18 -9
  43. package/dist/cjs/utils/cardActions/index.js +10 -10
  44. package/dist/cjs/utils/cardActions/styled.js +1 -1
  45. package/dist/cjs/utils/cardDimensions.js +1 -1
  46. package/dist/cjs/utils/getErrorMessage.js +2 -2
  47. package/dist/cjs/utils/index.js +46 -46
  48. package/dist/cjs/utils/lightCards/styled.js +1 -1
  49. package/dist/cjs/utils/objectURLCache.js +1 -1
  50. package/dist/cjs/utils/viewportDetector.js +49 -22
  51. package/dist/cjs/version.json +1 -1
  52. package/dist/es2019/errors.js +9 -1
  53. package/dist/es2019/root/card/cardAnalytics.js +1 -1
  54. package/dist/es2019/root/card/cardLoader.js +47 -53
  55. package/dist/es2019/root/card/getCardPreview/filePreviewStatus.js +4 -1
  56. package/dist/es2019/root/card/getCardPreview/index.js +45 -3
  57. package/dist/es2019/root/card/index.js +131 -35
  58. package/dist/es2019/root/cardView.js +26 -40
  59. package/dist/es2019/root/inline/loader.js +15 -4
  60. package/dist/es2019/root/inline/mediaInlineCard.js +30 -10
  61. package/dist/es2019/root/inlinePlayer.js +56 -4
  62. package/dist/es2019/root/styled.js +2 -1
  63. package/dist/es2019/root/ui/common.js +7 -1
  64. package/dist/es2019/root/ui/iconMessage/index.js +3 -2
  65. package/dist/es2019/root/ui/imageRenderer/imageRenderer.js +6 -2
  66. package/dist/es2019/root/ui/loadingRateLimited/loadingRateLimited.js +4 -3
  67. package/dist/es2019/root/ui/loadingRateLimited/styled.js +1 -1
  68. package/dist/es2019/root/ui/progressBar/progressBar.js +5 -3
  69. package/dist/es2019/root/ui/progressBar/styled.js +7 -6
  70. package/dist/es2019/root/ui/styled.js +65 -4
  71. package/dist/es2019/root/ui/titleBox/failedTitleBox.js +3 -2
  72. package/dist/es2019/root/ui/titleBox/styled.js +1 -2
  73. package/dist/es2019/root/ui/titleBox/titleBox.js +1 -1
  74. package/dist/es2019/utils/cardActions/cardActionsDropdownMenu.js +8 -4
  75. package/dist/es2019/utils/getErrorMessage.js +1 -1
  76. package/dist/es2019/utils/viewportDetector.js +48 -18
  77. package/dist/es2019/version.json +1 -1
  78. package/dist/esm/actions.js +2 -2
  79. package/dist/esm/errors.js +28 -9
  80. package/dist/esm/root/card/cardAnalytics.js +1 -1
  81. package/dist/esm/root/card/cardLoader.js +66 -126
  82. package/dist/esm/root/card/cardState.js +2 -2
  83. package/dist/esm/root/card/getCardPreview/cache.js +3 -2
  84. package/dist/esm/root/card/getCardPreview/filePreviewStatus.js +4 -1
  85. package/dist/esm/root/card/getCardPreview/index.js +74 -12
  86. package/dist/esm/root/card/index.js +198 -100
  87. package/dist/esm/root/cardView.js +42 -54
  88. package/dist/esm/root/inline/loader.js +46 -14
  89. package/dist/esm/root/inline/mediaInlineCard.js +30 -10
  90. package/dist/esm/root/inlinePlayer.js +74 -23
  91. package/dist/esm/root/styled.js +3 -2
  92. package/dist/esm/root/ui/common.js +7 -1
  93. package/dist/esm/root/ui/iconMessage/index.js +3 -2
  94. package/dist/esm/root/ui/imageRenderer/imageRenderer.js +6 -2
  95. package/dist/esm/root/ui/loadingRateLimited/loadingRateLimited.js +4 -3
  96. package/dist/esm/root/ui/loadingRateLimited/styled.js +1 -1
  97. package/dist/esm/root/ui/progressBar/progressBar.js +6 -3
  98. package/dist/esm/root/ui/progressBar/styled.js +7 -7
  99. package/dist/esm/root/ui/styled.js +61 -13
  100. package/dist/esm/root/ui/titleBox/failedTitleBox.js +3 -2
  101. package/dist/esm/root/ui/titleBox/styled.js +1 -2
  102. package/dist/esm/root/ui/titleBox/titleBox.js +1 -1
  103. package/dist/esm/utils/cardActions/cardActionsDropdownMenu.js +17 -9
  104. package/dist/esm/utils/getErrorMessage.js +1 -1
  105. package/dist/esm/utils/viewportDetector.js +48 -21
  106. package/dist/esm/version.json +1 -1
  107. package/dist/types/errors.d.ts +9 -3
  108. package/dist/types/index.d.ts +3 -1
  109. package/dist/types/root/card/cardLoader.d.ts +5 -19
  110. package/dist/types/root/card/getCardPreview/index.d.ts +7 -1
  111. package/dist/types/root/card/index.d.ts +9 -8
  112. package/dist/types/root/cardView.d.ts +5 -3
  113. package/dist/types/root/inline/loader.d.ts +2 -0
  114. package/dist/types/root/inline/mediaInlineCard.d.ts +3 -5
  115. package/dist/types/root/inlinePlayer.d.ts +8 -1
  116. package/dist/types/root/styled.d.ts +1 -0
  117. package/dist/types/root/ui/common.d.ts +4 -1
  118. package/dist/types/root/ui/iconMessage/index.d.ts +2 -2
  119. package/dist/types/root/ui/iconWrapper/styled.d.ts +1 -1
  120. package/dist/types/root/ui/imageRenderer/imageRenderer.d.ts +3 -2
  121. package/dist/types/root/ui/loadingRateLimited/loadingRateLimited.d.ts +2 -1
  122. package/dist/types/root/ui/loadingRateLimited/styled.d.ts +1 -1
  123. package/dist/types/root/ui/playButton/playButton.d.ts +1 -0
  124. package/dist/types/root/ui/progressBar/progressBar.d.ts +4 -2
  125. package/dist/types/root/ui/progressBar/styled.d.ts +3 -2
  126. package/dist/types/root/ui/styled.d.ts +10 -3
  127. package/dist/types/root/ui/tickBox/tickBox.d.ts +1 -0
  128. package/dist/types/root/ui/titleBox/failedTitleBox.d.ts +3 -3
  129. package/dist/types/root/ui/titleBox/styled.d.ts +1 -1
  130. package/dist/types/root/ui/titleBox/titleBox.d.ts +2 -10
  131. package/dist/types/types.d.ts +1 -1
  132. package/dist/types/utils/getErrorMessage.d.ts +1 -0
  133. package/dist/types/utils/viewportDetector.d.ts +13 -5
  134. package/example-helpers/developmentUseMessage.tsx +14 -0
  135. package/example-helpers/index.tsx +34 -4
  136. package/example-helpers/selectableCard.tsx +2 -1
  137. package/package.json +16 -15
  138. package/dist/cjs/root/card/cardSSRView.js +0 -114
  139. package/dist/cjs/root/ui/Breakpoint.js +0 -13
  140. package/dist/cjs/root/ui/styledSSR.js +0 -108
  141. package/dist/cjs/utils/lazyContent/index.js +0 -56
  142. package/dist/cjs/utils/lazyContent/styled.js +0 -23
  143. package/dist/es2019/root/card/cardSSRView.js +0 -93
  144. package/dist/es2019/root/ui/Breakpoint.js +0 -6
  145. package/dist/es2019/root/ui/styledSSR.js +0 -93
  146. package/dist/es2019/utils/lazyContent/index.js +0 -18
  147. package/dist/es2019/utils/lazyContent/styled.js +0 -12
  148. package/dist/esm/root/card/cardSSRView.js +0 -92
  149. package/dist/esm/root/ui/Breakpoint.js +0 -6
  150. package/dist/esm/root/ui/styledSSR.js +0 -76
  151. package/dist/esm/utils/lazyContent/index.js +0 -41
  152. package/dist/esm/utils/lazyContent/styled.js +0 -14
  153. package/dist/types/root/card/cardSSRView.d.ts +0 -13
  154. package/dist/types/root/ui/Breakpoint.d.ts +0 -4
  155. package/dist/types/root/ui/styledSSR.d.ts +0 -16
  156. package/dist/types/utils/lazyContent/index.d.ts +0 -11
  157. package/dist/types/utils/lazyContent/styled.d.ts +0 -5
@@ -10,7 +10,9 @@ export var ImageRenderer = function ImageRenderer(_ref) {
10
10
  onImageLoad = _ref.onImageLoad,
11
11
  onImageError = _ref.onImageError,
12
12
  onDisplayImage = _ref.onDisplayImage,
13
- mediaType = _ref.mediaType;
13
+ mediaType = _ref.mediaType,
14
+ nativeLazyLoad = _ref.nativeLazyLoad,
15
+ forceSyncDisplay = _ref.forceSyncDisplay;
14
16
  useEffect(function () {
15
17
  // TODO: trigger accordingly with the succeeded event. This could be a breaking change
16
18
  if (mediaType === 'image' && onDisplayImage) {
@@ -22,6 +24,8 @@ export var ImageRenderer = function ImageRenderer(_ref) {
22
24
  alt: alt,
23
25
  previewOrientation: previewOrientation,
24
26
  onImageLoad: onImageLoad,
25
- onImageError: onImageError
27
+ onImageError: onImageError,
28
+ loading: nativeLazyLoad ? 'lazy' : undefined,
29
+ forceSyncDisplay: forceSyncDisplay
26
30
  }, resizeModeToMediaImageProps(resizeMode)));
27
31
  };
@@ -1,9 +1,10 @@
1
1
  import React from 'react';
2
2
  import { errorIcon } from '@atlaskit/media-ui/errorIcon';
3
3
  import { WarningIconWrapper, LoadingRateLimitedContainer, CouldntLoadWrapper, ErrorWrapper, LoadingRateLimitedTextWrapper } from './styled';
4
+ import { FormattedMessageWrapper } from '../../styled';
4
5
  import { messages } from '@atlaskit/media-ui';
5
- import { FormattedMessage } from 'react-intl';
6
- import { Breakpoint } from '../Breakpoint';
6
+ import { FormattedMessage } from 'react-intl-next';
7
+ import { Breakpoint } from '../common';
7
8
  export var LoadingRateLimited = function LoadingRateLimited(_ref) {
8
9
  var _ref$breakpoint = _ref.breakpoint,
9
10
  breakpoint = _ref$breakpoint === void 0 ? Breakpoint.SMALL : _ref$breakpoint,
@@ -12,5 +13,5 @@ export var LoadingRateLimited = function LoadingRateLimited(_ref) {
12
13
  return /*#__PURE__*/React.createElement(LoadingRateLimitedContainer, null, /*#__PURE__*/React.createElement(WarningIconWrapper, null, errorIcon), /*#__PURE__*/React.createElement(LoadingRateLimitedTextWrapper, {
13
14
  breakpoint: breakpoint,
14
15
  positionBottom: positionBottom
15
- }, /*#__PURE__*/React.createElement(CouldntLoadWrapper, null, /*#__PURE__*/React.createElement(FormattedMessage, messages.couldnt_load_file)), /*#__PURE__*/React.createElement(ErrorWrapper, null, /*#__PURE__*/React.createElement(FormattedMessage, messages.error_429))));
16
+ }, /*#__PURE__*/React.createElement(CouldntLoadWrapper, null, /*#__PURE__*/React.createElement(FormattedMessageWrapper, null, /*#__PURE__*/React.createElement(FormattedMessage, messages.couldnt_load_file))), /*#__PURE__*/React.createElement(ErrorWrapper, null, /*#__PURE__*/React.createElement(FormattedMessageWrapper, null, /*#__PURE__*/React.createElement(FormattedMessage, messages.error_429)))));
16
17
  };
@@ -10,7 +10,7 @@ export var WarningIconWrapper = styled.div(_templateObject2 || (_templateObject2
10
10
  export var LoadingRateLimitedTextWrapper = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n ", "\n"])), function (_ref) {
11
11
  var breakpoint = _ref.breakpoint,
12
12
  positionBottom = _ref.positionBottom;
13
- return "\n margin-top: 10px;\n overflow: hidden;\n color: ".concat(N300, ";\n display: block;\n width:100%;\n text-align:center;\n ").concat(generateResponsiveStyles(breakpoint, positionBottom, 1), "\n ");
13
+ return "\n margin-top: 10px;\n overflow: hidden;\n color: ".concat(N300, ";\n display: block;\n width:100%;\n text-align:center;\n ").concat(generateResponsiveStyles(breakpoint, positionBottom, false, 1), "\n ");
14
14
  });
15
15
  LoadingRateLimitedTextWrapper.displayName = 'LoadingRateLimitedTextWrapper';
16
16
  export var CouldntLoadWrapper = styled.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n font-weight: 550;\n"])));
@@ -1,16 +1,19 @@
1
1
  import React from 'react';
2
2
  import { StyledBar } from './styled';
3
- import { Breakpoint } from '../Breakpoint';
3
+ import { Breakpoint } from '../common';
4
4
  export var ProgressBar = function ProgressBar(_ref) {
5
5
  var progress = _ref.progress,
6
6
  _ref$breakpoint = _ref.breakpoint,
7
7
  breakpoint = _ref$breakpoint === void 0 ? Breakpoint.SMALL : _ref$breakpoint,
8
8
  _ref$positionBottom = _ref.positionBottom,
9
- positionBottom = _ref$positionBottom === void 0 ? false : _ref$positionBottom;
9
+ positionBottom = _ref$positionBottom === void 0 ? false : _ref$positionBottom,
10
+ _ref$showOnTop = _ref.showOnTop,
11
+ showOnTop = _ref$showOnTop === void 0 ? false : _ref$showOnTop;
10
12
  var normalizedProgress = Math.min(1, Math.max(0, progress || 0)) * 100;
11
13
  return /*#__PURE__*/React.createElement(StyledBar, {
12
14
  progress: normalizedProgress,
13
15
  breakpoint: breakpoint,
14
- positionBottom: positionBottom
16
+ positionBottom: positionBottom,
17
+ showOnTop: showOnTop
15
18
  });
16
19
  };
@@ -6,8 +6,7 @@ import styled from 'styled-components';
6
6
  import { borderRadius } from '@atlaskit/media-ui';
7
7
  import { rgba } from '../../../styles/mixins';
8
8
  import { N0, N400 } from '@atlaskit/theme/colors';
9
- import { getTitleBoxHeight, responsiveSettings } from '../common';
10
- import { Breakpoint } from '../Breakpoint';
9
+ import { Breakpoint, getTitleBoxHeight, responsiveSettings } from '../common';
11
10
  var height = 3;
12
11
  var padding = 1;
13
12
  var width = 95; // %
@@ -20,17 +19,18 @@ var smallSizeSettings = {
20
19
  var largeSizeSettings = {
21
20
  marginBottom: 12
22
21
  };
23
- export function generateResponsiveStyles(breakpoint, positionBottom) {
24
- var multiplier = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
22
+ export function generateResponsiveStyles(breakpoint, positionBottom, showOnTop) {
23
+ var multiplier = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
25
24
  var setting = breakpoint === Breakpoint.SMALL ? smallSizeSettings : largeSizeSettings;
26
25
  var marginPositionBottom = responsiveSettings[breakpoint].titleBox.verticalPadding;
27
26
  var marginBottom = setting.marginBottom * multiplier + (positionBottom ? marginPositionBottom : getTitleBoxHeight(breakpoint));
28
- return "\n bottom: ".concat(marginBottom, "px\n ");
27
+ return "\n ".concat(showOnTop ? 'top' : 'bottom', ": ").concat(marginBottom, "px\n ");
29
28
  }
30
29
  export var StyledBar = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n ", "\n"])), function (_ref) {
31
30
  var progress = _ref.progress,
32
31
  breakpoint = _ref.breakpoint,
33
- positionBottom = _ref.positionBottom;
34
- return "\n ".concat(borderRadius, "\n overflow: hidden;\n position: absolute;\n width: ").concat(width, "%;\n left: ").concat(left, "%;\n background-color: ").concat(rgba(N0, 0.8), ";\n height: ").concat(height + padding * 2, "px;\n padding: ").concat(padding, "px;\n\n ::before {\n content: '';\n width: ").concat(progress, "%;\n height: 100%;\n background-color: ").concat(N400, ";\n ").concat(borderRadius, "\n display: block;\n }\n\n ").concat(generateResponsiveStyles(breakpoint, positionBottom), "\n");
32
+ positionBottom = _ref.positionBottom,
33
+ showOnTop = _ref.showOnTop;
34
+ return "\n ".concat(borderRadius, "\n overflow: hidden;\n position: absolute;\n width: ").concat(width, "%;\n left: ").concat(left, "%;\n background-color: ").concat(rgba(N0, 0.8), ";\n height: ").concat(height + padding * 2, "px;\n padding: ").concat(padding, "px;\n box-sizing: border-box;\n\n ::before {\n content: '';\n width: ").concat(progress, "%;\n height: 100%;\n background-color: ").concat(N400, ";\n ").concat(borderRadius, "\n display: block;\n }\n\n ").concat(generateResponsiveStyles(breakpoint, positionBottom, showOnTop), "\n");
35
35
  });
36
36
  StyledBar.displayName = 'StyledProgressBar';
@@ -1,26 +1,68 @@
1
1
  import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
3
 
3
- var _templateObject;
4
+ var _templateObject, _templateObject2;
4
5
 
5
6
  import styled from 'styled-components';
6
7
  import { getCSSUnitValue } from '../../utils/getCSSUnitValue';
7
8
  import { getDefaultCardDimensions } from '../../utils/cardDimensions';
9
+ import { fontFamily } from '@atlaskit/theme/constants';
10
+ import { borderRadius } from '@atlaskit/media-ui';
11
+ import { N20, N60A } from '@atlaskit/theme/colors';
12
+ import { akEditorSelectedBoxShadow } from '@atlaskit/editor-shared-styles/consts';
8
13
  import { hideNativeBrowserTextSelectionStyles } from '@atlaskit/editor-shared-styles/selection';
14
+ import { transition } from '../../styles';
9
15
  import { tickBoxClassName, tickboxFixedStyles } from './tickBox/styled';
16
+ import { fixedBlanketStyles, blanketClassName } from './blanket/styled';
10
17
  import { fixedActionBarStyles, actionsBarClassName } from './actionsBar/styled';
11
18
  import { fixedPlayButtonStyles, playButtonClassName } from './playButton/styled';
12
- import { SSRFileExperienceWrapper } from './styledSSR';
19
+ import { Breakpoint, responsiveSettings } from './common';
20
+ var breakpointSizes = [[Breakpoint.SMALL, 599], [Breakpoint.LARGE, Infinity]];
21
+ export var calcBreakpointSize = function calcBreakpointSize() {
22
+ var wrapperWidth = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
23
+
24
+ var _ref = breakpointSizes.find(function (_ref3) {
25
+ var _ref4 = _slicedToArray(_ref3, 2),
26
+ _breakpoint = _ref4[0],
27
+ limit = _ref4[1];
28
+
29
+ return wrapperWidth <= limit;
30
+ }) || [Breakpoint.SMALL],
31
+ _ref2 = _slicedToArray(_ref, 1),
32
+ breakpoint = _ref2[0];
33
+
34
+ return breakpoint;
35
+ };
36
+
37
+ var generateResponsiveStyles = function generateResponsiveStyles() {
38
+ var breakpoint = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : Breakpoint.SMALL;
39
+ var setting = responsiveSettings[breakpoint];
40
+ return "\n font-size: ".concat(setting.fontSize, "px;\n line-height: ").concat(setting.lineHeight, "px;\n ");
41
+ };
13
42
 
14
43
  var getWrapperDimensions = function getWrapperDimensions(dimensions, appearance) {
15
- var _ref = dimensions || {},
16
- width = _ref.width,
17
- height = _ref.height;
44
+ var _ref5 = dimensions || {},
45
+ width = _ref5.width,
46
+ height = _ref5.height;
18
47
 
19
48
  var _getDefaultCardDimens = getDefaultCardDimensions(appearance),
20
49
  defaultWidth = _getDefaultCardDimens.width,
21
50
  defaultHeight = _getDefaultCardDimens.height;
22
51
 
23
52
  return "\n width: ".concat(getCSSUnitValue(width || defaultWidth), ";\n max-width: 100%;\n height: ").concat(getCSSUnitValue(height || defaultHeight), ";\n max-height: 100%;\n ");
53
+ }; // This is a trick to simulate the blue border without affecting the dimensions.
54
+ // CSS outline has no 'radius', therefore we can't achieve the same effect with it
55
+
56
+
57
+ var getWrapperShadow = function getWrapperShadow(disableOverlay, selected) {
58
+ var withOverlayShadow = !disableOverlay ? "0 1px 1px ".concat(N60A, ", 0 0 1px 0 ").concat(N60A) : '';
59
+ var selectedShadow = selected ? akEditorSelectedBoxShadow : '';
60
+ var shadow = [selectedShadow, withOverlayShadow].filter(Boolean).join(', ');
61
+ return shadow ? "box-shadow: ".concat(shadow, ";") : '';
62
+ };
63
+
64
+ var getCursorStyle = function getCursorStyle(shouldUsePointerCursor) {
65
+ return "cursor: ".concat(shouldUsePointerCursor ? 'pointer' : 'default', ";");
24
66
  };
25
67
 
26
68
  var getClickablePlayButtonStyles = function getClickablePlayButtonStyles(isPlayButtonClickable) {
@@ -39,12 +81,18 @@ var getSelectableTickBoxStyles = function getSelectableTickBoxStyles(isTickBoxSe
39
81
  return "\n &:hover .".concat(tickBoxClassName, " {\n ").concat(tickboxFixedStyles, "\n }\n ");
40
82
  };
41
83
 
42
- export var NewFileExperienceWrapper = styled(SSRFileExperienceWrapper)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n ", "\n"])), function (_ref2) {
43
- var dimensions = _ref2.dimensions,
44
- appearance = _ref2.appearance,
45
- isPlayButtonClickable = _ref2.isPlayButtonClickable,
46
- isTickBoxSelectable = _ref2.isTickBoxSelectable,
47
- shouldDisplayTooltip = _ref2.shouldDisplayTooltip;
48
- return "\n ".concat(hideNativeBrowserTextSelectionStyles, "\n\n /* We use classnames from here exceptionally to be able to handle styles when the Card is on hover */\n ").concat(getClickablePlayButtonStyles(isPlayButtonClickable), "\n ").concat(getSelectableTickBoxStyles(isTickBoxSelectable), "\n\n &:hover .").concat(actionsBarClassName, " {\n ").concat(fixedActionBarStyles, "\n }\n\n /* Tooltip does not support percentage dimensions. We enforce them here */\n ").concat(shouldDisplayTooltip ? "> div { ".concat(getWrapperDimensions(dimensions, appearance), " }") : '', "\n");
84
+ export var NewFileExperienceWrapper = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n ", "\n"])), function (_ref6) {
85
+ var breakpoint = _ref6.breakpoint,
86
+ dimensions = _ref6.dimensions,
87
+ appearance = _ref6.appearance,
88
+ shouldUsePointerCursor = _ref6.shouldUsePointerCursor,
89
+ disableOverlay = _ref6.disableOverlay,
90
+ displayBackground = _ref6.displayBackground,
91
+ selected = _ref6.selected,
92
+ isPlayButtonClickable = _ref6.isPlayButtonClickable,
93
+ isTickBoxSelectable = _ref6.isTickBoxSelectable,
94
+ shouldDisplayTooltip = _ref6.shouldDisplayTooltip;
95
+ return "\n ".concat(transition(), "\n box-sizing: border-box;\n * {\n box-sizing: border-box;\n }\n position: relative;\n font-family: ").concat(fontFamily(), ";\n ").concat(getWrapperDimensions(dimensions, appearance), "\n ").concat(displayBackground ? "background-color: ".concat(N20, ";") : '', "\n ").concat(borderRadius, "\n ").concat(getCursorStyle(shouldUsePointerCursor), "\n ").concat(getWrapperShadow(disableOverlay, selected), "\n ").concat(generateResponsiveStyles(breakpoint), "\n ").concat(hideNativeBrowserTextSelectionStyles, "\n\n /* We use classnames from here exceptionally to be able to handle styles when the Card is on hover */\n ").concat(getClickablePlayButtonStyles(isPlayButtonClickable), "\n ").concat(getSelectableTickBoxStyles(isTickBoxSelectable), "\n &:hover .").concat(blanketClassName, " {\n ").concat(fixedBlanketStyles, "\n }\n\n &:hover .").concat(actionsBarClassName, " {\n ").concat(fixedActionBarStyles, "\n }\n\n /* Tooltip does not support percentage dimensions. We enforce them here */\n ").concat(shouldDisplayTooltip ? "> div { width: 100%; height: 100% }" : '', "\n");
49
96
  });
50
- NewFileExperienceWrapper.displayName = 'NewFileExperienceWrapper';
97
+ NewFileExperienceWrapper.displayName = 'NewFileExperienceWrapper';
98
+ export var CardImageContainer = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n position: relative;\n max-width: 100%;\n width: 100%;\n height: 100%;\n max-height: 100%;\n overflow: hidden;\n ", "\n"])), borderRadius);
@@ -3,7 +3,8 @@ import { TitleBoxWrapper, ErrorMessageWrapper } from './styled';
3
3
  import EditorWarningIcon from '@atlaskit/icon/glyph/editor/warning';
4
4
  import { messages } from '@atlaskit/media-ui';
5
5
  import { R300 } from '@atlaskit/theme/colors';
6
- import { FormattedMessage } from 'react-intl';
6
+ import { FormattedMessage } from 'react-intl-next';
7
+ import { FormattedMessageWrapper } from '../../styled';
7
8
  export var FailedTitleBox = function FailedTitleBox(_ref) {
8
9
  var breakpoint = _ref.breakpoint,
9
10
  _ref$customMessage = _ref.customMessage,
@@ -14,5 +15,5 @@ export var FailedTitleBox = function FailedTitleBox(_ref) {
14
15
  label: 'Warning',
15
16
  size: 'small',
16
17
  primaryColor: R300
17
- }), /*#__PURE__*/React.createElement(FormattedMessage, customMessage)));
18
+ }), /*#__PURE__*/React.createElement(FormattedMessageWrapper, null, /*#__PURE__*/React.createElement(FormattedMessage, customMessage))));
18
19
  };
@@ -3,8 +3,7 @@ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral
3
3
  var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
4
4
 
5
5
  import styled from 'styled-components';
6
- import { responsiveSettings, getTitleBoxHeight } from '../common';
7
- import { Breakpoint } from '../Breakpoint';
6
+ import { responsiveSettings, getTitleBoxHeight, Breakpoint } from '../common';
8
7
  import { N0 } from '@atlaskit/theme/colors';
9
8
  import { rgba } from '../../../styles/mixins';
10
9
 
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import LockFilledIcon from '@atlaskit/icon/glyph/lock-filled';
3
- import { injectIntl } from 'react-intl';
3
+ import { injectIntl } from 'react-intl-next';
4
4
  import { TitleBoxWrapper, TitleBoxHeader, TitleBoxFooter, TitleBoxIcon } from './styled';
5
5
  import { Truncate } from '@atlaskit/media-ui/truncateText';
6
6
  import { formatDate } from '@atlaskit/media-ui/formatDate';
@@ -1,9 +1,11 @@
1
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
1
2
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
3
  import _createClass from "@babel/runtime/helpers/createClass";
3
4
  import _inherits from "@babel/runtime/helpers/inherits";
4
5
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
5
6
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
6
7
  import _extends from "@babel/runtime/helpers/extends";
8
+ var _excluded = ["triggerRef"];
7
9
 
8
10
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
9
11
 
@@ -80,16 +82,22 @@ export var CardActionsDropdownMenu = /*#__PURE__*/function (_Component) {
80
82
 
81
83
  if (actions.length > 0) {
82
84
  return /*#__PURE__*/React.createElement(DropdownMenu, {
83
- "data-testid": "media-card-actions-menu",
85
+ testId: "media-card-actions-menu",
84
86
  onOpenChange: onOpenChange,
85
- trigger: /*#__PURE__*/React.createElement(CardActionButtonWithAnalytics, {
86
- variant: triggerVariant,
87
- style: {
88
- color: triggerColor
89
- }
90
- }, /*#__PURE__*/React.createElement(MoreIcon, {
91
- label: "more"
92
- }))
87
+ trigger: function trigger(_ref) {
88
+ var triggerRef = _ref.triggerRef,
89
+ providedProps = _objectWithoutProperties(_ref, _excluded);
90
+
91
+ return /*#__PURE__*/React.createElement(CardActionButtonWithAnalytics, _extends({
92
+ variant: triggerVariant,
93
+ style: {
94
+ color: triggerColor
95
+ },
96
+ ref: triggerRef
97
+ }, providedProps), /*#__PURE__*/React.createElement(MoreIcon, {
98
+ label: "more"
99
+ }));
100
+ }
93
101
  }, /*#__PURE__*/React.createElement(DropdownItemGroup, null, actions.map(createDropdownItemWithAnalytics)));
94
102
  } else {
95
103
  return null;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { FormattedMessage } from 'react-intl';
2
+ import { FormattedMessage } from 'react-intl-next';
3
3
  import { messages } from '@atlaskit/media-ui';
4
4
  export var getErrorMessage = function getErrorMessage(status) {
5
5
  return status === 'error' && /*#__PURE__*/React.createElement(FormattedMessage, messages.failed_to_load);
@@ -4,8 +4,28 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
4
4
 
5
5
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
6
6
 
7
- import React, { useEffect } from 'react';
8
- import { LazyContent } from './lazyContent';
7
+ import React, { useEffect, forwardRef } from 'react';
8
+ /**
9
+ * As IntersectionObserver::rootMargin doesn't work within IFrames, we use an empty div + dynamic offsetTop to eagerly detect cards entering viewport.
10
+ * Using this approach, we can lazy load cards ABS_VIEWPORT_ANCHOR_OFFSET_TOP px before they enter viewport.
11
+ */
12
+
13
+ export var ABS_VIEWPORT_ANCHOR_OFFSET_TOP = 900; //px
14
+
15
+ export var ViewportAnchor = /*#__PURE__*/forwardRef(function (props, ref) {
16
+ if (typeof IntersectionObserver === 'undefined') {
17
+ return null;
18
+ }
19
+
20
+ return /*#__PURE__*/React.createElement("div", {
21
+ ref: ref,
22
+ className: "media-card-viewport-anchor",
23
+ style: {
24
+ position: 'absolute',
25
+ top: "".concat(props.offsetTop, "px")
26
+ }
27
+ });
28
+ });
9
29
 
10
30
  var createIntersectionObserverCallback = function createIntersectionObserverCallback(onVisible) {
11
31
  return function (entries, observer) {
@@ -30,33 +50,40 @@ var createIntersectionObserverCallback = function createIntersectionObserverCall
30
50
  };
31
51
  };
32
52
 
33
- var Observer = function Observer(_ref) {
53
+ var ViewportObserver = function ViewportObserver(_ref) {
34
54
  var onVisible = _ref.onVisible,
55
+ cardEl = _ref.cardEl,
35
56
  children = _ref.children,
36
- targetRef = _ref.targetRef;
57
+ preAnchorRef = _ref.preAnchorRef,
58
+ postAnchorRef = _ref.postAnchorRef;
37
59
  useEffect(function () {
38
60
  // IntersectionObserver uses root and target elements to detect intersections, defaulting root to the viewport
39
61
  var intersectionObserver = new IntersectionObserver(createIntersectionObserverCallback(onVisible));
40
- targetRef && intersectionObserver.observe(targetRef);
62
+ (preAnchorRef === null || preAnchorRef === void 0 ? void 0 : preAnchorRef.current) && intersectionObserver.observe(preAnchorRef.current);
63
+ (postAnchorRef === null || postAnchorRef === void 0 ? void 0 : postAnchorRef.current) && intersectionObserver.observe(postAnchorRef.current);
64
+ cardEl && intersectionObserver.observe(cardEl);
41
65
  return function () {
42
66
  intersectionObserver.disconnect();
43
67
  };
44
- }, [targetRef, onVisible]);
68
+ }, [cardEl, preAnchorRef, postAnchorRef, onVisible]);
45
69
  return /*#__PURE__*/React.createElement(React.Fragment, null, children);
46
70
  };
47
71
 
48
- export var createViewportDetector = function createViewportDetector(isIntersectionObserverSupported) {
49
- return function (_ref2) {
50
- var children = _ref2.children,
51
- targetRef = _ref2.targetRef,
52
- onVisible = _ref2.onVisible;
53
- return isIntersectionObserverSupported ? /*#__PURE__*/React.createElement(Observer, {
54
- targetRef: targetRef,
55
- onVisible: onVisible
56
- }, children) : /*#__PURE__*/React.createElement(LazyContent, {
57
- placeholder: /*#__PURE__*/React.createElement(React.Fragment, null, children),
58
- onRender: onVisible
59
- }, children);
60
- };
61
- };
62
- export var ViewportDetector = createViewportDetector(typeof IntersectionObserver !== 'undefined');
72
+ export var ViewportDetector = function ViewportDetector(_ref2) {
73
+ var cardEl = _ref2.cardEl,
74
+ preAnchorRef = _ref2.preAnchorRef,
75
+ postAnchorRef = _ref2.postAnchorRef,
76
+ onVisible = _ref2.onVisible,
77
+ children = _ref2.children;
78
+
79
+ if (typeof IntersectionObserver === 'undefined') {
80
+ return /*#__PURE__*/React.createElement(React.Fragment, null, children);
81
+ }
82
+
83
+ return /*#__PURE__*/React.createElement(ViewportObserver, {
84
+ cardEl: cardEl,
85
+ preAnchorRef: preAnchorRef,
86
+ postAnchorRef: postAnchorRef,
87
+ onVisible: onVisible
88
+ }, children);
89
+ };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/media-card",
3
- "version": "72.0.0",
3
+ "version": "73.1.1",
4
4
  "sideEffects": false
5
5
  }
@@ -1,8 +1,9 @@
1
1
  import { CardPreview } from '.';
2
- export declare type MediaCardErrorPrimaryReason = 'upload' | 'metadata-fetch' | 'error-file-state' | RemotePreviewPrimaryReason | LocalPreviewPrimaryReason | ImageLoadPrimaryReason | 'preview-fetch';
2
+ export declare type MediaCardErrorPrimaryReason = 'upload' | 'metadata-fetch' | 'error-file-state' | RemotePreviewPrimaryReason | LocalPreviewPrimaryReason | ImageLoadPrimaryReason | SsrPreviewPrimaryReason | 'preview-fetch';
3
3
  export declare type ImageLoadPrimaryReason = 'cache-remote-uri' | 'cache-local-uri' | 'local-uri' | 'remote-uri' | 'external-uri' | 'unknown-uri';
4
4
  export declare type RemotePreviewPrimaryReason = 'remote-preview-fetch' | 'remote-preview-not-ready';
5
5
  export declare type LocalPreviewPrimaryReason = 'local-preview-get' | 'local-preview-unsupported' | 'local-preview-rejected' | 'local-preview-image' | 'local-preview-video';
6
+ export declare type SsrPreviewPrimaryReason = 'ssr-client-uri' | 'ssr-client-load' | 'ssr-server-uri' | 'ssr-server-load';
6
7
  export declare class MediaCardError extends Error {
7
8
  readonly primaryReason: MediaCardErrorPrimaryReason;
8
9
  readonly secondaryError?: Error | undefined;
@@ -18,7 +19,12 @@ export declare class RemotePreviewError extends MediaCardError {
18
19
  readonly secondaryError?: Error | undefined;
19
20
  constructor(primaryReason: RemotePreviewPrimaryReason, secondaryError?: Error | undefined);
20
21
  }
21
- export declare const getImageLoadPrimaryReason: (source?: "local" | "remote" | "cache-local" | "cache-remote" | "external" | undefined) => ImageLoadPrimaryReason;
22
+ export declare class SsrPreviewError extends MediaCardError {
23
+ readonly primaryReason: SsrPreviewPrimaryReason;
24
+ readonly secondaryError?: Error | undefined;
25
+ constructor(primaryReason: SsrPreviewPrimaryReason, secondaryError?: Error | undefined);
26
+ }
27
+ export declare const getImageLoadPrimaryReason: (source?: "local" | "remote" | "ssr-server" | "ssr-client" | "cache-local" | "cache-remote" | "cache-ssr-client" | "cache-ssr-server" | "external" | undefined) => ImageLoadPrimaryReason;
22
28
  export declare class ImageLoadError extends MediaCardError {
23
29
  constructor(source?: CardPreview['source']);
24
30
  }
@@ -28,4 +34,4 @@ export declare const isRemotePreviewError: (err: Error) => err is LocalPreviewEr
28
34
  export declare const isUnsupportedLocalPreviewError: (err: Error) => boolean;
29
35
  export declare function isImageLoadError(err: Error): err is ImageLoadError;
30
36
  export declare const ensureMediaCardError: (primaryReason: MediaCardErrorPrimaryReason, error: Error) => MediaCardError;
31
- export declare const isUploadError: (error: MediaCardError) => boolean;
37
+ export declare const isUploadError: (error?: MediaCardError | undefined) => boolean | undefined;
@@ -1,7 +1,7 @@
1
1
  import { MouseEvent } from 'react';
2
2
  import { FileDetails, MediaClient, Identifier, ImageResizeMode, FileState } from '@atlaskit/media-client';
3
3
  import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
4
- import { MediaFeatureFlags, NumericalCardDimensions } from '@atlaskit/media-common';
4
+ import { MediaFeatureFlags, NumericalCardDimensions, SSR } from '@atlaskit/media-common';
5
5
  import { CardAction } from './actions';
6
6
  import { MediaViewerDataSource } from '@atlaskit/media-viewer';
7
7
  import { CardPreview, CardStatus, CardAppearance } from './types';
@@ -48,10 +48,12 @@ export interface CardProps extends SharedCardProps, CardEventProps {
48
48
  readonly mediaViewerDataSource?: MediaViewerDataSource;
49
49
  readonly contextId?: string;
50
50
  readonly shouldEnableDownloadButton?: boolean;
51
+ readonly ssr?: SSR;
51
52
  }
52
53
  export interface CardState {
53
54
  status: CardStatus;
54
55
  isCardVisible: boolean;
56
+ shouldAutoplay?: boolean;
55
57
  isPlayingFile: boolean;
56
58
  mediaViewerSelectedItem?: Identifier;
57
59
  fileState?: FileState;
@@ -1,20 +1,6 @@
1
1
  import React from 'react';
2
- import { WithMediaClientConfigProps } from '@atlaskit/media-client';
3
- import { MediaCardAnalyticsErrorBoundaryProps } from '../media-card-analytics-error-boundary';
4
- import { CardWithAnalyticsEventsProps } from '.';
5
- export declare type CardWithMediaClientConfigProps = WithMediaClientConfigProps<CardWithAnalyticsEventsProps>;
6
- declare type CardWithMediaClientConfigComponent = React.ComponentType<CardWithMediaClientConfigProps>;
7
- declare type MediaCardErrorBoundaryComponent = React.ComponentType<MediaCardAnalyticsErrorBoundaryProps>;
8
- export interface AsyncCardState {
9
- Card?: CardWithMediaClientConfigComponent;
10
- MediaCardErrorBoundary?: MediaCardErrorBoundaryComponent;
11
- }
12
- export default class CardLoader extends React.PureComponent<CardWithMediaClientConfigProps & AsyncCardState, AsyncCardState> {
13
- static displayName: string;
14
- static Card?: CardWithMediaClientConfigComponent;
15
- static MediaCardErrorBoundary?: MediaCardErrorBoundaryComponent;
16
- state: AsyncCardState;
17
- componentDidMount(): Promise<void>;
18
- render(): JSX.Element;
19
- }
20
- export {};
2
+ import type { WithMediaClientConfigProps } from '@atlaskit/media-client';
3
+ import type { CardBaseProps } from '.';
4
+ export declare type CardWithMediaClientConfigProps = WithMediaClientConfigProps<CardBaseProps>;
5
+ declare const CardLoader: React.FC<CardWithMediaClientConfigProps>;
6
+ export default CardLoader;
@@ -1,5 +1,5 @@
1
1
  import { MediaClient, FilePreview, FileState, MediaStoreGetFileImageParams, MediaBlobUrlAttrs } from '@atlaskit/media-client';
2
- import { MediaFeatureFlags } from '@atlaskit/media-common';
2
+ import { MediaFeatureFlags, SSR } from '@atlaskit/media-common';
3
3
  import { CardDimensions } from '../../../utils/cardDimensions';
4
4
  import { MediaCardError } from '../../../errors';
5
5
  import { CardStatus, CardPreview } from '../../../types';
@@ -42,3 +42,9 @@ export declare const shouldResolvePreview: ({ status, fileState, dimensions, pre
42
42
  isBannedLocalPreview: boolean;
43
43
  featureFlags?: MediaFeatureFlags | undefined;
44
44
  }) => boolean;
45
+ export declare const getSSRCardPreview: (ssr: SSR, mediaClient: MediaClient, id: string, params: MediaStoreGetFileImageParams, mediaBlobUrlAttrs?: MediaBlobUrlAttrs | undefined) => CardPreview;
46
+ export declare const isLocalPreview: (preview: CardPreview) => boolean;
47
+ export declare const isSSRPreview: (preview: CardPreview) => boolean;
48
+ export declare const isSSRServerPreview: (preview: CardPreview) => boolean;
49
+ export declare const isSSRClientPreview: (preview: CardPreview) => boolean;
50
+ export declare const fetchAndCacheRemotePreview: (mediaClient: MediaClient, id: string, dimensions: CardDimensions, params: MediaStoreGetFileImageParams, mediaBlobUrlAttrs?: MediaBlobUrlAttrs | undefined) => Promise<CardPreview>;
@@ -1,19 +1,18 @@
1
- /// <reference types="react-intl" />
2
1
  import React, { Component } from 'react';
3
2
  import { UIAnalyticsEvent, WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
4
3
  import { FileIdentifier } from '@atlaskit/media-client';
5
4
  import { Subscription } from 'rxjs/Subscription';
5
+ import { WrappedComponentProps } from 'react-intl-next';
6
6
  import { CardAction, CardProps, CardState } from '../..';
7
- export declare type CardWithAnalyticsEventsProps = CardProps & WithAnalyticsEventsProps;
8
- export declare class CardBase extends Component<CardWithAnalyticsEventsProps, CardState> {
7
+ export declare type CardBaseProps = CardProps & WithAnalyticsEventsProps & Partial<WrappedComponentProps>;
8
+ export declare class CardBase extends Component<CardBaseProps, CardState> {
9
9
  private hasBeenMounted;
10
+ private viewportPreAnchorRef;
11
+ private viewportPostAnchorRef;
10
12
  private timeElapsedTillCommenced;
11
13
  subscription?: Subscription;
12
14
  static defaultProps: Partial<CardProps>;
13
- static contextTypes: {
14
- intl: ReactIntl.IntlShape;
15
- };
16
- constructor(props: CardWithAnalyticsEventsProps);
15
+ constructor(props: CardBaseProps);
17
16
  componentDidMount(): void;
18
17
  componentDidUpdate(prevProps: CardProps, prevState: CardState): void;
19
18
  componentWillUnmount(): void;
@@ -21,6 +20,8 @@ export declare class CardBase extends Component<CardWithAnalyticsEventsProps, Ca
21
20
  private getImageURLParams;
22
21
  private getMediaBlobUrlAttrs;
23
22
  private getCardPreviewParams;
23
+ private setCacheSSRPreview;
24
+ private resolveSSRPreview;
24
25
  private resolvePreview;
25
26
  subscribeInternalFile(identifier: FileIdentifier): void;
26
27
  private get requestedDimensions();
@@ -50,4 +51,4 @@ export declare class CardBase extends Component<CardWithAnalyticsEventsProps, Ca
50
51
  onClick: (event: React.MouseEvent<HTMLDivElement>, analyticsEvent?: UIAnalyticsEvent | undefined) => void;
51
52
  onMouseEnter: (event: React.MouseEvent<HTMLDivElement>) => void;
52
53
  }
53
- export declare const Card: React.ComponentType<CardWithAnalyticsEventsProps>;
54
+ export declare const Card: React.ComponentType<CardBaseProps>;
@@ -1,9 +1,9 @@
1
1
  import React, { MouseEvent } from 'react';
2
- import { FormattedMessage } from 'react-intl';
3
2
  import { MediaItemType, FileDetails } from '@atlaskit/media-client';
4
3
  import { WithAnalyticsEventsProps, UIAnalyticsEvent } from '@atlaskit/analytics-next';
5
4
  import { SharedCardProps, CardStatus } from '../index';
6
5
  import { MediaCardError } from '../errors';
6
+ import { MessageDescriptor } from 'react-intl-next';
7
7
  export interface CardViewOwnProps extends SharedCardProps {
8
8
  readonly status: CardStatus;
9
9
  readonly mediaItemType: MediaItemType;
@@ -18,6 +18,8 @@ export interface CardViewOwnProps extends SharedCardProps {
18
18
  readonly innerRef?: (instance: HTMLDivElement | null) => void;
19
19
  readonly onImageLoad: () => void;
20
20
  readonly onImageError: () => void;
21
+ readonly nativeLazyLoad?: boolean;
22
+ readonly forceSyncDisplay?: boolean;
21
23
  disableAnimation?: boolean;
22
24
  }
23
25
  export interface CardViewState {
@@ -37,7 +39,7 @@ export interface RenderConfigByStatus {
37
39
  renderSpinner?: boolean;
38
40
  renderFailedTitleBox?: boolean;
39
41
  renderTickBox?: boolean;
40
- customTitleMessage?: FormattedMessage.MessageDescriptor;
42
+ customTitleMessage?: MessageDescriptor;
41
43
  }
42
44
  /**
43
45
  * This is classic vanilla CardView class. To create an instance of class one would need to supply
@@ -71,4 +73,4 @@ export declare class CardViewBase extends React.Component<CardViewProps, CardVie
71
73
  private getRenderConfigByStatus;
72
74
  private renderNewExperienceCard;
73
75
  }
74
- export declare const CardView: React.ForwardRefExoticComponent<Pick<Pick<CardViewProps, "progress" | "metadata" | "onClick" | "onMouseEnter" | "innerRef" | "appearance" | "error" | "actions" | "testId" | "selectable" | "selected" | "alt" | "disableOverlay" | "dimensions" | "featureFlags" | "dataURI" | "status" | "mediaItemType" | "resizeMode" | "onDisplayImage" | "previewOrientation" | "onImageError" | "onImageLoad" | "titleBoxBgColor" | "titleBoxIcon" | "disableAnimation" | "originalDimensions">, never> & Partial<Pick<Pick<CardViewProps, "progress" | "metadata" | "onClick" | "onMouseEnter" | "innerRef" | "appearance" | "error" | "actions" | "testId" | "selectable" | "selected" | "alt" | "disableOverlay" | "dimensions" | "featureFlags" | "dataURI" | "status" | "mediaItemType" | "resizeMode" | "onDisplayImage" | "previewOrientation" | "onImageError" | "onImageLoad" | "titleBoxBgColor" | "titleBoxIcon" | "disableAnimation" | "originalDimensions">, "progress" | "metadata" | "onClick" | "onMouseEnter" | "innerRef" | "appearance" | "error" | "actions" | "testId" | "selectable" | "selected" | "alt" | "disableOverlay" | "dimensions" | "featureFlags" | "dataURI" | "status" | "mediaItemType" | "resizeMode" | "onDisplayImage" | "previewOrientation" | "onImageError" | "onImageLoad" | "titleBoxBgColor" | "titleBoxIcon" | "disableAnimation" | "originalDimensions">> & Partial<Pick<Partial<CardViewOwnProps>, never>> & React.RefAttributes<any>>;
76
+ export declare const CardView: React.ForwardRefExoticComponent<Pick<Pick<CardViewProps, "progress" | "metadata" | "onClick" | "onMouseEnter" | "innerRef" | "testId" | "appearance" | "error" | "actions" | "selectable" | "selected" | "alt" | "disableOverlay" | "dimensions" | "featureFlags" | "dataURI" | "status" | "mediaItemType" | "resizeMode" | "onDisplayImage" | "previewOrientation" | "onImageError" | "onImageLoad" | "forceSyncDisplay" | "nativeLazyLoad" | "titleBoxBgColor" | "titleBoxIcon" | "disableAnimation" | "originalDimensions">, never> & Partial<Pick<Pick<CardViewProps, "progress" | "metadata" | "onClick" | "onMouseEnter" | "innerRef" | "testId" | "appearance" | "error" | "actions" | "selectable" | "selected" | "alt" | "disableOverlay" | "dimensions" | "featureFlags" | "dataURI" | "status" | "mediaItemType" | "resizeMode" | "onDisplayImage" | "previewOrientation" | "onImageError" | "onImageLoad" | "forceSyncDisplay" | "nativeLazyLoad" | "titleBoxBgColor" | "titleBoxIcon" | "disableAnimation" | "originalDimensions">, "progress" | "metadata" | "onClick" | "onMouseEnter" | "innerRef" | "testId" | "appearance" | "error" | "actions" | "selectable" | "selected" | "alt" | "disableOverlay" | "dimensions" | "featureFlags" | "dataURI" | "status" | "mediaItemType" | "resizeMode" | "onDisplayImage" | "previewOrientation" | "onImageError" | "onImageLoad" | "forceSyncDisplay" | "nativeLazyLoad" | "titleBoxBgColor" | "titleBoxIcon" | "disableAnimation" | "originalDimensions">> & Partial<Pick<Partial<CardViewOwnProps>, never>> & React.RefAttributes<any>>;
@@ -16,8 +16,10 @@ export default class MediaInlineCardLoader extends React.PureComponent<MediaInli
16
16
  static displayName: string;
17
17
  static MediaInlineCard?: MediaInlineCardWithMediaClientConfigComponent;
18
18
  static ErrorBoundary?: ErrorBoundaryComponent;
19
+ isMounted: boolean;
19
20
  state: MediaInlineCardLoaderState;
20
21
  componentDidMount(): Promise<void>;
22
+ componentWillUnmount(): Promise<void>;
21
23
  render(): JSX.Element;
22
24
  }
23
25
  export {};
@@ -1,6 +1,6 @@
1
1
  import React, { FC } from 'react';
2
2
  import { FileIdentifier, MediaClient } from '@atlaskit/media-client';
3
- import { InjectedIntlProps } from 'react-intl';
3
+ import { WrappedComponentProps } from 'react-intl-next';
4
4
  import { MediaViewerDataSource } from '@atlaskit/media-viewer';
5
5
  export interface MediaInlineCardProps {
6
6
  identifier: FileIdentifier;
@@ -10,7 +10,5 @@ export interface MediaInlineCardProps {
10
10
  onClick?: React.EventHandler<React.MouseEvent | React.KeyboardEvent>;
11
11
  mediaViewerDataSource?: MediaViewerDataSource;
12
12
  }
13
- export declare const MediaInlineCardInternal: FC<MediaInlineCardProps & InjectedIntlProps>;
14
- export declare const MediaInlineCard: React.ComponentClass<MediaInlineCardProps, any> & {
15
- WrappedComponent: ReactIntl.ComponentConstructor<MediaInlineCardProps & InjectedIntlProps>;
16
- };
13
+ export declare const MediaInlineCardInternal: FC<MediaInlineCardProps & WrappedComponentProps>;
14
+ export declare const MediaInlineCard: React.FC<MediaInlineCardProps>;