@atlaskit/media-card 77.4.7 → 77.4.9
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 +15 -0
- package/dist/cjs/card/card.js +1 -1
- package/dist/cjs/card/cardView.js +11 -7
- package/dist/cjs/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/cjs/card/ui/titleBox/styles.js +2 -18
- package/dist/cjs/card/ui/titleBox/titleBoxComponents.js +1 -4
- package/dist/cjs/card/ui/wrapper/styles.js +2 -10
- package/dist/cjs/card/ui/wrapper/wrapper.js +1 -4
- package/dist/cjs/card/v2/cardV2.js +1 -1
- package/dist/cjs/card/v2/cardViewV2.js +0 -3
- package/dist/cjs/card/v2/externalImageCard.js +3 -3
- package/dist/cjs/card/v2/fileCard.js +16 -15
- package/dist/cjs/card/v2/useFilePreview.js +44 -20
- package/dist/cjs/inline/loader.js +1 -1
- package/dist/cjs/utils/getDataURIDimension.js +38 -1
- package/dist/cjs/utils/lightCards/lightCardWrappers.js +1 -4
- package/dist/cjs/utils/lightCards/styles.js +2 -14
- package/dist/cjs/utils/ufoExperiences.js +1 -1
- package/dist/es2019/card/card.js +1 -1
- package/dist/es2019/card/cardView.js +6 -1
- package/dist/es2019/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/es2019/card/ui/titleBox/styles.js +3 -19
- package/dist/es2019/card/ui/titleBox/titleBoxComponents.js +1 -4
- package/dist/es2019/card/ui/wrapper/styles.js +2 -10
- package/dist/es2019/card/ui/wrapper/wrapper.js +1 -4
- package/dist/es2019/card/v2/cardV2.js +1 -1
- package/dist/es2019/card/v2/cardViewV2.js +0 -2
- package/dist/es2019/card/v2/externalImageCard.js +3 -3
- package/dist/es2019/card/v2/fileCard.js +18 -17
- package/dist/es2019/card/v2/useFilePreview.js +46 -21
- package/dist/es2019/inline/loader.js +1 -1
- package/dist/es2019/utils/getDataURIDimension.js +39 -0
- package/dist/es2019/utils/lightCards/lightCardWrappers.js +1 -4
- package/dist/es2019/utils/lightCards/styles.js +4 -16
- package/dist/es2019/utils/ufoExperiences.js +1 -1
- package/dist/esm/card/card.js +1 -1
- package/dist/esm/card/cardView.js +11 -7
- package/dist/esm/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/esm/card/ui/titleBox/styles.js +2 -18
- package/dist/esm/card/ui/titleBox/titleBoxComponents.js +1 -4
- package/dist/esm/card/ui/wrapper/styles.js +2 -10
- package/dist/esm/card/ui/wrapper/wrapper.js +1 -4
- package/dist/esm/card/v2/cardV2.js +1 -1
- package/dist/esm/card/v2/cardViewV2.js +0 -3
- package/dist/esm/card/v2/externalImageCard.js +3 -3
- package/dist/esm/card/v2/fileCard.js +18 -17
- package/dist/esm/card/v2/useFilePreview.js +45 -21
- package/dist/esm/inline/loader.js +1 -1
- package/dist/esm/utils/getDataURIDimension.js +38 -0
- package/dist/esm/utils/lightCards/lightCardWrappers.js +1 -4
- package/dist/esm/utils/lightCards/styles.js +3 -15
- package/dist/esm/utils/ufoExperiences.js +1 -1
- package/dist/types/card/ui/titleBox/styles.d.ts +1 -1
- package/dist/types/card/ui/titleBox/types.d.ts +0 -2
- package/dist/types/card/ui/wrapper/styles.d.ts +1 -1
- package/dist/types/card/ui/wrapper/types.d.ts +0 -2
- package/dist/types/card/v2/cardViewV2.d.ts +17 -6
- package/dist/types/card/v2/fileCard.d.ts +40 -6
- package/dist/types/card/v2/useFilePreview.d.ts +5 -9
- package/dist/types/utils/getDataURIDimension.d.ts +17 -0
- package/dist/types/utils/globalScope/globalScope.d.ts +2 -2
- package/dist/types/utils/globalScope/types.d.ts +1 -1
- package/dist/types/utils/lightCards/styles.d.ts +1 -1
- package/dist/types/utils/lightCards/types.d.ts +0 -2
- package/dist/types-ts4.5/card/ui/titleBox/styles.d.ts +1 -1
- package/dist/types-ts4.5/card/ui/titleBox/types.d.ts +0 -2
- package/dist/types-ts4.5/card/ui/wrapper/styles.d.ts +1 -1
- package/dist/types-ts4.5/card/ui/wrapper/types.d.ts +0 -2
- package/dist/types-ts4.5/card/v2/cardViewV2.d.ts +17 -6
- package/dist/types-ts4.5/card/v2/fileCard.d.ts +40 -6
- package/dist/types-ts4.5/card/v2/useFilePreview.d.ts +5 -9
- package/dist/types-ts4.5/utils/getDataURIDimension.d.ts +17 -0
- package/dist/types-ts4.5/utils/globalScope/globalScope.d.ts +2 -2
- package/dist/types-ts4.5/utils/globalScope/types.d.ts +1 -1
- package/dist/types-ts4.5/utils/lightCards/styles.d.ts +1 -1
- package/dist/types-ts4.5/utils/lightCards/types.d.ts +0 -2
- package/package.json +5 -2
|
@@ -3,6 +3,13 @@ import { getElementDimension } from './getElementDimension';
|
|
|
3
3
|
import { defaultImageCardDimensions } from './cardDimensions';
|
|
4
4
|
import { isValidPercentageUnit } from './isValidPercentageUnit';
|
|
5
5
|
import { containsPixelUnit } from './containsPixelUnit';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* ************************************************
|
|
9
|
+
* For Card v1
|
|
10
|
+
* ************************************************
|
|
11
|
+
*/
|
|
12
|
+
|
|
6
13
|
export var getDataURIDimension = function getDataURIDimension(dimension, options) {
|
|
7
14
|
var retinaFactor = isRetina() ? 2 : 1;
|
|
8
15
|
var dimensionValue = options.dimensions && options.dimensions[dimension] || '';
|
|
@@ -24,4 +31,35 @@ export var getRequestedDimensions = function getRequestedDimensions(options) {
|
|
|
24
31
|
width: width,
|
|
25
32
|
height: height
|
|
26
33
|
};
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* ************************************************
|
|
38
|
+
* For Card v2
|
|
39
|
+
* ************************************************
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
// Same as getDataURIDimension but without Retina factor
|
|
43
|
+
export var resolveCardPreviewDimension = function resolveCardPreviewDimension(dimensionName, _ref) {
|
|
44
|
+
var dimensions = _ref.dimensions,
|
|
45
|
+
element = _ref.element;
|
|
46
|
+
var dimensionValue = (dimensions === null || dimensions === void 0 ? void 0 : dimensions[dimensionName]) || '';
|
|
47
|
+
if (isValidPercentageUnit(dimensionValue) && element) {
|
|
48
|
+
return getElementDimension(element, dimensionName);
|
|
49
|
+
}
|
|
50
|
+
if (typeof dimensionValue === 'number') {
|
|
51
|
+
return dimensionValue;
|
|
52
|
+
}
|
|
53
|
+
if (containsPixelUnit("".concat(dimensionValue))) {
|
|
54
|
+
return parseInt("".concat(dimensionValue), 10);
|
|
55
|
+
}
|
|
56
|
+
return defaultImageCardDimensions[dimensionName];
|
|
57
|
+
};
|
|
58
|
+
export var resolveCardPreviewDimensions = function resolveCardPreviewDimensions(options) {
|
|
59
|
+
var width = resolveCardPreviewDimension('width', options);
|
|
60
|
+
var height = resolveCardPreviewDimension('height', options);
|
|
61
|
+
return {
|
|
62
|
+
width: width,
|
|
63
|
+
height: height
|
|
64
|
+
};
|
|
27
65
|
};
|
|
@@ -2,13 +2,10 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
/**@jsx jsx */
|
|
3
3
|
import { jsx } from '@emotion/react';
|
|
4
4
|
import { wrapperStyles } from './styles';
|
|
5
|
-
import { useGlobalTheme } from '@atlaskit/theme/components';
|
|
6
5
|
export var Wrapper = function Wrapper(props) {
|
|
7
|
-
var theme = useGlobalTheme();
|
|
8
6
|
return jsx("div", _extends({
|
|
9
7
|
css: wrapperStyles({
|
|
10
|
-
dimensions: props.dimensions
|
|
11
|
-
theme: theme
|
|
8
|
+
dimensions: props.dimensions
|
|
12
9
|
})
|
|
13
10
|
}, props), props.children);
|
|
14
11
|
};
|
|
@@ -2,20 +2,8 @@ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral
|
|
|
2
2
|
var _templateObject;
|
|
3
3
|
import { css } from '@emotion/react';
|
|
4
4
|
import { center, borderRadius } from '@atlaskit/media-ui';
|
|
5
|
-
import {
|
|
6
|
-
import { N20, DN50, N50, DN100 } from '@atlaskit/theme/colors';
|
|
5
|
+
import { N20, N50 } from '@atlaskit/theme/colors';
|
|
7
6
|
export var wrapperStyles = function wrapperStyles(_ref) {
|
|
8
|
-
var dimensions = _ref.dimensions
|
|
9
|
-
|
|
10
|
-
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n ", "\n background: ", ";\n color: ", ";\n ", "\n max-height: 100%;\n max-width: 100%;\n width: ", ";\n height: ", ";\n"])), center, themed({
|
|
11
|
-
light: "var(--ds-background-neutral, ".concat(N20, ")"),
|
|
12
|
-
dark: "var(--ds-background-neutral, ".concat(DN50, ")")
|
|
13
|
-
})({
|
|
14
|
-
theme: theme
|
|
15
|
-
}), themed({
|
|
16
|
-
light: "var(--ds-icon, ".concat(N50, ")"),
|
|
17
|
-
dark: "var(--ds-icon, ".concat(DN100, ")")
|
|
18
|
-
})({
|
|
19
|
-
theme: theme
|
|
20
|
-
}), borderRadius, dimensions.width, dimensions.height);
|
|
7
|
+
var dimensions = _ref.dimensions;
|
|
8
|
+
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n ", "\n background: ", ";\n color: ", ";\n ", "\n max-height: 100%;\n max-width: 100%;\n width: ", ";\n height: ", ";\n"])), center, "var(--ds-background-neutral, ".concat(N20, ")"), "var(--ds-icon, ".concat(N50, ")"), borderRadius, dimensions.width, dimensions.height);
|
|
21
9
|
};
|
|
@@ -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.4.
|
|
10
|
+
var packageVersion = "77.4.9";
|
|
11
11
|
var concurrentExperience;
|
|
12
12
|
var getExperience = function getExperience(id) {
|
|
13
13
|
if (!concurrentExperience) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TitleBoxFooterProps, TitleBoxHeaderProps, TitleBoxWrapperProps } from './types';
|
|
2
2
|
export declare const titleBoxWrapperStyles: {
|
|
3
|
-
({ breakpoint, titleBoxBgColor,
|
|
3
|
+
({ breakpoint, titleBoxBgColor, }: TitleBoxWrapperProps): import("@emotion/react").SerializedStyles;
|
|
4
4
|
displayName: string;
|
|
5
5
|
};
|
|
6
6
|
export declare const titleBoxHeaderStyles: {
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import { MessageDescriptor } from 'react-intl-next';
|
|
3
3
|
import { Breakpoint } from '../common';
|
|
4
4
|
import { TitleBoxIcon as TitleBoxIconType } from '../../../types';
|
|
5
|
-
import { GlobalThemeTokens } from '@atlaskit/theme/components';
|
|
6
5
|
export type TitleBoxProps = {
|
|
7
6
|
name: string;
|
|
8
7
|
breakpoint: Breakpoint;
|
|
@@ -17,7 +16,6 @@ export type TitleBoxWrapperProps = {
|
|
|
17
16
|
breakpoint: Breakpoint;
|
|
18
17
|
titleBoxBgColor?: string;
|
|
19
18
|
children?: JSX.Element | JSX.Element[] | any;
|
|
20
|
-
theme?: GlobalThemeTokens;
|
|
21
19
|
};
|
|
22
20
|
export type TitleBoxFooterProps = {
|
|
23
21
|
hasIconOverlap: boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { WrapperProps } from './types';
|
|
2
2
|
export declare const wrapperStyles: {
|
|
3
|
-
({ breakpoint, dimensions, appearance, disableOverlay, displayBackground, selected, isPlayButtonClickable, isTickBoxSelectable, shouldDisplayTooltip, mediaCardCursor,
|
|
3
|
+
({ breakpoint, dimensions, appearance, disableOverlay, displayBackground, selected, isPlayButtonClickable, isTickBoxSelectable, shouldDisplayTooltip, mediaCardCursor, }: WrapperProps): import("@emotion/react").SerializedStyles;
|
|
4
4
|
displayName: string;
|
|
5
5
|
};
|
|
@@ -3,7 +3,6 @@ import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
|
3
3
|
import { CardDimensions, CardAppearance } from '../../../types';
|
|
4
4
|
import { Breakpoint } from '../common';
|
|
5
5
|
import { MediaCardCursor } from '../../../types';
|
|
6
|
-
import { GlobalThemeTokens } from '@atlaskit/theme/components';
|
|
7
6
|
export interface WrapperProps {
|
|
8
7
|
testId?: string;
|
|
9
8
|
breakpoint: Breakpoint;
|
|
@@ -21,5 +20,4 @@ export interface WrapperProps {
|
|
|
21
20
|
shouldDisplayTooltip: boolean;
|
|
22
21
|
innerRef?: RefObject<HTMLDivElement>;
|
|
23
22
|
children?: JSX.Element;
|
|
24
|
-
theme?: GlobalThemeTokens;
|
|
25
23
|
}
|
|
@@ -2,11 +2,22 @@
|
|
|
2
2
|
import { jsx } from '@emotion/react';
|
|
3
3
|
import React, { MouseEvent } from 'react';
|
|
4
4
|
import { MessageDescriptor } from 'react-intl-next';
|
|
5
|
-
import { MediaItemType, FileDetails } from '@atlaskit/media-client';
|
|
5
|
+
import { MediaItemType, FileDetails, ImageResizeMode } from '@atlaskit/media-client';
|
|
6
6
|
import { WithAnalyticsEventsProps, UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
7
|
-
import {
|
|
7
|
+
import { CardStatus, CardPreview, MediaCardCursor, CardDimensions, TitleBoxIcon } from '../../types';
|
|
8
|
+
import { CardAction } from '../actions';
|
|
8
9
|
import { MediaCardError } from '../../errors';
|
|
9
|
-
export interface
|
|
10
|
+
export interface CardViewV2Props {
|
|
11
|
+
readonly disableOverlay?: boolean;
|
|
12
|
+
readonly resizeMode?: ImageResizeMode;
|
|
13
|
+
readonly dimensions: CardDimensions;
|
|
14
|
+
readonly actions?: Array<CardAction>;
|
|
15
|
+
readonly selectable?: boolean;
|
|
16
|
+
readonly selected?: boolean;
|
|
17
|
+
readonly alt?: string;
|
|
18
|
+
readonly testId?: string;
|
|
19
|
+
readonly titleBoxBgColor?: string;
|
|
20
|
+
readonly titleBoxIcon?: TitleBoxIcon;
|
|
10
21
|
readonly status: CardStatus;
|
|
11
22
|
readonly mediaItemType: MediaItemType;
|
|
12
23
|
readonly mediaCardCursor?: MediaCardCursor;
|
|
@@ -25,7 +36,7 @@ export interface CardViewV2OwnProps extends SharedCardProps {
|
|
|
25
36
|
disableAnimation?: boolean;
|
|
26
37
|
shouldHideTooltip?: boolean;
|
|
27
38
|
}
|
|
28
|
-
export type
|
|
39
|
+
export type CardViewV2BaseProps = CardViewV2Props & WithAnalyticsEventsProps;
|
|
29
40
|
export interface RenderConfigByStatusV2 {
|
|
30
41
|
renderTypeIcon?: boolean;
|
|
31
42
|
iconMessage?: JSX.Element;
|
|
@@ -40,5 +51,5 @@ export interface RenderConfigByStatusV2 {
|
|
|
40
51
|
renderTickBox?: boolean;
|
|
41
52
|
customTitleMessage?: MessageDescriptor;
|
|
42
53
|
}
|
|
43
|
-
export declare const CardViewV2Base: ({ innerRef, onImageLoad, onImageError, dimensions,
|
|
44
|
-
export declare const CardViewV2: React.ForwardRefExoticComponent<Omit<
|
|
54
|
+
export declare const CardViewV2Base: ({ innerRef, onImageLoad, onImageError, dimensions, onClick, onMouseEnter, testId, metadata, status, selected, selectable, cardPreview, mediaCardCursor, shouldHideTooltip, progress, alt, resizeMode, onDisplayImage, nativeLazyLoad, forceSyncDisplay, actions, disableOverlay, titleBoxBgColor, titleBoxIcon, error, disableAnimation, }: CardViewV2BaseProps) => jsx.JSX.Element;
|
|
55
|
+
export declare const CardViewV2: React.ForwardRefExoticComponent<Omit<CardViewV2BaseProps, keyof WithAnalyticsEventsProps> & React.RefAttributes<any>>;
|
|
@@ -1,19 +1,53 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
|
|
3
|
-
import { FileIdentifier, Identifier,
|
|
4
|
-
import { SSR } from '@atlaskit/media-common';
|
|
5
|
-
import { CardEventProps,
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
import { FileIdentifier, Identifier, ImageResizeMode } from '@atlaskit/media-client';
|
|
4
|
+
import { MediaFeatureFlags, NumericalCardDimensions, SSR } from '@atlaskit/media-common';
|
|
5
|
+
import { CardAppearance, CardDimensions, CardEventProps, TitleBoxIcon } from '../../types';
|
|
6
|
+
import { CardAction } from '../actions';
|
|
7
|
+
export interface FileCardProps extends CardEventProps {
|
|
8
|
+
/** Overlay the media file. */
|
|
9
|
+
readonly disableOverlay?: boolean;
|
|
10
|
+
/** Resize the media to 'crop' | 'fit' | 'full-fit' | 'stretchy-fit'. */
|
|
11
|
+
readonly resizeMode?: ImageResizeMode;
|
|
12
|
+
readonly featureFlags?: MediaFeatureFlags;
|
|
13
|
+
/** Sets meida card appearance */
|
|
14
|
+
readonly appearance?: CardAppearance;
|
|
15
|
+
/** Custom media card dimension like width and height. */
|
|
16
|
+
readonly dimensions?: CardDimensions;
|
|
17
|
+
/** Original media card dimension like width and height. */
|
|
18
|
+
readonly originalDimensions?: NumericalCardDimensions;
|
|
19
|
+
/** Array of additional media card actions. */
|
|
20
|
+
readonly actions?: Array<CardAction>;
|
|
21
|
+
/** Enable media card selectable. */
|
|
22
|
+
readonly selectable?: boolean;
|
|
23
|
+
/** Renders media card as selected, if selected is true. */
|
|
24
|
+
readonly selected?: boolean;
|
|
25
|
+
/** Alternate text for an media card. */
|
|
26
|
+
readonly alt?: string;
|
|
27
|
+
/** ID for testing the media card. */
|
|
28
|
+
readonly testId?: string;
|
|
29
|
+
/** Sets the title box background color. */
|
|
30
|
+
readonly titleBoxBgColor?: string;
|
|
31
|
+
/** Sets the title box icon. */
|
|
32
|
+
readonly titleBoxIcon?: TitleBoxIcon;
|
|
33
|
+
/** Instance of file identifier. */
|
|
8
34
|
readonly identifier: FileIdentifier;
|
|
35
|
+
/** Lazy loads the media file. */
|
|
9
36
|
readonly isLazy?: boolean;
|
|
37
|
+
/** Uses the inline player for media file. */
|
|
10
38
|
readonly useInlinePlayer?: boolean;
|
|
39
|
+
/** Uses media MediaViewer to preview the media file. */
|
|
11
40
|
readonly shouldOpenMediaViewer?: boolean;
|
|
41
|
+
/** Media file list to display in Media Viewer. */
|
|
12
42
|
readonly mediaViewerItems?: Identifier[];
|
|
43
|
+
/** Retrieve auth based on a given context. */
|
|
13
44
|
readonly contextId?: string;
|
|
45
|
+
/** Enables the download button for media file. */
|
|
14
46
|
readonly shouldEnableDownloadButton?: boolean;
|
|
47
|
+
/** Server-Side-Rendering modes are "server" and "client" */
|
|
15
48
|
readonly ssr?: SSR;
|
|
49
|
+
/** Disable tooltip for the card */
|
|
16
50
|
readonly shouldHideTooltip?: boolean;
|
|
17
51
|
}
|
|
18
52
|
export type FileCardBaseProps = FileCardProps & WithAnalyticsEventsProps;
|
|
19
|
-
export declare const FileCard: ({ appearance, resizeMode, isLazy, disableOverlay, featureFlags, identifier, ssr,
|
|
53
|
+
export declare const FileCard: ({ appearance, resizeMode, isLazy, disableOverlay, featureFlags, identifier, ssr, dimensions, originalDimensions, contextId, alt, actions, shouldEnableDownloadButton, useInlinePlayer, shouldOpenMediaViewer, onFullscreenChange, selectable, selected, testId, titleBoxBgColor, titleBoxIcon, shouldHideTooltip, mediaViewerItems, onClick, onMouseEnter, createAnalyticsEvent, }: FileCardBaseProps) => JSX.Element;
|
|
@@ -1,20 +1,16 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { FileIdentifier, ImageResizeMode, MediaBlobUrlAttrs
|
|
2
|
+
import { FileIdentifier, ImageResizeMode, MediaBlobUrlAttrs } from '@atlaskit/media-client';
|
|
3
3
|
import { MediaTraceContext, NumericalCardDimensions, SSR } from '@atlaskit/media-common';
|
|
4
4
|
import { MediaCardError } from '../../errors';
|
|
5
|
-
import {
|
|
5
|
+
import { CardPreview } from '../../types';
|
|
6
6
|
import { SSRStatus } from '../../utils/analytics';
|
|
7
7
|
export interface UseFilePreviewParams {
|
|
8
8
|
/** Instance of file identifier. */
|
|
9
9
|
readonly identifier: FileIdentifier;
|
|
10
|
-
/** Instance of MediaClient. */
|
|
11
|
-
readonly mediaClient: MediaClient;
|
|
12
10
|
/** Resize the media to 'crop' | 'fit' | 'full-fit' | 'stretchy-fit' */
|
|
13
11
|
readonly resizeMode?: ImageResizeMode;
|
|
14
|
-
/**
|
|
15
|
-
readonly dimensions?:
|
|
16
|
-
/** Dimensions to be requested to the server */
|
|
17
|
-
readonly requestedDimensions: NumericalCardDimensions;
|
|
12
|
+
/** Dimensions to be requested to the server. Will be scaled x2 in Retina Displays */
|
|
13
|
+
readonly dimensions?: Partial<NumericalCardDimensions>;
|
|
18
14
|
/** Server-Side-Rendering modes are "server" and "client" */
|
|
19
15
|
readonly ssr?: SSR;
|
|
20
16
|
/** Attributes to attach to the created Blob Url */
|
|
@@ -26,7 +22,7 @@ export interface UseFilePreviewParams {
|
|
|
26
22
|
/** Do not fetch a remote preview. Helpful for lazy loading */
|
|
27
23
|
readonly skipRemote?: boolean;
|
|
28
24
|
}
|
|
29
|
-
export declare const useFilePreview: ({ resizeMode, identifier, ssr,
|
|
25
|
+
export declare const useFilePreview: ({ resizeMode, identifier, ssr, dimensions, traceContext, previewDidRender, skipRemote, mediaBlobUrlAttrs, }: UseFilePreviewParams) => {
|
|
30
26
|
cardPreview: CardPreview | undefined;
|
|
31
27
|
error: MediaCardError | undefined;
|
|
32
28
|
nonCriticalError: MediaCardError | undefined;
|
|
@@ -1,9 +1,26 @@
|
|
|
1
1
|
import { CardDimensions } from '../types';
|
|
2
2
|
import { ElementDimension } from './getElementDimension';
|
|
3
3
|
import { NumericalCardDimensions } from '@atlaskit/media-common';
|
|
4
|
+
/**
|
|
5
|
+
* ************************************************
|
|
6
|
+
* For Card v1
|
|
7
|
+
* ************************************************
|
|
8
|
+
*/
|
|
4
9
|
export type getDataURIDimensionOptions = {
|
|
5
10
|
element?: Element | null;
|
|
6
11
|
dimensions?: CardDimensions;
|
|
7
12
|
};
|
|
8
13
|
export declare const getDataURIDimension: (dimension: ElementDimension, options: getDataURIDimensionOptions) => number;
|
|
9
14
|
export declare const getRequestedDimensions: (options: getDataURIDimensionOptions) => NumericalCardDimensions;
|
|
15
|
+
/**
|
|
16
|
+
* ************************************************
|
|
17
|
+
* For Card v2
|
|
18
|
+
* ************************************************
|
|
19
|
+
*/
|
|
20
|
+
type ResolveCardDimensionOptions = {
|
|
21
|
+
element?: Element | null;
|
|
22
|
+
dimensions?: CardDimensions;
|
|
23
|
+
};
|
|
24
|
+
export declare const resolveCardPreviewDimension: (dimensionName: ElementDimension, { dimensions, element }: ResolveCardDimensionOptions) => number;
|
|
25
|
+
export declare const resolveCardPreviewDimensions: (options: ResolveCardDimensionOptions) => NumericalCardDimensions;
|
|
26
|
+
export {};
|
|
@@ -11,5 +11,5 @@ export type MediaGlobalScope = {
|
|
|
11
11
|
export declare function getMediaGlobalScope(globalScope?: any): MediaGlobalScope;
|
|
12
12
|
export declare function getMediaCardSSR(globalScope?: any): MediaCardSsr;
|
|
13
13
|
export declare const getKey: ({ id, collectionName, occurrenceKey }: FileIdentifier) => string;
|
|
14
|
-
export declare const storeDataURI: (key: string, dataURI?: string, dimensions?: NumericalCardDimensions
|
|
15
|
-
export declare const generateScriptProps: (identifier: FileIdentifier, dataURI?: string, dimensions?: NumericalCardDimensions
|
|
14
|
+
export declare const storeDataURI: (key: string, dataURI?: string, dimensions?: Partial<NumericalCardDimensions>, error?: MediaCardErrorInfo, globalScope?: any) => void;
|
|
15
|
+
export declare const generateScriptProps: (identifier: FileIdentifier, dataURI?: string, dimensions?: Partial<NumericalCardDimensions>, error?: MediaCardErrorInfo) => React.ScriptHTMLAttributes<HTMLScriptElement>;
|
|
@@ -2,7 +2,7 @@ import { NumericalCardDimensions } from '@atlaskit/media-common';
|
|
|
2
2
|
import { MediaCardErrorInfo } from '../../utils/analytics';
|
|
3
3
|
export type MediaCardSsrData = {
|
|
4
4
|
dataURI?: string;
|
|
5
|
-
dimensions?: NumericalCardDimensions
|
|
5
|
+
dimensions?: Partial<NumericalCardDimensions>;
|
|
6
6
|
error?: MediaCardErrorInfo;
|
|
7
7
|
};
|
|
8
8
|
export type MediaCardSsr = Record<string, MediaCardSsrData>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { WrapperProps } from './types';
|
|
2
|
-
export declare const wrapperStyles: ({ dimensions
|
|
2
|
+
export declare const wrapperStyles: ({ dimensions }: WrapperProps) => import("@emotion/react").SerializedStyles;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { CardDimensions } from '../../types';
|
|
3
3
|
import { MediaFeatureFlags } from '@atlaskit/media-common';
|
|
4
|
-
import { GlobalThemeTokens } from '@atlaskit/theme/components';
|
|
5
4
|
export interface StaticCardProps {
|
|
6
5
|
dimensions?: CardDimensions;
|
|
7
6
|
testId?: string;
|
|
@@ -11,5 +10,4 @@ export interface WrapperProps {
|
|
|
11
10
|
dimensions: CardDimensions;
|
|
12
11
|
testId?: string;
|
|
13
12
|
children?: JSX.Element;
|
|
14
|
-
theme?: GlobalThemeTokens;
|
|
15
13
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TitleBoxFooterProps, TitleBoxHeaderProps, TitleBoxWrapperProps } from './types';
|
|
2
2
|
export declare const titleBoxWrapperStyles: {
|
|
3
|
-
({ breakpoint, titleBoxBgColor,
|
|
3
|
+
({ breakpoint, titleBoxBgColor, }: TitleBoxWrapperProps): import("@emotion/react").SerializedStyles;
|
|
4
4
|
displayName: string;
|
|
5
5
|
};
|
|
6
6
|
export declare const titleBoxHeaderStyles: {
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import { MessageDescriptor } from 'react-intl-next';
|
|
3
3
|
import { Breakpoint } from '../common';
|
|
4
4
|
import { TitleBoxIcon as TitleBoxIconType } from '../../../types';
|
|
5
|
-
import { GlobalThemeTokens } from '@atlaskit/theme/components';
|
|
6
5
|
export type TitleBoxProps = {
|
|
7
6
|
name: string;
|
|
8
7
|
breakpoint: Breakpoint;
|
|
@@ -17,7 +16,6 @@ export type TitleBoxWrapperProps = {
|
|
|
17
16
|
breakpoint: Breakpoint;
|
|
18
17
|
titleBoxBgColor?: string;
|
|
19
18
|
children?: JSX.Element | JSX.Element[] | any;
|
|
20
|
-
theme?: GlobalThemeTokens;
|
|
21
19
|
};
|
|
22
20
|
export type TitleBoxFooterProps = {
|
|
23
21
|
hasIconOverlap: boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { WrapperProps } from './types';
|
|
2
2
|
export declare const wrapperStyles: {
|
|
3
|
-
({ breakpoint, dimensions, appearance, disableOverlay, displayBackground, selected, isPlayButtonClickable, isTickBoxSelectable, shouldDisplayTooltip, mediaCardCursor,
|
|
3
|
+
({ breakpoint, dimensions, appearance, disableOverlay, displayBackground, selected, isPlayButtonClickable, isTickBoxSelectable, shouldDisplayTooltip, mediaCardCursor, }: WrapperProps): import("@emotion/react").SerializedStyles;
|
|
4
4
|
displayName: string;
|
|
5
5
|
};
|
|
@@ -3,7 +3,6 @@ import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
|
3
3
|
import { CardDimensions, CardAppearance } from '../../../types';
|
|
4
4
|
import { Breakpoint } from '../common';
|
|
5
5
|
import { MediaCardCursor } from '../../../types';
|
|
6
|
-
import { GlobalThemeTokens } from '@atlaskit/theme/components';
|
|
7
6
|
export interface WrapperProps {
|
|
8
7
|
testId?: string;
|
|
9
8
|
breakpoint: Breakpoint;
|
|
@@ -21,5 +20,4 @@ export interface WrapperProps {
|
|
|
21
20
|
shouldDisplayTooltip: boolean;
|
|
22
21
|
innerRef?: RefObject<HTMLDivElement>;
|
|
23
22
|
children?: JSX.Element;
|
|
24
|
-
theme?: GlobalThemeTokens;
|
|
25
23
|
}
|
|
@@ -2,11 +2,22 @@
|
|
|
2
2
|
import { jsx } from '@emotion/react';
|
|
3
3
|
import React, { MouseEvent } from 'react';
|
|
4
4
|
import { MessageDescriptor } from 'react-intl-next';
|
|
5
|
-
import { MediaItemType, FileDetails } from '@atlaskit/media-client';
|
|
5
|
+
import { MediaItemType, FileDetails, ImageResizeMode } from '@atlaskit/media-client';
|
|
6
6
|
import { WithAnalyticsEventsProps, UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
7
|
-
import {
|
|
7
|
+
import { CardStatus, CardPreview, MediaCardCursor, CardDimensions, TitleBoxIcon } from '../../types';
|
|
8
|
+
import { CardAction } from '../actions';
|
|
8
9
|
import { MediaCardError } from '../../errors';
|
|
9
|
-
export interface
|
|
10
|
+
export interface CardViewV2Props {
|
|
11
|
+
readonly disableOverlay?: boolean;
|
|
12
|
+
readonly resizeMode?: ImageResizeMode;
|
|
13
|
+
readonly dimensions: CardDimensions;
|
|
14
|
+
readonly actions?: Array<CardAction>;
|
|
15
|
+
readonly selectable?: boolean;
|
|
16
|
+
readonly selected?: boolean;
|
|
17
|
+
readonly alt?: string;
|
|
18
|
+
readonly testId?: string;
|
|
19
|
+
readonly titleBoxBgColor?: string;
|
|
20
|
+
readonly titleBoxIcon?: TitleBoxIcon;
|
|
10
21
|
readonly status: CardStatus;
|
|
11
22
|
readonly mediaItemType: MediaItemType;
|
|
12
23
|
readonly mediaCardCursor?: MediaCardCursor;
|
|
@@ -25,7 +36,7 @@ export interface CardViewV2OwnProps extends SharedCardProps {
|
|
|
25
36
|
disableAnimation?: boolean;
|
|
26
37
|
shouldHideTooltip?: boolean;
|
|
27
38
|
}
|
|
28
|
-
export type
|
|
39
|
+
export type CardViewV2BaseProps = CardViewV2Props & WithAnalyticsEventsProps;
|
|
29
40
|
export interface RenderConfigByStatusV2 {
|
|
30
41
|
renderTypeIcon?: boolean;
|
|
31
42
|
iconMessage?: JSX.Element;
|
|
@@ -40,5 +51,5 @@ export interface RenderConfigByStatusV2 {
|
|
|
40
51
|
renderTickBox?: boolean;
|
|
41
52
|
customTitleMessage?: MessageDescriptor;
|
|
42
53
|
}
|
|
43
|
-
export declare const CardViewV2Base: ({ innerRef, onImageLoad, onImageError, dimensions,
|
|
44
|
-
export declare const CardViewV2: React.ForwardRefExoticComponent<Omit<
|
|
54
|
+
export declare const CardViewV2Base: ({ innerRef, onImageLoad, onImageError, dimensions, onClick, onMouseEnter, testId, metadata, status, selected, selectable, cardPreview, mediaCardCursor, shouldHideTooltip, progress, alt, resizeMode, onDisplayImage, nativeLazyLoad, forceSyncDisplay, actions, disableOverlay, titleBoxBgColor, titleBoxIcon, error, disableAnimation, }: CardViewV2BaseProps) => jsx.JSX.Element;
|
|
55
|
+
export declare const CardViewV2: React.ForwardRefExoticComponent<Omit<CardViewV2BaseProps, keyof WithAnalyticsEventsProps> & React.RefAttributes<any>>;
|
|
@@ -1,19 +1,53 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
|
|
3
|
-
import { FileIdentifier, Identifier,
|
|
4
|
-
import { SSR } from '@atlaskit/media-common';
|
|
5
|
-
import { CardEventProps,
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
import { FileIdentifier, Identifier, ImageResizeMode } from '@atlaskit/media-client';
|
|
4
|
+
import { MediaFeatureFlags, NumericalCardDimensions, SSR } from '@atlaskit/media-common';
|
|
5
|
+
import { CardAppearance, CardDimensions, CardEventProps, TitleBoxIcon } from '../../types';
|
|
6
|
+
import { CardAction } from '../actions';
|
|
7
|
+
export interface FileCardProps extends CardEventProps {
|
|
8
|
+
/** Overlay the media file. */
|
|
9
|
+
readonly disableOverlay?: boolean;
|
|
10
|
+
/** Resize the media to 'crop' | 'fit' | 'full-fit' | 'stretchy-fit'. */
|
|
11
|
+
readonly resizeMode?: ImageResizeMode;
|
|
12
|
+
readonly featureFlags?: MediaFeatureFlags;
|
|
13
|
+
/** Sets meida card appearance */
|
|
14
|
+
readonly appearance?: CardAppearance;
|
|
15
|
+
/** Custom media card dimension like width and height. */
|
|
16
|
+
readonly dimensions?: CardDimensions;
|
|
17
|
+
/** Original media card dimension like width and height. */
|
|
18
|
+
readonly originalDimensions?: NumericalCardDimensions;
|
|
19
|
+
/** Array of additional media card actions. */
|
|
20
|
+
readonly actions?: Array<CardAction>;
|
|
21
|
+
/** Enable media card selectable. */
|
|
22
|
+
readonly selectable?: boolean;
|
|
23
|
+
/** Renders media card as selected, if selected is true. */
|
|
24
|
+
readonly selected?: boolean;
|
|
25
|
+
/** Alternate text for an media card. */
|
|
26
|
+
readonly alt?: string;
|
|
27
|
+
/** ID for testing the media card. */
|
|
28
|
+
readonly testId?: string;
|
|
29
|
+
/** Sets the title box background color. */
|
|
30
|
+
readonly titleBoxBgColor?: string;
|
|
31
|
+
/** Sets the title box icon. */
|
|
32
|
+
readonly titleBoxIcon?: TitleBoxIcon;
|
|
33
|
+
/** Instance of file identifier. */
|
|
8
34
|
readonly identifier: FileIdentifier;
|
|
35
|
+
/** Lazy loads the media file. */
|
|
9
36
|
readonly isLazy?: boolean;
|
|
37
|
+
/** Uses the inline player for media file. */
|
|
10
38
|
readonly useInlinePlayer?: boolean;
|
|
39
|
+
/** Uses media MediaViewer to preview the media file. */
|
|
11
40
|
readonly shouldOpenMediaViewer?: boolean;
|
|
41
|
+
/** Media file list to display in Media Viewer. */
|
|
12
42
|
readonly mediaViewerItems?: Identifier[];
|
|
43
|
+
/** Retrieve auth based on a given context. */
|
|
13
44
|
readonly contextId?: string;
|
|
45
|
+
/** Enables the download button for media file. */
|
|
14
46
|
readonly shouldEnableDownloadButton?: boolean;
|
|
47
|
+
/** Server-Side-Rendering modes are "server" and "client" */
|
|
15
48
|
readonly ssr?: SSR;
|
|
49
|
+
/** Disable tooltip for the card */
|
|
16
50
|
readonly shouldHideTooltip?: boolean;
|
|
17
51
|
}
|
|
18
52
|
export type FileCardBaseProps = FileCardProps & WithAnalyticsEventsProps;
|
|
19
|
-
export declare const FileCard: ({ appearance, resizeMode, isLazy, disableOverlay, featureFlags, identifier, ssr,
|
|
53
|
+
export declare const FileCard: ({ appearance, resizeMode, isLazy, disableOverlay, featureFlags, identifier, ssr, dimensions, originalDimensions, contextId, alt, actions, shouldEnableDownloadButton, useInlinePlayer, shouldOpenMediaViewer, onFullscreenChange, selectable, selected, testId, titleBoxBgColor, titleBoxIcon, shouldHideTooltip, mediaViewerItems, onClick, onMouseEnter, createAnalyticsEvent, }: FileCardBaseProps) => JSX.Element;
|
|
@@ -1,20 +1,16 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { FileIdentifier, ImageResizeMode, MediaBlobUrlAttrs
|
|
2
|
+
import { FileIdentifier, ImageResizeMode, MediaBlobUrlAttrs } from '@atlaskit/media-client';
|
|
3
3
|
import { MediaTraceContext, NumericalCardDimensions, SSR } from '@atlaskit/media-common';
|
|
4
4
|
import { MediaCardError } from '../../errors';
|
|
5
|
-
import {
|
|
5
|
+
import { CardPreview } from '../../types';
|
|
6
6
|
import { SSRStatus } from '../../utils/analytics';
|
|
7
7
|
export interface UseFilePreviewParams {
|
|
8
8
|
/** Instance of file identifier. */
|
|
9
9
|
readonly identifier: FileIdentifier;
|
|
10
|
-
/** Instance of MediaClient. */
|
|
11
|
-
readonly mediaClient: MediaClient;
|
|
12
10
|
/** Resize the media to 'crop' | 'fit' | 'full-fit' | 'stretchy-fit' */
|
|
13
11
|
readonly resizeMode?: ImageResizeMode;
|
|
14
|
-
/**
|
|
15
|
-
readonly dimensions?:
|
|
16
|
-
/** Dimensions to be requested to the server */
|
|
17
|
-
readonly requestedDimensions: NumericalCardDimensions;
|
|
12
|
+
/** Dimensions to be requested to the server. Will be scaled x2 in Retina Displays */
|
|
13
|
+
readonly dimensions?: Partial<NumericalCardDimensions>;
|
|
18
14
|
/** Server-Side-Rendering modes are "server" and "client" */
|
|
19
15
|
readonly ssr?: SSR;
|
|
20
16
|
/** Attributes to attach to the created Blob Url */
|
|
@@ -26,7 +22,7 @@ export interface UseFilePreviewParams {
|
|
|
26
22
|
/** Do not fetch a remote preview. Helpful for lazy loading */
|
|
27
23
|
readonly skipRemote?: boolean;
|
|
28
24
|
}
|
|
29
|
-
export declare const useFilePreview: ({ resizeMode, identifier, ssr,
|
|
25
|
+
export declare const useFilePreview: ({ resizeMode, identifier, ssr, dimensions, traceContext, previewDidRender, skipRemote, mediaBlobUrlAttrs, }: UseFilePreviewParams) => {
|
|
30
26
|
cardPreview: CardPreview | undefined;
|
|
31
27
|
error: MediaCardError | undefined;
|
|
32
28
|
nonCriticalError: MediaCardError | undefined;
|
|
@@ -1,9 +1,26 @@
|
|
|
1
1
|
import { CardDimensions } from '../types';
|
|
2
2
|
import { ElementDimension } from './getElementDimension';
|
|
3
3
|
import { NumericalCardDimensions } from '@atlaskit/media-common';
|
|
4
|
+
/**
|
|
5
|
+
* ************************************************
|
|
6
|
+
* For Card v1
|
|
7
|
+
* ************************************************
|
|
8
|
+
*/
|
|
4
9
|
export type getDataURIDimensionOptions = {
|
|
5
10
|
element?: Element | null;
|
|
6
11
|
dimensions?: CardDimensions;
|
|
7
12
|
};
|
|
8
13
|
export declare const getDataURIDimension: (dimension: ElementDimension, options: getDataURIDimensionOptions) => number;
|
|
9
14
|
export declare const getRequestedDimensions: (options: getDataURIDimensionOptions) => NumericalCardDimensions;
|
|
15
|
+
/**
|
|
16
|
+
* ************************************************
|
|
17
|
+
* For Card v2
|
|
18
|
+
* ************************************************
|
|
19
|
+
*/
|
|
20
|
+
type ResolveCardDimensionOptions = {
|
|
21
|
+
element?: Element | null;
|
|
22
|
+
dimensions?: CardDimensions;
|
|
23
|
+
};
|
|
24
|
+
export declare const resolveCardPreviewDimension: (dimensionName: ElementDimension, { dimensions, element }: ResolveCardDimensionOptions) => number;
|
|
25
|
+
export declare const resolveCardPreviewDimensions: (options: ResolveCardDimensionOptions) => NumericalCardDimensions;
|
|
26
|
+
export {};
|
|
@@ -11,5 +11,5 @@ export type MediaGlobalScope = {
|
|
|
11
11
|
export declare function getMediaGlobalScope(globalScope?: any): MediaGlobalScope;
|
|
12
12
|
export declare function getMediaCardSSR(globalScope?: any): MediaCardSsr;
|
|
13
13
|
export declare const getKey: ({ id, collectionName, occurrenceKey }: FileIdentifier) => string;
|
|
14
|
-
export declare const storeDataURI: (key: string, dataURI?: string, dimensions?: NumericalCardDimensions
|
|
15
|
-
export declare const generateScriptProps: (identifier: FileIdentifier, dataURI?: string, dimensions?: NumericalCardDimensions
|
|
14
|
+
export declare const storeDataURI: (key: string, dataURI?: string, dimensions?: Partial<NumericalCardDimensions>, error?: MediaCardErrorInfo, globalScope?: any) => void;
|
|
15
|
+
export declare const generateScriptProps: (identifier: FileIdentifier, dataURI?: string, dimensions?: Partial<NumericalCardDimensions>, error?: MediaCardErrorInfo) => React.ScriptHTMLAttributes<HTMLScriptElement>;
|
|
@@ -2,7 +2,7 @@ import { NumericalCardDimensions } from '@atlaskit/media-common';
|
|
|
2
2
|
import { MediaCardErrorInfo } from '../../utils/analytics';
|
|
3
3
|
export type MediaCardSsrData = {
|
|
4
4
|
dataURI?: string;
|
|
5
|
-
dimensions?: NumericalCardDimensions
|
|
5
|
+
dimensions?: Partial<NumericalCardDimensions>;
|
|
6
6
|
error?: MediaCardErrorInfo;
|
|
7
7
|
};
|
|
8
8
|
export type MediaCardSsr = Record<string, MediaCardSsrData>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { WrapperProps } from './types';
|
|
2
|
-
export declare const wrapperStyles: ({ dimensions
|
|
2
|
+
export declare const wrapperStyles: ({ dimensions }: WrapperProps) => import("@emotion/react").SerializedStyles;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { CardDimensions } from '../../types';
|
|
3
3
|
import { MediaFeatureFlags } from '@atlaskit/media-common';
|
|
4
|
-
import { GlobalThemeTokens } from '@atlaskit/theme/components';
|
|
5
4
|
export interface StaticCardProps {
|
|
6
5
|
dimensions?: CardDimensions;
|
|
7
6
|
testId?: string;
|
|
@@ -11,5 +10,4 @@ export interface WrapperProps {
|
|
|
11
10
|
dimensions: CardDimensions;
|
|
12
11
|
testId?: string;
|
|
13
12
|
children?: JSX.Element;
|
|
14
|
-
theme?: GlobalThemeTokens;
|
|
15
13
|
}
|