@atlaskit/media-card 72.0.0 → 72.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/dist/cjs/errors.js +26 -6
- package/dist/cjs/root/card/cardLoader.js +66 -124
- package/dist/cjs/root/card/getCardPreview/index.js +90 -10
- package/dist/cjs/root/card/index.js +154 -84
- package/dist/cjs/root/cardView.js +41 -54
- package/dist/cjs/root/inline/mediaInlineCard.js +10 -5
- package/dist/cjs/root/ui/common.js +11 -5
- package/dist/cjs/root/ui/imageRenderer/imageRenderer.js +6 -2
- package/dist/cjs/root/ui/loadingRateLimited/loadingRateLimited.js +2 -2
- package/dist/cjs/root/ui/progressBar/progressBar.js +2 -2
- package/dist/cjs/root/ui/progressBar/styled.js +1 -3
- package/dist/cjs/root/ui/styled.js +80 -17
- package/dist/cjs/root/ui/titleBox/styled.js +1 -3
- package/dist/cjs/utils/cardActions/cardActionsDropdownMenu.js +16 -9
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/errors.js +9 -1
- package/dist/es2019/root/card/cardLoader.js +47 -53
- package/dist/es2019/root/card/getCardPreview/index.js +45 -3
- package/dist/es2019/root/card/index.js +87 -20
- package/dist/es2019/root/cardView.js +26 -40
- package/dist/es2019/root/inline/mediaInlineCard.js +10 -5
- package/dist/es2019/root/ui/common.js +7 -1
- package/dist/es2019/root/ui/imageRenderer/imageRenderer.js +6 -2
- package/dist/es2019/root/ui/loadingRateLimited/loadingRateLimited.js +1 -1
- package/dist/es2019/root/ui/progressBar/progressBar.js +1 -1
- package/dist/es2019/root/ui/progressBar/styled.js +1 -2
- package/dist/es2019/root/ui/styled.js +64 -3
- package/dist/es2019/root/ui/titleBox/styled.js +1 -2
- package/dist/es2019/utils/cardActions/cardActionsDropdownMenu.js +8 -4
- package/dist/es2019/version.json +1 -1
- package/dist/esm/errors.js +23 -5
- package/dist/esm/root/card/cardLoader.js +66 -126
- package/dist/esm/root/card/getCardPreview/index.js +72 -10
- package/dist/esm/root/card/index.js +156 -85
- package/dist/esm/root/cardView.js +40 -52
- package/dist/esm/root/inline/mediaInlineCard.js +10 -5
- package/dist/esm/root/ui/common.js +7 -1
- package/dist/esm/root/ui/imageRenderer/imageRenderer.js +6 -2
- package/dist/esm/root/ui/loadingRateLimited/loadingRateLimited.js +1 -1
- package/dist/esm/root/ui/progressBar/progressBar.js +1 -1
- package/dist/esm/root/ui/progressBar/styled.js +1 -2
- package/dist/esm/root/ui/styled.js +61 -13
- package/dist/esm/root/ui/titleBox/styled.js +1 -2
- package/dist/esm/utils/cardActions/cardActionsDropdownMenu.js +16 -9
- package/dist/esm/version.json +1 -1
- package/dist/types/errors.d.ts +9 -3
- package/dist/types/index.d.ts +2 -1
- package/dist/types/root/card/cardLoader.d.ts +4 -18
- package/dist/types/root/card/getCardPreview/index.d.ts +7 -1
- package/dist/types/root/card/index.d.ts +2 -0
- package/dist/types/root/cardView.d.ts +3 -1
- package/dist/types/root/ui/common.d.ts +4 -1
- 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 +1 -1
- package/dist/types/root/ui/loadingRateLimited/styled.d.ts +1 -1
- package/dist/types/root/ui/progressBar/progressBar.d.ts +1 -1
- package/dist/types/root/ui/progressBar/styled.d.ts +1 -1
- package/dist/types/root/ui/styled.d.ts +10 -3
- package/dist/types/root/ui/titleBox/failedTitleBox.d.ts +1 -1
- package/dist/types/root/ui/titleBox/styled.d.ts +1 -1
- package/dist/types/root/ui/titleBox/titleBox.d.ts +1 -1
- package/dist/types/types.d.ts +1 -1
- package/example-helpers/developmentUseMessage.tsx +14 -0
- package/example-helpers/index.tsx +34 -4
- package/example-helpers/selectableCard.tsx +2 -1
- package/package.json +8 -5
- 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/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/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/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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { StyledBar } from './styled';
|
|
3
|
-
import { Breakpoint } from '../
|
|
3
|
+
import { Breakpoint } from '../common';
|
|
4
4
|
export var ProgressBar = function ProgressBar(_ref) {
|
|
5
5
|
var progress = _ref.progress,
|
|
6
6
|
_ref$breakpoint = _ref.breakpoint,
|
|
@@ -6,8 +6,7 @@ import styled from 'styled-components';
|
|
|
6
6
|
import { borderRadius } from '@atlaskit/media-ui';
|
|
7
7
|
import { rgba } from '../../../styles/mixins';
|
|
8
8
|
import { N0, N400 } from '@atlaskit/theme/colors';
|
|
9
|
-
import { getTitleBoxHeight, responsiveSettings } from '../common';
|
|
10
|
-
import { Breakpoint } from '../Breakpoint';
|
|
9
|
+
import { Breakpoint, getTitleBoxHeight, responsiveSettings } from '../common';
|
|
11
10
|
var height = 3;
|
|
12
11
|
var padding = 1;
|
|
13
12
|
var width = 95; // %
|
|
@@ -1,26 +1,68 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
3
|
|
|
3
|
-
var _templateObject;
|
|
4
|
+
var _templateObject, _templateObject2;
|
|
4
5
|
|
|
5
6
|
import styled from 'styled-components';
|
|
6
7
|
import { getCSSUnitValue } from '../../utils/getCSSUnitValue';
|
|
7
8
|
import { getDefaultCardDimensions } from '../../utils/cardDimensions';
|
|
9
|
+
import { fontFamily } from '@atlaskit/theme/constants';
|
|
10
|
+
import { borderRadius } from '@atlaskit/media-ui';
|
|
11
|
+
import { N20, N60A } from '@atlaskit/theme/colors';
|
|
12
|
+
import { akEditorSelectedBoxShadow } from '@atlaskit/editor-shared-styles/consts';
|
|
8
13
|
import { hideNativeBrowserTextSelectionStyles } from '@atlaskit/editor-shared-styles/selection';
|
|
14
|
+
import { transition } from '../../styles';
|
|
9
15
|
import { tickBoxClassName, tickboxFixedStyles } from './tickBox/styled';
|
|
16
|
+
import { fixedBlanketStyles, blanketClassName } from './blanket/styled';
|
|
10
17
|
import { fixedActionBarStyles, actionsBarClassName } from './actionsBar/styled';
|
|
11
18
|
import { fixedPlayButtonStyles, playButtonClassName } from './playButton/styled';
|
|
12
|
-
import {
|
|
19
|
+
import { Breakpoint, responsiveSettings } from './common';
|
|
20
|
+
var breakpointSizes = [[Breakpoint.SMALL, 599], [Breakpoint.LARGE, Infinity]];
|
|
21
|
+
export var calcBreakpointSize = function calcBreakpointSize() {
|
|
22
|
+
var wrapperWidth = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
23
|
+
|
|
24
|
+
var _ref = breakpointSizes.find(function (_ref3) {
|
|
25
|
+
var _ref4 = _slicedToArray(_ref3, 2),
|
|
26
|
+
_breakpoint = _ref4[0],
|
|
27
|
+
limit = _ref4[1];
|
|
28
|
+
|
|
29
|
+
return wrapperWidth <= limit;
|
|
30
|
+
}) || [Breakpoint.SMALL],
|
|
31
|
+
_ref2 = _slicedToArray(_ref, 1),
|
|
32
|
+
breakpoint = _ref2[0];
|
|
33
|
+
|
|
34
|
+
return breakpoint;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
var generateResponsiveStyles = function generateResponsiveStyles() {
|
|
38
|
+
var breakpoint = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : Breakpoint.SMALL;
|
|
39
|
+
var setting = responsiveSettings[breakpoint];
|
|
40
|
+
return "\n font-size: ".concat(setting.fontSize, "px;\n line-height: ").concat(setting.lineHeight, "px;\n ");
|
|
41
|
+
};
|
|
13
42
|
|
|
14
43
|
var getWrapperDimensions = function getWrapperDimensions(dimensions, appearance) {
|
|
15
|
-
var
|
|
16
|
-
width =
|
|
17
|
-
height =
|
|
44
|
+
var _ref5 = dimensions || {},
|
|
45
|
+
width = _ref5.width,
|
|
46
|
+
height = _ref5.height;
|
|
18
47
|
|
|
19
48
|
var _getDefaultCardDimens = getDefaultCardDimensions(appearance),
|
|
20
49
|
defaultWidth = _getDefaultCardDimens.width,
|
|
21
50
|
defaultHeight = _getDefaultCardDimens.height;
|
|
22
51
|
|
|
23
52
|
return "\n width: ".concat(getCSSUnitValue(width || defaultWidth), ";\n max-width: 100%;\n height: ").concat(getCSSUnitValue(height || defaultHeight), ";\n max-height: 100%;\n ");
|
|
53
|
+
}; // This is a trick to simulate the blue border without affecting the dimensions.
|
|
54
|
+
// CSS outline has no 'radius', therefore we can't achieve the same effect with it
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
var getWrapperShadow = function getWrapperShadow(disableOverlay, selected) {
|
|
58
|
+
var withOverlayShadow = !disableOverlay ? "0 1px 1px ".concat(N60A, ", 0 0 1px 0 ").concat(N60A) : '';
|
|
59
|
+
var selectedShadow = selected ? akEditorSelectedBoxShadow : '';
|
|
60
|
+
var shadow = [selectedShadow, withOverlayShadow].filter(Boolean).join(', ');
|
|
61
|
+
return shadow ? "box-shadow: ".concat(shadow, ";") : '';
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
var getCursorStyle = function getCursorStyle(shouldUsePointerCursor) {
|
|
65
|
+
return "cursor: ".concat(shouldUsePointerCursor ? 'pointer' : 'default', ";");
|
|
24
66
|
};
|
|
25
67
|
|
|
26
68
|
var getClickablePlayButtonStyles = function getClickablePlayButtonStyles(isPlayButtonClickable) {
|
|
@@ -39,12 +81,18 @@ var getSelectableTickBoxStyles = function getSelectableTickBoxStyles(isTickBoxSe
|
|
|
39
81
|
return "\n &:hover .".concat(tickBoxClassName, " {\n ").concat(tickboxFixedStyles, "\n }\n ");
|
|
40
82
|
};
|
|
41
83
|
|
|
42
|
-
export var NewFileExperienceWrapper = styled(
|
|
43
|
-
var
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
84
|
+
export var NewFileExperienceWrapper = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n ", "\n"])), function (_ref6) {
|
|
85
|
+
var breakpoint = _ref6.breakpoint,
|
|
86
|
+
dimensions = _ref6.dimensions,
|
|
87
|
+
appearance = _ref6.appearance,
|
|
88
|
+
shouldUsePointerCursor = _ref6.shouldUsePointerCursor,
|
|
89
|
+
disableOverlay = _ref6.disableOverlay,
|
|
90
|
+
displayBackground = _ref6.displayBackground,
|
|
91
|
+
selected = _ref6.selected,
|
|
92
|
+
isPlayButtonClickable = _ref6.isPlayButtonClickable,
|
|
93
|
+
isTickBoxSelectable = _ref6.isTickBoxSelectable,
|
|
94
|
+
shouldDisplayTooltip = _ref6.shouldDisplayTooltip;
|
|
95
|
+
return "\n ".concat(transition(), "\n box-sizing: border-box;\n * {\n box-sizing: border-box;\n }\n position: relative;\n font-family: ").concat(fontFamily(), ";\n ").concat(getWrapperDimensions(dimensions, appearance), "\n ").concat(displayBackground ? "background-color: ".concat(N20, ";") : '', "\n ").concat(borderRadius, "\n ").concat(getCursorStyle(shouldUsePointerCursor), "\n ").concat(getWrapperShadow(disableOverlay, selected), "\n ").concat(generateResponsiveStyles(breakpoint), "\n ").concat(hideNativeBrowserTextSelectionStyles, "\n\n /* We use classnames from here exceptionally to be able to handle styles when the Card is on hover */\n ").concat(getClickablePlayButtonStyles(isPlayButtonClickable), "\n ").concat(getSelectableTickBoxStyles(isTickBoxSelectable), "\n &:hover .").concat(blanketClassName, " {\n ").concat(fixedBlanketStyles, "\n }\n\n &:hover .").concat(actionsBarClassName, " {\n ").concat(fixedActionBarStyles, "\n }\n\n /* Tooltip does not support percentage dimensions. We enforce them here */\n ").concat(shouldDisplayTooltip ? "> div { ".concat(getWrapperDimensions(dimensions, appearance), " }") : '', "\n");
|
|
49
96
|
});
|
|
50
|
-
NewFileExperienceWrapper.displayName = 'NewFileExperienceWrapper';
|
|
97
|
+
NewFileExperienceWrapper.displayName = 'NewFileExperienceWrapper';
|
|
98
|
+
export var CardImageContainer = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n position: relative;\n max-width: 100%;\n width: 100%;\n height: 100%;\n max-height: 100%;\n overflow: hidden;\n ", "\n"])), borderRadius);
|
|
@@ -3,8 +3,7 @@ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral
|
|
|
3
3
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
4
4
|
|
|
5
5
|
import styled from 'styled-components';
|
|
6
|
-
import { responsiveSettings, getTitleBoxHeight } from '../common';
|
|
7
|
-
import { Breakpoint } from '../Breakpoint';
|
|
6
|
+
import { responsiveSettings, getTitleBoxHeight, Breakpoint } from '../common';
|
|
8
7
|
import { N0 } from '@atlaskit/theme/colors';
|
|
9
8
|
import { rgba } from '../../../styles/mixins';
|
|
10
9
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
1
2
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
3
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
4
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
@@ -80,16 +81,22 @@ export var CardActionsDropdownMenu = /*#__PURE__*/function (_Component) {
|
|
|
80
81
|
|
|
81
82
|
if (actions.length > 0) {
|
|
82
83
|
return /*#__PURE__*/React.createElement(DropdownMenu, {
|
|
83
|
-
|
|
84
|
+
testId: "media-card-actions-menu",
|
|
84
85
|
onOpenChange: onOpenChange,
|
|
85
|
-
trigger:
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
86
|
+
trigger: function trigger(_ref) {
|
|
87
|
+
var triggerRef = _ref.triggerRef,
|
|
88
|
+
providedProps = _objectWithoutProperties(_ref, ["triggerRef"]);
|
|
89
|
+
|
|
90
|
+
return /*#__PURE__*/React.createElement(CardActionButtonWithAnalytics, _extends({
|
|
91
|
+
variant: triggerVariant,
|
|
92
|
+
style: {
|
|
93
|
+
color: triggerColor
|
|
94
|
+
},
|
|
95
|
+
ref: triggerRef
|
|
96
|
+
}, providedProps), /*#__PURE__*/React.createElement(MoreIcon, {
|
|
97
|
+
label: "more"
|
|
98
|
+
}));
|
|
99
|
+
}
|
|
93
100
|
}, /*#__PURE__*/React.createElement(DropdownItemGroup, null, actions.map(createDropdownItemWithAnalytics)));
|
|
94
101
|
} else {
|
|
95
102
|
return null;
|
package/dist/esm/version.json
CHANGED
package/dist/types/errors.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { CardPreview } from '.';
|
|
2
|
-
export declare type MediaCardErrorPrimaryReason = 'upload' | 'metadata-fetch' | 'error-file-state' | RemotePreviewPrimaryReason | LocalPreviewPrimaryReason | ImageLoadPrimaryReason | 'preview-fetch';
|
|
2
|
+
export declare type MediaCardErrorPrimaryReason = 'upload' | 'metadata-fetch' | 'error-file-state' | RemotePreviewPrimaryReason | LocalPreviewPrimaryReason | ImageLoadPrimaryReason | SsrPreviewPrimaryReason | 'preview-fetch';
|
|
3
3
|
export declare type ImageLoadPrimaryReason = 'cache-remote-uri' | 'cache-local-uri' | 'local-uri' | 'remote-uri' | 'external-uri' | 'unknown-uri';
|
|
4
4
|
export declare type RemotePreviewPrimaryReason = 'remote-preview-fetch' | 'remote-preview-not-ready';
|
|
5
5
|
export declare type LocalPreviewPrimaryReason = 'local-preview-get' | 'local-preview-unsupported' | 'local-preview-rejected' | 'local-preview-image' | 'local-preview-video';
|
|
6
|
+
export declare type SsrPreviewPrimaryReason = 'ssr-client-uri' | 'ssr-client-load' | 'ssr-server-uri' | 'ssr-server-load';
|
|
6
7
|
export declare class MediaCardError extends Error {
|
|
7
8
|
readonly primaryReason: MediaCardErrorPrimaryReason;
|
|
8
9
|
readonly secondaryError?: Error | undefined;
|
|
@@ -18,7 +19,12 @@ export declare class RemotePreviewError extends MediaCardError {
|
|
|
18
19
|
readonly secondaryError?: Error | undefined;
|
|
19
20
|
constructor(primaryReason: RemotePreviewPrimaryReason, secondaryError?: Error | undefined);
|
|
20
21
|
}
|
|
21
|
-
export declare
|
|
22
|
+
export declare class SsrPreviewError extends MediaCardError {
|
|
23
|
+
readonly primaryReason: SsrPreviewPrimaryReason;
|
|
24
|
+
readonly secondaryError?: Error | undefined;
|
|
25
|
+
constructor(primaryReason: SsrPreviewPrimaryReason, secondaryError?: Error | undefined);
|
|
26
|
+
}
|
|
27
|
+
export declare const getImageLoadPrimaryReason: (source?: "local" | "remote" | "ssr-server" | "ssr-client" | "cache-local" | "cache-remote" | "cache-ssr-client" | "cache-ssr-server" | "external" | undefined) => ImageLoadPrimaryReason;
|
|
22
28
|
export declare class ImageLoadError extends MediaCardError {
|
|
23
29
|
constructor(source?: CardPreview['source']);
|
|
24
30
|
}
|
|
@@ -28,4 +34,4 @@ export declare const isRemotePreviewError: (err: Error) => err is LocalPreviewEr
|
|
|
28
34
|
export declare const isUnsupportedLocalPreviewError: (err: Error) => boolean;
|
|
29
35
|
export declare function isImageLoadError(err: Error): err is ImageLoadError;
|
|
30
36
|
export declare const ensureMediaCardError: (primaryReason: MediaCardErrorPrimaryReason, error: Error) => MediaCardError;
|
|
31
|
-
export declare const isUploadError: (error
|
|
37
|
+
export declare const isUploadError: (error?: MediaCardError | undefined) => boolean | undefined;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MouseEvent } from 'react';
|
|
2
2
|
import { FileDetails, MediaClient, Identifier, ImageResizeMode, FileState } from '@atlaskit/media-client';
|
|
3
3
|
import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
4
|
-
import { MediaFeatureFlags, NumericalCardDimensions } from '@atlaskit/media-common';
|
|
4
|
+
import { MediaFeatureFlags, NumericalCardDimensions, SSR } from '@atlaskit/media-common';
|
|
5
5
|
import { CardAction } from './actions';
|
|
6
6
|
import { MediaViewerDataSource } from '@atlaskit/media-viewer';
|
|
7
7
|
import { CardPreview, CardStatus, CardAppearance } from './types';
|
|
@@ -48,6 +48,7 @@ export interface CardProps extends SharedCardProps, CardEventProps {
|
|
|
48
48
|
readonly mediaViewerDataSource?: MediaViewerDataSource;
|
|
49
49
|
readonly contextId?: string;
|
|
50
50
|
readonly shouldEnableDownloadButton?: boolean;
|
|
51
|
+
readonly ssr?: SSR;
|
|
51
52
|
}
|
|
52
53
|
export interface CardState {
|
|
53
54
|
status: CardStatus;
|
|
@@ -1,20 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { WithMediaClientConfigProps } from '@atlaskit/media-client';
|
|
3
|
-
import {
|
|
4
|
-
import { CardWithAnalyticsEventsProps } from '.';
|
|
2
|
+
import type { WithMediaClientConfigProps } from '@atlaskit/media-client';
|
|
3
|
+
import type { CardWithAnalyticsEventsProps } from '.';
|
|
5
4
|
export declare type CardWithMediaClientConfigProps = WithMediaClientConfigProps<CardWithAnalyticsEventsProps>;
|
|
6
|
-
declare
|
|
7
|
-
|
|
8
|
-
export interface AsyncCardState {
|
|
9
|
-
Card?: CardWithMediaClientConfigComponent;
|
|
10
|
-
MediaCardErrorBoundary?: MediaCardErrorBoundaryComponent;
|
|
11
|
-
}
|
|
12
|
-
export default class CardLoader extends React.PureComponent<CardWithMediaClientConfigProps & AsyncCardState, AsyncCardState> {
|
|
13
|
-
static displayName: string;
|
|
14
|
-
static Card?: CardWithMediaClientConfigComponent;
|
|
15
|
-
static MediaCardErrorBoundary?: MediaCardErrorBoundaryComponent;
|
|
16
|
-
state: AsyncCardState;
|
|
17
|
-
componentDidMount(): Promise<void>;
|
|
18
|
-
render(): JSX.Element;
|
|
19
|
-
}
|
|
20
|
-
export {};
|
|
5
|
+
declare const CardLoader: React.FC<CardWithMediaClientConfigProps>;
|
|
6
|
+
export default CardLoader;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MediaClient, FilePreview, FileState, MediaStoreGetFileImageParams, MediaBlobUrlAttrs } from '@atlaskit/media-client';
|
|
2
|
-
import { MediaFeatureFlags } from '@atlaskit/media-common';
|
|
2
|
+
import { MediaFeatureFlags, SSR } from '@atlaskit/media-common';
|
|
3
3
|
import { CardDimensions } from '../../../utils/cardDimensions';
|
|
4
4
|
import { MediaCardError } from '../../../errors';
|
|
5
5
|
import { CardStatus, CardPreview } from '../../../types';
|
|
@@ -42,3 +42,9 @@ export declare const shouldResolvePreview: ({ status, fileState, dimensions, pre
|
|
|
42
42
|
isBannedLocalPreview: boolean;
|
|
43
43
|
featureFlags?: MediaFeatureFlags | undefined;
|
|
44
44
|
}) => boolean;
|
|
45
|
+
export declare const getSSRCardPreview: (ssr: SSR, mediaClient: MediaClient, id: string, params: MediaStoreGetFileImageParams, mediaBlobUrlAttrs?: MediaBlobUrlAttrs | undefined) => CardPreview;
|
|
46
|
+
export declare const isLocalPreview: (preview: CardPreview) => boolean;
|
|
47
|
+
export declare const isSSRPreview: (preview: CardPreview) => boolean;
|
|
48
|
+
export declare const isSSRServerPreview: (preview: CardPreview) => boolean;
|
|
49
|
+
export declare const isSSRClientPreview: (preview: CardPreview) => boolean;
|
|
50
|
+
export declare const fetchAndCacheRemotePreview: (mediaClient: MediaClient, id: string, dimensions: CardDimensions, params: MediaStoreGetFileImageParams, mediaBlobUrlAttrs?: MediaBlobUrlAttrs | undefined) => Promise<CardPreview>;
|
|
@@ -21,6 +21,8 @@ export declare class CardBase extends Component<CardWithAnalyticsEventsProps, Ca
|
|
|
21
21
|
private getImageURLParams;
|
|
22
22
|
private getMediaBlobUrlAttrs;
|
|
23
23
|
private getCardPreviewParams;
|
|
24
|
+
private setCacheSSRPreview;
|
|
25
|
+
private resolveSSRPreview;
|
|
24
26
|
private resolvePreview;
|
|
25
27
|
subscribeInternalFile(identifier: FileIdentifier): void;
|
|
26
28
|
private get requestedDimensions();
|
|
@@ -18,6 +18,8 @@ export interface CardViewOwnProps extends SharedCardProps {
|
|
|
18
18
|
readonly innerRef?: (instance: HTMLDivElement | null) => void;
|
|
19
19
|
readonly onImageLoad: () => void;
|
|
20
20
|
readonly onImageError: () => void;
|
|
21
|
+
readonly nativeLazyLoad?: boolean;
|
|
22
|
+
readonly forceSyncDisplay?: boolean;
|
|
21
23
|
disableAnimation?: boolean;
|
|
22
24
|
}
|
|
23
25
|
export interface CardViewState {
|
|
@@ -71,4 +73,4 @@ export declare class CardViewBase extends React.Component<CardViewProps, CardVie
|
|
|
71
73
|
private getRenderConfigByStatus;
|
|
72
74
|
private renderNewExperienceCard;
|
|
73
75
|
}
|
|
74
|
-
export declare const CardView: React.ForwardRefExoticComponent<Pick<Pick<CardViewProps, "progress" | "metadata" | "onClick" | "onMouseEnter" | "innerRef" | "appearance" | "error" | "actions" | "testId" | "selectable" | "selected" | "alt" | "disableOverlay" | "dimensions" | "featureFlags" | "dataURI" | "status" | "mediaItemType" | "resizeMode" | "onDisplayImage" | "previewOrientation" | "onImageError" | "onImageLoad" | "titleBoxBgColor" | "titleBoxIcon" | "disableAnimation" | "originalDimensions">, never> & Partial<Pick<Pick<CardViewProps, "progress" | "metadata" | "onClick" | "onMouseEnter" | "innerRef" | "appearance" | "error" | "actions" | "testId" | "selectable" | "selected" | "alt" | "disableOverlay" | "dimensions" | "featureFlags" | "dataURI" | "status" | "mediaItemType" | "resizeMode" | "onDisplayImage" | "previewOrientation" | "onImageError" | "onImageLoad" | "titleBoxBgColor" | "titleBoxIcon" | "disableAnimation" | "originalDimensions">, "progress" | "metadata" | "onClick" | "onMouseEnter" | "innerRef" | "appearance" | "error" | "actions" | "testId" | "selectable" | "selected" | "alt" | "disableOverlay" | "dimensions" | "featureFlags" | "dataURI" | "status" | "mediaItemType" | "resizeMode" | "onDisplayImage" | "previewOrientation" | "onImageError" | "onImageLoad" | "titleBoxBgColor" | "titleBoxIcon" | "disableAnimation" | "originalDimensions">> & Partial<Pick<Partial<CardViewOwnProps>, never>> & React.RefAttributes<any>>;
|
|
76
|
+
export declare const CardView: React.ForwardRefExoticComponent<Pick<Pick<CardViewProps, "progress" | "metadata" | "onClick" | "onMouseEnter" | "innerRef" | "appearance" | "error" | "actions" | "testId" | "selectable" | "selected" | "alt" | "disableOverlay" | "dimensions" | "featureFlags" | "dataURI" | "status" | "mediaItemType" | "resizeMode" | "onDisplayImage" | "previewOrientation" | "onImageError" | "onImageLoad" | "forceSyncDisplay" | "nativeLazyLoad" | "titleBoxBgColor" | "titleBoxIcon" | "disableAnimation" | "originalDimensions">, never> & Partial<Pick<Pick<CardViewProps, "progress" | "metadata" | "onClick" | "onMouseEnter" | "innerRef" | "appearance" | "error" | "actions" | "testId" | "selectable" | "selected" | "alt" | "disableOverlay" | "dimensions" | "featureFlags" | "dataURI" | "status" | "mediaItemType" | "resizeMode" | "onDisplayImage" | "previewOrientation" | "onImageError" | "onImageLoad" | "forceSyncDisplay" | "nativeLazyLoad" | "titleBoxBgColor" | "titleBoxIcon" | "disableAnimation" | "originalDimensions">, "progress" | "metadata" | "onClick" | "onMouseEnter" | "innerRef" | "appearance" | "error" | "actions" | "testId" | "selectable" | "selected" | "alt" | "disableOverlay" | "dimensions" | "featureFlags" | "dataURI" | "status" | "mediaItemType" | "resizeMode" | "onDisplayImage" | "previewOrientation" | "onImageError" | "onImageLoad" | "forceSyncDisplay" | "nativeLazyLoad" | "titleBoxBgColor" | "titleBoxIcon" | "disableAnimation" | "originalDimensions">> & Partial<Pick<Partial<CardViewOwnProps>, never>> & React.RefAttributes<any>>;
|
|
@@ -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,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,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { Breakpoint } from '../
|
|
2
|
+
import { Breakpoint } from '../common';
|
|
3
3
|
export declare function generateResponsiveStyles(breakpoint: Breakpoint, positionBottom: boolean, multiplier?: number): string;
|
|
4
4
|
export declare type StyledBarProps = {
|
|
5
5
|
progress: number;
|
|
@@ -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,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react-intl" />
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { TitleBoxIcon as TitleBoxIconType } from '../../../index';
|
|
4
|
-
import { Breakpoint } from '../
|
|
4
|
+
import { Breakpoint } from '../common';
|
|
5
5
|
export declare type TitleBoxProps = {
|
|
6
6
|
name: string;
|
|
7
7
|
breakpoint: Breakpoint;
|
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;
|
|
@@ -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": "72.
|
|
3
|
+
"version": "72.1.0",
|
|
4
4
|
"description": "Includes all media card related components, CardView, CardViewSmall, Card...",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -29,13 +29,13 @@
|
|
|
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
34
|
"@atlaskit/icon": "^21.9.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": "^17.
|
|
37
|
+
"@atlaskit/media-common": "^2.10.0",
|
|
38
|
+
"@atlaskit/media-ui": "^17.2.0",
|
|
39
39
|
"@atlaskit/media-viewer": "^45.8.0",
|
|
40
40
|
"@atlaskit/spinner": "^15.1.0",
|
|
41
41
|
"@atlaskit/theme": "^12.0.0",
|
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
"eventemitter2": "^4.1.0",
|
|
46
46
|
"lru-fast": "^0.2.2",
|
|
47
47
|
"react-lazily-render": "^1.2.0",
|
|
48
|
+
"react-loadable": "^5.1.0",
|
|
48
49
|
"video-snapshot": "^1.0.11"
|
|
49
50
|
},
|
|
50
51
|
"peerDependencies": {
|
|
@@ -61,9 +62,10 @@
|
|
|
61
62
|
"@atlaskit/button": "^16.1.0",
|
|
62
63
|
"@atlaskit/checkbox": "^12.3.0",
|
|
63
64
|
"@atlaskit/docs": "*",
|
|
65
|
+
"@atlaskit/inline-message": "^11.1.5",
|
|
64
66
|
"@atlaskit/item": "^12.0.0",
|
|
65
67
|
"@atlaskit/media-core": "^32.2.0",
|
|
66
|
-
"@atlaskit/media-test-helpers": "^28.
|
|
68
|
+
"@atlaskit/media-test-helpers": "^28.9.0",
|
|
67
69
|
"@atlaskit/radio": "^5.3.2",
|
|
68
70
|
"@atlaskit/range": "^5.1.0",
|
|
69
71
|
"@atlaskit/select": "^15.2.1",
|
|
@@ -75,6 +77,7 @@
|
|
|
75
77
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
|
76
78
|
"@testing-library/react": "^8.0.1",
|
|
77
79
|
"@types/classnames": "^2.2.6",
|
|
80
|
+
"@types/react-loadable": "^5.4.1",
|
|
78
81
|
"deepcopy": "0.6.3",
|
|
79
82
|
"enzyme": "^3.10.0",
|
|
80
83
|
"exenv": "^1.2.2",
|