@atlaskit/media-card 78.1.2 → 78.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/dist/cjs/card/card.js +1 -1
- package/dist/cjs/card/fileCard.js +1 -3
- package/dist/cjs/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/cjs/inline/loader.js +1 -1
- package/dist/cjs/utils/mediaPerformanceObserver/mediaPerformanceObserver.js +1 -1
- package/dist/cjs/utils/ufoExperiences.js +1 -1
- package/dist/es2019/card/card.js +1 -1
- package/dist/es2019/card/fileCard.js +1 -3
- package/dist/es2019/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/es2019/inline/loader.js +1 -1
- package/dist/es2019/utils/mediaPerformanceObserver/mediaPerformanceObserver.js +1 -1
- package/dist/es2019/utils/ufoExperiences.js +1 -1
- package/dist/esm/card/card.js +1 -1
- package/dist/esm/card/fileCard.js +1 -3
- package/dist/esm/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/esm/inline/loader.js +1 -1
- package/dist/esm/utils/mediaPerformanceObserver/mediaPerformanceObserver.js +1 -1
- package/dist/esm/utils/ufoExperiences.js +1 -1
- package/package.json +12 -16
- package/dist/cjs/card/cardviews/cardViewWrapper.js +0 -112
- package/dist/cjs/card/cardviews/errorCardView.js +0 -91
- package/dist/cjs/card/cardviews/iconCardView.js +0 -83
- package/dist/cjs/card/cardviews/imageCardView.js +0 -93
- package/dist/cjs/card/cardviews/index.js +0 -292
- package/dist/cjs/card/cardviews/loadingCardView.js +0 -58
- package/dist/cjs/card/cardviews/processingCardView.js +0 -69
- package/dist/cjs/card/cardviews/videoCardView.js +0 -98
- package/dist/es2019/card/cardviews/cardViewWrapper.js +0 -103
- package/dist/es2019/card/cardviews/errorCardView.js +0 -86
- package/dist/es2019/card/cardviews/iconCardView.js +0 -74
- package/dist/es2019/card/cardviews/imageCardView.js +0 -79
- package/dist/es2019/card/cardviews/index.js +0 -278
- package/dist/es2019/card/cardviews/loadingCardView.js +0 -53
- package/dist/es2019/card/cardviews/processingCardView.js +0 -64
- package/dist/es2019/card/cardviews/videoCardView.js +0 -84
- package/dist/esm/card/cardviews/cardViewWrapper.js +0 -105
- package/dist/esm/card/cardviews/errorCardView.js +0 -83
- package/dist/esm/card/cardviews/iconCardView.js +0 -75
- package/dist/esm/card/cardviews/imageCardView.js +0 -85
- package/dist/esm/card/cardviews/index.js +0 -281
- package/dist/esm/card/cardviews/loadingCardView.js +0 -50
- package/dist/esm/card/cardviews/processingCardView.js +0 -61
- package/dist/esm/card/cardviews/videoCardView.js +0 -90
- package/dist/types/card/cardviews/cardViewWrapper.d.ts +0 -41
- package/dist/types/card/cardviews/errorCardView.d.ts +0 -15
- package/dist/types/card/cardviews/iconCardView.d.ts +0 -17
- package/dist/types/card/cardviews/imageCardView.d.ts +0 -34
- package/dist/types/card/cardviews/index.d.ts +0 -51
- package/dist/types/card/cardviews/loadingCardView.d.ts +0 -14
- package/dist/types/card/cardviews/processingCardView.d.ts +0 -11
- package/dist/types/card/cardviews/videoCardView.d.ts +0 -34
- package/dist/types-ts4.5/card/cardviews/cardViewWrapper.d.ts +0 -41
- package/dist/types-ts4.5/card/cardviews/errorCardView.d.ts +0 -15
- package/dist/types-ts4.5/card/cardviews/iconCardView.d.ts +0 -17
- package/dist/types-ts4.5/card/cardviews/imageCardView.d.ts +0 -34
- package/dist/types-ts4.5/card/cardviews/index.d.ts +0 -51
- package/dist/types-ts4.5/card/cardviews/loadingCardView.d.ts +0 -14
- package/dist/types-ts4.5/card/cardviews/processingCardView.d.ts +0 -11
- package/dist/types-ts4.5/card/cardviews/videoCardView.d.ts +0 -34
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
/**
|
|
3
|
-
* @jsxRuntime classic
|
|
4
|
-
* @jsx jsx
|
|
5
|
-
*/
|
|
6
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
7
|
-
import { jsx } from '@emotion/react';
|
|
8
|
-
import { useEffect, useRef } from 'react';
|
|
9
|
-
import { withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
10
|
-
import { MimeTypeIcon } from '@atlaskit/media-ui/mime-type-icon';
|
|
11
|
-
import { createAndFireMediaCardEvent } from '../../utils/analytics';
|
|
12
|
-
import { IconWrapper } from '../ui/iconWrapper/iconWrapper';
|
|
13
|
-
import { CreatingPreview } from '../ui/iconMessage';
|
|
14
|
-
import { useBreakpoint } from '../useBreakpoint';
|
|
15
|
-
import { CardViewWrapper } from './cardViewWrapper';
|
|
16
|
-
const ProcessingCardViewBase = props => {
|
|
17
|
-
const {
|
|
18
|
-
disableAnimation,
|
|
19
|
-
dimensions,
|
|
20
|
-
metadata,
|
|
21
|
-
disableOverlay,
|
|
22
|
-
innerRef
|
|
23
|
-
} = props;
|
|
24
|
-
const divRef = useRef(null);
|
|
25
|
-
const breakpoint = useBreakpoint(dimensions === null || dimensions === void 0 ? void 0 : dimensions.width, divRef);
|
|
26
|
-
useEffect(() => {
|
|
27
|
-
innerRef && !!divRef.current && innerRef(divRef.current);
|
|
28
|
-
}, [innerRef]);
|
|
29
|
-
const {
|
|
30
|
-
name,
|
|
31
|
-
size,
|
|
32
|
-
mediaType,
|
|
33
|
-
mimeType
|
|
34
|
-
} = metadata || {};
|
|
35
|
-
const isZeroSize = size === 0;
|
|
36
|
-
const hasTitleBox = !disableOverlay && !!name;
|
|
37
|
-
return jsx(CardViewWrapper, _extends({}, props, {
|
|
38
|
-
metadata: metadata,
|
|
39
|
-
breakpoint: breakpoint,
|
|
40
|
-
"data-test-status": "processing",
|
|
41
|
-
ref: divRef
|
|
42
|
-
}), jsx(IconWrapper, {
|
|
43
|
-
breakpoint: breakpoint,
|
|
44
|
-
hasTitleBox: hasTitleBox
|
|
45
|
-
}, jsx(MimeTypeIcon, {
|
|
46
|
-
testId: "media-card-file-type-icon",
|
|
47
|
-
mediaType: mediaType,
|
|
48
|
-
mimeType: mimeType,
|
|
49
|
-
name: name
|
|
50
|
-
}), !isZeroSize && jsx(CreatingPreview, {
|
|
51
|
-
disableAnimation: disableAnimation
|
|
52
|
-
})));
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
// TODO: check if analytics is correct
|
|
56
|
-
|
|
57
|
-
export const ProcessingCardView = withAnalyticsEvents({
|
|
58
|
-
onClick: createAndFireMediaCardEvent({
|
|
59
|
-
eventType: 'ui',
|
|
60
|
-
action: 'clicked',
|
|
61
|
-
actionSubject: 'mediaCard',
|
|
62
|
-
attributes: {}
|
|
63
|
-
})
|
|
64
|
-
})(ProcessingCardViewBase);
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
/**
|
|
3
|
-
* @jsxRuntime classic
|
|
4
|
-
* @jsx jsx
|
|
5
|
-
*/
|
|
6
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
7
|
-
import { jsx } from '@emotion/react';
|
|
8
|
-
import { useEffect, useRef } from 'react';
|
|
9
|
-
import { withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
10
|
-
import { createAndFireMediaCardEvent } from '../../utils/analytics';
|
|
11
|
-
import { IconWrapper } from '../ui/iconWrapper/iconWrapper';
|
|
12
|
-
import { PlayButton } from '../ui/playButton/playButton';
|
|
13
|
-
import { ImageRenderer } from '../ui/imageRenderer/imageRenderer';
|
|
14
|
-
import { useBreakpoint } from '../useBreakpoint';
|
|
15
|
-
import { CardViewWrapper } from './cardViewWrapper';
|
|
16
|
-
import { ProgressBar } from '../ui/progressBar/progressBar';
|
|
17
|
-
import { Blanket } from '../ui/blanket/blanket';
|
|
18
|
-
const VideoCardViewBase = props => {
|
|
19
|
-
const {
|
|
20
|
-
status,
|
|
21
|
-
dimensions,
|
|
22
|
-
metadata,
|
|
23
|
-
disableOverlay,
|
|
24
|
-
innerRef,
|
|
25
|
-
progress,
|
|
26
|
-
cardPreview,
|
|
27
|
-
alt,
|
|
28
|
-
resizeMode,
|
|
29
|
-
onDisplayImage,
|
|
30
|
-
nativeLazyLoad,
|
|
31
|
-
forceSyncDisplay,
|
|
32
|
-
onImageLoad,
|
|
33
|
-
onImageError
|
|
34
|
-
} = props;
|
|
35
|
-
const divRef = useRef(null);
|
|
36
|
-
const breakpoint = useBreakpoint(dimensions === null || dimensions === void 0 ? void 0 : dimensions.width, divRef);
|
|
37
|
-
useEffect(() => {
|
|
38
|
-
innerRef && !!divRef.current && innerRef(divRef.current);
|
|
39
|
-
}, [innerRef]);
|
|
40
|
-
const {
|
|
41
|
-
name,
|
|
42
|
-
mediaType = 'unknown'
|
|
43
|
-
} = metadata || {};
|
|
44
|
-
const hasTitleBox = !disableOverlay && !!name;
|
|
45
|
-
const isUploading = status === 'uploading';
|
|
46
|
-
return jsx(CardViewWrapper, _extends({}, props, {
|
|
47
|
-
breakpoint: breakpoint,
|
|
48
|
-
"data-test-status": status,
|
|
49
|
-
"data-test-progress": progress,
|
|
50
|
-
ref: divRef,
|
|
51
|
-
customBlanket: () => disableOverlay ? null : jsx(Blanket, {
|
|
52
|
-
isFixed: isUploading
|
|
53
|
-
}),
|
|
54
|
-
progressBar: isUploading ? () => jsx(ProgressBar, {
|
|
55
|
-
progress: progress,
|
|
56
|
-
breakpoint: breakpoint,
|
|
57
|
-
positionBottom: !hasTitleBox
|
|
58
|
-
}) : undefined
|
|
59
|
-
}), jsx(ImageRenderer, {
|
|
60
|
-
cardPreview: cardPreview,
|
|
61
|
-
mediaType: mediaType,
|
|
62
|
-
alt: alt,
|
|
63
|
-
resizeMode: resizeMode,
|
|
64
|
-
onDisplayImage: onDisplayImage,
|
|
65
|
-
onImageLoad: () => onImageLoad === null || onImageLoad === void 0 ? void 0 : onImageLoad(cardPreview),
|
|
66
|
-
onImageError: () => onImageError === null || onImageError === void 0 ? void 0 : onImageError(cardPreview),
|
|
67
|
-
nativeLazyLoad: nativeLazyLoad,
|
|
68
|
-
forceSyncDisplay: forceSyncDisplay
|
|
69
|
-
}), cardPreview && jsx(IconWrapper, {
|
|
70
|
-
breakpoint: breakpoint,
|
|
71
|
-
hasTitleBox: hasTitleBox
|
|
72
|
-
}, jsx(PlayButton, null)));
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
// TODO: check if analytics is correct
|
|
76
|
-
|
|
77
|
-
export const VideoCardView = withAnalyticsEvents({
|
|
78
|
-
onClick: createAndFireMediaCardEvent({
|
|
79
|
-
eventType: 'ui',
|
|
80
|
-
action: 'clicked',
|
|
81
|
-
actionSubject: 'mediaCard',
|
|
82
|
-
attributes: {}
|
|
83
|
-
})
|
|
84
|
-
})(VideoCardViewBase);
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["cardPreview", "testId", "dimensions", "appearance", "metadata", "selected", "selectable", "actions", "breakpoint", "disableOverlay", "titleBoxBgColor", "titleBoxIcon", "shouldHideTooltip", "children", "onClick", "onMouseEnter", "mediaCardCursor", "customBlanket", "customTitleBox", "progressBar", "shouldOpenMediaViewer", "openMediaViewerButtonRef", "overriddenCreationDate"];
|
|
4
|
-
/**
|
|
5
|
-
* @jsxRuntime classic
|
|
6
|
-
* @jsx jsx
|
|
7
|
-
*/
|
|
8
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
9
|
-
import { jsx } from '@emotion/react';
|
|
10
|
-
import React from 'react';
|
|
11
|
-
import Tooltip from '@atlaskit/tooltip';
|
|
12
|
-
import { ImageContainer, Wrapper } from '../ui/wrapper';
|
|
13
|
-
import { attachDetailsToActions } from '../actions';
|
|
14
|
-
import { TitleBox } from '../ui/titleBox/titleBox';
|
|
15
|
-
import { TickBox } from '../ui/tickBox/tickBox';
|
|
16
|
-
import { Blanket } from '../ui/blanket/blanket';
|
|
17
|
-
import { ActionsBar } from '../ui/actionsBar/actionsBar';
|
|
18
|
-
import { fileCardImageViewSelector } from '../classnames';
|
|
19
|
-
import OpenMediaViewerButton from '../ui/openMediaViewerButton/openMediaViewerButton';
|
|
20
|
-
export var CardViewWrapper = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
21
|
-
var cardPreview = _ref.cardPreview,
|
|
22
|
-
testId = _ref.testId,
|
|
23
|
-
dimensions = _ref.dimensions,
|
|
24
|
-
_ref$appearance = _ref.appearance,
|
|
25
|
-
appearance = _ref$appearance === void 0 ? 'auto' : _ref$appearance,
|
|
26
|
-
metadata = _ref.metadata,
|
|
27
|
-
selected = _ref.selected,
|
|
28
|
-
selectable = _ref.selectable,
|
|
29
|
-
actions = _ref.actions,
|
|
30
|
-
breakpoint = _ref.breakpoint,
|
|
31
|
-
disableOverlay = _ref.disableOverlay,
|
|
32
|
-
titleBoxBgColor = _ref.titleBoxBgColor,
|
|
33
|
-
titleBoxIcon = _ref.titleBoxIcon,
|
|
34
|
-
shouldHideTooltip = _ref.shouldHideTooltip,
|
|
35
|
-
children = _ref.children,
|
|
36
|
-
onClick = _ref.onClick,
|
|
37
|
-
onMouseEnter = _ref.onMouseEnter,
|
|
38
|
-
mediaCardCursor = _ref.mediaCardCursor,
|
|
39
|
-
customBlanket = _ref.customBlanket,
|
|
40
|
-
customTitleBox = _ref.customTitleBox,
|
|
41
|
-
progressBar = _ref.progressBar,
|
|
42
|
-
shouldOpenMediaViewer = _ref.shouldOpenMediaViewer,
|
|
43
|
-
_ref$openMediaViewerB = _ref.openMediaViewerButtonRef,
|
|
44
|
-
openMediaViewerButtonRef = _ref$openMediaViewerB === void 0 ? null : _ref$openMediaViewerB,
|
|
45
|
-
overriddenCreationDate = _ref.overriddenCreationDate,
|
|
46
|
-
props = _objectWithoutProperties(_ref, _excluded);
|
|
47
|
-
var _ref2 = metadata || {},
|
|
48
|
-
name = _ref2.name,
|
|
49
|
-
createdAt = _ref2.createdAt,
|
|
50
|
-
mediaType = _ref2.mediaType;
|
|
51
|
-
var actionsWithDetails = metadata && actions ? attachDetailsToActions(actions, metadata) : [];
|
|
52
|
-
var defaultBlanket = !disableOverlay && jsx(Blanket, null);
|
|
53
|
-
var defaultTitleBox = !disableOverlay && !!name && jsx(TitleBox, {
|
|
54
|
-
name: name,
|
|
55
|
-
createdAt: overriddenCreationDate !== null && overriddenCreationDate !== void 0 ? overriddenCreationDate : createdAt,
|
|
56
|
-
breakpoint: breakpoint,
|
|
57
|
-
titleBoxIcon: titleBoxIcon,
|
|
58
|
-
titleBoxBgColor: titleBoxBgColor
|
|
59
|
-
});
|
|
60
|
-
var contents = jsx(React.Fragment, null, jsx(ImageContainer, _extends({
|
|
61
|
-
testId: fileCardImageViewSelector,
|
|
62
|
-
mediaName: name,
|
|
63
|
-
status: status,
|
|
64
|
-
selected: selected ? true : undefined
|
|
65
|
-
}, props), children, customBlanket ? customBlanket() : defaultBlanket, customTitleBox ? customTitleBox() : defaultTitleBox, !disableOverlay && !!selectable && jsx(TickBox, {
|
|
66
|
-
selected: selected
|
|
67
|
-
}), progressBar && progressBar()), !disableOverlay && actions && actions.length !== 0 && jsx(ActionsBar, {
|
|
68
|
-
filename: name,
|
|
69
|
-
actions: actionsWithDetails
|
|
70
|
-
}));
|
|
71
|
-
var shouldRenderPlayButton = function shouldRenderPlayButton() {
|
|
72
|
-
if (mediaType !== 'video' || !cardPreview) {
|
|
73
|
-
return false;
|
|
74
|
-
}
|
|
75
|
-
return true;
|
|
76
|
-
};
|
|
77
|
-
var isPlayButtonClickable = shouldRenderPlayButton() && disableOverlay;
|
|
78
|
-
var isTickBoxSelectable = !disableOverlay && !!selectable && !selected;
|
|
79
|
-
var shouldDisplayTooltip = !disableOverlay && !shouldHideTooltip;
|
|
80
|
-
var shouldDisplayBackground = !cardPreview || !disableOverlay;
|
|
81
|
-
return jsx(React.Fragment, null, shouldOpenMediaViewer && jsx(OpenMediaViewerButton, {
|
|
82
|
-
fileName: name !== null && name !== void 0 ? name : '',
|
|
83
|
-
innerRef: openMediaViewerButtonRef,
|
|
84
|
-
onClick: onClick
|
|
85
|
-
}), jsx(Wrapper, {
|
|
86
|
-
testId: testId || 'media-card-view',
|
|
87
|
-
dimensions: dimensions,
|
|
88
|
-
appearance: appearance,
|
|
89
|
-
onClick: onClick,
|
|
90
|
-
onMouseEnter: onMouseEnter,
|
|
91
|
-
innerRef: ref,
|
|
92
|
-
breakpoint: breakpoint,
|
|
93
|
-
mediaCardCursor: mediaCardCursor,
|
|
94
|
-
disableOverlay: !!disableOverlay,
|
|
95
|
-
selected: !!selected,
|
|
96
|
-
displayBackground: shouldDisplayBackground,
|
|
97
|
-
isPlayButtonClickable: !!isPlayButtonClickable,
|
|
98
|
-
isTickBoxSelectable: isTickBoxSelectable,
|
|
99
|
-
shouldDisplayTooltip: shouldDisplayTooltip
|
|
100
|
-
}, shouldDisplayTooltip ? jsx(Tooltip, {
|
|
101
|
-
content: name,
|
|
102
|
-
position: "bottom",
|
|
103
|
-
tag: "div"
|
|
104
|
-
}, contents) : contents));
|
|
105
|
-
});
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
/**
|
|
3
|
-
* @jsxRuntime classic
|
|
4
|
-
* @jsx jsx
|
|
5
|
-
*/
|
|
6
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
7
|
-
import { jsx } from '@emotion/react';
|
|
8
|
-
import { useRef } from 'react';
|
|
9
|
-
import { withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
10
|
-
import { createAndFireMediaCardEvent } from '../../utils/analytics';
|
|
11
|
-
import { useBreakpoint } from '../useBreakpoint';
|
|
12
|
-
import { CardViewWrapper } from './cardViewWrapper';
|
|
13
|
-
import { MimeTypeIcon } from '@atlaskit/media-ui/mime-type-icon';
|
|
14
|
-
import { IconWrapper } from '../ui/iconWrapper/iconWrapper';
|
|
15
|
-
import { FailedTitleBox } from '../ui/titleBox/failedTitleBox';
|
|
16
|
-
import { PreviewUnavailable, FailedToUpload, PreviewCurrentlyUnavailable, FailedToLoad } from '../ui/iconMessage';
|
|
17
|
-
import { isUploadError, isRateLimitedError, isPollingError } from '../../errors';
|
|
18
|
-
import { messages } from '@atlaskit/media-ui';
|
|
19
|
-
var IconMessage = function IconMessage(_ref) {
|
|
20
|
-
var error = _ref.error,
|
|
21
|
-
metadata = _ref.metadata;
|
|
22
|
-
var _ref2 = error || {},
|
|
23
|
-
secondaryError = _ref2.secondaryError;
|
|
24
|
-
if (isRateLimitedError(secondaryError) || isPollingError(secondaryError)) {
|
|
25
|
-
return jsx(PreviewCurrentlyUnavailable, null);
|
|
26
|
-
} else if (isUploadError(error)) {
|
|
27
|
-
return jsx(FailedToUpload, null);
|
|
28
|
-
} else if (!metadata) {
|
|
29
|
-
return jsx(FailedToLoad, null);
|
|
30
|
-
} else {
|
|
31
|
-
return jsx(PreviewUnavailable, null);
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
var ErrorCardViewBase = function ErrorCardViewBase(props) {
|
|
35
|
-
var error = props.error,
|
|
36
|
-
metadata = props.metadata,
|
|
37
|
-
dimensions = props.dimensions,
|
|
38
|
-
disableOverlay = props.disableOverlay;
|
|
39
|
-
var _ref3 = metadata || {},
|
|
40
|
-
name = _ref3.name,
|
|
41
|
-
mediaType = _ref3.mediaType,
|
|
42
|
-
mimeType = _ref3.mimeType;
|
|
43
|
-
var divRef = useRef(null);
|
|
44
|
-
var breakpoint = useBreakpoint(dimensions === null || dimensions === void 0 ? void 0 : dimensions.width, divRef);
|
|
45
|
-
var customMessage = isUploadError(props.error) ? messages.failed_to_upload : undefined;
|
|
46
|
-
var renderFailedTitleBox = !disableOverlay && (!name || !!customMessage);
|
|
47
|
-
var renderTitleBox = !disableOverlay && !!name && !customMessage;
|
|
48
|
-
var hasTitleBox = !!renderTitleBox || !!renderFailedTitleBox;
|
|
49
|
-
return jsx(CardViewWrapper, _extends({}, props, {
|
|
50
|
-
metadata: metadata,
|
|
51
|
-
breakpoint: breakpoint,
|
|
52
|
-
"data-test-status": "error",
|
|
53
|
-
ref: divRef,
|
|
54
|
-
customTitleBox: renderFailedTitleBox ? function () {
|
|
55
|
-
return jsx(FailedTitleBox, {
|
|
56
|
-
breakpoint: breakpoint,
|
|
57
|
-
customMessage: customMessage
|
|
58
|
-
});
|
|
59
|
-
} : undefined
|
|
60
|
-
}), jsx(IconWrapper, {
|
|
61
|
-
breakpoint: breakpoint,
|
|
62
|
-
hasTitleBox: hasTitleBox
|
|
63
|
-
}, jsx(MimeTypeIcon, {
|
|
64
|
-
testId: "media-card-file-type-icon",
|
|
65
|
-
mediaType: mediaType,
|
|
66
|
-
mimeType: mimeType,
|
|
67
|
-
name: name
|
|
68
|
-
}), !renderFailedTitleBox && jsx(IconMessage, {
|
|
69
|
-
error: error,
|
|
70
|
-
metadata: metadata
|
|
71
|
-
})));
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
// TODO: check if analytics is correct
|
|
75
|
-
|
|
76
|
-
export var ErrorCardView = withAnalyticsEvents({
|
|
77
|
-
onClick: createAndFireMediaCardEvent({
|
|
78
|
-
eventType: 'ui',
|
|
79
|
-
action: 'clicked',
|
|
80
|
-
actionSubject: 'mediaCard',
|
|
81
|
-
attributes: {}
|
|
82
|
-
})
|
|
83
|
-
})(ErrorCardViewBase);
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
/**
|
|
3
|
-
* @jsxRuntime classic
|
|
4
|
-
* @jsx jsx
|
|
5
|
-
*/
|
|
6
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
7
|
-
import { jsx } from '@emotion/react';
|
|
8
|
-
import { useEffect, useRef } from 'react';
|
|
9
|
-
import { MimeTypeIcon } from '@atlaskit/media-ui/mime-type-icon';
|
|
10
|
-
import { withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
11
|
-
import { createAndFireMediaCardEvent } from '../../utils/analytics';
|
|
12
|
-
import { IconWrapper } from '../ui/iconWrapper/iconWrapper';
|
|
13
|
-
import { useBreakpoint } from '../useBreakpoint';
|
|
14
|
-
import { CardViewWrapper } from './cardViewWrapper';
|
|
15
|
-
import { ProgressBar } from '../ui/progressBar/progressBar';
|
|
16
|
-
import { Blanket } from '../ui/blanket/blanket';
|
|
17
|
-
// NOTE: should we call this Icon or UploadingCardView since we now have ProgressBar?
|
|
18
|
-
|
|
19
|
-
var IconCardViewBase = function IconCardViewBase(props) {
|
|
20
|
-
var dimensions = props.dimensions,
|
|
21
|
-
metadata = props.metadata,
|
|
22
|
-
disableOverlay = props.disableOverlay,
|
|
23
|
-
innerRef = props.innerRef,
|
|
24
|
-
progress = props.progress,
|
|
25
|
-
status = props.status;
|
|
26
|
-
var divRef = useRef(null);
|
|
27
|
-
var breakpoint = useBreakpoint(dimensions === null || dimensions === void 0 ? void 0 : dimensions.width, divRef);
|
|
28
|
-
useEffect(function () {
|
|
29
|
-
innerRef && !!divRef.current && innerRef(divRef.current);
|
|
30
|
-
}, [innerRef]);
|
|
31
|
-
var _ref = metadata || {},
|
|
32
|
-
name = _ref.name,
|
|
33
|
-
mediaType = _ref.mediaType,
|
|
34
|
-
mimeType = _ref.mimeType;
|
|
35
|
-
var hasTitleBox = !disableOverlay && !!name;
|
|
36
|
-
var isUploading = status === 'uploading';
|
|
37
|
-
return jsx(CardViewWrapper, _extends({}, props, {
|
|
38
|
-
metadata: metadata,
|
|
39
|
-
breakpoint: breakpoint,
|
|
40
|
-
"data-test-status": status,
|
|
41
|
-
"data-test-progress": progress,
|
|
42
|
-
ref: divRef,
|
|
43
|
-
customBlanket: function customBlanket() {
|
|
44
|
-
return jsx(Blanket, {
|
|
45
|
-
isFixed: isUploading
|
|
46
|
-
});
|
|
47
|
-
},
|
|
48
|
-
progressBar: isUploading ? function () {
|
|
49
|
-
return jsx(ProgressBar, {
|
|
50
|
-
progress: progress,
|
|
51
|
-
breakpoint: breakpoint,
|
|
52
|
-
positionBottom: !hasTitleBox
|
|
53
|
-
});
|
|
54
|
-
} : undefined
|
|
55
|
-
}), jsx(IconWrapper, {
|
|
56
|
-
breakpoint: breakpoint,
|
|
57
|
-
hasTitleBox: hasTitleBox
|
|
58
|
-
}, jsx(MimeTypeIcon, {
|
|
59
|
-
testId: "media-card-file-type-icon",
|
|
60
|
-
mediaType: mediaType,
|
|
61
|
-
mimeType: mimeType,
|
|
62
|
-
name: name
|
|
63
|
-
})));
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
// TODO: check if analytics is correct
|
|
67
|
-
|
|
68
|
-
export var IconCardView = withAnalyticsEvents({
|
|
69
|
-
onClick: createAndFireMediaCardEvent({
|
|
70
|
-
eventType: 'ui',
|
|
71
|
-
action: 'clicked',
|
|
72
|
-
actionSubject: 'mediaCard',
|
|
73
|
-
attributes: {}
|
|
74
|
-
})
|
|
75
|
-
})(IconCardViewBase);
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
/**
|
|
3
|
-
* @jsxRuntime classic
|
|
4
|
-
* @jsx jsx
|
|
5
|
-
*/
|
|
6
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
7
|
-
import { jsx } from '@emotion/react';
|
|
8
|
-
import { useEffect, useRef } from 'react';
|
|
9
|
-
import { withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
10
|
-
import { createAndFireMediaCardEvent } from '../../utils/analytics';
|
|
11
|
-
import { ImageRenderer } from '../ui/imageRenderer/imageRenderer';
|
|
12
|
-
import { useBreakpoint } from '../useBreakpoint';
|
|
13
|
-
import { CardViewWrapper } from './cardViewWrapper';
|
|
14
|
-
import { ProgressBar } from '../ui/progressBar/progressBar';
|
|
15
|
-
import { Blanket } from '../ui/blanket/blanket';
|
|
16
|
-
var ImageCardViewBase = function ImageCardViewBase(props) {
|
|
17
|
-
var status = props.status,
|
|
18
|
-
dimensions = props.dimensions,
|
|
19
|
-
metadata = props.metadata,
|
|
20
|
-
disableOverlay = props.disableOverlay,
|
|
21
|
-
innerRef = props.innerRef,
|
|
22
|
-
progress = props.progress,
|
|
23
|
-
cardPreview = props.cardPreview,
|
|
24
|
-
alt = props.alt,
|
|
25
|
-
resizeMode = props.resizeMode,
|
|
26
|
-
onDisplayImage = props.onDisplayImage,
|
|
27
|
-
nativeLazyLoad = props.nativeLazyLoad,
|
|
28
|
-
forceSyncDisplay = props.forceSyncDisplay,
|
|
29
|
-
_onImageLoad = props.onImageLoad,
|
|
30
|
-
_onImageError = props.onImageError;
|
|
31
|
-
var divRef = useRef(null);
|
|
32
|
-
var breakpoint = useBreakpoint(dimensions === null || dimensions === void 0 ? void 0 : dimensions.width, divRef);
|
|
33
|
-
useEffect(function () {
|
|
34
|
-
innerRef && !!divRef.current && innerRef(divRef.current);
|
|
35
|
-
}, [innerRef]);
|
|
36
|
-
var _ref = metadata || {},
|
|
37
|
-
name = _ref.name,
|
|
38
|
-
_ref$mediaType = _ref.mediaType,
|
|
39
|
-
mediaType = _ref$mediaType === void 0 ? 'unknown' : _ref$mediaType;
|
|
40
|
-
var hasTitleBox = !disableOverlay && !!name;
|
|
41
|
-
var isUploading = status === 'uploading';
|
|
42
|
-
return jsx(CardViewWrapper, _extends({}, props, {
|
|
43
|
-
breakpoint: breakpoint,
|
|
44
|
-
"data-test-status": status,
|
|
45
|
-
"data-test-progress": progress,
|
|
46
|
-
ref: divRef,
|
|
47
|
-
customBlanket: function customBlanket() {
|
|
48
|
-
return jsx(Blanket, {
|
|
49
|
-
isFixed: isUploading
|
|
50
|
-
});
|
|
51
|
-
},
|
|
52
|
-
progressBar: isUploading ? function () {
|
|
53
|
-
return jsx(ProgressBar, {
|
|
54
|
-
progress: progress,
|
|
55
|
-
breakpoint: breakpoint,
|
|
56
|
-
positionBottom: !hasTitleBox
|
|
57
|
-
});
|
|
58
|
-
} : undefined
|
|
59
|
-
}), jsx(ImageRenderer, {
|
|
60
|
-
cardPreview: cardPreview,
|
|
61
|
-
mediaType: mediaType,
|
|
62
|
-
alt: alt,
|
|
63
|
-
resizeMode: resizeMode,
|
|
64
|
-
onDisplayImage: onDisplayImage,
|
|
65
|
-
onImageLoad: function onImageLoad() {
|
|
66
|
-
return _onImageLoad === null || _onImageLoad === void 0 ? void 0 : _onImageLoad(cardPreview);
|
|
67
|
-
},
|
|
68
|
-
onImageError: function onImageError() {
|
|
69
|
-
return _onImageError === null || _onImageError === void 0 ? void 0 : _onImageError(cardPreview);
|
|
70
|
-
},
|
|
71
|
-
nativeLazyLoad: nativeLazyLoad,
|
|
72
|
-
forceSyncDisplay: forceSyncDisplay
|
|
73
|
-
}));
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
// TODO: check if analytics is correct
|
|
77
|
-
|
|
78
|
-
export var ImageCardView = withAnalyticsEvents({
|
|
79
|
-
onClick: createAndFireMediaCardEvent({
|
|
80
|
-
eventType: 'ui',
|
|
81
|
-
action: 'clicked',
|
|
82
|
-
actionSubject: 'mediaCard',
|
|
83
|
-
attributes: {}
|
|
84
|
-
})
|
|
85
|
-
})(ImageCardViewBase);
|