@atlaskit/media-card 78.0.2 → 78.0.3
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 +8 -0
- package/dist/cjs/card/card.js +1 -1
- package/dist/cjs/card/fileCard.js +8 -7
- package/dist/cjs/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/cjs/card/svgView/helpers.js +48 -9
- package/dist/cjs/card/svgView/svgView.js +26 -28
- package/dist/cjs/card/ui/actionsBar/cardActions/styles.js +1 -1
- package/dist/cjs/card/ui/playButton/styles.js +2 -2
- package/dist/cjs/card/ui/titleBox/styles.js +2 -2
- package/dist/cjs/inline/loader.js +1 -1
- package/dist/cjs/utils/lightCards/errorIcon/styles.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 +9 -8
- package/dist/es2019/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/es2019/card/svgView/helpers.js +49 -9
- package/dist/es2019/card/svgView/svgView.js +23 -23
- package/dist/es2019/card/ui/actionsBar/cardActions/styles.js +1 -1
- package/dist/es2019/card/ui/playButton/styles.js +2 -2
- package/dist/es2019/card/ui/titleBox/styles.js +2 -2
- package/dist/es2019/inline/loader.js +1 -1
- package/dist/es2019/utils/lightCards/errorIcon/styles.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 +9 -8
- package/dist/esm/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/esm/card/svgView/helpers.js +48 -9
- package/dist/esm/card/svgView/svgView.js +26 -25
- package/dist/esm/card/ui/actionsBar/cardActions/styles.js +1 -1
- package/dist/esm/card/ui/playButton/styles.js +2 -2
- package/dist/esm/card/ui/titleBox/styles.js +2 -2
- package/dist/esm/inline/loader.js +1 -1
- package/dist/esm/utils/lightCards/errorIcon/styles.js +1 -1
- package/dist/esm/utils/ufoExperiences.js +1 -1
- package/dist/types/card/svgView/helpers.d.ts +1 -2
- package/dist/types/card/svgView/svgView.d.ts +4 -5
- package/dist/types-ts4.5/card/svgView/helpers.d.ts +1 -2
- package/dist/types-ts4.5/card/svgView/svgView.d.ts +4 -5
- package/example-helpers/cardViewWrapper.tsx +2 -0
- package/example-helpers/styles.ts +16 -16
- package/example-helpers/svg-helpers/svgContainer.tsx +3 -3
- package/package.json +1 -1
|
@@ -5,7 +5,7 @@ import { extractErrorInfo, getRenderErrorRequestMetadata } from './analytics';
|
|
|
5
5
|
import { MediaCardError } from '../errors';
|
|
6
6
|
import { getMediaEnvironment, getMediaRegion } from '@atlaskit/media-client';
|
|
7
7
|
const packageName = "@atlaskit/media-card";
|
|
8
|
-
const packageVersion = "78.0.
|
|
8
|
+
const packageVersion = "78.0.3";
|
|
9
9
|
let concurrentExperience;
|
|
10
10
|
const getExperience = id => {
|
|
11
11
|
if (!concurrentExperience) {
|
package/dist/esm/card/card.js
CHANGED
|
@@ -9,7 +9,7 @@ import { IntlProvider, injectIntl } from 'react-intl-next';
|
|
|
9
9
|
import { ExternalImageCard } from './externalImageCard';
|
|
10
10
|
import { FileCard } from './fileCard';
|
|
11
11
|
var packageName = "@atlaskit/media-card";
|
|
12
|
-
var packageVersion = "78.0.
|
|
12
|
+
var packageVersion = "78.0.3";
|
|
13
13
|
export var CardBase = function CardBase(_ref) {
|
|
14
14
|
var identifier = _ref.identifier,
|
|
15
15
|
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
@@ -3,7 +3,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
3
3
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
4
4
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
5
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
|
-
import {
|
|
6
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
7
|
import DownloadIcon from '@atlaskit/icon/glyph/download';
|
|
8
8
|
import { globalMediaEventEmitter, RECENTS_COLLECTION, imageResizeModeToFileImageMode, isProcessedFileState } from '@atlaskit/media-client';
|
|
9
9
|
import { MediaFileStateError, useFileState, useMediaClient } from '@atlaskit/media-client-react';
|
|
@@ -32,7 +32,7 @@ import { performanceNow } from './performance';
|
|
|
32
32
|
import { useContext } from 'react';
|
|
33
33
|
import { DateOverrideContext } from '../dateOverrideContext';
|
|
34
34
|
import { SvgView } from './svgView';
|
|
35
|
-
var LoadedCardView =
|
|
35
|
+
var LoadedCardView = fg('platform.media-experience.card-views-refactor_b91lr') ? CardViews : CardView;
|
|
36
36
|
export var FileCard = function FileCard(_ref) {
|
|
37
37
|
var _ref$appearance = _ref.appearance,
|
|
38
38
|
appearance = _ref$appearance === void 0 ? 'auto' : _ref$appearance,
|
|
@@ -318,7 +318,7 @@ export var FileCard = function FileCard(_ref) {
|
|
|
318
318
|
setShouldRenderSVG(false);
|
|
319
319
|
};
|
|
320
320
|
var onImageError = function onImageError(newCardPreview) {
|
|
321
|
-
if (
|
|
321
|
+
if (metadata.mimeType === 'image/svg+xml' && fg('platform.media-card-svg-rendering_6tdbv')) {
|
|
322
322
|
return;
|
|
323
323
|
}
|
|
324
324
|
onImageErrorBase(newCardPreview);
|
|
@@ -327,7 +327,7 @@ export var FileCard = function FileCard(_ref) {
|
|
|
327
327
|
setPreviewDidRender(true);
|
|
328
328
|
};
|
|
329
329
|
var onImageLoad = function onImageLoad(newCardPreview) {
|
|
330
|
-
if (
|
|
330
|
+
if (metadata.mimeType === 'image/svg+xml' && fg('platform.media-card-svg-rendering_6tdbv')) {
|
|
331
331
|
return;
|
|
332
332
|
}
|
|
333
333
|
onImageLoadBase(newCardPreview);
|
|
@@ -454,14 +454,15 @@ export var FileCard = function FileCard(_ref) {
|
|
|
454
454
|
//----------------------------------------------------------------//
|
|
455
455
|
|
|
456
456
|
useEffect(function () {
|
|
457
|
-
if (
|
|
457
|
+
if (finalStatus !== 'error' &&
|
|
458
458
|
/**
|
|
459
459
|
* We need to check that the card is visible before switching to SVG
|
|
460
460
|
* in order to avoid race conditions of the ViewportDector being unmounted before
|
|
461
461
|
* it is able to set isCardVisible to true.
|
|
462
462
|
*/
|
|
463
|
-
isCardVisible && metadata.mimeType === 'image/svg+xml' && disableOverlay
|
|
464
|
-
|
|
463
|
+
isCardVisible && metadata.mimeType === 'image/svg+xml' && disableOverlay &&
|
|
464
|
+
// SVG won't be supported when overlay is on
|
|
465
|
+
fg('platform.media-card-svg-rendering_6tdbv')) {
|
|
465
466
|
setShouldRenderSVG(true);
|
|
466
467
|
}
|
|
467
468
|
}, [isCardVisible, disableOverlay, metadata.mimeType, finalStatus]);
|
|
@@ -644,7 +645,7 @@ export var FileCard = function FileCard(_ref) {
|
|
|
644
645
|
cardPreview: preview,
|
|
645
646
|
alt: alt,
|
|
646
647
|
resizeMode: resizeMode,
|
|
647
|
-
|
|
648
|
+
cardDimensions: cardDimensions,
|
|
648
649
|
selected: selected,
|
|
649
650
|
onClick: onCardViewClick,
|
|
650
651
|
onMouseEnter: onImageMouseEnter,
|
|
@@ -83,7 +83,7 @@ var WrappedMediaCardAnalyticsErrorBoundary = /*#__PURE__*/function (_React$Compo
|
|
|
83
83
|
}(React.Component);
|
|
84
84
|
_defineProperty(WrappedMediaCardAnalyticsErrorBoundary, "displayName", 'MediaCardAnalyticsErrorBoundary');
|
|
85
85
|
var packageName = "@atlaskit/media-card";
|
|
86
|
-
var packageVersion = "78.0.
|
|
86
|
+
var packageVersion = "78.0.3";
|
|
87
87
|
var MediaCardAnalyticsErrorBoundary = withMediaAnalyticsContext({
|
|
88
88
|
packageVersion: packageVersion,
|
|
89
89
|
packageName: packageName,
|
|
@@ -1,10 +1,49 @@
|
|
|
1
|
-
export var calculateSvgDimensions = function calculateSvgDimensions(
|
|
2
|
-
var naturalWidth =
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
export var calculateSvgDimensions = function calculateSvgDimensions(imgElement, parentElement, resizeMode) {
|
|
2
|
+
var naturalWidth = imgElement.naturalWidth,
|
|
3
|
+
width = imgElement.width,
|
|
4
|
+
naturalHeight = imgElement.naturalHeight,
|
|
5
|
+
height = imgElement.height;
|
|
6
|
+
// Firefox & Safari can't always read the "natural" dimensions correctly.
|
|
7
|
+
// When these are undefined or zero, we replace them with the rendered values
|
|
8
|
+
var imgWidth = naturalWidth || width;
|
|
9
|
+
var imgHeight = naturalHeight || height;
|
|
10
|
+
var _parentElement$getBou = parentElement.getBoundingClientRect(),
|
|
11
|
+
parentWidth = _parentElement$getBou.width,
|
|
12
|
+
parentHeight = _parentElement$getBou.height;
|
|
13
|
+
if (resizeMode === 'fit' || resizeMode === 'full-fit') {
|
|
14
|
+
return {
|
|
15
|
+
maxWidth: "min(100%, ".concat(imgWidth, "px"),
|
|
16
|
+
maxHeight: "min(100%, ".concat(imgHeight, "px")
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
var imgRatio = imgWidth / imgHeight;
|
|
20
|
+
var cardRatio = parentWidth / parentHeight;
|
|
21
|
+
var isImageLandscapier = imgRatio > cardRatio;
|
|
22
|
+
if (resizeMode === 'stretchy-fit') {
|
|
23
|
+
if (isImageLandscapier) {
|
|
24
|
+
return {
|
|
25
|
+
width: '100%',
|
|
26
|
+
maxHeight: '100%'
|
|
27
|
+
};
|
|
28
|
+
} else {
|
|
29
|
+
return {
|
|
30
|
+
height: '100%',
|
|
31
|
+
maxWidth: '100%'
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
if (resizeMode === 'crop') {
|
|
36
|
+
if (isImageLandscapier) {
|
|
37
|
+
return {
|
|
38
|
+
height: imgHeight,
|
|
39
|
+
maxHeight: '100%'
|
|
40
|
+
};
|
|
41
|
+
} else {
|
|
42
|
+
return {
|
|
43
|
+
width: imgWidth,
|
|
44
|
+
maxWidth: '100%'
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return {};
|
|
10
49
|
};
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
1
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
2
5
|
/** @jsx jsx */
|
|
3
6
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
4
7
|
import { jsx } from '@emotion/react';
|
|
5
|
-
import React, { useState, useRef } from 'react';
|
|
8
|
+
import React, { useState, useRef, useEffect, useCallback } from 'react';
|
|
6
9
|
import { withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
7
10
|
import { createAndFireMediaCardEvent } from '../../utils/analytics';
|
|
8
11
|
import { ImageRenderer } from '../ui/imageRenderer/imageRenderer';
|
|
@@ -16,22 +19,9 @@ import { calculateSvgDimensions } from './helpers';
|
|
|
16
19
|
import OpenMediaViewerButton from '../ui/openMediaViewerButton/openMediaViewerButton';
|
|
17
20
|
import { MediaCardError } from '../../errors';
|
|
18
21
|
import { getErrorReason } from './errors';
|
|
19
|
-
export var convertResizeMode = function convertResizeMode(resizeMode) {
|
|
20
|
-
switch (resizeMode) {
|
|
21
|
-
case 'crop':
|
|
22
|
-
return 'cover';
|
|
23
|
-
case 'fit':
|
|
24
|
-
case 'full-fit':
|
|
25
|
-
return 'scale-down';
|
|
26
|
-
case 'stretchy-fit':
|
|
27
|
-
return 'contain';
|
|
28
|
-
default:
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
22
|
export var SvgViewBase = function SvgViewBase(_ref) {
|
|
33
23
|
var identifier = _ref.identifier,
|
|
34
|
-
|
|
24
|
+
cardDimensions = _ref.cardDimensions,
|
|
35
25
|
onClick = _ref.onClick,
|
|
36
26
|
onMouseEnter = _ref.onMouseEnter,
|
|
37
27
|
testId = _ref.testId,
|
|
@@ -60,10 +50,17 @@ export var SvgViewBase = function SvgViewBase(_ref) {
|
|
|
60
50
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
61
51
|
svgDimensions = _useState6[0],
|
|
62
52
|
setSvgDimensions = _useState6[1];
|
|
63
|
-
var
|
|
64
|
-
var
|
|
53
|
+
var imgRef = useRef(null);
|
|
54
|
+
var wrapperRef = useRef(null);
|
|
55
|
+
var breakpoint = useBreakpoint(cardDimensions.width, wrapperRef);
|
|
56
|
+
var calculateDimensions = useCallback(function (targetImgElem) {
|
|
57
|
+
if (!wrapperRef.current || !targetImgElem) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
setSvgDimensions(calculateSvgDimensions(targetImgElem, wrapperRef.current, resizeMode));
|
|
61
|
+
}, [resizeMode]);
|
|
65
62
|
var onSvgLoad = function onSvgLoad(evt) {
|
|
66
|
-
|
|
63
|
+
calculateDimensions(evt.currentTarget);
|
|
67
64
|
setDidSvgRender(true);
|
|
68
65
|
onLoad();
|
|
69
66
|
};
|
|
@@ -74,16 +71,21 @@ export var SvgViewBase = function SvgViewBase(_ref) {
|
|
|
74
71
|
var onPreviewLoad = function onPreviewLoad() {
|
|
75
72
|
setDidPreviewRender(true);
|
|
76
73
|
};
|
|
74
|
+
useEffect(function () {
|
|
75
|
+
if (imgRef.current) {
|
|
76
|
+
calculateDimensions(imgRef.current);
|
|
77
|
+
}
|
|
78
|
+
}, [imgRef, calculateDimensions]);
|
|
77
79
|
return jsx(React.Fragment, null, shouldOpenMediaViewer && jsx(OpenMediaViewerButton, {
|
|
78
80
|
fileName: fileName !== null && fileName !== void 0 ? fileName : '',
|
|
79
81
|
innerRef: openMediaViewerButtonRef,
|
|
80
82
|
onClick: onClick
|
|
81
83
|
}), jsx(Wrapper, {
|
|
82
84
|
testId: testId || 'media-card-svg-wrapper',
|
|
83
|
-
dimensions:
|
|
85
|
+
dimensions: cardDimensions,
|
|
84
86
|
onClick: onClick,
|
|
85
87
|
onMouseEnter: onMouseEnter,
|
|
86
|
-
innerRef:
|
|
88
|
+
innerRef: wrapperRef,
|
|
87
89
|
mediaCardCursor: mediaCardCursor,
|
|
88
90
|
selected: !!selected,
|
|
89
91
|
breakpoint: breakpoint,
|
|
@@ -103,13 +105,12 @@ export var SvgViewBase = function SvgViewBase(_ref) {
|
|
|
103
105
|
}, jsx(MediaSvg, {
|
|
104
106
|
testId: "media-card-svg",
|
|
105
107
|
identifier: identifier,
|
|
106
|
-
dimensions: svgDimensions,
|
|
107
108
|
onLoad: onSvgLoad,
|
|
108
109
|
onError: onSvgError,
|
|
109
|
-
style: {
|
|
110
|
-
visibility: didSvgRender ? 'visible' : 'hidden'
|
|
111
|
-
|
|
112
|
-
|
|
110
|
+
style: _objectSpread({
|
|
111
|
+
visibility: didSvgRender ? 'visible' : 'hidden'
|
|
112
|
+
}, svgDimensions),
|
|
113
|
+
ref: imgRef
|
|
113
114
|
}), !!cardPreview && !didSvgRender && jsx(ImageRenderer, {
|
|
114
115
|
cardPreview: cardPreview,
|
|
115
116
|
onImageLoad: onPreviewLoad,
|
|
@@ -5,7 +5,7 @@ import { borderRadius, size, center } from '@atlaskit/media-ui';
|
|
|
5
5
|
import { rgba } from '../../styles';
|
|
6
6
|
import { fontFamily } from '@atlaskit/theme/constants';
|
|
7
7
|
|
|
8
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles
|
|
8
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
9
9
|
export var wrapperStyles = css({
|
|
10
10
|
boxSizing: 'border-box',
|
|
11
11
|
fontFamily: fontFamily(),
|
|
@@ -7,7 +7,7 @@ var discSize = 48;
|
|
|
7
7
|
var discSizeHover = 56;
|
|
8
8
|
export var fixedPlayButtonStyles = "\n .".concat(bkgClassName, " {\n width: ").concat(discSizeHover, "px;\n height: ").concat(discSizeHover, "px;\n }\n");
|
|
9
9
|
|
|
10
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles
|
|
10
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
11
11
|
export var playButtonWrapperStyles = css({
|
|
12
12
|
position: 'absolute',
|
|
13
13
|
top: 0,
|
|
@@ -24,7 +24,7 @@ export var playButtonWrapperStyles = css({
|
|
|
24
24
|
}
|
|
25
25
|
});
|
|
26
26
|
|
|
27
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles
|
|
27
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
28
28
|
export var backgroundStyles = css({
|
|
29
29
|
transitionProperty: 'width, height',
|
|
30
30
|
transitionDuration: '0.1s',
|
|
@@ -58,14 +58,14 @@ export var titleBoxFooterStyles = function titleBoxFooterStyles(_ref3) {
|
|
|
58
58
|
};
|
|
59
59
|
titleBoxFooterStyles.displayName = 'TitleBoxFooter';
|
|
60
60
|
|
|
61
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles
|
|
61
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
62
62
|
export var titleBoxIconStyles = css({
|
|
63
63
|
position: 'absolute',
|
|
64
64
|
right: "var(--ds-space-050, 4px)",
|
|
65
65
|
bottom: '0px'
|
|
66
66
|
});
|
|
67
67
|
|
|
68
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles
|
|
68
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
69
69
|
export var errorMessageWrapperStyles = css({
|
|
70
70
|
display: 'flex',
|
|
71
71
|
alignItems: 'center',
|
|
@@ -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: "78.0.
|
|
106
|
+
packageName: "78.0.3",
|
|
107
107
|
componentName: 'mediaInlineCard',
|
|
108
108
|
component: 'mediaInlineCard'
|
|
109
109
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
2
2
|
import { css } from '@emotion/react';
|
|
3
3
|
|
|
4
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles
|
|
4
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
5
5
|
export var errorIconWrapperStyles = css({
|
|
6
6
|
display: 'flex',
|
|
7
7
|
color: "var(--ds-icon-warning, #ff991f)"
|
|
@@ -8,7 +8,7 @@ import { extractErrorInfo, getRenderErrorRequestMetadata } from './analytics';
|
|
|
8
8
|
import { MediaCardError } from '../errors';
|
|
9
9
|
import { getMediaEnvironment, getMediaRegion } from '@atlaskit/media-client';
|
|
10
10
|
var packageName = "@atlaskit/media-card";
|
|
11
|
-
var packageVersion = "78.0.
|
|
11
|
+
var packageVersion = "78.0.3";
|
|
12
12
|
var concurrentExperience;
|
|
13
13
|
var getExperience = function getExperience(id) {
|
|
14
14
|
if (!concurrentExperience) {
|
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
import { type ImageResizeMode } from '@atlaskit/media-client';
|
|
2
|
-
|
|
3
|
-
export declare const calculateSvgDimensions: (img: HTMLImageElement, resizeMode?: ImageResizeMode) => MediaSvgProps['dimensions'];
|
|
2
|
+
export declare const calculateSvgDimensions: (imgElement: HTMLImageElement, parentElement: HTMLElement, resizeMode: ImageResizeMode) => React.CSSProperties;
|
|
@@ -3,16 +3,15 @@ import { jsx } from '@emotion/react';
|
|
|
3
3
|
import React, { type MouseEvent } from 'react';
|
|
4
4
|
import { type FileIdentifier, type ImageResizeMode } from '@atlaskit/media-client';
|
|
5
5
|
import { type WithAnalyticsEventsProps, type UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
6
|
-
import { type
|
|
6
|
+
import { type CardDimensions, type CardStatus, type MediaCardCursor } from '../../types';
|
|
7
7
|
import { type MediaFilePreview } from '@atlaskit/media-file-preview';
|
|
8
8
|
import { MediaCardError } from '../../errors';
|
|
9
|
-
export declare const convertResizeMode: (resizeMode?: ImageResizeMode) => React.CSSProperties['objectFit'];
|
|
10
9
|
export type OnClickFn = (event: React.MouseEvent<HTMLDivElement | HTMLButtonElement>, analyticsEvent?: UIAnalyticsEvent) => void;
|
|
11
10
|
export interface SvgViewBaseOwnProps {
|
|
12
11
|
readonly testId?: string;
|
|
13
12
|
identifier: FileIdentifier;
|
|
14
13
|
readonly status: CardStatus;
|
|
15
|
-
readonly
|
|
14
|
+
readonly cardDimensions: CardDimensions;
|
|
16
15
|
readonly onClick?: OnClickFn;
|
|
17
16
|
readonly onMouseEnter?: (event: MouseEvent<HTMLDivElement>) => void;
|
|
18
17
|
readonly selected?: boolean;
|
|
@@ -21,12 +20,12 @@ export interface SvgViewBaseOwnProps {
|
|
|
21
20
|
readonly mediaCardCursor?: MediaCardCursor;
|
|
22
21
|
readonly progress?: number;
|
|
23
22
|
readonly alt?: string;
|
|
24
|
-
readonly resizeMode
|
|
23
|
+
readonly resizeMode: ImageResizeMode;
|
|
25
24
|
readonly onLoad: () => void;
|
|
26
25
|
readonly onError: (error: MediaCardError) => void;
|
|
27
26
|
readonly shouldOpenMediaViewer?: boolean;
|
|
28
27
|
readonly openMediaViewerButtonRef?: React.Ref<HTMLButtonElement>;
|
|
29
28
|
}
|
|
30
29
|
export type SvgViewProps = SvgViewBaseOwnProps & WithAnalyticsEventsProps;
|
|
31
|
-
export declare const SvgViewBase: ({ identifier,
|
|
30
|
+
export declare const SvgViewBase: ({ identifier, cardDimensions, onClick, onMouseEnter, testId, status, selected, fileName, cardPreview, mediaCardCursor, progress, alt, resizeMode, shouldOpenMediaViewer, openMediaViewerButtonRef, onLoad, onError, }: SvgViewProps) => jsx.JSX.Element;
|
|
32
31
|
export declare const SvgView: React.ForwardRefExoticComponent<Omit<SvgViewBaseOwnProps & WithAnalyticsEventsProps, keyof WithAnalyticsEventsProps> & React.RefAttributes<any>>;
|
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
import { type ImageResizeMode } from '@atlaskit/media-client';
|
|
2
|
-
|
|
3
|
-
export declare const calculateSvgDimensions: (img: HTMLImageElement, resizeMode?: ImageResizeMode) => MediaSvgProps['dimensions'];
|
|
2
|
+
export declare const calculateSvgDimensions: (imgElement: HTMLImageElement, parentElement: HTMLElement, resizeMode: ImageResizeMode) => React.CSSProperties;
|
|
@@ -3,16 +3,15 @@ import { jsx } from '@emotion/react';
|
|
|
3
3
|
import React, { type MouseEvent } from 'react';
|
|
4
4
|
import { type FileIdentifier, type ImageResizeMode } from '@atlaskit/media-client';
|
|
5
5
|
import { type WithAnalyticsEventsProps, type UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
6
|
-
import { type
|
|
6
|
+
import { type CardDimensions, type CardStatus, type MediaCardCursor } from '../../types';
|
|
7
7
|
import { type MediaFilePreview } from '@atlaskit/media-file-preview';
|
|
8
8
|
import { MediaCardError } from '../../errors';
|
|
9
|
-
export declare const convertResizeMode: (resizeMode?: ImageResizeMode) => React.CSSProperties['objectFit'];
|
|
10
9
|
export type OnClickFn = (event: React.MouseEvent<HTMLDivElement | HTMLButtonElement>, analyticsEvent?: UIAnalyticsEvent) => void;
|
|
11
10
|
export interface SvgViewBaseOwnProps {
|
|
12
11
|
readonly testId?: string;
|
|
13
12
|
identifier: FileIdentifier;
|
|
14
13
|
readonly status: CardStatus;
|
|
15
|
-
readonly
|
|
14
|
+
readonly cardDimensions: CardDimensions;
|
|
16
15
|
readonly onClick?: OnClickFn;
|
|
17
16
|
readonly onMouseEnter?: (event: MouseEvent<HTMLDivElement>) => void;
|
|
18
17
|
readonly selected?: boolean;
|
|
@@ -21,12 +20,12 @@ export interface SvgViewBaseOwnProps {
|
|
|
21
20
|
readonly mediaCardCursor?: MediaCardCursor;
|
|
22
21
|
readonly progress?: number;
|
|
23
22
|
readonly alt?: string;
|
|
24
|
-
readonly resizeMode
|
|
23
|
+
readonly resizeMode: ImageResizeMode;
|
|
25
24
|
readonly onLoad: () => void;
|
|
26
25
|
readonly onError: (error: MediaCardError) => void;
|
|
27
26
|
readonly shouldOpenMediaViewer?: boolean;
|
|
28
27
|
readonly openMediaViewerButtonRef?: React.Ref<HTMLButtonElement>;
|
|
29
28
|
}
|
|
30
29
|
export type SvgViewProps = SvgViewBaseOwnProps & WithAnalyticsEventsProps;
|
|
31
|
-
export declare const SvgViewBase: ({ identifier,
|
|
30
|
+
export declare const SvgViewBase: ({ identifier, cardDimensions, onClick, onMouseEnter, testId, status, selected, fileName, cardPreview, mediaCardCursor, progress, alt, resizeMode, shouldOpenMediaViewer, openMediaViewerButtonRef, onLoad, onError, }: SvgViewProps) => jsx.JSX.Element;
|
|
32
31
|
export declare const SvgView: React.ForwardRefExoticComponent<Omit<SvgViewBaseOwnProps & WithAnalyticsEventsProps, keyof WithAnalyticsEventsProps> & React.RefAttributes<any>>;
|
|
@@ -35,8 +35,10 @@ const cardWrapperStyles = ({ small, displayInline }: CardViewWrapperProps) =>
|
|
|
35
35
|
|
|
36
36
|
export const CardViewWrapper = (props: CardViewWrapperProps) => {
|
|
37
37
|
if (props.small) {
|
|
38
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
38
39
|
return <Box xcss={[cardWrapperStyles(props), smallStyles]}>{props.children}</Box>;
|
|
39
40
|
} else {
|
|
41
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
40
42
|
return <Box xcss={[cardWrapperStyles(props), largeStyles]}>{props.children}</Box>;
|
|
41
43
|
}
|
|
42
44
|
};
|
|
@@ -2,14 +2,14 @@ import { token } from '@atlaskit/tokens';
|
|
|
2
2
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
3
3
|
import { css } from '@emotion/react';
|
|
4
4
|
|
|
5
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles
|
|
5
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
6
6
|
export const editableCardOptionsStyles = css({
|
|
7
7
|
padding: token('space.250', '20px'),
|
|
8
8
|
borderBottom: `1px solid ${token('color.border', '#ccc')}`,
|
|
9
9
|
maxWidth: '700px',
|
|
10
10
|
});
|
|
11
11
|
|
|
12
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles
|
|
12
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
13
13
|
export const sliderWrapperStyles = css({
|
|
14
14
|
display: 'flex',
|
|
15
15
|
width: '50%',
|
|
@@ -20,7 +20,7 @@ export const sliderWrapperStyles = css({
|
|
|
20
20
|
},
|
|
21
21
|
});
|
|
22
22
|
|
|
23
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles
|
|
23
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
24
24
|
export const editableCardContentStyles = css({
|
|
25
25
|
padding: token('space.250', '20px'),
|
|
26
26
|
border: '2px dashed',
|
|
@@ -33,7 +33,7 @@ export const editableCardContentStyles = css({
|
|
|
33
33
|
boxSizing: 'border-box',
|
|
34
34
|
});
|
|
35
35
|
|
|
36
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles
|
|
36
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
37
37
|
export const optionsWrapperStyles = css({
|
|
38
38
|
display: 'flex',
|
|
39
39
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
@@ -43,7 +43,7 @@ export const optionsWrapperStyles = css({
|
|
|
43
43
|
},
|
|
44
44
|
});
|
|
45
45
|
|
|
46
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles
|
|
46
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
47
47
|
export const cardDimensionsWrapperStyles = css({
|
|
48
48
|
margin: `${token('space.100', '8px')} ${token('space.100', '8px')} ${token(
|
|
49
49
|
'space.250',
|
|
@@ -59,16 +59,16 @@ export const cardDimensionsWrapperStyles = css({
|
|
|
59
59
|
},
|
|
60
60
|
});
|
|
61
61
|
|
|
62
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles
|
|
62
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
63
63
|
export const flexWrapperStyles = css({
|
|
64
64
|
display: 'flex',
|
|
65
65
|
});
|
|
66
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles
|
|
66
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
67
67
|
export const cardPreviewWrapperStyles = css({
|
|
68
68
|
flex: 1,
|
|
69
69
|
});
|
|
70
70
|
|
|
71
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles
|
|
71
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
72
72
|
export const cardWrapperStyles = css({
|
|
73
73
|
border: `1px solid ${token('color.border.bold', 'black')}`,
|
|
74
74
|
padding: token('space.150', '12px'),
|
|
@@ -80,13 +80,13 @@ export const cardWrapperStyles = css({
|
|
|
80
80
|
display: 'inline-block',
|
|
81
81
|
});
|
|
82
82
|
|
|
83
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles
|
|
83
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
84
84
|
export const cardFlowHeaderStyles = css({
|
|
85
85
|
margin: `${token('space.250', '20px')} auto`,
|
|
86
86
|
padding: `${token('space.150', '12px')} ${token('space.0', '0px')}`,
|
|
87
87
|
});
|
|
88
88
|
|
|
89
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles
|
|
89
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
90
90
|
export const externalIdentifierWrapperStyles = css({
|
|
91
91
|
display: 'flex',
|
|
92
92
|
justifyContent: 'space-around',
|
|
@@ -97,7 +97,7 @@ export const externalIdentifierWrapperStyles = css({
|
|
|
97
97
|
},
|
|
98
98
|
});
|
|
99
99
|
|
|
100
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles
|
|
100
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
101
101
|
export const unhandledErrorCardWrapperStyles = css({
|
|
102
102
|
padding: token('space.250', '20px'),
|
|
103
103
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
@@ -111,24 +111,24 @@ export const unhandledErrorCardWrapperStyles = css({
|
|
|
111
111
|
},
|
|
112
112
|
});
|
|
113
113
|
|
|
114
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles
|
|
114
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
115
115
|
export const inlineCardVideoWrapperItemStyles = css({
|
|
116
116
|
padding: token('space.150', '12px'),
|
|
117
117
|
border: `1px solid ${token('color.border.bold', 'black')}`,
|
|
118
118
|
margin: token('space.150', '12px'),
|
|
119
119
|
});
|
|
120
120
|
|
|
121
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles
|
|
121
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
122
122
|
export const mediaViewerExampleColumnStyles = css({
|
|
123
123
|
flex: 1,
|
|
124
124
|
});
|
|
125
125
|
|
|
126
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles
|
|
126
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
127
127
|
export const mediaViewerExampleWrapperStyles = css({
|
|
128
128
|
display: 'flex',
|
|
129
129
|
});
|
|
130
130
|
|
|
131
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles
|
|
131
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
132
132
|
export const mediaInlineWrapperStyles = css({
|
|
133
133
|
display: 'flex',
|
|
134
134
|
alignItems: 'center',
|
|
@@ -136,7 +136,7 @@ export const mediaInlineWrapperStyles = css({
|
|
|
136
136
|
margin: token('space.1000', '80px'),
|
|
137
137
|
});
|
|
138
138
|
|
|
139
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles
|
|
139
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
140
140
|
export const mediaInlineTableStyles = css({
|
|
141
141
|
width: '800px',
|
|
142
142
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
@@ -8,9 +8,9 @@ import { Box, xcss } from '@atlaskit/primitives';
|
|
|
8
8
|
|
|
9
9
|
const containerStyles = xcss({
|
|
10
10
|
boxSizing: 'border-box',
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
outlineColor: 'color.border.accent.orange',
|
|
12
|
+
outlineStyle: 'solid',
|
|
13
|
+
outlineWidth: 'border.width.indicator',
|
|
14
14
|
margin: 'auto',
|
|
15
15
|
marginTop: 'space.100',
|
|
16
16
|
backgroundColor: 'color.background.accent.green.subtler',
|
package/package.json
CHANGED