@atlaskit/media-card 77.5.2 → 77.6.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 (62) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/cjs/card/card.js +1 -1
  3. package/dist/cjs/card/media-card-analytics-error-boundary.js +1 -1
  4. package/dist/cjs/card/v2/cardV2.js +1 -1
  5. package/dist/cjs/card/v2/cardviews/cardViewWrapper.js +100 -0
  6. package/dist/cjs/card/v2/cardviews/errorCardView.js +87 -0
  7. package/dist/cjs/card/v2/cardviews/iconCardView.js +79 -0
  8. package/dist/cjs/card/v2/cardviews/imageCardView.js +89 -0
  9. package/dist/cjs/card/v2/cardviews/index.js +282 -0
  10. package/dist/cjs/card/v2/cardviews/loadingCardView.js +53 -0
  11. package/dist/cjs/card/v2/cardviews/processingCardView.js +65 -0
  12. package/dist/cjs/card/v2/cardviews/videoCardView.js +94 -0
  13. package/dist/cjs/card/v2/fileCard.js +4 -1
  14. package/dist/cjs/inline/loader.js +1 -1
  15. package/dist/cjs/utils/ufoExperiences.js +1 -1
  16. package/dist/es2019/card/card.js +1 -1
  17. package/dist/es2019/card/media-card-analytics-error-boundary.js +1 -1
  18. package/dist/es2019/card/v2/cardV2.js +1 -1
  19. package/dist/es2019/card/v2/cardviews/cardViewWrapper.js +92 -0
  20. package/dist/es2019/card/v2/cardviews/errorCardView.js +82 -0
  21. package/dist/es2019/card/v2/cardviews/iconCardView.js +70 -0
  22. package/dist/es2019/card/v2/cardviews/imageCardView.js +75 -0
  23. package/dist/es2019/card/v2/cardviews/index.js +268 -0
  24. package/dist/es2019/card/v2/cardviews/loadingCardView.js +48 -0
  25. package/dist/es2019/card/v2/cardviews/processingCardView.js +60 -0
  26. package/dist/es2019/card/v2/cardviews/videoCardView.js +80 -0
  27. package/dist/es2019/card/v2/fileCard.js +4 -1
  28. package/dist/es2019/inline/loader.js +1 -1
  29. package/dist/es2019/utils/ufoExperiences.js +1 -1
  30. package/dist/esm/card/card.js +1 -1
  31. package/dist/esm/card/media-card-analytics-error-boundary.js +1 -1
  32. package/dist/esm/card/v2/cardV2.js +1 -1
  33. package/dist/esm/card/v2/cardviews/cardViewWrapper.js +93 -0
  34. package/dist/esm/card/v2/cardviews/errorCardView.js +79 -0
  35. package/dist/esm/card/v2/cardviews/iconCardView.js +71 -0
  36. package/dist/esm/card/v2/cardviews/imageCardView.js +81 -0
  37. package/dist/esm/card/v2/cardviews/index.js +271 -0
  38. package/dist/esm/card/v2/cardviews/loadingCardView.js +45 -0
  39. package/dist/esm/card/v2/cardviews/processingCardView.js +57 -0
  40. package/dist/esm/card/v2/cardviews/videoCardView.js +86 -0
  41. package/dist/esm/card/v2/fileCard.js +4 -1
  42. package/dist/esm/inline/loader.js +1 -1
  43. package/dist/esm/utils/ufoExperiences.js +1 -1
  44. package/dist/types/card/ui/wrapper/types.d.ts +2 -2
  45. package/dist/types/card/v2/cardviews/cardViewWrapper.d.ts +38 -0
  46. package/dist/types/card/v2/cardviews/errorCardView.d.ts +11 -0
  47. package/dist/types/card/v2/cardviews/iconCardView.d.ts +12 -0
  48. package/dist/types/card/v2/cardviews/imageCardView.d.ts +21 -0
  49. package/dist/types/card/v2/cardviews/index.d.ts +45 -0
  50. package/dist/types/card/v2/cardviews/loadingCardView.d.ts +10 -0
  51. package/dist/types/card/v2/cardviews/processingCardView.d.ts +8 -0
  52. package/dist/types/card/v2/cardviews/videoCardView.d.ts +21 -0
  53. package/dist/types-ts4.5/card/ui/wrapper/types.d.ts +2 -2
  54. package/dist/types-ts4.5/card/v2/cardviews/cardViewWrapper.d.ts +38 -0
  55. package/dist/types-ts4.5/card/v2/cardviews/errorCardView.d.ts +11 -0
  56. package/dist/types-ts4.5/card/v2/cardviews/iconCardView.d.ts +12 -0
  57. package/dist/types-ts4.5/card/v2/cardviews/imageCardView.d.ts +21 -0
  58. package/dist/types-ts4.5/card/v2/cardviews/index.d.ts +45 -0
  59. package/dist/types-ts4.5/card/v2/cardviews/loadingCardView.d.ts +10 -0
  60. package/dist/types-ts4.5/card/v2/cardviews/processingCardView.d.ts +8 -0
  61. package/dist/types-ts4.5/card/v2/cardviews/videoCardView.d.ts +21 -0
  62. package/package.json +4 -2
@@ -0,0 +1,45 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ /** @jsx jsx */
3
+ import { jsx } from '@emotion/react';
4
+ import { useEffect, useRef } from 'react';
5
+ import SpinnerIcon from '@atlaskit/spinner';
6
+ import { withAnalyticsEvents } from '@atlaskit/analytics-next';
7
+ import { createAndFireMediaCardEvent } from '../../../utils/analytics';
8
+ import { IconWrapper } from '../../ui/iconWrapper/iconWrapper';
9
+ import { useBreakpoint } from '../../useBreakpoint';
10
+ import { CardViewWrapper } from './cardViewWrapper';
11
+ var LoadingCardViewBase = function LoadingCardViewBase(props) {
12
+ var dimensions = props.dimensions,
13
+ metadata = props.metadata,
14
+ disableOverlay = props.disableOverlay,
15
+ innerRef = props.innerRef;
16
+ var divRef = useRef(null);
17
+ var breakpoint = useBreakpoint(dimensions === null || dimensions === void 0 ? void 0 : dimensions.width, divRef);
18
+ useEffect(function () {
19
+ innerRef && !!divRef.current && innerRef(divRef.current);
20
+ }, [innerRef]);
21
+ var _ref = metadata || {},
22
+ name = _ref.name;
23
+ var hasTitleBox = !disableOverlay && !!name;
24
+ return jsx(CardViewWrapper, _extends({}, props, {
25
+ metadata: metadata,
26
+ breakpoint: breakpoint,
27
+ ref: divRef
28
+ }), jsx(IconWrapper, {
29
+ breakpoint: breakpoint,
30
+ hasTitleBox: hasTitleBox
31
+ }, jsx(SpinnerIcon, {
32
+ testId: "media-card-loading"
33
+ })));
34
+ };
35
+
36
+ // TODO: check if analytics is correct
37
+
38
+ export var LoadingCardView = withAnalyticsEvents({
39
+ onClick: createAndFireMediaCardEvent({
40
+ eventType: 'ui',
41
+ action: 'clicked',
42
+ actionSubject: 'mediaCard',
43
+ attributes: {}
44
+ })
45
+ })(LoadingCardViewBase);
@@ -0,0 +1,57 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ /** @jsx jsx */
3
+ import { jsx } from '@emotion/react';
4
+ import { useEffect, useRef } from 'react';
5
+ import { withAnalyticsEvents } from '@atlaskit/analytics-next';
6
+ import { MimeTypeIcon } from '@atlaskit/media-ui/mime-type-icon';
7
+ import { createAndFireMediaCardEvent } from '../../../utils/analytics';
8
+ import { IconWrapper } from '../../ui/iconWrapper/iconWrapper';
9
+ import { CreatingPreview } from '../../ui/iconMessage';
10
+ import { useBreakpoint } from '../../useBreakpoint';
11
+ import { CardViewWrapper } from './cardViewWrapper';
12
+ var ProcessingCardViewBase = function ProcessingCardViewBase(props) {
13
+ var disableAnimation = props.disableAnimation,
14
+ dimensions = props.dimensions,
15
+ metadata = props.metadata,
16
+ disableOverlay = props.disableOverlay,
17
+ innerRef = props.innerRef;
18
+ var divRef = useRef(null);
19
+ var breakpoint = useBreakpoint(dimensions === null || dimensions === void 0 ? void 0 : dimensions.width, divRef);
20
+ useEffect(function () {
21
+ innerRef && !!divRef.current && innerRef(divRef.current);
22
+ }, [innerRef]);
23
+ var _ref = metadata || {},
24
+ name = _ref.name,
25
+ size = _ref.size,
26
+ mediaType = _ref.mediaType,
27
+ mimeType = _ref.mimeType;
28
+ var isZeroSize = size === 0;
29
+ var hasTitleBox = !disableOverlay && !!name;
30
+ return jsx(CardViewWrapper, _extends({}, props, {
31
+ metadata: metadata,
32
+ breakpoint: breakpoint,
33
+ "data-test-status": "processing",
34
+ ref: divRef
35
+ }), jsx(IconWrapper, {
36
+ breakpoint: breakpoint,
37
+ hasTitleBox: hasTitleBox
38
+ }, jsx(MimeTypeIcon, {
39
+ testId: "media-card-file-type-icon",
40
+ mediaType: mediaType,
41
+ mimeType: mimeType,
42
+ name: name
43
+ }), !isZeroSize && jsx(CreatingPreview, {
44
+ disableAnimation: disableAnimation
45
+ })));
46
+ };
47
+
48
+ // TODO: check if analytics is correct
49
+
50
+ export var ProcessingCardView = withAnalyticsEvents({
51
+ onClick: createAndFireMediaCardEvent({
52
+ eventType: 'ui',
53
+ action: 'clicked',
54
+ actionSubject: 'mediaCard',
55
+ attributes: {}
56
+ })
57
+ })(ProcessingCardViewBase);
@@ -0,0 +1,86 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ /** @jsx jsx */
3
+ import { jsx } from '@emotion/react';
4
+ import { useEffect, useRef } from 'react';
5
+ import { withAnalyticsEvents } from '@atlaskit/analytics-next';
6
+ import { createAndFireMediaCardEvent } from '../../../utils/analytics';
7
+ import { IconWrapper } from '../../ui/iconWrapper/iconWrapper';
8
+ import { PlayButton } from '../../ui/playButton/playButton';
9
+ import { ImageRenderer } from '../../ui/imageRenderer/imageRenderer';
10
+ import { useBreakpoint } from '../../useBreakpoint';
11
+ import { CardViewWrapper } from './cardViewWrapper';
12
+ import { ProgressBar } from '../../ui/progressBar/progressBar';
13
+ import { Blanket } from '../../ui/blanket/blanket';
14
+ var VideoCardViewBase = function VideoCardViewBase(props) {
15
+ var status = props.status,
16
+ dimensions = props.dimensions,
17
+ metadata = props.metadata,
18
+ disableOverlay = props.disableOverlay,
19
+ innerRef = props.innerRef,
20
+ progress = props.progress,
21
+ cardPreview = props.cardPreview,
22
+ alt = props.alt,
23
+ resizeMode = props.resizeMode,
24
+ onDisplayImage = props.onDisplayImage,
25
+ nativeLazyLoad = props.nativeLazyLoad,
26
+ forceSyncDisplay = props.forceSyncDisplay,
27
+ _onImageLoad = props.onImageLoad,
28
+ _onImageError = props.onImageError;
29
+ var divRef = useRef(null);
30
+ var breakpoint = useBreakpoint(dimensions === null || dimensions === void 0 ? void 0 : dimensions.width, divRef);
31
+ useEffect(function () {
32
+ innerRef && !!divRef.current && innerRef(divRef.current);
33
+ }, [innerRef]);
34
+ var _ref = metadata || {},
35
+ name = _ref.name,
36
+ _ref$mediaType = _ref.mediaType,
37
+ mediaType = _ref$mediaType === void 0 ? 'unknown' : _ref$mediaType;
38
+ var hasTitleBox = !disableOverlay && !!name;
39
+ var isUploading = status === 'uploading';
40
+ return jsx(CardViewWrapper, _extends({}, props, {
41
+ breakpoint: breakpoint,
42
+ "data-test-status": status,
43
+ "data-test-progress": progress,
44
+ ref: divRef,
45
+ customBlanket: function customBlanket() {
46
+ return disableOverlay ? null : jsx(Blanket, {
47
+ isFixed: isUploading
48
+ });
49
+ },
50
+ progressBar: isUploading ? function () {
51
+ return jsx(ProgressBar, {
52
+ progress: progress,
53
+ breakpoint: breakpoint,
54
+ positionBottom: !hasTitleBox
55
+ });
56
+ } : undefined
57
+ }), jsx(ImageRenderer, {
58
+ cardPreview: cardPreview,
59
+ mediaType: mediaType,
60
+ alt: alt,
61
+ resizeMode: resizeMode,
62
+ onDisplayImage: onDisplayImage,
63
+ onImageLoad: function onImageLoad() {
64
+ return _onImageLoad === null || _onImageLoad === void 0 ? void 0 : _onImageLoad(cardPreview);
65
+ },
66
+ onImageError: function onImageError() {
67
+ return _onImageError === null || _onImageError === void 0 ? void 0 : _onImageError(cardPreview);
68
+ },
69
+ nativeLazyLoad: nativeLazyLoad,
70
+ forceSyncDisplay: forceSyncDisplay
71
+ }), cardPreview && jsx(IconWrapper, {
72
+ breakpoint: breakpoint,
73
+ hasTitleBox: hasTitleBox
74
+ }, jsx(PlayButton, null)));
75
+ };
76
+
77
+ // TODO: check if analytics is correct
78
+
79
+ export var VideoCardView = withAnalyticsEvents({
80
+ onClick: createAndFireMediaCardEvent({
81
+ eventType: 'ui',
82
+ action: 'clicked',
83
+ actionSubject: 'mediaCard',
84
+ attributes: {}
85
+ })
86
+ })(VideoCardViewBase);
@@ -3,6 +3,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
4
4
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
5
5
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
6
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
6
7
  import DownloadIcon from '@atlaskit/icon/glyph/download';
7
8
  import { globalMediaEventEmitter, isImageRepresentationReady, RECENTS_COLLECTION } from '@atlaskit/media-client';
8
9
  import { MediaFileStateError, useFileState, useMediaClient } from '@atlaskit/media-client-react';
@@ -25,8 +26,10 @@ import { getDefaultCardDimensions } from '../../utils/cardDimensions';
25
26
  import { fireCommencedEvent, fireCopiedEvent, fireNonCriticalErrorEvent, fireOperationalEvent, fireScreenEvent } from '../cardAnalytics';
26
27
  import { isSSRPreview } from '../getCardPreview';
27
28
  import { CardViewV2 } from './cardViewV2';
29
+ import { CardViews } from './cardviews';
28
30
  import { InlinePlayerLazyV2 } from './inlinePlayerLazyV2';
29
31
  import { useFilePreview } from './useFilePreview';
32
+ var LoadedCardView = getBooleanFF('platform.media-experience.card-views-refactor_b91lr') ? CardViews : CardViewV2;
30
33
  export var FileCard = function FileCard(_ref) {
31
34
  var _ref$appearance = _ref.appearance,
32
35
  appearance = _ref$appearance === void 0 ? 'auto' : _ref$appearance,
@@ -509,7 +512,7 @@ export var FileCard = function FileCard(_ref) {
509
512
  // Force Media Image to always display img for SSR
510
513
  var forceSyncDisplay = !!ssr;
511
514
  var mediaCardCursor = getMediaCardCursor(!!useInlinePlayer, !!shouldOpenMediaViewer, finalStatus === 'error' || finalStatus === 'failed-processing', !!cardPreview, metadata.mediaType);
512
- var card = /*#__PURE__*/React.createElement(CardViewV2, {
515
+ var card = /*#__PURE__*/React.createElement(LoadedCardView, {
513
516
  status: cardStatusOverride || finalStatus,
514
517
  error: finalError,
515
518
  mediaItemType: mediaItemType,
@@ -103,7 +103,7 @@ var MediaInlineCardLoader = /*#__PURE__*/function (_React$PureComponent) {
103
103
  ErrorBoundary = _this$state.ErrorBoundary;
104
104
  var analyticsContext = {
105
105
  packageVersion: "@atlaskit/media-card",
106
- packageName: "77.5.2",
106
+ packageName: "77.6.0",
107
107
  componentName: 'mediaInlineCard',
108
108
  component: 'mediaInlineCard'
109
109
  };
@@ -7,7 +7,7 @@ import { extractErrorInfo, getRenderErrorRequestMetadata } from './analytics';
7
7
  import { MediaCardError } from '../errors';
8
8
  import { getMediaEnvironment, getMediaRegion } from '@atlaskit/media-client';
9
9
  var packageName = "@atlaskit/media-card";
10
- var packageVersion = "77.5.2";
10
+ var packageVersion = "77.6.0";
11
11
  var concurrentExperience;
12
12
  var getExperience = function getExperience(id) {
13
13
  if (!concurrentExperience) {
@@ -1,4 +1,4 @@
1
- import React, { MouseEvent, RefObject } from 'react';
1
+ import React, { MouseEvent } from 'react';
2
2
  import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
3
3
  import { CardDimensions, CardAppearance } from '../../../types';
4
4
  import { Breakpoint } from '../common';
@@ -18,6 +18,6 @@ export interface WrapperProps {
18
18
  isPlayButtonClickable: boolean;
19
19
  isTickBoxSelectable: boolean;
20
20
  shouldDisplayTooltip: boolean;
21
- innerRef?: RefObject<HTMLDivElement>;
21
+ innerRef?: React.Ref<HTMLDivElement>;
22
22
  children?: JSX.Element;
23
23
  }
@@ -0,0 +1,38 @@
1
+ import React, { MouseEvent, ReactNode } from 'react';
2
+ import { FileDetails } from '@atlaskit/media-client';
3
+ import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
4
+ import { CardAppearance, CardDimensions, MediaCardCursor, TitleBoxIcon } from '../../../types';
5
+ import { CardAction } from '../../actions';
6
+ import { Breakpoint } from '../../ui/common';
7
+ import { MediaFilePreview } from '../useFilePreview';
8
+ export type SharedCardViewProps = {
9
+ readonly cardPreview?: MediaFilePreview;
10
+ readonly testId?: string;
11
+ readonly dimensions?: CardDimensions;
12
+ readonly onClick?: (event: React.MouseEvent<HTMLDivElement>, analyticsEvent?: UIAnalyticsEvent) => void;
13
+ readonly onMouseEnter?: (event: MouseEvent<HTMLDivElement>) => void;
14
+ readonly appearance?: CardAppearance;
15
+ readonly disableOverlay?: boolean;
16
+ readonly actions?: Array<CardAction>;
17
+ readonly selectable?: boolean;
18
+ readonly selected?: boolean;
19
+ readonly metadata?: FileDetails;
20
+ readonly titleBoxBgColor?: string;
21
+ readonly titleBoxIcon?: TitleBoxIcon;
22
+ readonly mediaCardCursor?: MediaCardCursor;
23
+ readonly shouldHideTooltip?: boolean;
24
+ };
25
+ export type CardViewWrapperProps = SharedCardViewProps & {
26
+ children: React.ReactNode;
27
+ readonly breakpoint: Breakpoint;
28
+ customBlanket?: () => ReactNode;
29
+ customTitleBox?: () => ReactNode;
30
+ progressBar?: () => ReactNode;
31
+ };
32
+ export declare const CardViewWrapper: React.ForwardRefExoticComponent<SharedCardViewProps & {
33
+ children: React.ReactNode;
34
+ readonly breakpoint: Breakpoint;
35
+ customBlanket?: (() => ReactNode) | undefined;
36
+ customTitleBox?: (() => ReactNode) | undefined;
37
+ progressBar?: (() => ReactNode) | undefined;
38
+ } & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,11 @@
1
+ /// <reference types="react" />
2
+ import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
3
+ import { FileDetails } from '@atlaskit/media-client';
4
+ import { SharedCardViewProps } from './cardViewWrapper';
5
+ import { MediaCardError } from '../../../errors';
6
+ export type ErrorCardViewProps = SharedCardViewProps & WithAnalyticsEventsProps & {
7
+ metadata?: FileDetails;
8
+ disableAnimation?: boolean;
9
+ readonly error?: MediaCardError;
10
+ };
11
+ export declare const ErrorCardView: import("react").ForwardRefExoticComponent<Omit<ErrorCardViewProps, keyof WithAnalyticsEventsProps> & import("react").RefAttributes<any>>;
@@ -0,0 +1,12 @@
1
+ /// <reference types="react" />
2
+ import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
3
+ import { FileDetails } from '@atlaskit/media-client';
4
+ import { SharedCardViewProps } from './cardViewWrapper';
5
+ import type { CardStatus } from '../../../types';
6
+ export type IconCardViewProps = SharedCardViewProps & WithAnalyticsEventsProps & {
7
+ status: CardStatus;
8
+ metadata?: FileDetails;
9
+ readonly progress?: number;
10
+ readonly innerRef?: (instance: HTMLDivElement | null) => void;
11
+ };
12
+ export declare const IconCardView: import("react").ForwardRefExoticComponent<Omit<IconCardViewProps, keyof WithAnalyticsEventsProps> & import("react").RefAttributes<any>>;
@@ -0,0 +1,21 @@
1
+ /// <reference types="react" />
2
+ import { ImageResizeMode } from '@atlaskit/media-client';
3
+ import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
4
+ import { FileDetails } from '@atlaskit/media-client';
5
+ import type { CardPreview, CardStatus } from '../../../types';
6
+ import { SharedCardViewProps } from './cardViewWrapper';
7
+ export type ImageCardViewProps = SharedCardViewProps & WithAnalyticsEventsProps & {
8
+ status: CardStatus;
9
+ cardPreview: CardPreview;
10
+ readonly alt?: string;
11
+ readonly resizeMode?: ImageResizeMode;
12
+ readonly onDisplayImage?: () => void;
13
+ readonly nativeLazyLoad?: boolean;
14
+ readonly forceSyncDisplay?: boolean;
15
+ readonly onImageLoad?: (cardPreview: CardPreview) => void;
16
+ readonly onImageError?: (cardPreview: CardPreview) => void;
17
+ metadata?: FileDetails;
18
+ readonly innerRef?: (instance: HTMLDivElement | null) => void;
19
+ readonly progress?: number;
20
+ };
21
+ export declare const ImageCardView: import("react").ForwardRefExoticComponent<Omit<ImageCardViewProps, keyof WithAnalyticsEventsProps> & import("react").RefAttributes<any>>;
@@ -0,0 +1,45 @@
1
+ /** @jsx jsx */
2
+ import { jsx } from '@emotion/react';
3
+ import React, { MouseEvent } from 'react';
4
+ import { MessageDescriptor } from 'react-intl-next';
5
+ import { MediaItemType, FileDetails } from '@atlaskit/media-client';
6
+ import { WithAnalyticsEventsProps, UIAnalyticsEvent } from '@atlaskit/analytics-next';
7
+ import { SharedCardProps, CardStatus, MediaCardCursor } from '../../../types';
8
+ import { MediaCardError } from '../../../errors';
9
+ import { MediaFilePreview } from '../useFilePreview';
10
+ export interface CardViewsOwnProps extends SharedCardProps {
11
+ readonly status: CardStatus;
12
+ readonly mediaItemType: MediaItemType;
13
+ readonly mediaCardCursor?: MediaCardCursor;
14
+ readonly metadata?: FileDetails;
15
+ readonly error?: MediaCardError;
16
+ readonly onClick?: (event: React.MouseEvent<HTMLDivElement>, analyticsEvent?: UIAnalyticsEvent) => void;
17
+ readonly onMouseEnter?: (event: MouseEvent<HTMLDivElement>) => void;
18
+ readonly onDisplayImage?: () => void;
19
+ readonly cardPreview?: MediaFilePreview;
20
+ readonly progress?: number;
21
+ readonly innerRef?: (instance: HTMLDivElement | null) => void;
22
+ readonly onImageLoad?: (cardPreview: MediaFilePreview) => void;
23
+ readonly onImageError?: (cardPreview: MediaFilePreview) => void;
24
+ readonly nativeLazyLoad?: boolean;
25
+ readonly forceSyncDisplay?: boolean;
26
+ disableAnimation?: boolean;
27
+ shouldHideTooltip?: boolean;
28
+ }
29
+ export type CardViewV2Props = CardViewsOwnProps & WithAnalyticsEventsProps;
30
+ export interface RenderConfigByStatusV2 {
31
+ renderTypeIcon?: boolean;
32
+ iconMessage?: JSX.Element;
33
+ renderImageRenderer?: boolean;
34
+ renderPlayButton?: boolean;
35
+ renderTitleBox?: boolean;
36
+ renderBlanket?: boolean;
37
+ isFixedBlanket?: boolean;
38
+ renderProgressBar?: boolean;
39
+ renderSpinner?: boolean;
40
+ renderFailedTitleBox?: boolean;
41
+ renderTickBox?: boolean;
42
+ customTitleMessage?: MessageDescriptor;
43
+ }
44
+ export declare const CardViewsBase: ({ innerRef, onImageLoad, onImageError, dimensions, appearance, onClick, onMouseEnter, testId, metadata, status, selected, selectable, cardPreview, mediaCardCursor, shouldHideTooltip, progress, alt, resizeMode, onDisplayImage, nativeLazyLoad, forceSyncDisplay, actions, disableOverlay, titleBoxBgColor, titleBoxIcon, error, disableAnimation, }: CardViewV2Props) => jsx.JSX.Element;
45
+ export declare const CardViews: React.ForwardRefExoticComponent<Omit<CardViewV2Props, keyof WithAnalyticsEventsProps> & React.RefAttributes<any>>;
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
3
+ import { FileDetails } from '@atlaskit/media-client';
4
+ import { SharedCardViewProps } from './cardViewWrapper';
5
+ export type LoadingCardViewProps = SharedCardViewProps & WithAnalyticsEventsProps & {
6
+ metadata?: FileDetails;
7
+ disableAnimation?: boolean;
8
+ readonly innerRef?: (instance: HTMLDivElement | null) => void;
9
+ };
10
+ export declare const LoadingCardView: import("react").ForwardRefExoticComponent<Omit<LoadingCardViewProps, keyof WithAnalyticsEventsProps> & import("react").RefAttributes<any>>;
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
3
+ import { SharedCardViewProps } from './cardViewWrapper';
4
+ export type ProcessingCardViewProps = SharedCardViewProps & WithAnalyticsEventsProps & {
5
+ disableAnimation?: boolean;
6
+ readonly innerRef?: (instance: HTMLDivElement | null) => void;
7
+ };
8
+ export declare const ProcessingCardView: import("react").ForwardRefExoticComponent<Omit<ProcessingCardViewProps, keyof WithAnalyticsEventsProps> & import("react").RefAttributes<any>>;
@@ -0,0 +1,21 @@
1
+ /// <reference types="react" />
2
+ import { ImageResizeMode } from '@atlaskit/media-client';
3
+ import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
4
+ import { FileDetails } from '@atlaskit/media-client';
5
+ import type { CardPreview, CardStatus } from '../../../types';
6
+ import { SharedCardViewProps } from './cardViewWrapper';
7
+ export type VideoCardViewProps = SharedCardViewProps & WithAnalyticsEventsProps & {
8
+ status: CardStatus;
9
+ cardPreview: CardPreview;
10
+ readonly alt?: string;
11
+ readonly resizeMode?: ImageResizeMode;
12
+ readonly onDisplayImage?: () => void;
13
+ readonly nativeLazyLoad?: boolean;
14
+ readonly forceSyncDisplay?: boolean;
15
+ readonly onImageLoad?: (cardPreview: CardPreview) => void;
16
+ readonly onImageError?: (cardPreview: CardPreview) => void;
17
+ metadata?: FileDetails;
18
+ readonly innerRef?: (instance: HTMLDivElement | null) => void;
19
+ readonly progress?: number;
20
+ };
21
+ export declare const VideoCardView: import("react").ForwardRefExoticComponent<Omit<VideoCardViewProps, keyof WithAnalyticsEventsProps> & import("react").RefAttributes<any>>;
@@ -1,4 +1,4 @@
1
- import React, { MouseEvent, RefObject } from 'react';
1
+ import React, { MouseEvent } from 'react';
2
2
  import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
3
3
  import { CardDimensions, CardAppearance } from '../../../types';
4
4
  import { Breakpoint } from '../common';
@@ -18,6 +18,6 @@ export interface WrapperProps {
18
18
  isPlayButtonClickable: boolean;
19
19
  isTickBoxSelectable: boolean;
20
20
  shouldDisplayTooltip: boolean;
21
- innerRef?: RefObject<HTMLDivElement>;
21
+ innerRef?: React.Ref<HTMLDivElement>;
22
22
  children?: JSX.Element;
23
23
  }
@@ -0,0 +1,38 @@
1
+ import React, { MouseEvent, ReactNode } from 'react';
2
+ import { FileDetails } from '@atlaskit/media-client';
3
+ import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
4
+ import { CardAppearance, CardDimensions, MediaCardCursor, TitleBoxIcon } from '../../../types';
5
+ import { CardAction } from '../../actions';
6
+ import { Breakpoint } from '../../ui/common';
7
+ import { MediaFilePreview } from '../useFilePreview';
8
+ export type SharedCardViewProps = {
9
+ readonly cardPreview?: MediaFilePreview;
10
+ readonly testId?: string;
11
+ readonly dimensions?: CardDimensions;
12
+ readonly onClick?: (event: React.MouseEvent<HTMLDivElement>, analyticsEvent?: UIAnalyticsEvent) => void;
13
+ readonly onMouseEnter?: (event: MouseEvent<HTMLDivElement>) => void;
14
+ readonly appearance?: CardAppearance;
15
+ readonly disableOverlay?: boolean;
16
+ readonly actions?: Array<CardAction>;
17
+ readonly selectable?: boolean;
18
+ readonly selected?: boolean;
19
+ readonly metadata?: FileDetails;
20
+ readonly titleBoxBgColor?: string;
21
+ readonly titleBoxIcon?: TitleBoxIcon;
22
+ readonly mediaCardCursor?: MediaCardCursor;
23
+ readonly shouldHideTooltip?: boolean;
24
+ };
25
+ export type CardViewWrapperProps = SharedCardViewProps & {
26
+ children: React.ReactNode;
27
+ readonly breakpoint: Breakpoint;
28
+ customBlanket?: () => ReactNode;
29
+ customTitleBox?: () => ReactNode;
30
+ progressBar?: () => ReactNode;
31
+ };
32
+ export declare const CardViewWrapper: React.ForwardRefExoticComponent<SharedCardViewProps & {
33
+ children: React.ReactNode;
34
+ readonly breakpoint: Breakpoint;
35
+ customBlanket?: (() => ReactNode) | undefined;
36
+ customTitleBox?: (() => ReactNode) | undefined;
37
+ progressBar?: (() => ReactNode) | undefined;
38
+ } & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,11 @@
1
+ /// <reference types="react" />
2
+ import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
3
+ import { FileDetails } from '@atlaskit/media-client';
4
+ import { SharedCardViewProps } from './cardViewWrapper';
5
+ import { MediaCardError } from '../../../errors';
6
+ export type ErrorCardViewProps = SharedCardViewProps & WithAnalyticsEventsProps & {
7
+ metadata?: FileDetails;
8
+ disableAnimation?: boolean;
9
+ readonly error?: MediaCardError;
10
+ };
11
+ export declare const ErrorCardView: import("react").ForwardRefExoticComponent<Omit<ErrorCardViewProps, keyof WithAnalyticsEventsProps> & import("react").RefAttributes<any>>;
@@ -0,0 +1,12 @@
1
+ /// <reference types="react" />
2
+ import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
3
+ import { FileDetails } from '@atlaskit/media-client';
4
+ import { SharedCardViewProps } from './cardViewWrapper';
5
+ import type { CardStatus } from '../../../types';
6
+ export type IconCardViewProps = SharedCardViewProps & WithAnalyticsEventsProps & {
7
+ status: CardStatus;
8
+ metadata?: FileDetails;
9
+ readonly progress?: number;
10
+ readonly innerRef?: (instance: HTMLDivElement | null) => void;
11
+ };
12
+ export declare const IconCardView: import("react").ForwardRefExoticComponent<Omit<IconCardViewProps, keyof WithAnalyticsEventsProps> & import("react").RefAttributes<any>>;
@@ -0,0 +1,21 @@
1
+ /// <reference types="react" />
2
+ import { ImageResizeMode } from '@atlaskit/media-client';
3
+ import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
4
+ import { FileDetails } from '@atlaskit/media-client';
5
+ import type { CardPreview, CardStatus } from '../../../types';
6
+ import { SharedCardViewProps } from './cardViewWrapper';
7
+ export type ImageCardViewProps = SharedCardViewProps & WithAnalyticsEventsProps & {
8
+ status: CardStatus;
9
+ cardPreview: CardPreview;
10
+ readonly alt?: string;
11
+ readonly resizeMode?: ImageResizeMode;
12
+ readonly onDisplayImage?: () => void;
13
+ readonly nativeLazyLoad?: boolean;
14
+ readonly forceSyncDisplay?: boolean;
15
+ readonly onImageLoad?: (cardPreview: CardPreview) => void;
16
+ readonly onImageError?: (cardPreview: CardPreview) => void;
17
+ metadata?: FileDetails;
18
+ readonly innerRef?: (instance: HTMLDivElement | null) => void;
19
+ readonly progress?: number;
20
+ };
21
+ export declare const ImageCardView: import("react").ForwardRefExoticComponent<Omit<ImageCardViewProps, keyof WithAnalyticsEventsProps> & import("react").RefAttributes<any>>;
@@ -0,0 +1,45 @@
1
+ /** @jsx jsx */
2
+ import { jsx } from '@emotion/react';
3
+ import React, { MouseEvent } from 'react';
4
+ import { MessageDescriptor } from 'react-intl-next';
5
+ import { MediaItemType, FileDetails } from '@atlaskit/media-client';
6
+ import { WithAnalyticsEventsProps, UIAnalyticsEvent } from '@atlaskit/analytics-next';
7
+ import { SharedCardProps, CardStatus, MediaCardCursor } from '../../../types';
8
+ import { MediaCardError } from '../../../errors';
9
+ import { MediaFilePreview } from '../useFilePreview';
10
+ export interface CardViewsOwnProps extends SharedCardProps {
11
+ readonly status: CardStatus;
12
+ readonly mediaItemType: MediaItemType;
13
+ readonly mediaCardCursor?: MediaCardCursor;
14
+ readonly metadata?: FileDetails;
15
+ readonly error?: MediaCardError;
16
+ readonly onClick?: (event: React.MouseEvent<HTMLDivElement>, analyticsEvent?: UIAnalyticsEvent) => void;
17
+ readonly onMouseEnter?: (event: MouseEvent<HTMLDivElement>) => void;
18
+ readonly onDisplayImage?: () => void;
19
+ readonly cardPreview?: MediaFilePreview;
20
+ readonly progress?: number;
21
+ readonly innerRef?: (instance: HTMLDivElement | null) => void;
22
+ readonly onImageLoad?: (cardPreview: MediaFilePreview) => void;
23
+ readonly onImageError?: (cardPreview: MediaFilePreview) => void;
24
+ readonly nativeLazyLoad?: boolean;
25
+ readonly forceSyncDisplay?: boolean;
26
+ disableAnimation?: boolean;
27
+ shouldHideTooltip?: boolean;
28
+ }
29
+ export type CardViewV2Props = CardViewsOwnProps & WithAnalyticsEventsProps;
30
+ export interface RenderConfigByStatusV2 {
31
+ renderTypeIcon?: boolean;
32
+ iconMessage?: JSX.Element;
33
+ renderImageRenderer?: boolean;
34
+ renderPlayButton?: boolean;
35
+ renderTitleBox?: boolean;
36
+ renderBlanket?: boolean;
37
+ isFixedBlanket?: boolean;
38
+ renderProgressBar?: boolean;
39
+ renderSpinner?: boolean;
40
+ renderFailedTitleBox?: boolean;
41
+ renderTickBox?: boolean;
42
+ customTitleMessage?: MessageDescriptor;
43
+ }
44
+ export declare const CardViewsBase: ({ innerRef, onImageLoad, onImageError, dimensions, appearance, onClick, onMouseEnter, testId, metadata, status, selected, selectable, cardPreview, mediaCardCursor, shouldHideTooltip, progress, alt, resizeMode, onDisplayImage, nativeLazyLoad, forceSyncDisplay, actions, disableOverlay, titleBoxBgColor, titleBoxIcon, error, disableAnimation, }: CardViewV2Props) => jsx.JSX.Element;
45
+ export declare const CardViews: React.ForwardRefExoticComponent<Omit<CardViewV2Props, keyof WithAnalyticsEventsProps> & React.RefAttributes<any>>;
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
3
+ import { FileDetails } from '@atlaskit/media-client';
4
+ import { SharedCardViewProps } from './cardViewWrapper';
5
+ export type LoadingCardViewProps = SharedCardViewProps & WithAnalyticsEventsProps & {
6
+ metadata?: FileDetails;
7
+ disableAnimation?: boolean;
8
+ readonly innerRef?: (instance: HTMLDivElement | null) => void;
9
+ };
10
+ export declare const LoadingCardView: import("react").ForwardRefExoticComponent<Omit<LoadingCardViewProps, keyof WithAnalyticsEventsProps> & import("react").RefAttributes<any>>;
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
3
+ import { SharedCardViewProps } from './cardViewWrapper';
4
+ export type ProcessingCardViewProps = SharedCardViewProps & WithAnalyticsEventsProps & {
5
+ disableAnimation?: boolean;
6
+ readonly innerRef?: (instance: HTMLDivElement | null) => void;
7
+ };
8
+ export declare const ProcessingCardView: import("react").ForwardRefExoticComponent<Omit<ProcessingCardViewProps, keyof WithAnalyticsEventsProps> & import("react").RefAttributes<any>>;
@@ -0,0 +1,21 @@
1
+ /// <reference types="react" />
2
+ import { ImageResizeMode } from '@atlaskit/media-client';
3
+ import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
4
+ import { FileDetails } from '@atlaskit/media-client';
5
+ import type { CardPreview, CardStatus } from '../../../types';
6
+ import { SharedCardViewProps } from './cardViewWrapper';
7
+ export type VideoCardViewProps = SharedCardViewProps & WithAnalyticsEventsProps & {
8
+ status: CardStatus;
9
+ cardPreview: CardPreview;
10
+ readonly alt?: string;
11
+ readonly resizeMode?: ImageResizeMode;
12
+ readonly onDisplayImage?: () => void;
13
+ readonly nativeLazyLoad?: boolean;
14
+ readonly forceSyncDisplay?: boolean;
15
+ readonly onImageLoad?: (cardPreview: CardPreview) => void;
16
+ readonly onImageError?: (cardPreview: CardPreview) => void;
17
+ metadata?: FileDetails;
18
+ readonly innerRef?: (instance: HTMLDivElement | null) => void;
19
+ readonly progress?: number;
20
+ };
21
+ export declare const VideoCardView: import("react").ForwardRefExoticComponent<Omit<VideoCardViewProps, keyof WithAnalyticsEventsProps> & import("react").RefAttributes<any>>;