@atlaskit/media-card 74.8.1 → 75.0.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 (156) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/cjs/card/card.js +2 -7
  3. package/dist/cjs/card/media-card-analytics-error-boundary.js +1 -1
  4. package/dist/cjs/card/styles/index.js +1 -7
  5. package/dist/cjs/inline/mediaInlineAnalyticsErrorBoundary.js +1 -1
  6. package/dist/cjs/inline/mediaInlineCard.js +12 -21
  7. package/dist/cjs/utils/ufoExperiences.js +1 -1
  8. package/dist/cjs/version.json +1 -1
  9. package/dist/es2019/card/card.js +2 -7
  10. package/dist/es2019/card/media-card-analytics-error-boundary.js +1 -1
  11. package/dist/es2019/card/styles/index.js +0 -4
  12. package/dist/es2019/inline/mediaInlineAnalyticsErrorBoundary.js +1 -1
  13. package/dist/es2019/inline/mediaInlineCard.js +12 -21
  14. package/dist/es2019/utils/ufoExperiences.js +1 -1
  15. package/dist/es2019/version.json +1 -1
  16. package/dist/esm/card/card.js +2 -7
  17. package/dist/esm/card/media-card-analytics-error-boundary.js +1 -1
  18. package/dist/esm/card/styles/index.js +1 -5
  19. package/dist/esm/inline/mediaInlineAnalyticsErrorBoundary.js +1 -1
  20. package/dist/esm/inline/mediaInlineCard.js +12 -21
  21. package/dist/esm/utils/ufoExperiences.js +1 -1
  22. package/dist/esm/version.json +1 -1
  23. package/dist/types/card/styles/index.d.ts +0 -1
  24. package/dist/types/inline/mediaInlineCard.d.ts +0 -8
  25. package/dist/types/types.d.ts +0 -8
  26. package/dist/types-ts4.5/card/actions.d.ts +9 -0
  27. package/dist/types-ts4.5/card/card.d.ts +63 -0
  28. package/dist/types-ts4.5/card/cardAnalytics.d.ts +10 -0
  29. package/dist/types-ts4.5/card/cardConstants.d.ts +1 -0
  30. package/dist/types-ts4.5/card/cardImageView/cardImageViewWrapper.d.ts +6 -0
  31. package/dist/types-ts4.5/card/cardImageView/cardOverlay/cardOverlayComponents.d.ts +8 -0
  32. package/dist/types-ts4.5/card/cardImageView/cardOverlay/index.d.ts +39 -0
  33. package/dist/types-ts4.5/card/cardImageView/cardOverlay/styles.d.ts +26 -0
  34. package/dist/types-ts4.5/card/cardImageView/cardViewWrapper.d.ts +4 -0
  35. package/dist/types-ts4.5/card/cardImageView/classnames.d.ts +2 -0
  36. package/dist/types-ts4.5/card/cardImageView/fileCardImageView.d.ts +49 -0
  37. package/dist/types-ts4.5/card/cardImageView/index.d.ts +2 -0
  38. package/dist/types-ts4.5/card/cardImageView/styles.d.ts +24 -0
  39. package/dist/types-ts4.5/card/cardLoader.d.ts +6 -0
  40. package/dist/types-ts4.5/card/cardState.d.ts +10 -0
  41. package/dist/types-ts4.5/card/cardView.d.ts +80 -0
  42. package/dist/types-ts4.5/card/getCardPreview/cache.d.ts +19 -0
  43. package/dist/types-ts4.5/card/getCardPreview/filePreviewStatus.d.ts +5 -0
  44. package/dist/types-ts4.5/card/getCardPreview/helpers.d.ts +10 -0
  45. package/dist/types-ts4.5/card/getCardPreview/imageRefetchingAnalytics.d.ts +10 -0
  46. package/dist/types-ts4.5/card/getCardPreview/index.d.ts +59 -0
  47. package/dist/types-ts4.5/card/getCardStatus.d.ts +5 -0
  48. package/dist/types-ts4.5/card/index.d.ts +1 -0
  49. package/dist/types-ts4.5/card/inlinePlayer.d.ts +52 -0
  50. package/dist/types-ts4.5/card/inlinePlayerLazy.d.ts +2 -0
  51. package/dist/types-ts4.5/card/inlinePlayerWrapper.d.ts +4 -0
  52. package/dist/types-ts4.5/card/media-card-analytics-error-boundary.d.ts +14 -0
  53. package/dist/types-ts4.5/card/styles/animations.d.ts +1 -0
  54. package/dist/types-ts4.5/card/styles/config.d.ts +1 -0
  55. package/dist/types-ts4.5/card/styles/easing.d.ts +2 -0
  56. package/dist/types-ts4.5/card/styles/getSelectedBorderStyle.d.ts +3 -0
  57. package/dist/types-ts4.5/card/styles/index.d.ts +8 -0
  58. package/dist/types-ts4.5/card/styles/mixins.d.ts +21 -0
  59. package/dist/types-ts4.5/card/styles/styles.d.ts +10 -0
  60. package/dist/types-ts4.5/card/types.d.ts +24 -0
  61. package/dist/types-ts4.5/card/ui/actionsBar/actionsBar.d.ts +5 -0
  62. package/dist/types-ts4.5/card/ui/actionsBar/actionsBarWrapper.d.ts +4 -0
  63. package/dist/types-ts4.5/card/ui/actionsBar/styles.d.ts +6 -0
  64. package/dist/types-ts4.5/card/ui/actionsBar/types.d.ts +10 -0
  65. package/dist/types-ts4.5/card/ui/blanket/blanket.d.ts +6 -0
  66. package/dist/types-ts4.5/card/ui/blanket/styles.d.ts +6 -0
  67. package/dist/types-ts4.5/card/ui/common.d.ts +23 -0
  68. package/dist/types-ts4.5/card/ui/iconMessage/iconMessageWrapper.d.ts +4 -0
  69. package/dist/types-ts4.5/card/ui/iconMessage/index.d.ts +8 -0
  70. package/dist/types-ts4.5/card/ui/iconMessage/styles.d.ts +5 -0
  71. package/dist/types-ts4.5/card/ui/iconMessage/types.d.ts +19 -0
  72. package/dist/types-ts4.5/card/ui/iconWrapper/iconWrapper.d.ts +4 -0
  73. package/dist/types-ts4.5/card/ui/iconWrapper/styles.d.ts +7 -0
  74. package/dist/types-ts4.5/card/ui/iconWrapper/types.d.ts +6 -0
  75. package/dist/types-ts4.5/card/ui/imageRenderer/imageRenderer.d.ts +15 -0
  76. package/dist/types-ts4.5/card/ui/loadingRateLimited/styles.d.ts +13 -0
  77. package/dist/types-ts4.5/card/ui/newFileExperience/newFileExperienceWrapper.d.ts +4 -0
  78. package/dist/types-ts4.5/card/ui/newFileExperience/styles.d.ts +5 -0
  79. package/dist/types-ts4.5/card/ui/newFileExperience/types.d.ts +25 -0
  80. package/dist/types-ts4.5/card/ui/playButton/playButton.d.ts +2 -0
  81. package/dist/types-ts4.5/card/ui/playButton/playButtonBackground.d.ts +3 -0
  82. package/dist/types-ts4.5/card/ui/playButton/playButtonWrapper.d.ts +3 -0
  83. package/dist/types-ts4.5/card/ui/playButton/styles.d.ts +5 -0
  84. package/dist/types-ts4.5/card/ui/progressBar/progressBar.d.ts +10 -0
  85. package/dist/types-ts4.5/card/ui/progressBar/styledBar.d.ts +4 -0
  86. package/dist/types-ts4.5/card/ui/progressBar/styles.d.ts +7 -0
  87. package/dist/types-ts4.5/card/ui/progressBar/types.d.ts +7 -0
  88. package/dist/types-ts4.5/card/ui/styles.d.ts +11 -0
  89. package/dist/types-ts4.5/card/ui/tickBox/styles.d.ts +7 -0
  90. package/dist/types-ts4.5/card/ui/tickBox/tickBox.d.ts +3 -0
  91. package/dist/types-ts4.5/card/ui/tickBox/tickBoxWrapper.d.ts +4 -0
  92. package/dist/types-ts4.5/card/ui/tickBox/types.d.ts +4 -0
  93. package/dist/types-ts4.5/card/ui/titleBox/failedTitleBox.d.ts +3 -0
  94. package/dist/types-ts4.5/card/ui/titleBox/styles.d.ts +15 -0
  95. package/dist/types-ts4.5/card/ui/titleBox/titleBox.d.ts +4 -0
  96. package/dist/types-ts4.5/card/ui/titleBox/titleBoxComponents.d.ts +8 -0
  97. package/dist/types-ts4.5/card/ui/titleBox/types.d.ts +34 -0
  98. package/dist/types-ts4.5/card/ui/unhandledErrorCard/index.d.ts +7 -0
  99. package/dist/types-ts4.5/card/ui/unhandledErrorCard/types.d.ts +6 -0
  100. package/dist/types-ts4.5/classnames.d.ts +5 -0
  101. package/dist/types-ts4.5/errors.d.ts +41 -0
  102. package/dist/types-ts4.5/index.d.ts +15 -0
  103. package/dist/types-ts4.5/inline/index.d.ts +1 -0
  104. package/dist/types-ts4.5/inline/loader.d.ts +26 -0
  105. package/dist/types-ts4.5/inline/mediaInlineAnalyticsErrorBoundary.d.ts +12 -0
  106. package/dist/types-ts4.5/inline/mediaInlineCard.d.ts +15 -0
  107. package/dist/types-ts4.5/types.d.ts +103 -0
  108. package/dist/types-ts4.5/utils/analytics.d.ts +95 -0
  109. package/dist/types-ts4.5/utils/breakpoint.d.ts +11 -0
  110. package/dist/types-ts4.5/utils/cardActions/cardActionButton.d.ts +3 -0
  111. package/dist/types-ts4.5/utils/cardActions/cardActionIconButton.d.ts +12 -0
  112. package/dist/types-ts4.5/utils/cardActions/cardActionsDropdownMenu.d.ts +14 -0
  113. package/dist/types-ts4.5/utils/cardActions/cardActionsView.d.ts +16 -0
  114. package/dist/types-ts4.5/utils/cardActions/index.d.ts +7 -0
  115. package/dist/types-ts4.5/utils/cardActions/styles.d.ts +18 -0
  116. package/dist/types-ts4.5/utils/cardDimensions.d.ts +49 -0
  117. package/dist/types-ts4.5/utils/containsPixelUnit.d.ts +1 -0
  118. package/dist/types-ts4.5/utils/dimensionComparer.d.ts +3 -0
  119. package/dist/types-ts4.5/utils/document.d.ts +2 -0
  120. package/dist/types-ts4.5/utils/errorIcon/index.d.ts +12 -0
  121. package/dist/types-ts4.5/utils/errorIcon/styles.d.ts +1 -0
  122. package/dist/types-ts4.5/utils/fileIcon/index.d.ts +12 -0
  123. package/dist/types-ts4.5/utils/fileIcon/styles.d.ts +1 -0
  124. package/dist/types-ts4.5/utils/generateUniqueId.d.ts +1 -0
  125. package/dist/types-ts4.5/utils/getCSSUnitValue.d.ts +1 -0
  126. package/dist/types-ts4.5/utils/getDataURIDimension.d.ts +9 -0
  127. package/dist/types-ts4.5/utils/getElementDimension.d.ts +2 -0
  128. package/dist/types-ts4.5/utils/getErrorMessage.d.ts +2 -0
  129. package/dist/types-ts4.5/utils/getMediaCardCursor.d.ts +6 -0
  130. package/dist/types-ts4.5/utils/globalScope/getSSRData.d.ts +3 -0
  131. package/dist/types-ts4.5/utils/globalScope/globalScope.d.ts +21 -0
  132. package/dist/types-ts4.5/utils/globalScope/index.d.ts +4 -0
  133. package/dist/types-ts4.5/utils/globalScope/types.d.ts +8 -0
  134. package/dist/types-ts4.5/utils/index.d.ts +14 -0
  135. package/dist/types-ts4.5/utils/isRetina.d.ts +1 -0
  136. package/dist/types-ts4.5/utils/isValidPercentageUnit.d.ts +1 -0
  137. package/dist/types-ts4.5/utils/lightCards/cardError.d.ts +12 -0
  138. package/dist/types-ts4.5/utils/lightCards/cardLoading.d.ts +5 -0
  139. package/dist/types-ts4.5/utils/lightCards/getDimensionsWithDefault.d.ts +2 -0
  140. package/dist/types-ts4.5/utils/lightCards/lightCardWrappers.d.ts +5 -0
  141. package/dist/types-ts4.5/utils/lightCards/styles.d.ts +4 -0
  142. package/dist/types-ts4.5/utils/lightCards/types.d.ts +15 -0
  143. package/dist/types-ts4.5/utils/metadata.d.ts +2 -0
  144. package/dist/types-ts4.5/utils/objectURLCache.d.ts +11 -0
  145. package/dist/types-ts4.5/utils/preventClickThrough.d.ts +8 -0
  146. package/dist/types-ts4.5/utils/printScript.d.ts +2 -0
  147. package/dist/types-ts4.5/utils/progressBar/index.d.ts +9 -0
  148. package/dist/types-ts4.5/utils/progressBar/styles.d.ts +1 -0
  149. package/dist/types-ts4.5/utils/resizeModeToMediaImageProps.d.ts +5 -0
  150. package/dist/types-ts4.5/utils/shouldDisplayImageThumbnail.d.ts +3 -0
  151. package/dist/types-ts4.5/utils/ufoExperiences.d.ts +7 -0
  152. package/dist/types-ts4.5/utils/videoIsPlayable.d.ts +2 -0
  153. package/dist/types-ts4.5/utils/videoSnapshot.d.ts +1 -0
  154. package/dist/types-ts4.5/utils/viewportDetector.d.ts +6 -0
  155. package/package.json +5 -5
  156. package/report.api.md +0 -5
@@ -0,0 +1,10 @@
1
+ import { FileAttributes, MediaTraceContext, PerformanceAttributes } from '@atlaskit/media-common';
2
+ import { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
3
+ import { SSRStatus } from '../utils/analytics';
4
+ import { CardStatus } from '../types';
5
+ import { MediaCardError } from '../errors';
6
+ export declare const fireOperationalEvent: (createAnalyticsEvent: CreateUIAnalyticsEvent, status: CardStatus, fileAttributes: FileAttributes, performanceAttributes: PerformanceAttributes, ssrReliability: SSRStatus, error: MediaCardError | undefined, traceContext: MediaTraceContext, metadataTraceContext?: MediaTraceContext) => void;
7
+ export declare const fireCommencedEvent: (createAnalyticsEvent: CreateUIAnalyticsEvent, fileAttributes: FileAttributes, performanceAttributes: PerformanceAttributes, traceContext: MediaTraceContext) => void;
8
+ export declare const fireCopiedEvent: (createAnalyticsEvent: CreateUIAnalyticsEvent, fileId: string, cardRef: HTMLDivElement) => void;
9
+ export declare const fireScreenEvent: (createAnalyticsEvent: CreateUIAnalyticsEvent, fileAttributes: FileAttributes) => void;
10
+ export declare const fireNonCriticalErrorEvent: (createAnalyticsEvent: CreateUIAnalyticsEvent, cardStatus: CardStatus, fileAttributes: FileAttributes, ssrReliability: SSRStatus, error: MediaCardError | undefined, traceContext: MediaTraceContext, metadataTraceContext?: MediaTraceContext) => void;
@@ -0,0 +1 @@
1
+ export declare const newFileExperienceClassName = "new-file-experience-wrapper";
@@ -0,0 +1,6 @@
1
+ /**@jsx jsx */
2
+ import { jsx } from '@emotion/react';
3
+ import { WrapperProps } from './styles';
4
+ export declare const CardImageViewWrapper: (props: WrapperProps) => jsx.JSX.Element;
5
+ export declare const PlayIconWrapper: (props: any) => jsx.JSX.Element;
6
+ export declare const ProgressBarWrapper: (props: any) => jsx.JSX.Element;
@@ -0,0 +1,8 @@
1
+ /**@jsx jsx */
2
+ import { jsx } from '@emotion/react';
3
+ import { OverlayProps } from './styles';
4
+ export declare const Overlay: (props: OverlayProps) => jsx.JSX.Element;
5
+ export declare const ErrorMessage: (props: any) => jsx.JSX.Element;
6
+ export declare const AltWrapper: (props: any) => jsx.JSX.Element;
7
+ export declare const TitleWrapper: (props: any) => jsx.JSX.Element;
8
+ export declare const Metadata: (props: any) => jsx.JSX.Element;
@@ -0,0 +1,39 @@
1
+ /**@jsx jsx */
2
+ import { jsx } from '@emotion/react';
3
+ import { MouseEvent, Component, ReactNode } from 'react';
4
+ import { MediaType } from '@atlaskit/media-client';
5
+ import { CardAction, CardEventHandler } from '../../actions';
6
+ import { CardStatus } from '../../../types';
7
+ export interface CardOverlayProps {
8
+ readonly cardStatus: CardStatus;
9
+ mediaType?: MediaType;
10
+ mediaName?: string;
11
+ subtitle?: string;
12
+ selectable?: boolean;
13
+ selected?: boolean;
14
+ persistent: boolean;
15
+ error?: ReactNode;
16
+ alt?: string;
17
+ noHover?: boolean;
18
+ actions?: Array<CardAction>;
19
+ icon?: string;
20
+ }
21
+ export interface CardOverlayState {
22
+ isMenuExpanded: boolean;
23
+ }
24
+ export declare class CardOverlay extends Component<CardOverlayProps, CardOverlayState> {
25
+ static defaultProps: {
26
+ actions: never[];
27
+ mediaName: string;
28
+ };
29
+ constructor(props: CardOverlayProps);
30
+ private get wrapperClassNames();
31
+ render(): jsx.JSX.Element;
32
+ errorLine(): false | "" | 0 | jsx.JSX.Element | null | undefined;
33
+ tickBox(): false | jsx.JSX.Element | undefined;
34
+ bottomLeftColumn(): jsx.JSX.Element | undefined;
35
+ onMenuToggle: (attrs: {
36
+ isOpen: boolean;
37
+ }) => void;
38
+ removeBtnClick(handler: CardEventHandler): (e: MouseEvent<HTMLDivElement, any>) => void;
39
+ }
@@ -0,0 +1,26 @@
1
+ /// <reference types="react" />
2
+ /**
3
+ * Everything about this file change is just wrong.
4
+ * Mostly because we do bad things with classes.
5
+ * This is all wrong and hopefully will be removed from existence with card v3,
6
+ * so please don’t be too sad about all this!
7
+ */
8
+ import { GlobalThemeTokens } from '@atlaskit/theme/components';
9
+ export interface OverlayProps {
10
+ hasError?: boolean;
11
+ noHover?: boolean;
12
+ className?: string;
13
+ children?: JSX.Element[];
14
+ }
15
+ export declare const tickBoxStyles: import("@emotion/react").SerializedStyles;
16
+ export declare const overlayStyles: (props: OverlayProps) => import("@emotion/react").SerializedStyles;
17
+ export declare const errorLineStyles: import("@emotion/react").SerializedStyles;
18
+ export declare const leftColumnStyles: import("@emotion/react").SerializedStyles;
19
+ export declare const topRowStyles: import("@emotion/react").SerializedStyles;
20
+ export declare const bottomRowStyles: import("@emotion/react").SerializedStyles;
21
+ export declare const rightColumnStyles: import("@emotion/react").SerializedStyles;
22
+ export declare const errorMessageStyles: import("@emotion/react").SerializedStyles;
23
+ export declare const altWrapperStyles: import("@emotion/react").SerializedStyles;
24
+ export declare const titleWrapperStyles: (theme: GlobalThemeTokens) => import("@emotion/react").SerializedStyles;
25
+ export declare const subtitleStyles: import("@emotion/react").SerializedStyles;
26
+ export declare const metadataStyles: import("@emotion/react").SerializedStyles;
@@ -0,0 +1,4 @@
1
+ /**@jsx jsx */
2
+ import { jsx } from '@emotion/react';
3
+ import { WrapperProps } from '../types';
4
+ export declare const Wrapper: (props: WrapperProps) => jsx.JSX.Element;
@@ -0,0 +1,2 @@
1
+ export declare const fileCardImageViewSelector = "media-file-card-view";
2
+ export declare const fileCardImageViewSelectedSelector = "media-file-card-view-selected";
@@ -0,0 +1,49 @@
1
+ /**@jsx jsx */
2
+ import { jsx } from '@emotion/react';
3
+ import { Component, ReactNode } from 'react';
4
+ import { MediaItemType, MediaType, ImageResizeMode } from '@atlaskit/media-client';
5
+ import { CardStatus, CardPreview, CardDimensions } from '../../types';
6
+ import { CardAction } from '../actions';
7
+ export interface FileCardImageViewProps {
8
+ readonly mediaName?: string;
9
+ readonly mediaType?: MediaType;
10
+ readonly mimeType?: string;
11
+ readonly fileSize?: string;
12
+ readonly dataURI?: string;
13
+ readonly alt?: string;
14
+ readonly progress?: number;
15
+ readonly status: CardStatus;
16
+ readonly mediaItemType: MediaItemType;
17
+ readonly dimensions?: CardDimensions;
18
+ readonly resizeMode?: ImageResizeMode;
19
+ readonly disableOverlay?: boolean;
20
+ readonly selectable?: boolean;
21
+ readonly selected?: boolean;
22
+ readonly error?: ReactNode;
23
+ readonly actions?: CardAction[];
24
+ readonly onDisplayImage?: () => void;
25
+ readonly previewOrientation?: number;
26
+ readonly onImageError?: (cardPreview: CardPreview) => void;
27
+ readonly onImageLoad?: (cardPreview: CardPreview) => void;
28
+ readonly cardPreview: CardPreview;
29
+ }
30
+ export declare class FileCardImageView extends Component<FileCardImageViewProps> {
31
+ private wasThumbnailDisplayed;
32
+ static defaultProps: Partial<FileCardImageViewProps>;
33
+ render(): jsx.JSX.Element;
34
+ private renderCardContents;
35
+ private renderLoadingContents;
36
+ private renderErrorContents;
37
+ private renderFailedContents;
38
+ private renderUploadingCardOverlay;
39
+ private renderPlayButton;
40
+ onImageLoad: () => void;
41
+ onImageError: () => void;
42
+ private renderMediaImage;
43
+ private renderProgressBar;
44
+ private renderSuccessCardContents;
45
+ private renderSuccessCardOverlay;
46
+ private get isFileCardImageReadyForDisplay();
47
+ private get isCropped();
48
+ private get isStretched();
49
+ }
@@ -0,0 +1,2 @@
1
+ export { FileCardImageView } from './fileCardImageView';
2
+ export type { FileCardImageViewProps } from './fileCardImageView';
@@ -0,0 +1,24 @@
1
+ /// <reference types="react" />
2
+ import { GlobalThemeTokens } from '@atlaskit/theme/components';
3
+ import { CardStatus } from '../../types';
4
+ export interface WrapperProps {
5
+ disableOverlay?: boolean;
6
+ selectable?: boolean;
7
+ selected?: boolean;
8
+ hasOnClick?: boolean;
9
+ mediaType?: string;
10
+ mediaName?: string;
11
+ progress?: number;
12
+ status?: CardStatus;
13
+ theme?: GlobalThemeTokens;
14
+ children?: JSX.Element | JSX.Element[];
15
+ }
16
+ export declare const wrapperStyles: (props: WrapperProps) => import("@emotion/react").SerializedStyles;
17
+ export declare const playIconWrapperStyles: import("@emotion/react").SerializedStyles;
18
+ export declare const playIconBackgroundStyles: import("@emotion/react").SerializedStyles;
19
+ export declare const progressBarWrapperStyles: import("@emotion/react").SerializedStyles;
20
+ export declare const overlayStyles: import("@emotion/react").SerializedStyles;
21
+ export declare const titleStyles: import("@emotion/react").SerializedStyles;
22
+ export declare const bodyStyles: import("@emotion/react").SerializedStyles;
23
+ export declare const progressWrapperStyles: import("@emotion/react").SerializedStyles;
24
+ export declare const cardActionsWrapperStyles: import("@emotion/react").SerializedStyles;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import type { WithMediaClientConfigProps } from '@atlaskit/media-client';
3
+ import type { CardBaseProps } from './card';
4
+ export type CardWithMediaClientConfigProps = WithMediaClientConfigProps<CardBaseProps>;
5
+ declare const CardLoader: React.FC<CardWithMediaClientConfigProps>;
6
+ export default CardLoader;
@@ -0,0 +1,10 @@
1
+ import { FileState } from '@atlaskit/media-client';
2
+ import { MediaFeatureFlags } from '@atlaskit/media-common';
3
+ import { CardState } from '../types';
4
+ import { MediaCardError } from '../errors';
5
+ /**
6
+ * From docs: "Both state and props received by the updater function are guaranteed to be up-to-date.
7
+ * The output of the updater is shallowly merged with state."
8
+ */
9
+ export declare const createStateUpdater: (newState: Partial<CardState>, fireErrorEvent: (error: MediaCardError) => void) => (prevState: CardState) => Partial<CardState>;
10
+ export declare const getCardStateFromFileState: (fileState: FileState, isBannedLocalPreview: boolean, featureFlags?: MediaFeatureFlags) => Partial<CardState>;
@@ -0,0 +1,80 @@
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 } from '../types';
8
+ import { MediaCardError } from '../errors';
9
+ import { CardPreview } from '../types';
10
+ import { MediaCardCursor } from '../types';
11
+ export interface CardViewOwnProps extends SharedCardProps {
12
+ readonly status: CardStatus;
13
+ readonly mediaItemType: MediaItemType;
14
+ readonly mediaCardCursor?: MediaCardCursor;
15
+ readonly metadata?: FileDetails;
16
+ readonly error?: MediaCardError;
17
+ readonly onClick?: (event: React.MouseEvent<HTMLDivElement>, analyticsEvent?: UIAnalyticsEvent) => void;
18
+ readonly onMouseEnter?: (event: MouseEvent<HTMLDivElement>) => void;
19
+ readonly onDisplayImage?: () => void;
20
+ readonly cardPreview?: CardPreview;
21
+ readonly progress?: number;
22
+ readonly innerRef?: (instance: HTMLDivElement | null) => void;
23
+ readonly onImageLoad: (cardPreview: CardPreview) => void;
24
+ readonly onImageError: (cardPreview: CardPreview) => void;
25
+ readonly nativeLazyLoad?: boolean;
26
+ readonly forceSyncDisplay?: boolean;
27
+ disableAnimation?: boolean;
28
+ }
29
+ export interface CardViewState {
30
+ elementWidth?: number;
31
+ didImageRender: boolean;
32
+ }
33
+ export type CardViewProps = CardViewOwnProps & WithAnalyticsEventsProps;
34
+ export interface RenderConfigByStatus {
35
+ renderTypeIcon?: boolean;
36
+ iconMessage?: JSX.Element;
37
+ renderImageRenderer?: boolean;
38
+ renderPlayButton?: boolean;
39
+ renderTitleBox?: boolean;
40
+ renderBlanket?: boolean;
41
+ isFixedBlanket?: boolean;
42
+ renderProgressBar?: boolean;
43
+ renderSpinner?: boolean;
44
+ renderFailedTitleBox?: boolean;
45
+ renderTickBox?: boolean;
46
+ customTitleMessage?: MessageDescriptor;
47
+ }
48
+ /**
49
+ * This is classic vanilla CardView class. To create an instance of class one would need to supply
50
+ * `createAnalyticsEvent` prop to satisfy it's Analytics Events needs.
51
+ */
52
+ export declare class CardViewBase extends React.Component<CardViewProps, CardViewState> {
53
+ state: CardViewState;
54
+ divRef: React.RefObject<HTMLDivElement>;
55
+ static defaultProps: Partial<CardViewOwnProps>;
56
+ componentDidMount(): void;
57
+ componentDidUpdate({ cardPreview: prevCardPreview }: CardViewProps): void;
58
+ private onImageLoad;
59
+ private onImageError;
60
+ private get width();
61
+ private get breakpoint();
62
+ saveElementWidth: () => void;
63
+ render(): jsx.JSX.Element;
64
+ private renderSpinner;
65
+ private shouldRenderPlayButton;
66
+ private renderPlayButton;
67
+ private renderBlanket;
68
+ private renderTitleBox;
69
+ private renderFailedTitleBox;
70
+ private renderProgressBar;
71
+ private renderImageRenderer;
72
+ private renderTickBox;
73
+ private renderMediaTypeIcon;
74
+ private renderActionsBar;
75
+ private renderFileNewExperience;
76
+ private renderFile;
77
+ private getRenderConfigByStatus;
78
+ private renderNewExperienceCard;
79
+ }
80
+ export declare const CardView: React.ForwardRefExoticComponent<Pick<Omit<CardViewProps, keyof WithAnalyticsEventsProps>, never> & Partial<Pick<Omit<CardViewProps, keyof WithAnalyticsEventsProps>, keyof CardViewOwnProps>> & Partial<Pick<Partial<CardViewOwnProps>, never>> & React.RefAttributes<any>>;
@@ -0,0 +1,19 @@
1
+ import { ImageResizeMode } from '@atlaskit/media-client';
2
+ import { ObjectURLCache } from '../../utils/objectURLCache';
3
+ import { CardPreview } from '../../types';
4
+ type Mode = ImageResizeMode | undefined;
5
+ export declare const getCacheKey: (id: string, mode: Mode) => string;
6
+ export interface CardPreviewCache {
7
+ get(id: string, mode: Mode): CardPreview | undefined;
8
+ set(id: string, mode: Mode, cardPreview: CardPreview): void;
9
+ remove(id: string, mode: Mode): void;
10
+ }
11
+ export declare class CardPreviewCacheImpl implements CardPreviewCache {
12
+ private previewCache;
13
+ constructor(previewCache: ObjectURLCache);
14
+ get: (id: string, mode: Mode) => CardPreview | undefined;
15
+ set: (id: string, mode: Mode, cardPreview: CardPreview) => void;
16
+ remove: (id: string, mode: Mode) => void;
17
+ }
18
+ declare const _default: CardPreviewCacheImpl;
19
+ export default _default;
@@ -0,0 +1,5 @@
1
+ import { MediaFeatureFlags } from '@atlaskit/media-common';
2
+ import { CardStatus, FilePreviewStatus } from '../../types';
3
+ import { FileState } from '@atlaskit/media-client';
4
+ export declare const extractFilePreviewStatus: (fileState: FileState, isBannedLocalPreview: boolean, featureFlags?: MediaFeatureFlags) => FilePreviewStatus;
5
+ export declare const isPreviewableStatus: (cardStatus: CardStatus, { isPreviewable, hasPreview, isSupportedByBrowser }: FilePreviewStatus) => boolean;
@@ -0,0 +1,10 @@
1
+ import { MediaClient, FilePreview, MediaStoreGetFileImageParams, MediaType } from '@atlaskit/media-client';
2
+ import { MediaTraceContext } from '@atlaskit/media-common';
3
+ import { CardPreview } from '../../types';
4
+ /**
5
+ * This method tells the support for the media
6
+ * types covered in getCardPreviewFromFilePreview
7
+ */
8
+ export declare const isSupportedLocalPreview: (mediaType?: MediaType) => boolean;
9
+ export declare const getCardPreviewFromFilePreview: (filePreview: FilePreview | Promise<FilePreview>) => Promise<CardPreview>;
10
+ export declare const getCardPreviewFromBackend: (mediaClient: MediaClient, id: string, params: MediaStoreGetFileImageParams, traceContext?: MediaTraceContext) => Promise<CardPreview>;
@@ -0,0 +1,10 @@
1
+ import { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
2
+ import { CardDimensions } from '../../types';
3
+ import { CardPreviewAttributes } from '../../utils/analytics';
4
+ type cardAction = 'cache-hit' | 'remote-success';
5
+ export declare const fireImageFetchingOperationalEvent: (createAnalyticsEvent: CreateUIAnalyticsEvent, action: cardAction, cardPreviewAttributes: CardPreviewAttributes) => void;
6
+ export declare const calculatePercentageDifference: (prevDimensions: CardDimensions | undefined, currentDimensions: CardDimensions | undefined) => {
7
+ width: string;
8
+ height: string;
9
+ } | undefined;
10
+ export {};
@@ -0,0 +1,59 @@
1
+ import { MediaClient, FilePreview, FileState, MediaStoreGetFileImageParams, MediaBlobUrlAttrs, FileIdentifier } from '@atlaskit/media-client';
2
+ import { MediaFeatureFlags, SSR, MediaTraceContext } from '@atlaskit/media-common';
3
+ import { ImageResizeMode } from '@atlaskit/media-client';
4
+ import { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
5
+ import { CardDimensions } from '../../types';
6
+ import { MediaCardError } from '../../errors';
7
+ import { CardStatus, CardPreview } from '../../types';
8
+ export { getCardPreviewFromFilePreview, getCardPreviewFromBackend, isSupportedLocalPreview, } from './helpers';
9
+ export { extractFilePreviewStatus } from './filePreviewStatus';
10
+ export declare const getCardPreviewFromCache: (id: string, mode: ImageResizeMode | undefined) => CardPreview | undefined;
11
+ export declare const removeCardPreviewFromCache: (id: string, mode: ImageResizeMode | undefined) => void;
12
+ /**
13
+ * Will return the preview if available and supported by the browser
14
+ * See extractFilePreviewStatus "hasLocalPreview" logic
15
+ */
16
+ export declare const getFilePreviewFromFileState: (fileState: FileState) => FilePreview | Promise<FilePreview> | undefined;
17
+ export type CardPreviewParams = {
18
+ mediaClient: MediaClient;
19
+ id: string;
20
+ dimensions?: CardDimensions;
21
+ filePreview?: FilePreview | Promise<FilePreview>;
22
+ onLocalPreviewError: (error: MediaCardError) => void;
23
+ isRemotePreviewReady: boolean;
24
+ imageUrlParams: MediaStoreGetFileImageParams;
25
+ mediaBlobUrlAttrs?: MediaBlobUrlAttrs;
26
+ createAnalyticsEvent?: CreateUIAnalyticsEvent;
27
+ featureFlags?: MediaFeatureFlags;
28
+ traceContext?: MediaTraceContext;
29
+ };
30
+ /**
31
+ * This function will try to return a Card preview, either from cache, local preview or remote preview.
32
+ * It should only be called if there is a chance to get either a remote or a local preview, or both.
33
+ * This, in order to ensure there is always going to be a valid return value OR throw an error if the process fails.
34
+ * It is worth noting that local preview failures break the process if there is no remote preview available.
35
+ * In that case we throw an error immediately.
36
+ * Otherwise, if the local preview fails but there is a remote preview available, the failure does not break the process.
37
+ * In that case, we still want to report the local preview error to the caller, for feature realiability track.
38
+ * hence the use of the optional callback onLocalPreviewError
39
+ */
40
+ export declare const getCardPreview: ({ mediaClient, id, dimensions, filePreview, onLocalPreviewError, isRemotePreviewReady, imageUrlParams, mediaBlobUrlAttrs, createAnalyticsEvent, featureFlags, traceContext, }: CardPreviewParams) => Promise<CardPreview>;
41
+ export declare const shouldResolvePreview: ({ status, fileState, prevDimensions, dimensions, identifier, fileImageMode, hasCardPreview, isBannedLocalPreview, featureFlags, wasResolvedUpfrontPreview, }: {
42
+ status: CardStatus;
43
+ fileState: FileState;
44
+ prevDimensions?: CardDimensions | undefined;
45
+ dimensions?: CardDimensions | undefined;
46
+ identifier: FileIdentifier;
47
+ fileImageMode?: ImageResizeMode | undefined;
48
+ hasCardPreview: boolean;
49
+ isBannedLocalPreview: boolean;
50
+ featureFlags?: MediaFeatureFlags | undefined;
51
+ wasResolvedUpfrontPreview: boolean;
52
+ }) => boolean;
53
+ export declare const getSSRCardPreview: (ssr: SSR, mediaClient: MediaClient, id: string, params: MediaStoreGetFileImageParams, mediaBlobUrlAttrs?: MediaBlobUrlAttrs) => CardPreview;
54
+ export declare const isLocalPreview: (preview: CardPreview) => boolean;
55
+ export declare const isSSRPreview: (preview: CardPreview) => boolean;
56
+ export declare const isSSRServerPreview: (preview: CardPreview) => boolean;
57
+ export declare const isSSRClientPreview: (preview: CardPreview) => boolean;
58
+ export declare const isSSRDataPreview: (preview: CardPreview) => boolean;
59
+ export declare const fetchAndCacheRemotePreview: (mediaClient: MediaClient, id: string, dimensions: CardDimensions, params: MediaStoreGetFileImageParams, mediaBlobUrlAttrs?: MediaBlobUrlAttrs, traceContext?: MediaTraceContext) => Promise<CardPreview>;
@@ -0,0 +1,5 @@
1
+ import { FileStatus } from '@atlaskit/media-client';
2
+ import { MediaFeatureFlags } from '@atlaskit/media-common';
3
+ import { CardStatus, FilePreviewStatus } from '../types';
4
+ export declare const isFinalCardStatus: (status: CardStatus) => boolean;
5
+ export declare const getCardStatus: (fileStatus: FileStatus, filePreviewStatus: FilePreviewStatus, featureFlags?: MediaFeatureFlags) => CardStatus;
@@ -0,0 +1 @@
1
+ export { default as Card } from './cardLoader';
@@ -0,0 +1,52 @@
1
+ import React from 'react';
2
+ import { Component } from 'react';
3
+ import { MediaClient, FileIdentifier, FileState, MediaFileArtifacts, MediaSubscription } from '@atlaskit/media-client';
4
+ import { NumericalCardDimensions } from '@atlaskit/media-common';
5
+ import { CardDimensions } from '../types';
6
+ import { WithAnalyticsEventsProps, UIAnalyticsEvent } from '@atlaskit/analytics-next';
7
+ import type { CardPreview } from '../types';
8
+ export interface InlinePlayerOwnProps {
9
+ identifier: FileIdentifier;
10
+ mediaClient: MediaClient;
11
+ dimensions?: CardDimensions;
12
+ originalDimensions?: NumericalCardDimensions;
13
+ autoplay: boolean;
14
+ selected?: boolean;
15
+ onFullscreenChange?: (fullscreen: boolean) => void;
16
+ onError?: (error: Error) => void;
17
+ readonly onClick?: (event: React.MouseEvent<HTMLDivElement>, analyticsEvent?: UIAnalyticsEvent) => void;
18
+ testId?: string;
19
+ readonly cardPreview?: CardPreview;
20
+ readonly forwardRef?: React.Ref<HTMLDivElement>;
21
+ }
22
+ export type InlinePlayerProps = InlinePlayerOwnProps & WithAnalyticsEventsProps;
23
+ export interface InlinePlayerState {
24
+ fileSrc?: string;
25
+ isUploading?: boolean;
26
+ progress?: number;
27
+ elementWidth?: number;
28
+ }
29
+ export declare const getPreferredVideoArtifact: (fileState: FileState) => keyof MediaFileArtifacts | undefined;
30
+ export declare class InlinePlayerBase extends Component<InlinePlayerProps, InlinePlayerState> {
31
+ subscription?: MediaSubscription;
32
+ state: InlinePlayerState;
33
+ divRef: React.RefObject<HTMLDivElement>;
34
+ static defaultProps: {
35
+ dimensions: {
36
+ width: number;
37
+ height: number;
38
+ };
39
+ };
40
+ componentDidMount(): void;
41
+ setFileSrc: (fileSrc: string) => void;
42
+ setBinaryURL: () => Promise<void>;
43
+ unsubscribe: () => void;
44
+ revoke: () => void;
45
+ componentWillUnmount(): void;
46
+ onDownloadClick: () => void;
47
+ onFirstPlay: () => void;
48
+ private get breakpoint();
49
+ saveElementWidth: () => void;
50
+ render(): JSX.Element;
51
+ }
52
+ export declare const InlinePlayer: React.ForwardRefExoticComponent<Pick<InlinePlayerProps, "createAnalyticsEvent" | keyof InlinePlayerOwnProps> & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare const InlinePlayerLazy: import("react").LazyExoticComponent<import("react").ForwardRefExoticComponent<Pick<import("./inlinePlayer").InlinePlayerProps, "createAnalyticsEvent" | keyof import("./inlinePlayer").InlinePlayerOwnProps> & import("react").RefAttributes<HTMLDivElement>>>;
@@ -0,0 +1,4 @@
1
+ /**@jsx jsx */
2
+ import { jsx } from '@emotion/react';
3
+ import { InlinePlayerWrapperProps } from './types';
4
+ export declare const InlinePlayerWrapper: (props: InlinePlayerWrapperProps) => jsx.JSX.Element;
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import { MediaFeatureFlags } from '@atlaskit/media-common';
3
+ import { CardDimensions, CardOnClickCallback } from '../types';
4
+ import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
5
+ export type MediaCardAnalyticsErrorBoundaryProps = {
6
+ dimensions?: CardDimensions;
7
+ data?: {
8
+ [k: string]: any;
9
+ };
10
+ onClick?: CardOnClickCallback;
11
+ featureFlags?: MediaFeatureFlags;
12
+ } & WithAnalyticsEventsProps;
13
+ declare const MediaCardAnalyticsErrorBoundary: React.ComponentType<MediaCardAnalyticsErrorBoundaryProps & WithAnalyticsEventsProps>;
14
+ export default MediaCardAnalyticsErrorBoundary;
@@ -0,0 +1 @@
1
+ export declare const spin: import("@emotion/serialize").Keyframes;
@@ -0,0 +1 @@
1
+ export declare const defaultTransitionDuration = ".3s";
@@ -0,0 +1,2 @@
1
+ export declare const easeOutCubic = "cubic-bezier(0.215, 0.61, 0.355, 1)";
2
+ export declare const easeOutExpo = "cubic-bezier(0.19, 1, 0.22, 1)";
@@ -0,0 +1,3 @@
1
+ export declare const getSelectedBorderStyle: ({ selected, }: {
2
+ selected?: boolean | undefined;
3
+ }) => string;
@@ -0,0 +1,8 @@
1
+ export { defaultTransitionDuration } from './config';
2
+ export { antialiased, borderRadiusLeft, capitalize, centerSelf, centerSelfX, centerSelfY, centerX, hexToRgb, rgba, spaceAround, transition, withAppearance, } from './mixins';
3
+ export type { WithAppearanceProps } from './mixins';
4
+ export { easeOutCubic, easeOutExpo } from './easing';
5
+ export { spin } from './animations';
6
+ export declare const rootStyles: () => import("@emotion/react").SerializedStyles;
7
+ export declare const cardShadow: string;
8
+ export default rootStyles;
@@ -0,0 +1,21 @@
1
+ import { CardAppearance } from '../../types';
2
+ export declare const centerX = "\n display: flex;\n justify-content: center;\n";
3
+ export declare const antialiased = "\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n";
4
+ export declare const centerSelfY = "\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n";
5
+ export declare const centerSelfX = "\n position: absolute;\n left: 50%;\n transform: translateX(-50%);\n";
6
+ export declare const centerSelf = "\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n";
7
+ export declare const borderRadiusLeft: string;
8
+ export declare const spaceAround = "\n display: flex;\n flex-direction: column;\n justify-content: space-around;\n";
9
+ export declare const transition: (propertyName?: string) => string;
10
+ export declare const hexToRgb: (hex: any) => string | null;
11
+ export declare const rgba: (hex: any, opacity: any) => string;
12
+ export declare const capitalize = "\n &::first-letter {\n text-transform: uppercase;\n }\n";
13
+ export interface WithAppearanceProps {
14
+ appearance?: CardAppearance;
15
+ }
16
+ export declare const withAppearance: (styleMap: {
17
+ auto?: string | undefined;
18
+ image?: string | undefined;
19
+ square?: string | undefined;
20
+ horizontal?: string | undefined;
21
+ }) => ({ appearance }: WithAppearanceProps) => string;
@@ -0,0 +1,10 @@
1
+ import { InlinePlayerWrapperProps, WrapperProps } from '../types';
2
+ export declare const inlinePlayerClassName = "media-card-inline-player";
3
+ export declare const wrapperStyles: {
4
+ ({ dimensions, breakpointSize, shouldUsePointerCursor, }: WrapperProps): import("@emotion/react").SerializedStyles;
5
+ displayName: string;
6
+ };
7
+ export declare const inlinePlayerWrapperStyles: {
8
+ ({ dimensions, selected, }: InlinePlayerWrapperProps): import("@emotion/react").SerializedStyles;
9
+ displayName: string;
10
+ };
@@ -0,0 +1,24 @@
1
+ import React, { MouseEvent, ReactElement, RefObject } from 'react';
2
+ import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
3
+ import { CardDimensions } from '../types';
4
+ import { BreakpointSizeValue } from '../utils/breakpoint';
5
+ export interface WrapperProps {
6
+ testId?: string;
7
+ shouldUsePointerCursor?: boolean;
8
+ dimensions?: CardDimensions;
9
+ breakpointSize?: BreakpointSizeValue;
10
+ onClick?: (event: React.MouseEvent<HTMLDivElement>, analyticsEvent?: UIAnalyticsEvent) => void;
11
+ onMouseEnter?: (event: MouseEvent<HTMLDivElement>) => void;
12
+ innerRef?: RefObject<HTMLDivElement>;
13
+ children?: JSX.Element;
14
+ }
15
+ export type InlinePlayerWrapperProps = {
16
+ testId?: string;
17
+ dimensions?: CardDimensions;
18
+ selected: {
19
+ selected?: boolean | undefined;
20
+ };
21
+ onClick?: (event: React.MouseEvent<HTMLDivElement>, analyticsEvent?: UIAnalyticsEvent) => void;
22
+ innerRef?: RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | undefined;
23
+ children?: JSX.Element[] | ReactElement<any, any> | null | any;
24
+ };
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import { ActionsBarProps } from './types';
3
+ export declare class ActionsBar extends React.Component<ActionsBarProps> {
4
+ render(): JSX.Element | null;
5
+ }
@@ -0,0 +1,4 @@
1
+ /**@jsx jsx */
2
+ import { jsx } from '@emotion/react';
3
+ import { ActionBarWrapperProps } from './types';
4
+ export declare const ActionsBarWrapper: (props: ActionBarWrapperProps) => jsx.JSX.Element;
@@ -0,0 +1,6 @@
1
+ export declare const actionsBarClassName = "media-card-actions-bar";
2
+ export declare const fixedActionBarStyles = "opacity: 1;";
3
+ export declare const wrapperStyles: {
4
+ (isFixed?: boolean): import("@emotion/react").SerializedStyles;
5
+ displayName: string;
6
+ };
@@ -0,0 +1,10 @@
1
+ import { ReactNode } from 'react';
2
+ import { CardAction } from '../../actions';
3
+ export interface ActionsBarProps {
4
+ actions: Array<CardAction>;
5
+ isFixed?: boolean;
6
+ }
7
+ export type ActionBarWrapperProps = {
8
+ isFixed?: boolean;
9
+ children?: ReactNode;
10
+ };
@@ -0,0 +1,6 @@
1
+ /**@jsx jsx */
2
+ import { jsx } from '@emotion/react';
3
+ export interface BlanketProps {
4
+ isFixed?: boolean;
5
+ }
6
+ export declare const Blanket: (props: BlanketProps) => jsx.JSX.Element;
@@ -0,0 +1,6 @@
1
+ export declare const blanketClassName = "media-card-blanket";
2
+ export declare const fixedBlanketStyles: string;
3
+ export declare const blanketStyles: {
4
+ (isFixed?: boolean): import("@emotion/react").SerializedStyles;
5
+ displayName: string;
6
+ };