@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.
Files changed (77) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/cjs/card/card.js +1 -1
  3. package/dist/cjs/card/cardView.js +11 -7
  4. package/dist/cjs/card/media-card-analytics-error-boundary.js +1 -1
  5. package/dist/cjs/card/ui/titleBox/styles.js +2 -18
  6. package/dist/cjs/card/ui/titleBox/titleBoxComponents.js +1 -4
  7. package/dist/cjs/card/ui/wrapper/styles.js +2 -10
  8. package/dist/cjs/card/ui/wrapper/wrapper.js +1 -4
  9. package/dist/cjs/card/v2/cardV2.js +1 -1
  10. package/dist/cjs/card/v2/cardViewV2.js +0 -3
  11. package/dist/cjs/card/v2/externalImageCard.js +3 -3
  12. package/dist/cjs/card/v2/fileCard.js +16 -15
  13. package/dist/cjs/card/v2/useFilePreview.js +44 -20
  14. package/dist/cjs/inline/loader.js +1 -1
  15. package/dist/cjs/utils/getDataURIDimension.js +38 -1
  16. package/dist/cjs/utils/lightCards/lightCardWrappers.js +1 -4
  17. package/dist/cjs/utils/lightCards/styles.js +2 -14
  18. package/dist/cjs/utils/ufoExperiences.js +1 -1
  19. package/dist/es2019/card/card.js +1 -1
  20. package/dist/es2019/card/cardView.js +6 -1
  21. package/dist/es2019/card/media-card-analytics-error-boundary.js +1 -1
  22. package/dist/es2019/card/ui/titleBox/styles.js +3 -19
  23. package/dist/es2019/card/ui/titleBox/titleBoxComponents.js +1 -4
  24. package/dist/es2019/card/ui/wrapper/styles.js +2 -10
  25. package/dist/es2019/card/ui/wrapper/wrapper.js +1 -4
  26. package/dist/es2019/card/v2/cardV2.js +1 -1
  27. package/dist/es2019/card/v2/cardViewV2.js +0 -2
  28. package/dist/es2019/card/v2/externalImageCard.js +3 -3
  29. package/dist/es2019/card/v2/fileCard.js +18 -17
  30. package/dist/es2019/card/v2/useFilePreview.js +46 -21
  31. package/dist/es2019/inline/loader.js +1 -1
  32. package/dist/es2019/utils/getDataURIDimension.js +39 -0
  33. package/dist/es2019/utils/lightCards/lightCardWrappers.js +1 -4
  34. package/dist/es2019/utils/lightCards/styles.js +4 -16
  35. package/dist/es2019/utils/ufoExperiences.js +1 -1
  36. package/dist/esm/card/card.js +1 -1
  37. package/dist/esm/card/cardView.js +11 -7
  38. package/dist/esm/card/media-card-analytics-error-boundary.js +1 -1
  39. package/dist/esm/card/ui/titleBox/styles.js +2 -18
  40. package/dist/esm/card/ui/titleBox/titleBoxComponents.js +1 -4
  41. package/dist/esm/card/ui/wrapper/styles.js +2 -10
  42. package/dist/esm/card/ui/wrapper/wrapper.js +1 -4
  43. package/dist/esm/card/v2/cardV2.js +1 -1
  44. package/dist/esm/card/v2/cardViewV2.js +0 -3
  45. package/dist/esm/card/v2/externalImageCard.js +3 -3
  46. package/dist/esm/card/v2/fileCard.js +18 -17
  47. package/dist/esm/card/v2/useFilePreview.js +45 -21
  48. package/dist/esm/inline/loader.js +1 -1
  49. package/dist/esm/utils/getDataURIDimension.js +38 -0
  50. package/dist/esm/utils/lightCards/lightCardWrappers.js +1 -4
  51. package/dist/esm/utils/lightCards/styles.js +3 -15
  52. package/dist/esm/utils/ufoExperiences.js +1 -1
  53. package/dist/types/card/ui/titleBox/styles.d.ts +1 -1
  54. package/dist/types/card/ui/titleBox/types.d.ts +0 -2
  55. package/dist/types/card/ui/wrapper/styles.d.ts +1 -1
  56. package/dist/types/card/ui/wrapper/types.d.ts +0 -2
  57. package/dist/types/card/v2/cardViewV2.d.ts +17 -6
  58. package/dist/types/card/v2/fileCard.d.ts +40 -6
  59. package/dist/types/card/v2/useFilePreview.d.ts +5 -9
  60. package/dist/types/utils/getDataURIDimension.d.ts +17 -0
  61. package/dist/types/utils/globalScope/globalScope.d.ts +2 -2
  62. package/dist/types/utils/globalScope/types.d.ts +1 -1
  63. package/dist/types/utils/lightCards/styles.d.ts +1 -1
  64. package/dist/types/utils/lightCards/types.d.ts +0 -2
  65. package/dist/types-ts4.5/card/ui/titleBox/styles.d.ts +1 -1
  66. package/dist/types-ts4.5/card/ui/titleBox/types.d.ts +0 -2
  67. package/dist/types-ts4.5/card/ui/wrapper/styles.d.ts +1 -1
  68. package/dist/types-ts4.5/card/ui/wrapper/types.d.ts +0 -2
  69. package/dist/types-ts4.5/card/v2/cardViewV2.d.ts +17 -6
  70. package/dist/types-ts4.5/card/v2/fileCard.d.ts +40 -6
  71. package/dist/types-ts4.5/card/v2/useFilePreview.d.ts +5 -9
  72. package/dist/types-ts4.5/utils/getDataURIDimension.d.ts +17 -0
  73. package/dist/types-ts4.5/utils/globalScope/globalScope.d.ts +2 -2
  74. package/dist/types-ts4.5/utils/globalScope/types.d.ts +1 -1
  75. package/dist/types-ts4.5/utils/lightCards/styles.d.ts +1 -1
  76. package/dist/types-ts4.5/utils/lightCards/types.d.ts +0 -2
  77. 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 { themed } from '@atlaskit/theme/components';
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
- theme = _ref.theme;
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.7";
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, theme, }: TitleBoxWrapperProps): import("@emotion/react").SerializedStyles;
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, theme, }: WrapperProps): import("@emotion/react").SerializedStyles;
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 { SharedCardProps, CardStatus, CardPreview, MediaCardCursor } from '../../types';
7
+ import { CardStatus, CardPreview, MediaCardCursor, CardDimensions, TitleBoxIcon } from '../../types';
8
+ import { CardAction } from '../actions';
8
9
  import { MediaCardError } from '../../errors';
9
- export interface CardViewV2OwnProps extends SharedCardProps {
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 CardViewV2Props = CardViewV2OwnProps & WithAnalyticsEventsProps;
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, appearance, onClick, onMouseEnter, testId, metadata, status, selected, selectable, cardPreview, mediaCardCursor, shouldHideTooltip, progress, alt, resizeMode, onDisplayImage, nativeLazyLoad, forceSyncDisplay, actions, disableOverlay, titleBoxBgColor, titleBoxIcon, error, disableAnimation, }: CardViewV2Props) => jsx.JSX.Element;
44
- export declare const CardViewV2: React.ForwardRefExoticComponent<Omit<CardViewV2Props, keyof WithAnalyticsEventsProps> & React.RefAttributes<any>>;
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, MediaClient } from '@atlaskit/media-client';
4
- import { SSR } from '@atlaskit/media-common';
5
- import { CardEventProps, SharedCardProps } from '../../types';
6
- export interface FileCardProps extends SharedCardProps, CardEventProps {
7
- readonly mediaClient: MediaClient;
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, mediaClient, dimensions, originalDimensions, contextId, alt, actions, shouldEnableDownloadButton, useInlinePlayer, shouldOpenMediaViewer, onFullscreenChange, selectable, selected, testId, titleBoxBgColor, titleBoxIcon, shouldHideTooltip, mediaViewerItems, onClick, onMouseEnter, createAnalyticsEvent, }: FileCardBaseProps) => JSX.Element;
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, MediaClient } from '@atlaskit/media-client';
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 { CardDimensions, CardPreview } from '../../types';
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
- /** Custom media card dimension like width and height. */
15
- readonly dimensions?: CardDimensions;
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, mediaClient, dimensions, requestedDimensions, traceContext, previewDidRender, skipRemote, mediaBlobUrlAttrs, }: UseFilePreviewParams) => {
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, error?: MediaCardErrorInfo, globalScope?: any) => void;
15
- export declare const generateScriptProps: (identifier: FileIdentifier, dataURI?: string, dimensions?: NumericalCardDimensions, error?: MediaCardErrorInfo) => React.ScriptHTMLAttributes<HTMLScriptElement>;
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, theme }: WrapperProps) => import("@emotion/react").SerializedStyles;
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, theme, }: TitleBoxWrapperProps): import("@emotion/react").SerializedStyles;
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, theme, }: WrapperProps): import("@emotion/react").SerializedStyles;
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 { SharedCardProps, CardStatus, CardPreview, MediaCardCursor } from '../../types';
7
+ import { CardStatus, CardPreview, MediaCardCursor, CardDimensions, TitleBoxIcon } from '../../types';
8
+ import { CardAction } from '../actions';
8
9
  import { MediaCardError } from '../../errors';
9
- export interface CardViewV2OwnProps extends SharedCardProps {
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 CardViewV2Props = CardViewV2OwnProps & WithAnalyticsEventsProps;
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, appearance, onClick, onMouseEnter, testId, metadata, status, selected, selectable, cardPreview, mediaCardCursor, shouldHideTooltip, progress, alt, resizeMode, onDisplayImage, nativeLazyLoad, forceSyncDisplay, actions, disableOverlay, titleBoxBgColor, titleBoxIcon, error, disableAnimation, }: CardViewV2Props) => jsx.JSX.Element;
44
- export declare const CardViewV2: React.ForwardRefExoticComponent<Omit<CardViewV2Props, keyof WithAnalyticsEventsProps> & React.RefAttributes<any>>;
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, MediaClient } from '@atlaskit/media-client';
4
- import { SSR } from '@atlaskit/media-common';
5
- import { CardEventProps, SharedCardProps } from '../../types';
6
- export interface FileCardProps extends SharedCardProps, CardEventProps {
7
- readonly mediaClient: MediaClient;
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, mediaClient, dimensions, originalDimensions, contextId, alt, actions, shouldEnableDownloadButton, useInlinePlayer, shouldOpenMediaViewer, onFullscreenChange, selectable, selected, testId, titleBoxBgColor, titleBoxIcon, shouldHideTooltip, mediaViewerItems, onClick, onMouseEnter, createAnalyticsEvent, }: FileCardBaseProps) => JSX.Element;
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, MediaClient } from '@atlaskit/media-client';
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 { CardDimensions, CardPreview } from '../../types';
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
- /** Custom media card dimension like width and height. */
15
- readonly dimensions?: CardDimensions;
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, mediaClient, dimensions, requestedDimensions, traceContext, previewDidRender, skipRemote, mediaBlobUrlAttrs, }: UseFilePreviewParams) => {
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, error?: MediaCardErrorInfo, globalScope?: any) => void;
15
- export declare const generateScriptProps: (identifier: FileIdentifier, dataURI?: string, dimensions?: NumericalCardDimensions, error?: MediaCardErrorInfo) => React.ScriptHTMLAttributes<HTMLScriptElement>;
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, theme }: WrapperProps) => import("@emotion/react").SerializedStyles;
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
  }