@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.
- package/CHANGELOG.md +92 -0
- package/dist/cjs/actions.js +2 -2
- package/dist/cjs/errors.js +35 -11
- package/dist/cjs/files/cardImageView/cardOverlay/styled.js +1 -1
- package/dist/cjs/files/cardImageView/index.js +1 -1
- package/dist/cjs/files/cardImageView/styled.js +1 -1
- package/dist/cjs/index.js +8 -8
- package/dist/cjs/root/card/cardAnalytics.js +2 -2
- package/dist/cjs/root/card/cardLoader.js +66 -124
- package/dist/cjs/root/card/cardState.js +2 -2
- package/dist/cjs/root/card/getCardPreview/cache.js +5 -5
- package/dist/cjs/root/card/getCardPreview/filePreviewStatus.js +4 -1
- package/dist/cjs/root/card/getCardPreview/helpers.js +1 -1
- package/dist/cjs/root/card/getCardPreview/index.js +101 -18
- package/dist/cjs/root/card/getCardStatus.js +1 -1
- package/dist/cjs/root/card/index.js +191 -97
- package/dist/cjs/root/cardView.js +44 -57
- package/dist/cjs/root/inline/loader.js +45 -14
- package/dist/cjs/root/inline/mediaInlineCard.js +31 -11
- package/dist/cjs/root/inlinePlayer.js +77 -24
- package/dist/cjs/root/styled.js +7 -3
- package/dist/cjs/root/ui/actionsBar/styled.js +1 -1
- package/dist/cjs/root/ui/blanket/styled.js +1 -1
- package/dist/cjs/root/ui/common.js +11 -5
- package/dist/cjs/root/ui/iconMessage/index.js +5 -3
- package/dist/cjs/root/ui/iconWrapper/styled.js +1 -1
- package/dist/cjs/root/ui/imageRenderer/imageRenderer.js +6 -2
- package/dist/cjs/root/ui/loadingRateLimited/loadingRateLimited.js +6 -4
- package/dist/cjs/root/ui/loadingRateLimited/styled.js +2 -2
- package/dist/cjs/root/ui/playButton/styled.js +1 -1
- package/dist/cjs/root/ui/progressBar/progressBar.js +7 -4
- package/dist/cjs/root/ui/progressBar/styled.js +8 -9
- package/dist/cjs/root/ui/styled.js +80 -17
- package/dist/cjs/root/ui/tickBox/styled.js +1 -1
- package/dist/cjs/root/ui/titleBox/failedTitleBox.js +4 -2
- package/dist/cjs/root/ui/titleBox/styled.js +2 -4
- package/dist/cjs/root/ui/titleBox/titleBox.js +2 -2
- package/dist/cjs/styles/index.js +25 -23
- package/dist/cjs/styles/mixins.js +1 -1
- package/dist/cjs/utils/analytics.js +2 -1
- package/dist/cjs/utils/breakpoint.js +1 -1
- package/dist/cjs/utils/cardActions/cardActionsDropdownMenu.js +18 -9
- package/dist/cjs/utils/cardActions/index.js +10 -10
- package/dist/cjs/utils/cardActions/styled.js +1 -1
- package/dist/cjs/utils/cardDimensions.js +1 -1
- package/dist/cjs/utils/getErrorMessage.js +2 -2
- package/dist/cjs/utils/index.js +46 -46
- package/dist/cjs/utils/lightCards/styled.js +1 -1
- package/dist/cjs/utils/objectURLCache.js +1 -1
- package/dist/cjs/utils/viewportDetector.js +49 -22
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/errors.js +9 -1
- package/dist/es2019/root/card/cardAnalytics.js +1 -1
- package/dist/es2019/root/card/cardLoader.js +47 -53
- package/dist/es2019/root/card/getCardPreview/filePreviewStatus.js +4 -1
- package/dist/es2019/root/card/getCardPreview/index.js +45 -3
- package/dist/es2019/root/card/index.js +131 -35
- package/dist/es2019/root/cardView.js +26 -40
- package/dist/es2019/root/inline/loader.js +15 -4
- package/dist/es2019/root/inline/mediaInlineCard.js +30 -10
- package/dist/es2019/root/inlinePlayer.js +56 -4
- package/dist/es2019/root/styled.js +2 -1
- package/dist/es2019/root/ui/common.js +7 -1
- package/dist/es2019/root/ui/iconMessage/index.js +3 -2
- package/dist/es2019/root/ui/imageRenderer/imageRenderer.js +6 -2
- package/dist/es2019/root/ui/loadingRateLimited/loadingRateLimited.js +4 -3
- package/dist/es2019/root/ui/loadingRateLimited/styled.js +1 -1
- package/dist/es2019/root/ui/progressBar/progressBar.js +5 -3
- package/dist/es2019/root/ui/progressBar/styled.js +7 -6
- package/dist/es2019/root/ui/styled.js +65 -4
- package/dist/es2019/root/ui/titleBox/failedTitleBox.js +3 -2
- package/dist/es2019/root/ui/titleBox/styled.js +1 -2
- package/dist/es2019/root/ui/titleBox/titleBox.js +1 -1
- package/dist/es2019/utils/cardActions/cardActionsDropdownMenu.js +8 -4
- package/dist/es2019/utils/getErrorMessage.js +1 -1
- package/dist/es2019/utils/viewportDetector.js +48 -18
- package/dist/es2019/version.json +1 -1
- package/dist/esm/actions.js +2 -2
- package/dist/esm/errors.js +28 -9
- package/dist/esm/root/card/cardAnalytics.js +1 -1
- package/dist/esm/root/card/cardLoader.js +66 -126
- package/dist/esm/root/card/cardState.js +2 -2
- package/dist/esm/root/card/getCardPreview/cache.js +3 -2
- package/dist/esm/root/card/getCardPreview/filePreviewStatus.js +4 -1
- package/dist/esm/root/card/getCardPreview/index.js +74 -12
- package/dist/esm/root/card/index.js +198 -100
- package/dist/esm/root/cardView.js +42 -54
- package/dist/esm/root/inline/loader.js +46 -14
- package/dist/esm/root/inline/mediaInlineCard.js +30 -10
- package/dist/esm/root/inlinePlayer.js +74 -23
- package/dist/esm/root/styled.js +3 -2
- package/dist/esm/root/ui/common.js +7 -1
- package/dist/esm/root/ui/iconMessage/index.js +3 -2
- package/dist/esm/root/ui/imageRenderer/imageRenderer.js +6 -2
- package/dist/esm/root/ui/loadingRateLimited/loadingRateLimited.js +4 -3
- package/dist/esm/root/ui/loadingRateLimited/styled.js +1 -1
- package/dist/esm/root/ui/progressBar/progressBar.js +6 -3
- package/dist/esm/root/ui/progressBar/styled.js +7 -7
- package/dist/esm/root/ui/styled.js +61 -13
- package/dist/esm/root/ui/titleBox/failedTitleBox.js +3 -2
- package/dist/esm/root/ui/titleBox/styled.js +1 -2
- package/dist/esm/root/ui/titleBox/titleBox.js +1 -1
- package/dist/esm/utils/cardActions/cardActionsDropdownMenu.js +17 -9
- package/dist/esm/utils/getErrorMessage.js +1 -1
- package/dist/esm/utils/viewportDetector.js +48 -21
- package/dist/esm/version.json +1 -1
- package/dist/types/errors.d.ts +9 -3
- package/dist/types/index.d.ts +3 -1
- package/dist/types/root/card/cardLoader.d.ts +5 -19
- package/dist/types/root/card/getCardPreview/index.d.ts +7 -1
- package/dist/types/root/card/index.d.ts +9 -8
- package/dist/types/root/cardView.d.ts +5 -3
- package/dist/types/root/inline/loader.d.ts +2 -0
- package/dist/types/root/inline/mediaInlineCard.d.ts +3 -5
- package/dist/types/root/inlinePlayer.d.ts +8 -1
- package/dist/types/root/styled.d.ts +1 -0
- package/dist/types/root/ui/common.d.ts +4 -1
- package/dist/types/root/ui/iconMessage/index.d.ts +2 -2
- package/dist/types/root/ui/iconWrapper/styled.d.ts +1 -1
- package/dist/types/root/ui/imageRenderer/imageRenderer.d.ts +3 -2
- package/dist/types/root/ui/loadingRateLimited/loadingRateLimited.d.ts +2 -1
- package/dist/types/root/ui/loadingRateLimited/styled.d.ts +1 -1
- package/dist/types/root/ui/playButton/playButton.d.ts +1 -0
- package/dist/types/root/ui/progressBar/progressBar.d.ts +4 -2
- package/dist/types/root/ui/progressBar/styled.d.ts +3 -2
- package/dist/types/root/ui/styled.d.ts +10 -3
- package/dist/types/root/ui/tickBox/tickBox.d.ts +1 -0
- package/dist/types/root/ui/titleBox/failedTitleBox.d.ts +3 -3
- package/dist/types/root/ui/titleBox/styled.d.ts +1 -1
- package/dist/types/root/ui/titleBox/titleBox.d.ts +2 -10
- package/dist/types/types.d.ts +1 -1
- package/dist/types/utils/getErrorMessage.d.ts +1 -0
- package/dist/types/utils/viewportDetector.d.ts +13 -5
- package/example-helpers/developmentUseMessage.tsx +14 -0
- package/example-helpers/index.tsx +34 -4
- package/example-helpers/selectableCard.tsx +2 -1
- package/package.json +16 -15
- package/dist/cjs/root/card/cardSSRView.js +0 -114
- package/dist/cjs/root/ui/Breakpoint.js +0 -13
- package/dist/cjs/root/ui/styledSSR.js +0 -108
- package/dist/cjs/utils/lazyContent/index.js +0 -56
- package/dist/cjs/utils/lazyContent/styled.js +0 -23
- package/dist/es2019/root/card/cardSSRView.js +0 -93
- package/dist/es2019/root/ui/Breakpoint.js +0 -6
- package/dist/es2019/root/ui/styledSSR.js +0 -93
- package/dist/es2019/utils/lazyContent/index.js +0 -18
- package/dist/es2019/utils/lazyContent/styled.js +0 -12
- package/dist/esm/root/card/cardSSRView.js +0 -92
- package/dist/esm/root/ui/Breakpoint.js +0 -6
- package/dist/esm/root/ui/styledSSR.js +0 -76
- package/dist/esm/utils/lazyContent/index.js +0 -41
- package/dist/esm/utils/lazyContent/styled.js +0 -14
- package/dist/types/root/card/cardSSRView.d.ts +0 -13
- package/dist/types/root/ui/Breakpoint.d.ts +0 -4
- package/dist/types/root/ui/styledSSR.d.ts +0 -16
- package/dist/types/utils/lazyContent/index.d.ts +0 -11
- package/dist/types/utils/lazyContent/styled.d.ts +0 -5
|
@@ -10,6 +10,7 @@ export interface InlinePlayerOwnProps {
|
|
|
10
10
|
mediaClient: MediaClient;
|
|
11
11
|
dimensions?: CardDimensions;
|
|
12
12
|
originalDimensions?: NumericalCardDimensions;
|
|
13
|
+
autoplay: boolean;
|
|
13
14
|
selected?: boolean;
|
|
14
15
|
onError?: (error: Error) => void;
|
|
15
16
|
readonly onClick?: (event: React.MouseEvent<HTMLDivElement>, analyticsEvent?: UIAnalyticsEvent) => void;
|
|
@@ -19,11 +20,15 @@ export interface InlinePlayerOwnProps {
|
|
|
19
20
|
export declare type InlinePlayerProps = InlinePlayerOwnProps & WithAnalyticsEventsProps;
|
|
20
21
|
export interface InlinePlayerState {
|
|
21
22
|
fileSrc?: string;
|
|
23
|
+
isUploading?: boolean;
|
|
24
|
+
progress?: number;
|
|
25
|
+
elementWidth?: number;
|
|
22
26
|
}
|
|
23
27
|
export declare const getPreferredVideoArtifact: (fileState: FileState) => keyof MediaFileArtifacts | undefined;
|
|
24
28
|
export declare class InlinePlayerBase extends Component<InlinePlayerProps, InlinePlayerState> {
|
|
25
29
|
subscription?: Subscription;
|
|
26
30
|
state: InlinePlayerState;
|
|
31
|
+
divRef: React.RefObject<HTMLDivElement>;
|
|
27
32
|
static defaultProps: {
|
|
28
33
|
dimensions: {
|
|
29
34
|
width: number;
|
|
@@ -38,6 +43,8 @@ export declare class InlinePlayerBase extends Component<InlinePlayerProps, Inlin
|
|
|
38
43
|
componentWillUnmount(): void;
|
|
39
44
|
onDownloadClick: () => void;
|
|
40
45
|
onFirstPlay: () => void;
|
|
46
|
+
private get breakpoint();
|
|
47
|
+
saveElementWidth: () => void;
|
|
41
48
|
render(): JSX.Element;
|
|
42
49
|
}
|
|
43
|
-
export declare const InlinePlayer: React.ForwardRefExoticComponent<Pick<InlinePlayerProps, "onError" | "onClick" | "
|
|
50
|
+
export declare const InlinePlayer: React.ForwardRefExoticComponent<Pick<InlinePlayerProps, "onError" | "onClick" | "testId" | "createAnalyticsEvent" | "selected" | "dimensions" | "originalDimensions" | "mediaClient" | "identifier" | "autoplay" | "forwardRef"> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -12,4 +12,5 @@ declare type InlinePlayerWrapper = {
|
|
|
12
12
|
selected?: boolean;
|
|
13
13
|
};
|
|
14
14
|
export declare const InlinePlayerWrapper: import("styled-components").StyledComponentClass<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & InlinePlayerWrapper, any, import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & InlinePlayerWrapper>;
|
|
15
|
+
export declare const FormattedMessageWrapper: import("styled-components").StyledComponentClass<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, any, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>>;
|
|
15
16
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { MessageDescriptor } from 'react-intl-next';
|
|
3
3
|
export declare type InternalIconMessageProps = {
|
|
4
|
-
messageDescriptor:
|
|
4
|
+
messageDescriptor: MessageDescriptor;
|
|
5
5
|
animated?: boolean;
|
|
6
6
|
reducedFont?: boolean;
|
|
7
7
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { Breakpoint } from '../
|
|
2
|
+
import { Breakpoint } from '../common';
|
|
3
3
|
export declare function titleBoxHeight(hasTitleBox: boolean, breakpoint: Breakpoint): string;
|
|
4
4
|
export declare type IconWrapperProps = {
|
|
5
5
|
hasTitleBox: boolean;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { MediaType, ImageResizeMode
|
|
2
|
+
import { MediaType, ImageResizeMode } from '@atlaskit/media-client';
|
|
3
3
|
export declare type ImageRendererProps = {
|
|
4
4
|
readonly dataURI: string;
|
|
5
5
|
readonly mediaType: MediaType;
|
|
6
|
-
readonly mediaItemType: MediaItemType;
|
|
7
6
|
readonly previewOrientation?: number;
|
|
8
7
|
readonly alt?: string;
|
|
9
8
|
readonly resizeMode?: ImageResizeMode;
|
|
10
9
|
readonly onDisplayImage?: () => void;
|
|
11
10
|
readonly onImageError?: () => void;
|
|
12
11
|
readonly onImageLoad?: () => void;
|
|
12
|
+
readonly nativeLazyLoad?: boolean;
|
|
13
|
+
readonly forceSyncDisplay?: boolean;
|
|
13
14
|
};
|
|
14
15
|
export declare const ImageRenderer: React.FC<ImageRendererProps>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Breakpoint } from '../common';
|
|
2
3
|
export declare const LoadingRateLimited: ({ breakpoint, positionBottom, }: {
|
|
3
4
|
breakpoint?: Breakpoint | undefined;
|
|
4
5
|
positionBottom?: boolean | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HTMLAttributes, ComponentClass } from 'react';
|
|
2
|
-
import { Breakpoint } from '../
|
|
2
|
+
import { Breakpoint } from '../common';
|
|
3
3
|
export declare const LoadingRateLimitedContainer: import("styled-components").StyledComponentClass<import("react").DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, any, import("react").DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>>;
|
|
4
4
|
export declare const WarningIconWrapper: ComponentClass<HTMLAttributes<{}>>;
|
|
5
5
|
export declare type StyledTextProps = {
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Breakpoint } from '../common';
|
|
2
3
|
export declare type ProgressBarProps = {
|
|
3
4
|
progress?: number;
|
|
4
5
|
breakpoint?: Breakpoint;
|
|
5
6
|
positionBottom?: boolean;
|
|
7
|
+
showOnTop?: boolean;
|
|
6
8
|
};
|
|
7
|
-
export declare const ProgressBar: ({ progress, breakpoint, positionBottom, }: ProgressBarProps) => JSX.Element;
|
|
9
|
+
export declare const ProgressBar: ({ progress, breakpoint, positionBottom, showOnTop, }: ProgressBarProps) => JSX.Element;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { Breakpoint } from '../
|
|
3
|
-
export declare function generateResponsiveStyles(breakpoint: Breakpoint, positionBottom: boolean, multiplier?: number): string;
|
|
2
|
+
import { Breakpoint } from '../common';
|
|
3
|
+
export declare function generateResponsiveStyles(breakpoint: Breakpoint, positionBottom: boolean, showOnTop: boolean, multiplier?: number): string;
|
|
4
4
|
export declare type StyledBarProps = {
|
|
5
5
|
progress: number;
|
|
6
6
|
breakpoint: Breakpoint;
|
|
7
7
|
positionBottom: boolean;
|
|
8
|
+
showOnTop: boolean;
|
|
8
9
|
};
|
|
9
10
|
export declare const StyledBar: import("styled-components").StyledComponentClass<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & StyledBarProps, any, import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & StyledBarProps>;
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { CardDimensions, CardAppearance } from '../..';
|
|
3
|
+
import { Breakpoint } from './common';
|
|
4
|
+
export declare const calcBreakpointSize: (wrapperWidth?: number) => Breakpoint;
|
|
5
|
+
export interface NewFileExperienceWrapperProps {
|
|
6
|
+
breakpoint: Breakpoint;
|
|
7
|
+
dimensions?: CardDimensions;
|
|
8
|
+
appearance?: CardAppearance;
|
|
9
|
+
mediaType?: string;
|
|
4
10
|
shouldUsePointerCursor: boolean;
|
|
5
11
|
disableOverlay: boolean;
|
|
6
12
|
displayBackground: boolean;
|
|
@@ -9,4 +15,5 @@ export interface NewFileExperienceWrapperProps extends BaseNewFileExperienceWrap
|
|
|
9
15
|
isTickBoxSelectable: boolean;
|
|
10
16
|
shouldDisplayTooltip: boolean;
|
|
11
17
|
}
|
|
12
|
-
export declare const NewFileExperienceWrapper: import("styled-components").StyledComponentClass<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> &
|
|
18
|
+
export declare const NewFileExperienceWrapper: import("styled-components").StyledComponentClass<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & NewFileExperienceWrapperProps, any, import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & NewFileExperienceWrapperProps>;
|
|
19
|
+
export declare const CardImageContainer: import("styled-components").StyledComponentClass<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, any, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Breakpoint } from '../
|
|
3
|
-
import {
|
|
2
|
+
import { Breakpoint } from '../common';
|
|
3
|
+
import { MessageDescriptor } from 'react-intl-next';
|
|
4
4
|
export declare type OnRetryFunction = () => void;
|
|
5
5
|
export declare type FailedTitleBoxProps = {
|
|
6
6
|
breakpoint: Breakpoint;
|
|
7
|
-
customMessage?:
|
|
7
|
+
customMessage?: MessageDescriptor;
|
|
8
8
|
};
|
|
9
9
|
export declare const FailedTitleBox: React.FC<FailedTitleBoxProps>;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
/// <reference types="react-intl" />
|
|
2
1
|
import React from 'react';
|
|
3
2
|
import { TitleBoxIcon as TitleBoxIconType } from '../../../index';
|
|
4
|
-
import { Breakpoint } from '../
|
|
3
|
+
import { Breakpoint } from '../common';
|
|
5
4
|
export declare type TitleBoxProps = {
|
|
6
5
|
name: string;
|
|
7
6
|
breakpoint: Breakpoint;
|
|
@@ -12,13 +11,6 @@ export declare type TitleBoxProps = {
|
|
|
12
11
|
declare type FormattedDateProps = {
|
|
13
12
|
timestamp: number;
|
|
14
13
|
};
|
|
15
|
-
declare
|
|
16
|
-
intl?: {
|
|
17
|
-
locale?: string;
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
export declare const FormattedDate: React.ComponentClass<FormattedDateProps & WithIntlProps, any> & {
|
|
21
|
-
WrappedComponent: ReactIntl.ComponentConstructor<FormattedDateProps & WithIntlProps & ReactIntl.InjectedIntlProps>;
|
|
22
|
-
};
|
|
14
|
+
export declare const FormattedDate: React.ComponentType<FormattedDateProps>;
|
|
23
15
|
export declare const TitleBox: ({ name, createdAt, breakpoint, titleBoxBgColor, titleBoxIcon, }: TitleBoxProps) => JSX.Element;
|
|
24
16
|
export {};
|
package/dist/types/types.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export declare type FilePreviewStatus = {
|
|
|
7
7
|
};
|
|
8
8
|
export declare type CardAppearance = 'auto' | 'image' | 'square' | 'horizontal';
|
|
9
9
|
export declare type CardDimensionValue = number | string;
|
|
10
|
-
export declare type CardPreviewSource = 'local' | 'remote' | 'cache-local' | 'cache-remote' | 'external';
|
|
10
|
+
export declare type CardPreviewSource = 'local' | 'remote' | 'ssr-server' | 'ssr-client' | 'cache-local' | 'cache-remote' | 'cache-ssr-client' | 'cache-ssr-server' | 'external';
|
|
11
11
|
export interface CardPreview {
|
|
12
12
|
dataURI: string;
|
|
13
13
|
orientation?: number;
|
|
@@ -1,8 +1,16 @@
|
|
|
1
|
-
import React
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* As IntersectionObserver::rootMargin doesn't work within IFrames, we use an empty div + dynamic offsetTop to eagerly detect cards entering viewport.
|
|
4
|
+
* Using this approach, we can lazy load cards ABS_VIEWPORT_ANCHOR_OFFSET_TOP px before they enter viewport.
|
|
5
|
+
*/
|
|
6
|
+
export declare const ABS_VIEWPORT_ANCHOR_OFFSET_TOP = 900;
|
|
7
|
+
export declare const ViewportAnchor: React.ForwardRefExoticComponent<{
|
|
8
|
+
offsetTop: number;
|
|
9
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
10
|
+
export declare type ViewportDetectorProps = {
|
|
11
|
+
cardEl: HTMLElement | null;
|
|
12
|
+
preAnchorRef: React.RefObject<HTMLDivElement>;
|
|
13
|
+
postAnchorRef: React.RefObject<HTMLDivElement>;
|
|
4
14
|
onVisible: () => void;
|
|
5
15
|
};
|
|
6
|
-
export declare const createViewportDetector: (isIntersectionObserverSupported: boolean) => React.FC<ViewportDetectorProps>;
|
|
7
16
|
export declare const ViewportDetector: React.FC<ViewportDetectorProps>;
|
|
8
|
-
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import InlineMessage from '@atlaskit/inline-message';
|
|
3
|
+
|
|
4
|
+
const DevelopmentUseMessage: React.FC = () => (
|
|
5
|
+
<div style={{ textAlign: 'center' }}>
|
|
6
|
+
<InlineMessage type={'warning'} title={'Development use only'}>
|
|
7
|
+
The purpose of this example is to explore on edge cases for this
|
|
8
|
+
component's feature. Some ways of using the component in here might not be
|
|
9
|
+
the standard way. It is discouraged to use this code as a base for
|
|
10
|
+
consumers.
|
|
11
|
+
</InlineMessage>
|
|
12
|
+
</div>
|
|
13
|
+
);
|
|
14
|
+
export default DevelopmentUseMessage;
|
|
@@ -9,11 +9,16 @@ import {
|
|
|
9
9
|
FeatureFlagsWrapper,
|
|
10
10
|
} from '@atlaskit/media-test-helpers';
|
|
11
11
|
import CrossIcon from '@atlaskit/icon/glyph/cross';
|
|
12
|
+
import FabricAnalyticsListeners, {
|
|
13
|
+
AnalyticsWebClient,
|
|
14
|
+
} from '@atlaskit/analytics-listeners';
|
|
15
|
+
|
|
12
16
|
import AnnotateIcon from '@atlaskit/icon/glyph/media-services/annotate';
|
|
13
17
|
import { SelectableCard } from './selectableCard';
|
|
14
18
|
import { Card, CardAppearance, CardEvent, CardAction } from '../src';
|
|
15
19
|
import { relevantFeatureFlagNames } from '../src/root/card/cardAnalytics';
|
|
16
20
|
import { MediaCardError } from '../src/errors';
|
|
21
|
+
import DevelopmentUseMessage from './developmentUseMessage';
|
|
17
22
|
|
|
18
23
|
const mediaClientConfig = createStorybookMediaClientConfig();
|
|
19
24
|
|
|
@@ -119,10 +124,20 @@ export const wrongMediaClientConfig = createStorybookMediaClientConfig({
|
|
|
119
124
|
});
|
|
120
125
|
export const wrongCollection = 'adfasdf';
|
|
121
126
|
|
|
122
|
-
export
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
127
|
+
export type MainWrapperProps = {
|
|
128
|
+
developmentOnly?: boolean;
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
export const MainWrapper: React.FC<MainWrapperProps> = ({
|
|
132
|
+
children,
|
|
133
|
+
developmentOnly,
|
|
134
|
+
}) => (
|
|
135
|
+
<>
|
|
136
|
+
{developmentOnly && <DevelopmentUseMessage />}
|
|
137
|
+
<FeatureFlagsWrapper filterFlags={relevantFeatureFlagNames}>
|
|
138
|
+
{children}
|
|
139
|
+
</FeatureFlagsWrapper>
|
|
140
|
+
</>
|
|
126
141
|
);
|
|
127
142
|
|
|
128
143
|
export const mediaCardErrorState = (
|
|
@@ -142,3 +157,18 @@ export const mediaCardErrorState = (
|
|
|
142
157
|
return undefined;
|
|
143
158
|
}
|
|
144
159
|
};
|
|
160
|
+
|
|
161
|
+
export const SSRAnalyticsWrapper: React.FC = ({ children }) => {
|
|
162
|
+
const mockClient: AnalyticsWebClient = {
|
|
163
|
+
sendUIEvent: (e) => console.debug('UI event', e),
|
|
164
|
+
sendOperationalEvent: (e) => console.debug('Operational event', e),
|
|
165
|
+
sendTrackEvent: (e) => console.debug('Track event', e),
|
|
166
|
+
sendScreenEvent: (e) => console.debug('Screen event', e),
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
return (
|
|
170
|
+
<FabricAnalyticsListeners client={mockClient}>
|
|
171
|
+
{children}
|
|
172
|
+
</FabricAnalyticsListeners>
|
|
173
|
+
);
|
|
174
|
+
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Component } from 'react';
|
|
3
|
+
import { MediaClientConfig } from '@atlaskit/media-core';
|
|
3
4
|
import { Identifier } from '@atlaskit/media-client';
|
|
4
5
|
import { Card } from '../src';
|
|
5
6
|
|
|
6
7
|
export interface SelectableCardProps {
|
|
7
|
-
mediaClientConfig:
|
|
8
|
+
mediaClientConfig: MediaClientConfig;
|
|
8
9
|
identifier: Identifier;
|
|
9
10
|
}
|
|
10
11
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/media-card",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "73.1.1",
|
|
4
4
|
"description": "Includes all media card related components, CardView, CardViewSmall, Card...",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -29,59 +29,60 @@
|
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@atlaskit/analytics-next": "^8.2.0",
|
|
32
|
-
"@atlaskit/dropdown-menu": "^
|
|
32
|
+
"@atlaskit/dropdown-menu": "^11.0.0",
|
|
33
33
|
"@atlaskit/editor-shared-styles": "^1.6.0",
|
|
34
|
-
"@atlaskit/icon": "^21.
|
|
34
|
+
"@atlaskit/icon": "^21.10.0",
|
|
35
35
|
"@atlaskit/in-product-testing": "^0.1.0",
|
|
36
36
|
"@atlaskit/media-client": "^14.3.0",
|
|
37
|
-
"@atlaskit/media-common": "^2.
|
|
38
|
-
"@atlaskit/media-ui": "^
|
|
39
|
-
"@atlaskit/media-viewer": "^
|
|
37
|
+
"@atlaskit/media-common": "^2.10.0",
|
|
38
|
+
"@atlaskit/media-ui": "^18.1.0",
|
|
39
|
+
"@atlaskit/media-viewer": "^46.0.0",
|
|
40
40
|
"@atlaskit/spinner": "^15.1.0",
|
|
41
|
-
"@atlaskit/theme": "^12.
|
|
41
|
+
"@atlaskit/theme": "^12.1.0",
|
|
42
42
|
"@atlaskit/tooltip": "^17.5.0",
|
|
43
43
|
"@babel/runtime": "^7.0.0",
|
|
44
44
|
"classnames": "^2.2.5",
|
|
45
45
|
"eventemitter2": "^4.1.0",
|
|
46
46
|
"lru-fast": "^0.2.2",
|
|
47
|
-
"react-
|
|
47
|
+
"react-loadable": "^5.1.0",
|
|
48
48
|
"video-snapshot": "^1.0.11"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
51
|
"react": "^16.8.0",
|
|
52
52
|
"react-dom": "^16.8.0",
|
|
53
|
-
"react-intl": "
|
|
53
|
+
"react-intl-next": "npm:react-intl@^5.18.1",
|
|
54
54
|
"rxjs": "^5.5.0",
|
|
55
55
|
"styled-components": "^3.2.6"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"@atlaskit/analytics-listeners": "^8.
|
|
59
|
-
"@atlaskit/analytics-namespaced-context": "^6.
|
|
60
|
-
"@atlaskit/build-utils": "*",
|
|
58
|
+
"@atlaskit/analytics-listeners": "^8.2.0",
|
|
59
|
+
"@atlaskit/analytics-namespaced-context": "^6.4.0",
|
|
61
60
|
"@atlaskit/button": "^16.1.0",
|
|
62
61
|
"@atlaskit/checkbox": "^12.3.0",
|
|
63
62
|
"@atlaskit/docs": "*",
|
|
63
|
+
"@atlaskit/inline-message": "^11.2.0",
|
|
64
64
|
"@atlaskit/item": "^12.0.0",
|
|
65
65
|
"@atlaskit/media-core": "^32.2.0",
|
|
66
|
-
"@atlaskit/media-test-helpers": "^
|
|
66
|
+
"@atlaskit/media-test-helpers": "^29.0.0",
|
|
67
67
|
"@atlaskit/radio": "^5.3.2",
|
|
68
68
|
"@atlaskit/range": "^5.1.0",
|
|
69
69
|
"@atlaskit/select": "^15.2.1",
|
|
70
70
|
"@atlaskit/ssr": "*",
|
|
71
71
|
"@atlaskit/textfield": "^5.1.0",
|
|
72
|
-
"@atlaskit/toggle": "^12.
|
|
72
|
+
"@atlaskit/toggle": "^12.4.0",
|
|
73
73
|
"@atlaskit/visual-regression": "*",
|
|
74
74
|
"@atlaskit/webdriver-runner": "*",
|
|
75
75
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
|
76
76
|
"@testing-library/react": "^8.0.1",
|
|
77
77
|
"@types/classnames": "^2.2.6",
|
|
78
|
+
"@types/react-loadable": "^5.4.1",
|
|
78
79
|
"deepcopy": "0.6.3",
|
|
79
80
|
"enzyme": "^3.10.0",
|
|
80
81
|
"exenv": "^1.2.2",
|
|
81
82
|
"local-cypress": "^1.2.1",
|
|
82
83
|
"react": "^16.8.0",
|
|
83
84
|
"react-dom": "^16.8.0",
|
|
84
|
-
"react-intl": "
|
|
85
|
+
"react-intl-next": "npm:react-intl@^5.18.1",
|
|
85
86
|
"rxjs": "^5.5.0",
|
|
86
87
|
"typescript": "3.9.6",
|
|
87
88
|
"uuid": "^3.1.0",
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.CardSSRView = void 0;
|
|
9
|
-
|
|
10
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
-
|
|
12
|
-
var _react = _interopRequireDefault(require("react"));
|
|
13
|
-
|
|
14
|
-
var _mediaClient = require("@atlaskit/media-client");
|
|
15
|
-
|
|
16
|
-
var _mediaUi = require("@atlaskit/media-ui");
|
|
17
|
-
|
|
18
|
-
var _spinner = _interopRequireDefault(require("@atlaskit/spinner"));
|
|
19
|
-
|
|
20
|
-
var _getDataURIDimension = require("../../utils/getDataURIDimension");
|
|
21
|
-
|
|
22
|
-
var _cardDimensions = require("../../utils/cardDimensions");
|
|
23
|
-
|
|
24
|
-
var _styled = require("../ui/iconWrapper/styled");
|
|
25
|
-
|
|
26
|
-
var _styledSSR = require("../ui/styledSSR");
|
|
27
|
-
|
|
28
|
-
var _styled2 = require("../ui/blanket/styled");
|
|
29
|
-
|
|
30
|
-
var _cardConstants = require("./cardConstants");
|
|
31
|
-
|
|
32
|
-
var _resizeModeToMediaImageProps = require("../../utils/resizeModeToMediaImageProps");
|
|
33
|
-
|
|
34
|
-
/*
|
|
35
|
-
* This file is designed to be optimised for maximum performance.
|
|
36
|
-
* Because of this the imports are optimised to import only what is required
|
|
37
|
-
* If you're adding a new dependency please ensure that the
|
|
38
|
-
* imported file only contains and depends on only what is required for it to function.
|
|
39
|
-
*/
|
|
40
|
-
var CardSSRView = function CardSSRView(_ref) {
|
|
41
|
-
var identifier = _ref.identifier,
|
|
42
|
-
dimensions = _ref.dimensions,
|
|
43
|
-
mediaClient = _ref.mediaClient,
|
|
44
|
-
resizeMode = _ref.resizeMode,
|
|
45
|
-
disableOverlay = _ref.disableOverlay,
|
|
46
|
-
isLazy = _ref.isLazy;
|
|
47
|
-
var dataURI;
|
|
48
|
-
|
|
49
|
-
try {
|
|
50
|
-
var _getRequestedDimensio = (0, _getDataURIDimension.getRequestedDimensions)({
|
|
51
|
-
dimensions: dimensions
|
|
52
|
-
}),
|
|
53
|
-
width = _getRequestedDimensio.width,
|
|
54
|
-
height = _getRequestedDimensio.height;
|
|
55
|
-
|
|
56
|
-
var mode = (0, _mediaClient.imageResizeModeToFileImageMode)(resizeMode);
|
|
57
|
-
dataURI = mediaClient.getImageUrlSync(identifier.id, {
|
|
58
|
-
collection: identifier.collectionName,
|
|
59
|
-
mode: mode,
|
|
60
|
-
width: width,
|
|
61
|
-
height: height,
|
|
62
|
-
allowAnimated: true
|
|
63
|
-
});
|
|
64
|
-
} catch (e) {
|
|
65
|
-
// if we are unable to get the image url (eg missing auth) we want to continue rendering with a spinner
|
|
66
|
-
dataURI = '';
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
var shouldDisplayBackground = !dataURI || !disableOverlay;
|
|
70
|
-
return /*#__PURE__*/_react.default.createElement(_styledSSR.SSRFileExperienceWrapper, {
|
|
71
|
-
className: _cardConstants.newFileExperienceClassName,
|
|
72
|
-
dimensions: dimensions,
|
|
73
|
-
breakpoint: calculateBreakpoint(dimensions),
|
|
74
|
-
shouldUsePointerCursor: Boolean(dataURI),
|
|
75
|
-
displayBackground: shouldDisplayBackground,
|
|
76
|
-
disableOverlay: !!disableOverlay,
|
|
77
|
-
selected: false,
|
|
78
|
-
"data-testid": "media-card-view"
|
|
79
|
-
}, /*#__PURE__*/_react.default.createElement(_styledSSR.CardImageContainer, {
|
|
80
|
-
className: "media-file-card-view",
|
|
81
|
-
"data-testid": "media-file-card-view"
|
|
82
|
-
}, /*#__PURE__*/_react.default.createElement(_styled.IconWrapper, {
|
|
83
|
-
breakpoint: calculateBreakpoint(dimensions),
|
|
84
|
-
hasTitleBox: false
|
|
85
|
-
}, /*#__PURE__*/_react.default.createElement(_spinner.default, null)), !!dataURI && /*#__PURE__*/_react.default.createElement(_mediaUi.MediaImage, (0, _extends2.default)({
|
|
86
|
-
dataURI: dataURI // alt={alt} // having alt text causes the image to fail to render with a broken image.
|
|
87
|
-
// onImageLoad={this.onImageLoad} // TODO add these back as part of tracking performance.
|
|
88
|
-
// onImageError={this.onImageError}
|
|
89
|
-
|
|
90
|
-
}, (0, _resizeModeToMediaImageProps.resizeModeToMediaImageProps)(resizeMode), {
|
|
91
|
-
loading: getLazyValue(isLazy)
|
|
92
|
-
})), !disableOverlay && /*#__PURE__*/_react.default.createElement(_styled2.Blanket, {
|
|
93
|
-
isFixed: false
|
|
94
|
-
})));
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
exports.CardSSRView = CardSSRView;
|
|
98
|
-
|
|
99
|
-
function getLazyValue(isLazy) {
|
|
100
|
-
switch (isLazy) {
|
|
101
|
-
case false:
|
|
102
|
-
return 'eager';
|
|
103
|
-
|
|
104
|
-
default:
|
|
105
|
-
return 'lazy';
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
function calculateBreakpoint(dimensions) {
|
|
110
|
-
var _dimensions$width;
|
|
111
|
-
|
|
112
|
-
var width = (_dimensions$width = dimensions === null || dimensions === void 0 ? void 0 : dimensions.width) !== null && _dimensions$width !== void 0 ? _dimensions$width : _cardDimensions.defaultImageCardDimensions.width;
|
|
113
|
-
return (0, _styledSSR.calcBreakpointSize)(parseInt("".concat(width), 10));
|
|
114
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.Breakpoint = void 0;
|
|
7
|
-
var Breakpoint;
|
|
8
|
-
exports.Breakpoint = Breakpoint;
|
|
9
|
-
|
|
10
|
-
(function (Breakpoint) {
|
|
11
|
-
Breakpoint["SMALL"] = "small";
|
|
12
|
-
Breakpoint["LARGE"] = "large";
|
|
13
|
-
})(Breakpoint || (exports.Breakpoint = Breakpoint = {}));
|