@atlaskit/media-card 77.11.3 → 77.12.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 +12 -0
- package/dist/cjs/card/card.js +1 -1
- package/dist/cjs/card/cardView.js +6 -10
- package/dist/cjs/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/cjs/card/ui/styles.js +1 -12
- package/dist/cjs/card/ui/wrapper/imageContainer.js +52 -0
- package/dist/cjs/card/ui/wrapper/index.js +8 -1
- package/dist/cjs/card/v2/cardV2.js +1 -1
- package/dist/cjs/card/v2/cardViewV2.js +12 -17
- package/dist/cjs/card/v2/cardviews/cardViewWrapper.js +5 -9
- package/dist/cjs/card/v2/fileCard.js +66 -20
- package/dist/cjs/card/v2/svgView/helpers.js +16 -0
- package/dist/cjs/card/v2/svgView/index.js +12 -0
- package/dist/cjs/card/v2/svgView/svgView.js +134 -0
- package/dist/cjs/inline/loader.js +1 -1
- package/dist/cjs/utils/ufoExperiences.js +1 -1
- package/dist/es2019/card/card.js +1 -1
- package/dist/es2019/card/cardView.js +8 -12
- package/dist/es2019/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/es2019/card/ui/styles.js +0 -11
- package/dist/es2019/card/ui/wrapper/imageContainer.js +44 -0
- package/dist/es2019/card/ui/wrapper/index.js +2 -1
- package/dist/es2019/card/v2/cardV2.js +1 -1
- package/dist/es2019/card/v2/cardViewV2.js +13 -18
- package/dist/es2019/card/v2/cardviews/cardViewWrapper.js +6 -10
- package/dist/es2019/card/v2/fileCard.js +51 -8
- package/dist/es2019/card/v2/svgView/helpers.js +12 -0
- package/dist/es2019/card/v2/svgView/index.js +1 -0
- package/dist/es2019/card/v2/svgView/svgView.js +113 -0
- package/dist/es2019/inline/loader.js +1 -1
- package/dist/es2019/utils/ufoExperiences.js +1 -1
- package/dist/esm/card/card.js +1 -1
- package/dist/esm/card/cardView.js +8 -12
- package/dist/esm/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/esm/card/ui/styles.js +0 -11
- package/dist/esm/card/ui/wrapper/imageContainer.js +45 -0
- package/dist/esm/card/ui/wrapper/index.js +2 -1
- package/dist/esm/card/v2/cardV2.js +1 -1
- package/dist/esm/card/v2/cardViewV2.js +13 -18
- package/dist/esm/card/v2/cardviews/cardViewWrapper.js +6 -10
- package/dist/esm/card/v2/fileCard.js +66 -20
- package/dist/esm/card/v2/svgView/helpers.js +10 -0
- package/dist/esm/card/v2/svgView/index.js +1 -0
- package/dist/esm/card/v2/svgView/svgView.js +123 -0
- package/dist/esm/inline/loader.js +1 -1
- package/dist/esm/utils/ufoExperiences.js +1 -1
- package/dist/types/card/ui/styles.d.ts +0 -1
- package/dist/types/card/ui/wrapper/imageContainer.d.ts +15 -0
- package/dist/types/card/ui/wrapper/index.d.ts +1 -0
- package/dist/types/card/v2/svgView/helpers.d.ts +3 -0
- package/dist/types/card/v2/svgView/index.d.ts +1 -0
- package/dist/types/card/v2/svgView/svgView.d.ts +31 -0
- package/dist/types-ts4.5/card/ui/styles.d.ts +0 -1
- package/dist/types-ts4.5/card/ui/wrapper/imageContainer.d.ts +15 -0
- package/dist/types-ts4.5/card/ui/wrapper/index.d.ts +1 -0
- package/dist/types-ts4.5/card/v2/svgView/helpers.d.ts +3 -0
- package/dist/types-ts4.5/card/v2/svgView/index.d.ts +1 -0
- package/dist/types-ts4.5/card/v2/svgView/svgView.d.ts +31 -0
- package/example-helpers/svg-helpers/cardContainer.tsx +30 -0
- package/example-helpers/svg-helpers/controls.tsx +21 -0
- package/example-helpers/svg-helpers/delayApiResponses.ts +31 -0
- package/example-helpers/svg-helpers/dimensionPicker.tsx +124 -0
- package/example-helpers/svg-helpers/index.ts +7 -0
- package/example-helpers/svg-helpers/svgContainer.tsx +32 -0
- package/example-helpers/svg-helpers/toggle.tsx +43 -0
- package/example-helpers/svg-helpers/uploader.ts +44 -0
- package/package.json +11 -3
|
@@ -5,9 +5,8 @@ var _excluded = ["cardPreview", "testId", "dimensions", "appearance", "metadata"
|
|
|
5
5
|
import { jsx } from '@emotion/react';
|
|
6
6
|
import React from 'react';
|
|
7
7
|
import Tooltip from '@atlaskit/tooltip';
|
|
8
|
-
import { Wrapper } from '../../ui/wrapper';
|
|
8
|
+
import { ImageContainer, Wrapper } from '../../ui/wrapper';
|
|
9
9
|
import { attachDetailsToActions } from '../../actions';
|
|
10
|
-
import { cardImageContainerStyles } from '../../ui/styles';
|
|
11
10
|
import { TitleBox } from '../../ui/titleBox/titleBox';
|
|
12
11
|
import { TickBox } from '../../ui/tickBox/tickBox';
|
|
13
12
|
import { Blanket } from '../../ui/blanket/blanket';
|
|
@@ -54,14 +53,11 @@ export var CardViewWrapper = /*#__PURE__*/React.forwardRef(function (_ref, ref)
|
|
|
54
53
|
titleBoxIcon: titleBoxIcon,
|
|
55
54
|
titleBoxBgColor: titleBoxBgColor
|
|
56
55
|
});
|
|
57
|
-
var contents = jsx(React.Fragment, null, jsx(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
,
|
|
61
|
-
|
|
62
|
-
"data-testid": fileCardImageViewSelector,
|
|
63
|
-
"data-test-media-name": name,
|
|
64
|
-
"data-test-selected": selected ? true : undefined
|
|
56
|
+
var contents = jsx(React.Fragment, null, jsx(ImageContainer, _extends({
|
|
57
|
+
testId: fileCardImageViewSelector,
|
|
58
|
+
mediaName: name,
|
|
59
|
+
status: status,
|
|
60
|
+
selected: selected ? true : undefined
|
|
65
61
|
}, props), children, customBlanket ? customBlanket() : defaultBlanket, customTitleBox ? customTitleBox() : defaultTitleBox, !disableOverlay && !!selectable && jsx(TickBox, {
|
|
66
62
|
selected: selected
|
|
67
63
|
}), progressBar && progressBar()), !disableOverlay && actions && actions.length !== 0 && jsx(ActionsBar, {
|
|
@@ -31,6 +31,7 @@ import { useFilePreview } from '@atlaskit/media-file-preview';
|
|
|
31
31
|
import { performanceNow } from './performance';
|
|
32
32
|
import { useContext } from 'react';
|
|
33
33
|
import { DateOverrideContext } from '../../dateOverrideContext';
|
|
34
|
+
import { SvgView } from './svgView';
|
|
34
35
|
var LoadedCardView = getBooleanFF('platform.media-experience.card-views-refactor_b91lr') ? CardViews : CardViewV2;
|
|
35
36
|
export var FileCard = function FileCard(_ref) {
|
|
36
37
|
var _ref$appearance = _ref.appearance,
|
|
@@ -140,12 +141,16 @@ export var FileCard = function FileCard(_ref) {
|
|
|
140
141
|
setIsPlayingFile = _useState8[1];
|
|
141
142
|
var _useState9 = useState(false),
|
|
142
143
|
_useState10 = _slicedToArray(_useState9, 2),
|
|
143
|
-
|
|
144
|
-
|
|
144
|
+
shouldRenderSVG = _useState10[0],
|
|
145
|
+
setShouldRenderSVG = _useState10[1];
|
|
145
146
|
var _useState11 = useState(false),
|
|
146
147
|
_useState12 = _slicedToArray(_useState11, 2),
|
|
147
|
-
|
|
148
|
-
|
|
148
|
+
shouldAutoplay = _useState12[0],
|
|
149
|
+
setShouldAutoplay = _useState12[1];
|
|
150
|
+
var _useState13 = useState(false),
|
|
151
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
152
|
+
previewDidRender = _useState14[0],
|
|
153
|
+
setPreviewDidRender = _useState14[1];
|
|
149
154
|
var mediaBlobUrlAttrs = useMemo(function () {
|
|
150
155
|
var id = identifier.id,
|
|
151
156
|
collection = identifier.collectionName;
|
|
@@ -181,18 +186,18 @@ export var FileCard = function FileCard(_ref) {
|
|
|
181
186
|
onImageErrorBase = _useFilePreview.onImageError,
|
|
182
187
|
onImageLoadBase = _useFilePreview.onImageLoad,
|
|
183
188
|
getSsrScriptProps = _useFilePreview.getSsrScriptProps;
|
|
184
|
-
var
|
|
185
|
-
|
|
186
|
-
error =
|
|
187
|
-
setError =
|
|
189
|
+
var _useState15 = useState(),
|
|
190
|
+
_useState16 = _slicedToArray(_useState15, 2),
|
|
191
|
+
error = _useState16[0],
|
|
192
|
+
setError = _useState16[1];
|
|
188
193
|
|
|
189
194
|
// CXP-2723 TODO: TEMPORARY VARIABLES
|
|
190
195
|
var finalError = error || (previewError && previewError.primaryReason !== 'failed-processing' ? previewError : undefined);
|
|
191
196
|
var finalStatus = finalError ? 'error' : status;
|
|
192
|
-
var
|
|
193
|
-
|
|
194
|
-
mediaViewerSelectedItem =
|
|
195
|
-
setMediaViewerSelectedItem =
|
|
197
|
+
var _useState17 = useState(null),
|
|
198
|
+
_useState18 = _slicedToArray(_useState17, 2),
|
|
199
|
+
mediaViewerSelectedItem = _useState18[0],
|
|
200
|
+
setMediaViewerSelectedItem = _useState18[1];
|
|
196
201
|
var uploadProgressRef = useRef();
|
|
197
202
|
var metadata = useMemo(function () {
|
|
198
203
|
var getProcessingStatusFromFileState = function getProcessingStatusFromFileState(status) {
|
|
@@ -430,6 +435,23 @@ export var FileCard = function FileCard(_ref) {
|
|
|
430
435
|
}
|
|
431
436
|
}, [isCardVisible, disableOverlay, fileAttributes.fileMediatype, fileStateValue, identifier, isPlayingFile, finalStatus, useInlinePlayer]);
|
|
432
437
|
|
|
438
|
+
//----------------------------------------------------------------//
|
|
439
|
+
// Switch to SVG
|
|
440
|
+
//----------------------------------------------------------------//
|
|
441
|
+
|
|
442
|
+
useEffect(function () {
|
|
443
|
+
if (getBooleanFF('platform.media-svg-rendering') &&
|
|
444
|
+
/**
|
|
445
|
+
* We need to check that the card is visible before switching to SVG
|
|
446
|
+
* in order to avoid race conditions of the ViewportDector being unmounted before
|
|
447
|
+
* it is able to set isCardVisible to true.
|
|
448
|
+
*/
|
|
449
|
+
isCardVisible && metadata.mimeType === 'image/svg+xml' && disableOverlay // SVG won't be supported when overlay is on
|
|
450
|
+
) {
|
|
451
|
+
setShouldRenderSVG(true);
|
|
452
|
+
}
|
|
453
|
+
}, [isCardVisible, disableOverlay, metadata]);
|
|
454
|
+
|
|
433
455
|
//----------------------------------------------------------------//
|
|
434
456
|
//----------------- fireScreenEvent ------------------------------//
|
|
435
457
|
//----------------------------------------------------------------//
|
|
@@ -497,6 +519,18 @@ export var FileCard = function FileCard(_ref) {
|
|
|
497
519
|
updateFileStateRef.current();
|
|
498
520
|
}, [fileState, preview, previewStatus, updateFileStateRef]);
|
|
499
521
|
|
|
522
|
+
//----------------------------------------------------------------//
|
|
523
|
+
// Shared Card View & SVG View resources
|
|
524
|
+
//----------------------------------------------------------------//
|
|
525
|
+
|
|
526
|
+
var mediaCardCursor = getMediaCardCursor(!!useInlinePlayer, !!shouldOpenMediaViewer, finalStatus === 'error' || finalStatus === 'failed-processing', !!preview, metadata.mediaType);
|
|
527
|
+
var onImageMouseEnter = function onImageMouseEnter(event) {
|
|
528
|
+
onMouseEnter === null || onMouseEnter === void 0 || onMouseEnter({
|
|
529
|
+
event: event,
|
|
530
|
+
mediaItemDetails: metadata
|
|
531
|
+
});
|
|
532
|
+
};
|
|
533
|
+
|
|
500
534
|
//----------------------------------------------------------------//
|
|
501
535
|
//---------------------- Render Card Function --------------------//
|
|
502
536
|
//----------------------------------------------------------------//
|
|
@@ -516,7 +550,6 @@ export var FileCard = function FileCard(_ref) {
|
|
|
516
550
|
var nativeLazyLoad = isLazyWithOverride && !isCardVisible && preview && isSSRPreview(preview);
|
|
517
551
|
// Force Media Image to always display img for SSR
|
|
518
552
|
var forceSyncDisplay = !!ssr;
|
|
519
|
-
var mediaCardCursor = getMediaCardCursor(!!useInlinePlayer, !!shouldOpenMediaViewer, finalStatus === 'error' || finalStatus === 'failed-processing', !!preview, metadata.mediaType);
|
|
520
553
|
var card = /*#__PURE__*/React.createElement(LoadedCardView, {
|
|
521
554
|
status: cardStatusOverride || finalStatus,
|
|
522
555
|
error: finalError,
|
|
@@ -532,12 +565,7 @@ export var FileCard = function FileCard(_ref) {
|
|
|
532
565
|
shouldOpenMediaViewer: shouldOpenMediaViewer,
|
|
533
566
|
openMediaViewerButtonRef: mediaViewerButtonRef,
|
|
534
567
|
onClick: withCallbacks ? onCardViewClick : undefined,
|
|
535
|
-
onMouseEnter: withCallbacks ?
|
|
536
|
-
onMouseEnter === null || onMouseEnter === void 0 || onMouseEnter({
|
|
537
|
-
event: event,
|
|
538
|
-
mediaItemDetails: metadata
|
|
539
|
-
});
|
|
540
|
-
} : undefined,
|
|
568
|
+
onMouseEnter: withCallbacks ? onImageMouseEnter : undefined,
|
|
541
569
|
disableOverlay: disableOverlay,
|
|
542
570
|
progress: uploadProgressRef.current,
|
|
543
571
|
onDisplayImage: withCallbacks ? function () {
|
|
@@ -594,7 +622,25 @@ export var FileCard = function FileCard(_ref) {
|
|
|
594
622
|
testId: testId,
|
|
595
623
|
cardPreview: preview,
|
|
596
624
|
videoControlsWrapperRef: videoControlsWrapperRef
|
|
597
|
-
})) :
|
|
625
|
+
})) : shouldRenderSVG ? /*#__PURE__*/React.createElement(SvgView, {
|
|
626
|
+
testId: testId,
|
|
627
|
+
identifier: identifier,
|
|
628
|
+
status: finalStatus,
|
|
629
|
+
fileName: metadata.name,
|
|
630
|
+
cardPreview: preview,
|
|
631
|
+
alt: alt,
|
|
632
|
+
resizeMode: resizeMode,
|
|
633
|
+
dimensions: cardDimensions,
|
|
634
|
+
selected: selected,
|
|
635
|
+
onClick: onCardViewClick,
|
|
636
|
+
onMouseEnter: onImageMouseEnter,
|
|
637
|
+
progress: uploadProgressRef.current,
|
|
638
|
+
onImageError: onImageError,
|
|
639
|
+
onImageLoad: onImageLoad,
|
|
640
|
+
mediaCardCursor: mediaCardCursor,
|
|
641
|
+
shouldOpenMediaViewer: shouldOpenMediaViewer,
|
|
642
|
+
openMediaViewerButtonRef: mediaViewerButtonRef
|
|
643
|
+
}) : renderCard(), mediaViewerSelectedItem ? /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/React.createElement(MediaViewer, {
|
|
598
644
|
collectionName: collectionName,
|
|
599
645
|
items: mediaViewerItems || [],
|
|
600
646
|
mediaClientConfig: mediaClient.config,
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export var calculateSvgDimensions = function calculateSvgDimensions(img, resizeMode) {
|
|
2
|
+
var naturalWidth = img.naturalWidth,
|
|
3
|
+
naturalHeight = img.naturalHeight;
|
|
4
|
+
var isLadscape = naturalWidth / naturalHeight > 1;
|
|
5
|
+
return resizeMode === 'crop' ? isLadscape ? {
|
|
6
|
+
height: '100%'
|
|
7
|
+
} : {
|
|
8
|
+
width: '100%'
|
|
9
|
+
} : {};
|
|
10
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SvgView } from './svgView';
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
/** @jsx jsx */
|
|
3
|
+
import { jsx } from '@emotion/react';
|
|
4
|
+
import React, { useState, useRef } from 'react';
|
|
5
|
+
import { withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
6
|
+
import { createAndFireMediaCardEvent } from '../../../utils/analytics';
|
|
7
|
+
import { ImageRenderer } from '../../ui/imageRenderer/imageRenderer';
|
|
8
|
+
import { ProgressBar } from '../../ui/progressBar/progressBar';
|
|
9
|
+
import { Blanket } from '../../ui/blanket/blanket';
|
|
10
|
+
import { Wrapper, ImageContainer } from '../../ui/wrapper';
|
|
11
|
+
import { fileCardImageViewSelector } from '../../classnames';
|
|
12
|
+
import { useBreakpoint } from '../../useBreakpoint';
|
|
13
|
+
import MediaSvg from '@atlaskit/media-svg';
|
|
14
|
+
import { calculateSvgDimensions } from './helpers';
|
|
15
|
+
import OpenMediaViewerButton from '../../ui/openMediaViewerButton/openMediaViewerButton';
|
|
16
|
+
export var convertResizeMode = function convertResizeMode(resizeMode) {
|
|
17
|
+
switch (resizeMode) {
|
|
18
|
+
case 'crop':
|
|
19
|
+
return 'cover';
|
|
20
|
+
case 'fit':
|
|
21
|
+
case 'full-fit':
|
|
22
|
+
return 'scale-down';
|
|
23
|
+
case 'stretchy-fit':
|
|
24
|
+
return 'contain';
|
|
25
|
+
default:
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
export var SvgViewBase = function SvgViewBase(_ref) {
|
|
30
|
+
var identifier = _ref.identifier,
|
|
31
|
+
dimensions = _ref.dimensions,
|
|
32
|
+
onClick = _ref.onClick,
|
|
33
|
+
onMouseEnter = _ref.onMouseEnter,
|
|
34
|
+
testId = _ref.testId,
|
|
35
|
+
status = _ref.status,
|
|
36
|
+
selected = _ref.selected,
|
|
37
|
+
fileName = _ref.fileName,
|
|
38
|
+
cardPreview = _ref.cardPreview,
|
|
39
|
+
mediaCardCursor = _ref.mediaCardCursor,
|
|
40
|
+
progress = _ref.progress,
|
|
41
|
+
alt = _ref.alt,
|
|
42
|
+
resizeMode = _ref.resizeMode,
|
|
43
|
+
shouldOpenMediaViewer = _ref.shouldOpenMediaViewer,
|
|
44
|
+
_ref$openMediaViewerB = _ref.openMediaViewerButtonRef,
|
|
45
|
+
openMediaViewerButtonRef = _ref$openMediaViewerB === void 0 ? null : _ref$openMediaViewerB;
|
|
46
|
+
var _useState = useState(false),
|
|
47
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
48
|
+
didSvgRender = _useState2[0],
|
|
49
|
+
setDidSvgRender = _useState2[1];
|
|
50
|
+
var _useState3 = useState(false),
|
|
51
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
52
|
+
didPreviewRender = _useState4[0],
|
|
53
|
+
setDidPreviewRender = _useState4[1];
|
|
54
|
+
var _useState5 = useState(),
|
|
55
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
56
|
+
svgDimensions = _useState6[0],
|
|
57
|
+
setSvgDimensions = _useState6[1];
|
|
58
|
+
var divRef = useRef(null);
|
|
59
|
+
var breakpoint = useBreakpoint(dimensions === null || dimensions === void 0 ? void 0 : dimensions.width, divRef);
|
|
60
|
+
var onSvgLoad = function onSvgLoad(evt) {
|
|
61
|
+
setSvgDimensions(calculateSvgDimensions(evt.currentTarget, resizeMode));
|
|
62
|
+
setDidSvgRender(true);
|
|
63
|
+
};
|
|
64
|
+
var onPreviewLoad = function onPreviewLoad() {
|
|
65
|
+
setDidPreviewRender(true);
|
|
66
|
+
};
|
|
67
|
+
return jsx(React.Fragment, null, shouldOpenMediaViewer && jsx(OpenMediaViewerButton, {
|
|
68
|
+
fileName: fileName !== null && fileName !== void 0 ? fileName : '',
|
|
69
|
+
innerRef: openMediaViewerButtonRef,
|
|
70
|
+
onClick: onClick
|
|
71
|
+
}), jsx(Wrapper, {
|
|
72
|
+
testId: testId || 'media-card-svg-wrapper',
|
|
73
|
+
dimensions: dimensions,
|
|
74
|
+
onClick: onClick,
|
|
75
|
+
onMouseEnter: onMouseEnter,
|
|
76
|
+
innerRef: divRef,
|
|
77
|
+
mediaCardCursor: mediaCardCursor,
|
|
78
|
+
selected: !!selected,
|
|
79
|
+
breakpoint: breakpoint,
|
|
80
|
+
disableOverlay: true,
|
|
81
|
+
displayBackground: !didSvgRender && !didPreviewRender,
|
|
82
|
+
isTickBoxSelectable: false,
|
|
83
|
+
shouldDisplayTooltip: false,
|
|
84
|
+
isPlayButtonClickable: false
|
|
85
|
+
}, jsx(ImageContainer, {
|
|
86
|
+
centerElements: true,
|
|
87
|
+
testId: fileCardImageViewSelector,
|
|
88
|
+
mediaName: fileName,
|
|
89
|
+
status: status,
|
|
90
|
+
progress: progress,
|
|
91
|
+
selected: selected,
|
|
92
|
+
source: cardPreview === null || cardPreview === void 0 ? void 0 : cardPreview.source
|
|
93
|
+
}, jsx(MediaSvg, {
|
|
94
|
+
testId: "media-card-svg",
|
|
95
|
+
identifier: identifier,
|
|
96
|
+
dimensions: svgDimensions,
|
|
97
|
+
onLoad: onSvgLoad,
|
|
98
|
+
style: {
|
|
99
|
+
visibility: didSvgRender ? 'visible' : 'hidden',
|
|
100
|
+
objectFit: convertResizeMode(resizeMode)
|
|
101
|
+
}
|
|
102
|
+
}), !!cardPreview && !didSvgRender && jsx(ImageRenderer, {
|
|
103
|
+
cardPreview: cardPreview,
|
|
104
|
+
onImageLoad: onPreviewLoad,
|
|
105
|
+
mediaType: 'image',
|
|
106
|
+
alt: alt,
|
|
107
|
+
resizeMode: resizeMode
|
|
108
|
+
}), status === 'uploading' && jsx(Blanket, {
|
|
109
|
+
isFixed: true
|
|
110
|
+
}), status === 'uploading' && jsx(ProgressBar, {
|
|
111
|
+
progress: progress,
|
|
112
|
+
breakpoint: breakpoint,
|
|
113
|
+
positionBottom: true
|
|
114
|
+
}))));
|
|
115
|
+
};
|
|
116
|
+
export var SvgView = withAnalyticsEvents({
|
|
117
|
+
onClick: createAndFireMediaCardEvent({
|
|
118
|
+
eventType: 'ui',
|
|
119
|
+
action: 'clicked',
|
|
120
|
+
actionSubject: 'mediaCard',
|
|
121
|
+
attributes: {}
|
|
122
|
+
})
|
|
123
|
+
})(SvgViewBase);
|
|
@@ -103,7 +103,7 @@ var MediaInlineCardLoader = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
103
103
|
ErrorBoundary = _this$state.ErrorBoundary;
|
|
104
104
|
var analyticsContext = {
|
|
105
105
|
packageVersion: "@atlaskit/media-card",
|
|
106
|
-
packageName: "77.
|
|
106
|
+
packageName: "77.12.0",
|
|
107
107
|
componentName: 'mediaInlineCard',
|
|
108
108
|
component: 'mediaInlineCard'
|
|
109
109
|
};
|
|
@@ -7,7 +7,7 @@ import { extractErrorInfo, getRenderErrorRequestMetadata } from './analytics';
|
|
|
7
7
|
import { MediaCardError } from '../errors';
|
|
8
8
|
import { getMediaEnvironment, getMediaRegion } from '@atlaskit/media-client';
|
|
9
9
|
var packageName = "@atlaskit/media-card";
|
|
10
|
-
var packageVersion = "77.
|
|
10
|
+
var packageVersion = "77.12.0";
|
|
11
11
|
var concurrentExperience;
|
|
12
12
|
var getExperience = function getExperience(id) {
|
|
13
13
|
if (!concurrentExperience) {
|
|
@@ -8,6 +8,5 @@ export declare const getWrapperShadow: (disableOverlay: boolean, selected: boole
|
|
|
8
8
|
export declare const getCursorStyle: (cursor: MediaCardCursor | undefined) => string;
|
|
9
9
|
export declare const getClickablePlayButtonStyles: (isPlayButtonClickable: boolean) => "" | "\n &:hover .media-card-play-button {\n \n .play-icon-background {\n width: 56px;\n height: 56px;\n }\n\n }\n ";
|
|
10
10
|
export declare const getSelectableTickBoxStyles: (isTickBoxSelectable: boolean) => string;
|
|
11
|
-
export declare const cardImageContainerStyles: import("@emotion/react").SerializedStyles;
|
|
12
11
|
export declare const transition: (propertyName?: string) => string;
|
|
13
12
|
export declare const rgba: (hex: any, opacity: any) => string;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
/** @jsx jsx */
|
|
3
|
+
import { jsx } from '@emotion/react';
|
|
4
|
+
type ImageContainerProps = {
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
centerElements?: boolean;
|
|
7
|
+
testId: string;
|
|
8
|
+
mediaName?: string;
|
|
9
|
+
status?: string;
|
|
10
|
+
progress?: number;
|
|
11
|
+
selected?: boolean;
|
|
12
|
+
source?: string;
|
|
13
|
+
};
|
|
14
|
+
export declare const ImageContainer: ({ children, testId, mediaName, status, progress, selected, source, centerElements, }: ImageContainerProps) => jsx.JSX.Element;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SvgView } from './svgView';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { jsx } from '@emotion/react';
|
|
3
|
+
import React, { type MouseEvent } from 'react';
|
|
4
|
+
import { type FileIdentifier, type ImageResizeMode } from '@atlaskit/media-client';
|
|
5
|
+
import { type WithAnalyticsEventsProps, type UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
6
|
+
import { type CardStatus, type MediaCardCursor, type CardDimensions } from '../../../types';
|
|
7
|
+
import { type MediaFilePreview } from '@atlaskit/media-file-preview';
|
|
8
|
+
export declare const convertResizeMode: (resizeMode?: ImageResizeMode) => React.CSSProperties['objectFit'];
|
|
9
|
+
export type OnClickFn = (event: React.MouseEvent<HTMLDivElement | HTMLButtonElement>, analyticsEvent?: UIAnalyticsEvent) => void;
|
|
10
|
+
export interface SvgViewBaseOwnProps {
|
|
11
|
+
readonly testId?: string;
|
|
12
|
+
identifier: FileIdentifier;
|
|
13
|
+
readonly status: CardStatus;
|
|
14
|
+
readonly dimensions: CardDimensions;
|
|
15
|
+
readonly onClick?: OnClickFn;
|
|
16
|
+
readonly onMouseEnter?: (event: MouseEvent<HTMLDivElement>) => void;
|
|
17
|
+
readonly selected?: boolean;
|
|
18
|
+
readonly fileName?: string;
|
|
19
|
+
readonly cardPreview?: MediaFilePreview;
|
|
20
|
+
readonly mediaCardCursor?: MediaCardCursor;
|
|
21
|
+
readonly progress?: number;
|
|
22
|
+
readonly alt?: string;
|
|
23
|
+
readonly resizeMode?: ImageResizeMode;
|
|
24
|
+
readonly onImageLoad?: (cardPreview: MediaFilePreview) => void;
|
|
25
|
+
readonly onImageError?: (cardPreview: MediaFilePreview) => void;
|
|
26
|
+
readonly shouldOpenMediaViewer?: boolean;
|
|
27
|
+
readonly openMediaViewerButtonRef?: React.Ref<HTMLButtonElement>;
|
|
28
|
+
}
|
|
29
|
+
export type SvgViewProps = SvgViewBaseOwnProps & WithAnalyticsEventsProps;
|
|
30
|
+
export declare const SvgViewBase: ({ identifier, dimensions, onClick, onMouseEnter, testId, status, selected, fileName, cardPreview, mediaCardCursor, progress, alt, resizeMode, shouldOpenMediaViewer, openMediaViewerButtonRef, }: SvgViewProps) => jsx.JSX.Element;
|
|
31
|
+
export declare const SvgView: React.ForwardRefExoticComponent<Omit<SvgViewBaseOwnProps & WithAnalyticsEventsProps, keyof WithAnalyticsEventsProps> & React.RefAttributes<any>>;
|
|
@@ -8,6 +8,5 @@ export declare const getWrapperShadow: (disableOverlay: boolean, selected: boole
|
|
|
8
8
|
export declare const getCursorStyle: (cursor: MediaCardCursor | undefined) => string;
|
|
9
9
|
export declare const getClickablePlayButtonStyles: (isPlayButtonClickable: boolean) => "" | "\n &:hover .media-card-play-button {\n \n .play-icon-background {\n width: 56px;\n height: 56px;\n }\n\n }\n ";
|
|
10
10
|
export declare const getSelectableTickBoxStyles: (isTickBoxSelectable: boolean) => string;
|
|
11
|
-
export declare const cardImageContainerStyles: import("@emotion/react").SerializedStyles;
|
|
12
11
|
export declare const transition: (propertyName?: string) => string;
|
|
13
12
|
export declare const rgba: (hex: any, opacity: any) => string;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
/** @jsx jsx */
|
|
3
|
+
import { jsx } from '@emotion/react';
|
|
4
|
+
type ImageContainerProps = {
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
centerElements?: boolean;
|
|
7
|
+
testId: string;
|
|
8
|
+
mediaName?: string;
|
|
9
|
+
status?: string;
|
|
10
|
+
progress?: number;
|
|
11
|
+
selected?: boolean;
|
|
12
|
+
source?: string;
|
|
13
|
+
};
|
|
14
|
+
export declare const ImageContainer: ({ children, testId, mediaName, status, progress, selected, source, centerElements, }: ImageContainerProps) => jsx.JSX.Element;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SvgView } from './svgView';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { jsx } from '@emotion/react';
|
|
3
|
+
import React, { type MouseEvent } from 'react';
|
|
4
|
+
import { type FileIdentifier, type ImageResizeMode } from '@atlaskit/media-client';
|
|
5
|
+
import { type WithAnalyticsEventsProps, type UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
6
|
+
import { type CardStatus, type MediaCardCursor, type CardDimensions } from '../../../types';
|
|
7
|
+
import { type MediaFilePreview } from '@atlaskit/media-file-preview';
|
|
8
|
+
export declare const convertResizeMode: (resizeMode?: ImageResizeMode) => React.CSSProperties['objectFit'];
|
|
9
|
+
export type OnClickFn = (event: React.MouseEvent<HTMLDivElement | HTMLButtonElement>, analyticsEvent?: UIAnalyticsEvent) => void;
|
|
10
|
+
export interface SvgViewBaseOwnProps {
|
|
11
|
+
readonly testId?: string;
|
|
12
|
+
identifier: FileIdentifier;
|
|
13
|
+
readonly status: CardStatus;
|
|
14
|
+
readonly dimensions: CardDimensions;
|
|
15
|
+
readonly onClick?: OnClickFn;
|
|
16
|
+
readonly onMouseEnter?: (event: MouseEvent<HTMLDivElement>) => void;
|
|
17
|
+
readonly selected?: boolean;
|
|
18
|
+
readonly fileName?: string;
|
|
19
|
+
readonly cardPreview?: MediaFilePreview;
|
|
20
|
+
readonly mediaCardCursor?: MediaCardCursor;
|
|
21
|
+
readonly progress?: number;
|
|
22
|
+
readonly alt?: string;
|
|
23
|
+
readonly resizeMode?: ImageResizeMode;
|
|
24
|
+
readonly onImageLoad?: (cardPreview: MediaFilePreview) => void;
|
|
25
|
+
readonly onImageError?: (cardPreview: MediaFilePreview) => void;
|
|
26
|
+
readonly shouldOpenMediaViewer?: boolean;
|
|
27
|
+
readonly openMediaViewerButtonRef?: React.Ref<HTMLButtonElement>;
|
|
28
|
+
}
|
|
29
|
+
export type SvgViewProps = SvgViewBaseOwnProps & WithAnalyticsEventsProps;
|
|
30
|
+
export declare const SvgViewBase: ({ identifier, dimensions, onClick, onMouseEnter, testId, status, selected, fileName, cardPreview, mediaCardCursor, progress, alt, resizeMode, shouldOpenMediaViewer, openMediaViewerButtonRef, }: SvgViewProps) => jsx.JSX.Element;
|
|
31
|
+
export declare const SvgView: React.ForwardRefExoticComponent<Omit<SvgViewBaseOwnProps & WithAnalyticsEventsProps, keyof WithAnalyticsEventsProps> & React.RefAttributes<any>>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
import { jsx } from '@emotion/react';
|
|
5
|
+
|
|
6
|
+
export const CardBox = ({
|
|
7
|
+
title,
|
|
8
|
+
children,
|
|
9
|
+
}: {
|
|
10
|
+
title: string;
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
}) => (
|
|
13
|
+
<div style={{ marginBottom: '10px' }}>
|
|
14
|
+
<h3 style={{ textAlign: 'center' }}>{title}</h3>
|
|
15
|
+
{children}
|
|
16
|
+
</div>
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
export const CardRow = ({ children }: { children: React.ReactNode }) => (
|
|
20
|
+
<div
|
|
21
|
+
style={{
|
|
22
|
+
display: 'flex',
|
|
23
|
+
flexWrap: 'wrap',
|
|
24
|
+
gap: '10px',
|
|
25
|
+
marginBottom: '10px',
|
|
26
|
+
}}
|
|
27
|
+
>
|
|
28
|
+
{children}
|
|
29
|
+
</div>
|
|
30
|
+
);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React, { type ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
import { Box, xcss } from '@atlaskit/primitives';
|
|
4
|
+
import { media } from '@atlaskit/primitives/responsive';
|
|
5
|
+
|
|
6
|
+
const controlsBoxStyles = xcss({
|
|
7
|
+
maxWidth: '1500px',
|
|
8
|
+
width: '90%',
|
|
9
|
+
margin: 'auto',
|
|
10
|
+
padding: 'space.100',
|
|
11
|
+
[media.above.sm]: {
|
|
12
|
+
width: '70%',
|
|
13
|
+
},
|
|
14
|
+
[media.above.lg]: {
|
|
15
|
+
width: '50%',
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export const ControlsBox = ({ children }: { children: ReactNode }) => (
|
|
20
|
+
<Box xcss={controlsBoxStyles}>{children}</Box>
|
|
21
|
+
);
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type MediaApi } from '@atlaskit/media-client';
|
|
2
|
+
import { sleep } from '@atlaskit/media-test-helpers';
|
|
3
|
+
|
|
4
|
+
type Endpoints = {
|
|
5
|
+
getImage: number;
|
|
6
|
+
getItems: number;
|
|
7
|
+
getFileBinary: number;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export const delayApiResponses = (
|
|
11
|
+
mediaApi: MediaApi,
|
|
12
|
+
{ getImage, getItems, getFileBinary }: Endpoints,
|
|
13
|
+
) => {
|
|
14
|
+
const baseGetImage = mediaApi.getImage;
|
|
15
|
+
mediaApi.getImage = async (...params) => {
|
|
16
|
+
await sleep(getImage);
|
|
17
|
+
return baseGetImage(...params);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const baseGetItems = mediaApi.getItems;
|
|
21
|
+
mediaApi.getItems = async (...params) => {
|
|
22
|
+
await sleep(getItems);
|
|
23
|
+
return baseGetItems(...params);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const baseGetFileBinary = mediaApi.getFileBinary;
|
|
27
|
+
mediaApi.getFileBinary = async (...params) => {
|
|
28
|
+
await sleep(getFileBinary);
|
|
29
|
+
return baseGetFileBinary(...params);
|
|
30
|
+
};
|
|
31
|
+
};
|