@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,281 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
-
/**
|
|
4
|
-
* @jsxRuntime classic
|
|
5
|
-
* @jsx jsx
|
|
6
|
-
*/
|
|
7
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
8
|
-
import { jsx } from '@emotion/react';
|
|
9
|
-
import React, { useEffect, useState, useRef } from 'react';
|
|
10
|
-
import { withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
11
|
-
import { createAndFireMediaCardEvent } from '../../utils/analytics';
|
|
12
|
-
import { useBreakpoint } from '../useBreakpoint';
|
|
13
|
-
import { ProcessingCardView } from './processingCardView';
|
|
14
|
-
import { ErrorCardView } from './errorCardView';
|
|
15
|
-
import { VideoCardView } from './videoCardView';
|
|
16
|
-
import { ImageCardView } from './imageCardView';
|
|
17
|
-
import { IconCardView } from './iconCardView';
|
|
18
|
-
import { LoadingCardView } from './loadingCardView';
|
|
19
|
-
export var CardViewsBase = function CardViewsBase(_ref) {
|
|
20
|
-
var innerRef = _ref.innerRef,
|
|
21
|
-
onImageLoad = _ref.onImageLoad,
|
|
22
|
-
onImageError = _ref.onImageError,
|
|
23
|
-
dimensions = _ref.dimensions,
|
|
24
|
-
_ref$appearance = _ref.appearance,
|
|
25
|
-
appearance = _ref$appearance === void 0 ? 'auto' : _ref$appearance,
|
|
26
|
-
onClick = _ref.onClick,
|
|
27
|
-
onMouseEnter = _ref.onMouseEnter,
|
|
28
|
-
testId = _ref.testId,
|
|
29
|
-
metadata = _ref.metadata,
|
|
30
|
-
status = _ref.status,
|
|
31
|
-
selected = _ref.selected,
|
|
32
|
-
selectable = _ref.selectable,
|
|
33
|
-
cardPreview = _ref.cardPreview,
|
|
34
|
-
mediaCardCursor = _ref.mediaCardCursor,
|
|
35
|
-
shouldHideTooltip = _ref.shouldHideTooltip,
|
|
36
|
-
progress = _ref.progress,
|
|
37
|
-
alt = _ref.alt,
|
|
38
|
-
resizeMode = _ref.resizeMode,
|
|
39
|
-
onDisplayImage = _ref.onDisplayImage,
|
|
40
|
-
nativeLazyLoad = _ref.nativeLazyLoad,
|
|
41
|
-
forceSyncDisplay = _ref.forceSyncDisplay,
|
|
42
|
-
actions = _ref.actions,
|
|
43
|
-
disableOverlay = _ref.disableOverlay,
|
|
44
|
-
titleBoxBgColor = _ref.titleBoxBgColor,
|
|
45
|
-
titleBoxIcon = _ref.titleBoxIcon,
|
|
46
|
-
error = _ref.error,
|
|
47
|
-
disableAnimation = _ref.disableAnimation,
|
|
48
|
-
shouldOpenMediaViewer = _ref.shouldOpenMediaViewer,
|
|
49
|
-
openMediaViewerButtonRef = _ref.openMediaViewerButtonRef,
|
|
50
|
-
overriddenCreationDate = _ref.overriddenCreationDate;
|
|
51
|
-
var _useState = useState(false),
|
|
52
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
53
|
-
didImageRender = _useState2[0],
|
|
54
|
-
setDidImageRender = _useState2[1];
|
|
55
|
-
var divRef = useRef(null);
|
|
56
|
-
var prevCardPreviewRef = useRef();
|
|
57
|
-
var breakpoint = useBreakpoint(dimensions === null || dimensions === void 0 ? void 0 : dimensions.width, divRef);
|
|
58
|
-
useEffect(function () {
|
|
59
|
-
innerRef && !!divRef.current && innerRef(divRef.current);
|
|
60
|
-
}, [innerRef]);
|
|
61
|
-
|
|
62
|
-
/* didImageRender movements */
|
|
63
|
-
|
|
64
|
-
useEffect(function () {
|
|
65
|
-
// We should only switch didImageRender to false when cardPreview goes undefined, not when it is changed. as this method could be triggered after onImageLoad callback, falling on a race condition
|
|
66
|
-
if (prevCardPreviewRef.current && !cardPreview) {
|
|
67
|
-
setDidImageRender(false);
|
|
68
|
-
}
|
|
69
|
-
prevCardPreviewRef.current = cardPreview;
|
|
70
|
-
}, [cardPreview]);
|
|
71
|
-
var handleOnImageLoad = function handleOnImageLoad(prevCardPreview) {
|
|
72
|
-
if (prevCardPreview.dataURI !== (cardPreview === null || cardPreview === void 0 ? void 0 : cardPreview.dataURI)) {
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
setDidImageRender(true);
|
|
76
|
-
onImageLoad === null || onImageLoad === void 0 || onImageLoad(cardPreview);
|
|
77
|
-
};
|
|
78
|
-
var handleOnImageError = function handleOnImageError(prevCardPreview) {
|
|
79
|
-
if (prevCardPreview.dataURI !== (cardPreview === null || cardPreview === void 0 ? void 0 : cardPreview.dataURI)) {
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
setDidImageRender(false);
|
|
83
|
-
onImageError === null || onImageError === void 0 || onImageError(cardPreview);
|
|
84
|
-
};
|
|
85
|
-
var getRenderConfigByStatus = function getRenderConfigByStatus() {
|
|
86
|
-
var _ref2 = metadata || {},
|
|
87
|
-
mediaType = _ref2.mediaType;
|
|
88
|
-
|
|
89
|
-
// TODO: figure out if data-test-progress for all the card views
|
|
90
|
-
|
|
91
|
-
var baseProps = {
|
|
92
|
-
testId: testId,
|
|
93
|
-
dimensions: dimensions,
|
|
94
|
-
appearance: appearance,
|
|
95
|
-
metadata: metadata,
|
|
96
|
-
selected: selected,
|
|
97
|
-
selectable: selectable,
|
|
98
|
-
actions: actions,
|
|
99
|
-
breakpoint: breakpoint,
|
|
100
|
-
disableOverlay: disableOverlay,
|
|
101
|
-
titleBoxBgColor: titleBoxBgColor,
|
|
102
|
-
titleBoxIcon: titleBoxIcon,
|
|
103
|
-
shouldHideTooltip: shouldHideTooltip,
|
|
104
|
-
onClick: onClick,
|
|
105
|
-
onMouseEnter: onMouseEnter,
|
|
106
|
-
mediaCardCursor: mediaCardCursor,
|
|
107
|
-
innerRef: innerRef,
|
|
108
|
-
shouldOpenMediaViewer: shouldOpenMediaViewer,
|
|
109
|
-
openMediaViewerButtonRef: openMediaViewerButtonRef,
|
|
110
|
-
overriddenCreationDate: overriddenCreationDate
|
|
111
|
-
};
|
|
112
|
-
switch (status) {
|
|
113
|
-
case 'uploading':
|
|
114
|
-
if (cardPreview) {
|
|
115
|
-
return jsx(React.Fragment, null, jsx("div", {
|
|
116
|
-
style: {
|
|
117
|
-
display: !didImageRender ? 'none' : 'inline'
|
|
118
|
-
}
|
|
119
|
-
}, mediaType === 'video' ? jsx(VideoCardView, _extends({}, baseProps, {
|
|
120
|
-
status: status,
|
|
121
|
-
cardPreview: cardPreview,
|
|
122
|
-
alt: alt,
|
|
123
|
-
resizeMode: resizeMode,
|
|
124
|
-
onDisplayImage: onDisplayImage,
|
|
125
|
-
onImageLoad: handleOnImageLoad,
|
|
126
|
-
onImageError: handleOnImageError,
|
|
127
|
-
nativeLazyLoad: nativeLazyLoad,
|
|
128
|
-
forceSyncDisplay: forceSyncDisplay,
|
|
129
|
-
progress: progress
|
|
130
|
-
})) : jsx(ImageCardView, _extends({}, baseProps, {
|
|
131
|
-
status: status,
|
|
132
|
-
cardPreview: cardPreview,
|
|
133
|
-
alt: alt,
|
|
134
|
-
resizeMode: resizeMode,
|
|
135
|
-
onDisplayImage: onDisplayImage,
|
|
136
|
-
onImageLoad: handleOnImageLoad,
|
|
137
|
-
onImageError: handleOnImageError,
|
|
138
|
-
nativeLazyLoad: nativeLazyLoad,
|
|
139
|
-
forceSyncDisplay: forceSyncDisplay,
|
|
140
|
-
progress: progress
|
|
141
|
-
}))), jsx("div", {
|
|
142
|
-
style: {
|
|
143
|
-
display: didImageRender ? 'none' : 'inline'
|
|
144
|
-
}
|
|
145
|
-
}, jsx(IconCardView, _extends({
|
|
146
|
-
status: status,
|
|
147
|
-
progress: progress
|
|
148
|
-
}, baseProps))));
|
|
149
|
-
} else {
|
|
150
|
-
return jsx(IconCardView, _extends({
|
|
151
|
-
status: status,
|
|
152
|
-
progress: progress
|
|
153
|
-
}, baseProps));
|
|
154
|
-
}
|
|
155
|
-
case 'processing':
|
|
156
|
-
if (cardPreview) {
|
|
157
|
-
return jsx(React.Fragment, null, jsx("div", {
|
|
158
|
-
style: {
|
|
159
|
-
display: !didImageRender ? 'none' : 'inline'
|
|
160
|
-
}
|
|
161
|
-
}, mediaType === 'video' ? jsx(VideoCardView, _extends({}, baseProps, {
|
|
162
|
-
status: status,
|
|
163
|
-
cardPreview: cardPreview,
|
|
164
|
-
alt: alt,
|
|
165
|
-
resizeMode: resizeMode,
|
|
166
|
-
onDisplayImage: onDisplayImage,
|
|
167
|
-
onImageLoad: handleOnImageLoad,
|
|
168
|
-
onImageError: handleOnImageError,
|
|
169
|
-
nativeLazyLoad: nativeLazyLoad,
|
|
170
|
-
forceSyncDisplay: forceSyncDisplay,
|
|
171
|
-
progress: progress
|
|
172
|
-
})) : jsx(ImageCardView, _extends({}, baseProps, {
|
|
173
|
-
status: status,
|
|
174
|
-
cardPreview: cardPreview,
|
|
175
|
-
alt: alt,
|
|
176
|
-
resizeMode: resizeMode,
|
|
177
|
-
onDisplayImage: onDisplayImage,
|
|
178
|
-
onImageLoad: handleOnImageLoad,
|
|
179
|
-
onImageError: handleOnImageError,
|
|
180
|
-
nativeLazyLoad: nativeLazyLoad,
|
|
181
|
-
forceSyncDisplay: forceSyncDisplay,
|
|
182
|
-
progress: progress
|
|
183
|
-
}))), jsx("div", {
|
|
184
|
-
style: {
|
|
185
|
-
display: didImageRender ? 'none' : 'inline'
|
|
186
|
-
}
|
|
187
|
-
}, jsx(ProcessingCardView, _extends({
|
|
188
|
-
disableAnimation: disableAnimation
|
|
189
|
-
}, baseProps))));
|
|
190
|
-
} else {
|
|
191
|
-
return jsx(ProcessingCardView, _extends({
|
|
192
|
-
disableAnimation: disableAnimation
|
|
193
|
-
}, baseProps));
|
|
194
|
-
}
|
|
195
|
-
case 'complete':
|
|
196
|
-
if (cardPreview) {
|
|
197
|
-
return jsx(React.Fragment, null, jsx("div", {
|
|
198
|
-
style: {
|
|
199
|
-
display: !didImageRender ? 'none' : 'inline'
|
|
200
|
-
}
|
|
201
|
-
}, mediaType === 'video' ? jsx(VideoCardView, _extends({}, baseProps, {
|
|
202
|
-
status: status,
|
|
203
|
-
cardPreview: cardPreview,
|
|
204
|
-
alt: alt,
|
|
205
|
-
resizeMode: resizeMode,
|
|
206
|
-
onDisplayImage: onDisplayImage,
|
|
207
|
-
onImageLoad: handleOnImageLoad,
|
|
208
|
-
onImageError: handleOnImageError,
|
|
209
|
-
nativeLazyLoad: nativeLazyLoad,
|
|
210
|
-
forceSyncDisplay: forceSyncDisplay
|
|
211
|
-
})) : jsx(ImageCardView, _extends({}, baseProps, {
|
|
212
|
-
status: status,
|
|
213
|
-
cardPreview: cardPreview,
|
|
214
|
-
alt: alt,
|
|
215
|
-
resizeMode: resizeMode,
|
|
216
|
-
onDisplayImage: onDisplayImage,
|
|
217
|
-
onImageLoad: handleOnImageLoad,
|
|
218
|
-
onImageError: handleOnImageError,
|
|
219
|
-
nativeLazyLoad: nativeLazyLoad,
|
|
220
|
-
forceSyncDisplay: forceSyncDisplay
|
|
221
|
-
}))), jsx("div", {
|
|
222
|
-
style: {
|
|
223
|
-
display: didImageRender ? 'none' : 'inline'
|
|
224
|
-
}
|
|
225
|
-
}, jsx(IconCardView, _extends({
|
|
226
|
-
status: status
|
|
227
|
-
}, baseProps))));
|
|
228
|
-
} else {
|
|
229
|
-
return jsx(IconCardView, _extends({
|
|
230
|
-
status: status
|
|
231
|
-
}, baseProps));
|
|
232
|
-
}
|
|
233
|
-
case 'error':
|
|
234
|
-
case 'failed-processing':
|
|
235
|
-
return jsx(ErrorCardView, _extends({
|
|
236
|
-
disableAnimation: disableAnimation,
|
|
237
|
-
error: error
|
|
238
|
-
}, baseProps));
|
|
239
|
-
case 'loading-preview':
|
|
240
|
-
case 'loading':
|
|
241
|
-
default:
|
|
242
|
-
if (cardPreview) {
|
|
243
|
-
return jsx(React.Fragment, null, jsx("div", {
|
|
244
|
-
style: {
|
|
245
|
-
display: !didImageRender ? 'none' : 'inline'
|
|
246
|
-
}
|
|
247
|
-
}, jsx(ImageCardView, _extends({}, baseProps, {
|
|
248
|
-
status: status,
|
|
249
|
-
cardPreview: cardPreview,
|
|
250
|
-
alt: alt,
|
|
251
|
-
resizeMode: resizeMode,
|
|
252
|
-
onDisplayImage: onDisplayImage,
|
|
253
|
-
onImageLoad: handleOnImageLoad,
|
|
254
|
-
onImageError: handleOnImageError,
|
|
255
|
-
nativeLazyLoad: nativeLazyLoad,
|
|
256
|
-
forceSyncDisplay: forceSyncDisplay,
|
|
257
|
-
progress: progress
|
|
258
|
-
}))), jsx("div", {
|
|
259
|
-
style: {
|
|
260
|
-
display: didImageRender ? 'none' : 'inline'
|
|
261
|
-
}
|
|
262
|
-
}, jsx(LoadingCardView, _extends({}, baseProps, {
|
|
263
|
-
disableAnimation: disableAnimation
|
|
264
|
-
}))));
|
|
265
|
-
} else {
|
|
266
|
-
return jsx(LoadingCardView, _extends({}, baseProps, {
|
|
267
|
-
disableAnimation: disableAnimation
|
|
268
|
-
}));
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
};
|
|
272
|
-
return getRenderConfigByStatus();
|
|
273
|
-
};
|
|
274
|
-
export var CardViews = withAnalyticsEvents({
|
|
275
|
-
onClick: createAndFireMediaCardEvent({
|
|
276
|
-
eventType: 'ui',
|
|
277
|
-
action: 'clicked',
|
|
278
|
-
actionSubject: 'mediaCard',
|
|
279
|
-
attributes: {}
|
|
280
|
-
})
|
|
281
|
-
})(CardViewsBase);
|
|
@@ -1,50 +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 SpinnerIcon from '@atlaskit/spinner';
|
|
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
|
-
var LoadingCardViewBase = function LoadingCardViewBase(props) {
|
|
16
|
-
var dimensions = props.dimensions,
|
|
17
|
-
metadata = props.metadata,
|
|
18
|
-
disableOverlay = props.disableOverlay,
|
|
19
|
-
innerRef = props.innerRef;
|
|
20
|
-
var divRef = useRef(null);
|
|
21
|
-
var breakpoint = useBreakpoint(dimensions === null || dimensions === void 0 ? void 0 : dimensions.width, divRef);
|
|
22
|
-
useEffect(function () {
|
|
23
|
-
innerRef && !!divRef.current && innerRef(divRef.current);
|
|
24
|
-
}, [innerRef]);
|
|
25
|
-
var _ref = metadata || {},
|
|
26
|
-
name = _ref.name;
|
|
27
|
-
var hasTitleBox = !disableOverlay && !!name;
|
|
28
|
-
return jsx(CardViewWrapper, _extends({}, props, {
|
|
29
|
-
metadata: metadata,
|
|
30
|
-
breakpoint: breakpoint,
|
|
31
|
-
ref: divRef
|
|
32
|
-
}), jsx(IconWrapper, {
|
|
33
|
-
breakpoint: breakpoint,
|
|
34
|
-
hasTitleBox: hasTitleBox
|
|
35
|
-
}, jsx(SpinnerIcon, {
|
|
36
|
-
testId: "media-card-loading",
|
|
37
|
-
interactionName: "media-card-loading"
|
|
38
|
-
})));
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
// TODO: check if analytics is correct
|
|
42
|
-
|
|
43
|
-
export var LoadingCardView = withAnalyticsEvents({
|
|
44
|
-
onClick: createAndFireMediaCardEvent({
|
|
45
|
-
eventType: 'ui',
|
|
46
|
-
action: 'clicked',
|
|
47
|
-
actionSubject: 'mediaCard',
|
|
48
|
-
attributes: {}
|
|
49
|
-
})
|
|
50
|
-
})(LoadingCardViewBase);
|
|
@@ -1,61 +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
|
-
var ProcessingCardViewBase = function ProcessingCardViewBase(props) {
|
|
17
|
-
var disableAnimation = props.disableAnimation,
|
|
18
|
-
dimensions = props.dimensions,
|
|
19
|
-
metadata = props.metadata,
|
|
20
|
-
disableOverlay = props.disableOverlay,
|
|
21
|
-
innerRef = props.innerRef;
|
|
22
|
-
var divRef = useRef(null);
|
|
23
|
-
var breakpoint = useBreakpoint(dimensions === null || dimensions === void 0 ? void 0 : dimensions.width, divRef);
|
|
24
|
-
useEffect(function () {
|
|
25
|
-
innerRef && !!divRef.current && innerRef(divRef.current);
|
|
26
|
-
}, [innerRef]);
|
|
27
|
-
var _ref = metadata || {},
|
|
28
|
-
name = _ref.name,
|
|
29
|
-
size = _ref.size,
|
|
30
|
-
mediaType = _ref.mediaType,
|
|
31
|
-
mimeType = _ref.mimeType;
|
|
32
|
-
var isZeroSize = size === 0;
|
|
33
|
-
var hasTitleBox = !disableOverlay && !!name;
|
|
34
|
-
return jsx(CardViewWrapper, _extends({}, props, {
|
|
35
|
-
metadata: metadata,
|
|
36
|
-
breakpoint: breakpoint,
|
|
37
|
-
"data-test-status": "processing",
|
|
38
|
-
ref: divRef
|
|
39
|
-
}), jsx(IconWrapper, {
|
|
40
|
-
breakpoint: breakpoint,
|
|
41
|
-
hasTitleBox: hasTitleBox
|
|
42
|
-
}, jsx(MimeTypeIcon, {
|
|
43
|
-
testId: "media-card-file-type-icon",
|
|
44
|
-
mediaType: mediaType,
|
|
45
|
-
mimeType: mimeType,
|
|
46
|
-
name: name
|
|
47
|
-
}), !isZeroSize && jsx(CreatingPreview, {
|
|
48
|
-
disableAnimation: disableAnimation
|
|
49
|
-
})));
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
// TODO: check if analytics is correct
|
|
53
|
-
|
|
54
|
-
export var ProcessingCardView = withAnalyticsEvents({
|
|
55
|
-
onClick: createAndFireMediaCardEvent({
|
|
56
|
-
eventType: 'ui',
|
|
57
|
-
action: 'clicked',
|
|
58
|
-
actionSubject: 'mediaCard',
|
|
59
|
-
attributes: {}
|
|
60
|
-
})
|
|
61
|
-
})(ProcessingCardViewBase);
|
|
@@ -1,90 +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
|
-
var VideoCardViewBase = function VideoCardViewBase(props) {
|
|
19
|
-
var status = props.status,
|
|
20
|
-
dimensions = props.dimensions,
|
|
21
|
-
metadata = props.metadata,
|
|
22
|
-
disableOverlay = props.disableOverlay,
|
|
23
|
-
innerRef = props.innerRef,
|
|
24
|
-
progress = props.progress,
|
|
25
|
-
cardPreview = props.cardPreview,
|
|
26
|
-
alt = props.alt,
|
|
27
|
-
resizeMode = props.resizeMode,
|
|
28
|
-
onDisplayImage = props.onDisplayImage,
|
|
29
|
-
nativeLazyLoad = props.nativeLazyLoad,
|
|
30
|
-
forceSyncDisplay = props.forceSyncDisplay,
|
|
31
|
-
_onImageLoad = props.onImageLoad,
|
|
32
|
-
_onImageError = props.onImageError;
|
|
33
|
-
var divRef = useRef(null);
|
|
34
|
-
var breakpoint = useBreakpoint(dimensions === null || dimensions === void 0 ? void 0 : dimensions.width, divRef);
|
|
35
|
-
useEffect(function () {
|
|
36
|
-
innerRef && !!divRef.current && innerRef(divRef.current);
|
|
37
|
-
}, [innerRef]);
|
|
38
|
-
var _ref = metadata || {},
|
|
39
|
-
name = _ref.name,
|
|
40
|
-
_ref$mediaType = _ref.mediaType,
|
|
41
|
-
mediaType = _ref$mediaType === void 0 ? 'unknown' : _ref$mediaType;
|
|
42
|
-
var hasTitleBox = !disableOverlay && !!name;
|
|
43
|
-
var isUploading = status === 'uploading';
|
|
44
|
-
return jsx(CardViewWrapper, _extends({}, props, {
|
|
45
|
-
breakpoint: breakpoint,
|
|
46
|
-
"data-test-status": status,
|
|
47
|
-
"data-test-progress": progress,
|
|
48
|
-
ref: divRef,
|
|
49
|
-
customBlanket: function customBlanket() {
|
|
50
|
-
return disableOverlay ? null : jsx(Blanket, {
|
|
51
|
-
isFixed: isUploading
|
|
52
|
-
});
|
|
53
|
-
},
|
|
54
|
-
progressBar: isUploading ? function () {
|
|
55
|
-
return jsx(ProgressBar, {
|
|
56
|
-
progress: progress,
|
|
57
|
-
breakpoint: breakpoint,
|
|
58
|
-
positionBottom: !hasTitleBox
|
|
59
|
-
});
|
|
60
|
-
} : undefined
|
|
61
|
-
}), jsx(ImageRenderer, {
|
|
62
|
-
cardPreview: cardPreview,
|
|
63
|
-
mediaType: mediaType,
|
|
64
|
-
alt: alt,
|
|
65
|
-
resizeMode: resizeMode,
|
|
66
|
-
onDisplayImage: onDisplayImage,
|
|
67
|
-
onImageLoad: function onImageLoad() {
|
|
68
|
-
return _onImageLoad === null || _onImageLoad === void 0 ? void 0 : _onImageLoad(cardPreview);
|
|
69
|
-
},
|
|
70
|
-
onImageError: function onImageError() {
|
|
71
|
-
return _onImageError === null || _onImageError === void 0 ? void 0 : _onImageError(cardPreview);
|
|
72
|
-
},
|
|
73
|
-
nativeLazyLoad: nativeLazyLoad,
|
|
74
|
-
forceSyncDisplay: forceSyncDisplay
|
|
75
|
-
}), cardPreview && jsx(IconWrapper, {
|
|
76
|
-
breakpoint: breakpoint,
|
|
77
|
-
hasTitleBox: hasTitleBox
|
|
78
|
-
}, jsx(PlayButton, null)));
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
// TODO: check if analytics is correct
|
|
82
|
-
|
|
83
|
-
export var VideoCardView = withAnalyticsEvents({
|
|
84
|
-
onClick: createAndFireMediaCardEvent({
|
|
85
|
-
eventType: 'ui',
|
|
86
|
-
action: 'clicked',
|
|
87
|
-
actionSubject: 'mediaCard',
|
|
88
|
-
attributes: {}
|
|
89
|
-
})
|
|
90
|
-
})(VideoCardViewBase);
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import React, { type MouseEvent, type ReactNode } from 'react';
|
|
2
|
-
import { type FileDetails } from '@atlaskit/media-client';
|
|
3
|
-
import { type UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
4
|
-
import { type CardAppearance, type CardDimensions, type MediaCardCursor, type TitleBoxIcon } from '../../types';
|
|
5
|
-
import { type CardAction } from '../actions';
|
|
6
|
-
import { type Breakpoint } from '../ui/common';
|
|
7
|
-
import { type MediaFilePreview } from '@atlaskit/media-file-preview';
|
|
8
|
-
export type SharedCardViewProps = {
|
|
9
|
-
readonly cardPreview?: MediaFilePreview;
|
|
10
|
-
readonly testId?: string;
|
|
11
|
-
readonly dimensions?: CardDimensions;
|
|
12
|
-
readonly openMediaViewerButtonRef?: React.Ref<HTMLButtonElement>;
|
|
13
|
-
readonly shouldOpenMediaViewer?: boolean;
|
|
14
|
-
readonly onClick?: (event: React.MouseEvent<HTMLDivElement | HTMLButtonElement>, analyticsEvent?: UIAnalyticsEvent) => void;
|
|
15
|
-
readonly onMouseEnter?: (event: MouseEvent<HTMLDivElement>) => void;
|
|
16
|
-
readonly appearance?: CardAppearance;
|
|
17
|
-
readonly disableOverlay?: boolean;
|
|
18
|
-
readonly actions?: Array<CardAction>;
|
|
19
|
-
readonly selectable?: boolean;
|
|
20
|
-
readonly selected?: boolean;
|
|
21
|
-
readonly metadata?: FileDetails;
|
|
22
|
-
readonly titleBoxBgColor?: string;
|
|
23
|
-
readonly titleBoxIcon?: TitleBoxIcon;
|
|
24
|
-
readonly mediaCardCursor?: MediaCardCursor;
|
|
25
|
-
readonly shouldHideTooltip?: boolean;
|
|
26
|
-
overriddenCreationDate?: number;
|
|
27
|
-
};
|
|
28
|
-
export type CardViewWrapperProps = SharedCardViewProps & {
|
|
29
|
-
children: React.ReactNode;
|
|
30
|
-
readonly breakpoint: Breakpoint;
|
|
31
|
-
customBlanket?: () => ReactNode;
|
|
32
|
-
customTitleBox?: () => ReactNode;
|
|
33
|
-
progressBar?: () => ReactNode;
|
|
34
|
-
};
|
|
35
|
-
export declare const CardViewWrapper: React.ForwardRefExoticComponent<SharedCardViewProps & {
|
|
36
|
-
children: React.ReactNode;
|
|
37
|
-
readonly breakpoint: Breakpoint;
|
|
38
|
-
customBlanket?: (() => ReactNode) | undefined;
|
|
39
|
-
customTitleBox?: (() => ReactNode) | undefined;
|
|
40
|
-
progressBar?: (() => ReactNode) | undefined;
|
|
41
|
-
} & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { type WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
|
|
3
|
-
import { type FileDetails } from '@atlaskit/media-client';
|
|
4
|
-
import { type SharedCardViewProps } from './cardViewWrapper';
|
|
5
|
-
import { type MediaCardError } from '../../errors';
|
|
6
|
-
export type ErrorCardViewProps = SharedCardViewProps & WithAnalyticsEventsProps & {
|
|
7
|
-
metadata?: FileDetails;
|
|
8
|
-
disableAnimation?: boolean;
|
|
9
|
-
readonly error?: MediaCardError;
|
|
10
|
-
};
|
|
11
|
-
export declare const ErrorCardView: import("react").ForwardRefExoticComponent<Omit<SharedCardViewProps & WithAnalyticsEventsProps & {
|
|
12
|
-
metadata?: FileDetails | undefined;
|
|
13
|
-
disableAnimation?: boolean | undefined;
|
|
14
|
-
readonly error?: MediaCardError | undefined;
|
|
15
|
-
}, keyof WithAnalyticsEventsProps> & import("react").RefAttributes<any>>;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { type WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
|
|
3
|
-
import { type FileDetails } from '@atlaskit/media-client';
|
|
4
|
-
import { type SharedCardViewProps } from './cardViewWrapper';
|
|
5
|
-
import type { CardStatus } from '../../types';
|
|
6
|
-
export type IconCardViewProps = SharedCardViewProps & WithAnalyticsEventsProps & {
|
|
7
|
-
status: CardStatus;
|
|
8
|
-
metadata?: FileDetails;
|
|
9
|
-
readonly progress?: number;
|
|
10
|
-
readonly innerRef?: (instance: HTMLDivElement | null) => void;
|
|
11
|
-
};
|
|
12
|
-
export declare const IconCardView: import("react").ForwardRefExoticComponent<Omit<SharedCardViewProps & WithAnalyticsEventsProps & {
|
|
13
|
-
status: CardStatus;
|
|
14
|
-
metadata?: FileDetails | undefined;
|
|
15
|
-
readonly progress?: number | undefined;
|
|
16
|
-
readonly innerRef?: ((instance: HTMLDivElement | null) => void) | undefined;
|
|
17
|
-
}, keyof WithAnalyticsEventsProps> & import("react").RefAttributes<any>>;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { type ImageResizeMode } from '@atlaskit/media-client';
|
|
3
|
-
import { type WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
|
|
4
|
-
import { type FileDetails } from '@atlaskit/media-client';
|
|
5
|
-
import type { CardPreview, CardStatus } from '../../types';
|
|
6
|
-
import { type SharedCardViewProps } from './cardViewWrapper';
|
|
7
|
-
export type ImageCardViewProps = SharedCardViewProps & WithAnalyticsEventsProps & {
|
|
8
|
-
status: CardStatus;
|
|
9
|
-
cardPreview: CardPreview;
|
|
10
|
-
readonly alt?: string;
|
|
11
|
-
readonly resizeMode?: ImageResizeMode;
|
|
12
|
-
readonly onDisplayImage?: () => void;
|
|
13
|
-
readonly nativeLazyLoad?: boolean;
|
|
14
|
-
readonly forceSyncDisplay?: boolean;
|
|
15
|
-
readonly onImageLoad?: (cardPreview: CardPreview) => void;
|
|
16
|
-
readonly onImageError?: (cardPreview: CardPreview) => void;
|
|
17
|
-
metadata?: FileDetails;
|
|
18
|
-
readonly innerRef?: (instance: HTMLDivElement | null) => void;
|
|
19
|
-
readonly progress?: number;
|
|
20
|
-
};
|
|
21
|
-
export declare const ImageCardView: import("react").ForwardRefExoticComponent<Omit<SharedCardViewProps & WithAnalyticsEventsProps & {
|
|
22
|
-
status: CardStatus;
|
|
23
|
-
cardPreview: CardPreview;
|
|
24
|
-
readonly alt?: string | undefined;
|
|
25
|
-
readonly resizeMode?: ImageResizeMode | undefined;
|
|
26
|
-
readonly onDisplayImage?: (() => void) | undefined;
|
|
27
|
-
readonly nativeLazyLoad?: boolean | undefined;
|
|
28
|
-
readonly forceSyncDisplay?: boolean | undefined;
|
|
29
|
-
readonly onImageLoad?: ((cardPreview: CardPreview) => void) | undefined;
|
|
30
|
-
readonly onImageError?: ((cardPreview: CardPreview) => void) | undefined;
|
|
31
|
-
metadata?: FileDetails | undefined;
|
|
32
|
-
readonly innerRef?: ((instance: HTMLDivElement | null) => void) | undefined;
|
|
33
|
-
readonly progress?: number | undefined;
|
|
34
|
-
}, keyof WithAnalyticsEventsProps> & import("react").RefAttributes<any>>;
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @jsxRuntime classic
|
|
3
|
-
* @jsx jsx
|
|
4
|
-
*/
|
|
5
|
-
import { jsx } from '@emotion/react';
|
|
6
|
-
import React, { type MouseEvent } from 'react';
|
|
7
|
-
import { type MessageDescriptor } from 'react-intl-next';
|
|
8
|
-
import { type MediaItemType, type FileDetails } from '@atlaskit/media-client';
|
|
9
|
-
import { type WithAnalyticsEventsProps, type UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
10
|
-
import { type SharedCardProps, type CardStatus, type MediaCardCursor } from '../../types';
|
|
11
|
-
import { type MediaCardError } from '../../errors';
|
|
12
|
-
import { type MediaFilePreview } from '@atlaskit/media-file-preview';
|
|
13
|
-
export interface CardViewsOwnProps extends SharedCardProps {
|
|
14
|
-
readonly status: CardStatus;
|
|
15
|
-
readonly mediaItemType: MediaItemType;
|
|
16
|
-
readonly mediaCardCursor?: MediaCardCursor;
|
|
17
|
-
readonly metadata?: FileDetails;
|
|
18
|
-
readonly error?: MediaCardError;
|
|
19
|
-
readonly onClick?: (event: React.MouseEvent<HTMLDivElement | HTMLButtonElement>, analyticsEvent?: UIAnalyticsEvent) => void;
|
|
20
|
-
readonly onMouseEnter?: (event: MouseEvent<HTMLDivElement>) => void;
|
|
21
|
-
readonly onDisplayImage?: () => void;
|
|
22
|
-
readonly cardPreview?: MediaFilePreview;
|
|
23
|
-
readonly progress?: number;
|
|
24
|
-
readonly innerRef?: (instance: HTMLDivElement | null) => void;
|
|
25
|
-
readonly onImageLoad?: (cardPreview: MediaFilePreview) => void;
|
|
26
|
-
readonly onImageError?: (cardPreview: MediaFilePreview) => void;
|
|
27
|
-
readonly nativeLazyLoad?: boolean;
|
|
28
|
-
readonly forceSyncDisplay?: boolean;
|
|
29
|
-
disableAnimation?: boolean;
|
|
30
|
-
shouldHideTooltip?: boolean;
|
|
31
|
-
readonly openMediaViewerButtonRef?: React.Ref<HTMLButtonElement>;
|
|
32
|
-
readonly shouldOpenMediaViewer?: boolean;
|
|
33
|
-
overriddenCreationDate?: number;
|
|
34
|
-
}
|
|
35
|
-
export type CardViewProps = CardViewsOwnProps & WithAnalyticsEventsProps;
|
|
36
|
-
export interface RenderConfigByStatus {
|
|
37
|
-
renderTypeIcon?: boolean;
|
|
38
|
-
iconMessage?: JSX.Element;
|
|
39
|
-
renderImageRenderer?: boolean;
|
|
40
|
-
renderPlayButton?: boolean;
|
|
41
|
-
renderTitleBox?: boolean;
|
|
42
|
-
renderBlanket?: boolean;
|
|
43
|
-
isFixedBlanket?: boolean;
|
|
44
|
-
renderProgressBar?: boolean;
|
|
45
|
-
renderSpinner?: boolean;
|
|
46
|
-
renderFailedTitleBox?: boolean;
|
|
47
|
-
renderTickBox?: boolean;
|
|
48
|
-
customTitleMessage?: MessageDescriptor;
|
|
49
|
-
}
|
|
50
|
-
export declare const CardViewsBase: ({ 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, shouldOpenMediaViewer, openMediaViewerButtonRef, overriddenCreationDate, }: CardViewProps) => jsx.JSX.Element;
|
|
51
|
-
export declare const CardViews: React.ForwardRefExoticComponent<Omit<CardViewsOwnProps & WithAnalyticsEventsProps, keyof WithAnalyticsEventsProps> & React.RefAttributes<any>>;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { type WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
|
|
3
|
-
import { type FileDetails } from '@atlaskit/media-client';
|
|
4
|
-
import { type SharedCardViewProps } from './cardViewWrapper';
|
|
5
|
-
export type LoadingCardViewProps = SharedCardViewProps & WithAnalyticsEventsProps & {
|
|
6
|
-
metadata?: FileDetails;
|
|
7
|
-
disableAnimation?: boolean;
|
|
8
|
-
readonly innerRef?: (instance: HTMLDivElement | null) => void;
|
|
9
|
-
};
|
|
10
|
-
export declare const LoadingCardView: import("react").ForwardRefExoticComponent<Omit<SharedCardViewProps & WithAnalyticsEventsProps & {
|
|
11
|
-
metadata?: FileDetails | undefined;
|
|
12
|
-
disableAnimation?: boolean | undefined;
|
|
13
|
-
readonly innerRef?: ((instance: HTMLDivElement | null) => void) | undefined;
|
|
14
|
-
}, keyof WithAnalyticsEventsProps> & import("react").RefAttributes<any>>;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { type WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
|
|
3
|
-
import { type SharedCardViewProps } from './cardViewWrapper';
|
|
4
|
-
export type ProcessingCardViewProps = SharedCardViewProps & WithAnalyticsEventsProps & {
|
|
5
|
-
disableAnimation?: boolean;
|
|
6
|
-
readonly innerRef?: (instance: HTMLDivElement | null) => void;
|
|
7
|
-
};
|
|
8
|
-
export declare const ProcessingCardView: import("react").ForwardRefExoticComponent<Omit<SharedCardViewProps & WithAnalyticsEventsProps & {
|
|
9
|
-
disableAnimation?: boolean | undefined;
|
|
10
|
-
readonly innerRef?: ((instance: HTMLDivElement | null) => void) | undefined;
|
|
11
|
-
}, keyof WithAnalyticsEventsProps> & import("react").RefAttributes<any>>;
|