@atlaskit/media-card 79.7.2 → 79.8.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/cardView.js +1 -0
- package/dist/cjs/card/fileCard.js +0 -7
- package/dist/cjs/card/ui/unhandledErrorCard/contentLoadingErrorMessage.js +1 -1
- package/dist/cjs/card/ui/wrapper/imageContainer-compiled.js +4 -2
- package/dist/cjs/card/ui/wrapper/wrapper-compiled.compiled.css +3 -1
- package/dist/cjs/card/ui/wrapper/wrapper-compiled.js +5 -6
- package/dist/es2019/card/cardView.js +1 -0
- package/dist/es2019/card/fileCard.js +0 -7
- package/dist/es2019/card/ui/unhandledErrorCard/contentLoadingErrorMessage.js +1 -1
- package/dist/es2019/card/ui/wrapper/imageContainer-compiled.js +4 -2
- package/dist/es2019/card/ui/wrapper/wrapper-compiled.compiled.css +3 -1
- package/dist/es2019/card/ui/wrapper/wrapper-compiled.js +4 -7
- package/dist/esm/card/cardView.js +1 -0
- package/dist/esm/card/fileCard.js +0 -7
- package/dist/esm/card/ui/unhandledErrorCard/contentLoadingErrorMessage.js +1 -1
- package/dist/esm/card/ui/wrapper/imageContainer-compiled.js +4 -2
- package/dist/esm/card/ui/wrapper/wrapper-compiled.compiled.css +3 -1
- package/dist/esm/card/ui/wrapper/wrapper-compiled.js +5 -6
- package/dist/types/card/fileCard.d.ts +1 -4
- package/dist/types/card/ui/unhandledErrorCard/contentLoadingErrorMessage.d.ts +1 -1
- package/dist/types/card/ui/wrapper/imageContainer-compiled.d.ts +3 -1
- package/dist/types/card/ui/wrapper/imageContainer.d.ts +2 -0
- package/dist/types/types.d.ts +1 -2
- package/dist/types/utils/viewportDetector.d.ts +1 -1
- package/dist/types-ts4.5/card/fileCard.d.ts +1 -4
- package/dist/types-ts4.5/card/ui/unhandledErrorCard/contentLoadingErrorMessage.d.ts +1 -1
- package/dist/types-ts4.5/card/ui/wrapper/imageContainer-compiled.d.ts +3 -1
- package/dist/types-ts4.5/card/ui/wrapper/imageContainer.d.ts +2 -0
- package/dist/types-ts4.5/types.d.ts +1 -2
- package/dist/types-ts4.5/utils/viewportDetector.d.ts +1 -1
- package/example-helpers/DelayedRender.tsx +1 -1
- package/example-helpers/cards.tsx +75 -22
- package/example-helpers/index.tsx +14 -4
- package/example-helpers/selectableCard.tsx +1 -1
- package/example-helpers/ssrHelpers.tsx +5 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @atlaskit/media-card
|
|
2
2
|
|
|
3
|
+
## 79.8.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`7cfa4a9ffdf8d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7cfa4a9ffdf8d) -
|
|
8
|
+
Suppress i18n eslint errors
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
11
|
+
## 79.8.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- [`3aebb34f01aad`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/3aebb34f01aad) -
|
|
16
|
+
remove-image-load-error-from-media-card
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- [`5bd9159b5173c`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/5bd9159b5173c) -
|
|
21
|
+
Removing curosr styles from VC metric calculations by switching to a data-cursor attribute
|
|
22
|
+
enabling change exclusion
|
|
23
|
+
- Updated dependencies
|
|
24
|
+
|
|
3
25
|
## 79.7.2
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|
|
@@ -252,6 +252,7 @@ var CardViewBase = exports.CardViewBase = function CardViewBase(_ref) {
|
|
|
252
252
|
mediaName: name,
|
|
253
253
|
status: status,
|
|
254
254
|
progress: progress,
|
|
255
|
+
mediaCardCursor: mediaCardCursor,
|
|
255
256
|
selected: selected,
|
|
256
257
|
source: cardPreview === null || cardPreview === void 0 ? void 0 : cardPreview.source
|
|
257
258
|
}, renderTypeIcon && /*#__PURE__*/_react.default.createElement(_iconWrapper.IconWrapper, {
|
|
@@ -44,7 +44,6 @@ var _usePressTracing = _interopRequireDefault(require("@atlaskit/react-ufo/use-p
|
|
|
44
44
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
45
45
|
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; }
|
|
46
46
|
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) { (0, _defineProperty2.default)(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; }
|
|
47
|
-
var IMAGE_LOAD_ERROR = 'image-load-error';
|
|
48
47
|
var traceContextRetriever = function traceContextRetriever() {
|
|
49
48
|
var trace = (0, _experienceTraceIdContext.getActiveTrace)();
|
|
50
49
|
if (trace && (0, _platformFeatureFlags.fg)('platform-filecard-ufo-trace')) {
|
|
@@ -403,16 +402,10 @@ var FileCard = exports.FileCard = function FileCard(_ref) {
|
|
|
403
402
|
setStatus('error');
|
|
404
403
|
};
|
|
405
404
|
var onImageError = function onImageError(newCardPreview) {
|
|
406
|
-
var _onErrorRef$current;
|
|
407
405
|
if (metadata.mimeType === 'image/svg+xml') {
|
|
408
406
|
return;
|
|
409
407
|
}
|
|
410
408
|
onImageErrorBase(newCardPreview);
|
|
411
|
-
|
|
412
|
-
// The image error is not reflected in the status,
|
|
413
|
-
// as the preview might fail to load if the file itself is broken.
|
|
414
|
-
// In that case we want call onError callback.
|
|
415
|
-
(_onErrorRef$current = onErrorRef.current) === null || _onErrorRef$current === void 0 || _onErrorRef$current.call(onErrorRef, IMAGE_LOAD_ERROR);
|
|
416
409
|
};
|
|
417
410
|
var onSvgLoad = function onSvgLoad() {
|
|
418
411
|
setPreviewDidRender(true);
|
|
@@ -10,7 +10,7 @@ var ContentLoadingErrorMessage = exports.ContentLoadingErrorMessage = function C
|
|
|
10
10
|
var isHidden = _ref.isHidden;
|
|
11
11
|
return (
|
|
12
12
|
/*#__PURE__*/
|
|
13
|
-
// eslint-disable-next-line @atlaskit/design-system/use-primitives-text
|
|
13
|
+
// eslint-disable-next-line @atlaskit/design-system/use-primitives-text, @atlassian/i18n/no-literal-string-in-jsx
|
|
14
14
|
_react.default.createElement("p", {
|
|
15
15
|
style: {
|
|
16
16
|
display: isHidden ? 'none' : 'block'
|
|
@@ -20,7 +20,8 @@ var ImageContainer = exports.ImageContainer = function ImageContainer(_ref) {
|
|
|
20
20
|
progress = _ref.progress,
|
|
21
21
|
selected = _ref.selected,
|
|
22
22
|
source = _ref.source,
|
|
23
|
-
centerElements = _ref.centerElements
|
|
23
|
+
centerElements = _ref.centerElements,
|
|
24
|
+
mediaCardCursor = _ref.mediaCardCursor;
|
|
24
25
|
return /*#__PURE__*/React.createElement("div", {
|
|
25
26
|
"data-testid": _classnames.fileCardImageViewSelector
|
|
26
27
|
/**
|
|
@@ -35,6 +36,7 @@ var ImageContainer = exports.ImageContainer = function ImageContainer(_ref) {
|
|
|
35
36
|
"data-test-status": status,
|
|
36
37
|
"data-test-progress": progress,
|
|
37
38
|
"data-test-selected": selected,
|
|
38
|
-
"data-test-source": source
|
|
39
|
+
"data-test-source": source,
|
|
40
|
+
"data-cursor": mediaCardCursor
|
|
39
41
|
}, children);
|
|
40
42
|
};
|
|
@@ -16,6 +16,7 @@ button:focus+._1hlmjc5g{outline:solid var(--ds-border-width-focused,2px) var(--d
|
|
|
16
16
|
._1y898vuz:hover .media-card-play-button .play-icon-background{width:56px}
|
|
17
17
|
._1yf91flm:hover .media-card-tickbox{background-color:var(--_mt8cm6)}
|
|
18
18
|
._4t3ine4n{height:var(--media-wrapper-height)}
|
|
19
|
+
._5sb1v00u [data-cursor=wait]{cursor:wait}
|
|
19
20
|
._9m3z1osq>div{width:100%}
|
|
20
21
|
._bfhklslw{background-color:var(--_1jkcdu5)}
|
|
21
22
|
._c71l1osq{max-height:100%}
|
|
@@ -24,4 +25,5 @@ button:focus+._1hlmjc5g{outline:solid var(--ds-border-width-focused,2px) var(--d
|
|
|
24
25
|
._kqswh2mm{position:relative}
|
|
25
26
|
._mts3kb7n:focus-within .media-card-actions-bar{opacity:1}
|
|
26
27
|
._p12f1osq{max-width:100%}
|
|
27
|
-
._vchhusvi{box-sizing:border-box}
|
|
28
|
+
._vchhusvi{box-sizing:border-box}
|
|
29
|
+
._yfmhtlke [data-cursor=pointer]{cursor:pointer}
|
|
@@ -14,7 +14,6 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
14
14
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
15
|
var _cardConstants = require("../../cardConstants");
|
|
16
16
|
var _vcMedia = require("@atlaskit/react-ufo/vc-media");
|
|
17
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
18
17
|
var _colors = require("@atlaskit/theme/colors");
|
|
19
18
|
var _cardDimensions = require("../../../utils/cardDimensions");
|
|
20
19
|
var _getCSSUnitValue = require("../../../utils/getCSSUnitValue");
|
|
@@ -49,6 +48,9 @@ var hideNativeBrowserTextSelectionStyles = null;
|
|
|
49
48
|
var clickableButtonPlayButtonStyles = null;
|
|
50
49
|
var selectableTickboxStyle = null;
|
|
51
50
|
var tooltipStyle = null;
|
|
51
|
+
|
|
52
|
+
// These styles target data attributes to enable the exclusion from TTVC metric calculation.
|
|
53
|
+
var cursorStyle = null;
|
|
52
54
|
var getResponsiveStyles = function getResponsiveStyles(breakpoint) {
|
|
53
55
|
// dynamically setting the properties to avoid ratcheting build errors. These need to be removed however for the compiled transformation.
|
|
54
56
|
return breakpoint === 'small' ? (0, _defineProperty2.default)((0, _defineProperty2.default)({}, 'fontSize', '11px'), 'lineHeight', '14px') : (0, _defineProperty2.default)((0, _defineProperty2.default)({}, 'fontSize', '14px'), 'lineHeight', '22px');
|
|
@@ -61,7 +63,6 @@ var Wrapper = exports.Wrapper = function Wrapper(props) {
|
|
|
61
63
|
onMouseEnter = props.onMouseEnter,
|
|
62
64
|
innerRef = props.innerRef,
|
|
63
65
|
breakpoint = props.breakpoint,
|
|
64
|
-
mediaCardCursor = props.mediaCardCursor,
|
|
65
66
|
disableOverlay = props.disableOverlay,
|
|
66
67
|
selected = props.selected,
|
|
67
68
|
displayBackground = props.displayBackground,
|
|
@@ -76,7 +77,7 @@ var Wrapper = exports.Wrapper = function Wrapper(props) {
|
|
|
76
77
|
id: "newFileExperienceWrapper"
|
|
77
78
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
78
79
|
,
|
|
79
|
-
className: (0, _runtime.ax)([wrapperStyles.default, displayBackground && "_bfhklslw", wrapperShadowKey && shadowStyleMap[wrapperShadowKey], selected && "_1p1y1j28 _1rk81j28 _14r11j28 _1np21j28", isPlayButtonClickable && "_1y898vuz _19zy8vuz", isTickBoxSelectable && "_1yf91flm _1xp5rcbj", shouldDisplayTooltip && "_9m3z1osq _10pb1osq", _cardConstants.newFileExperienceClassName]),
|
|
80
|
+
className: (0, _runtime.ax)([wrapperStyles.default, "_yfmhtlke _5sb1v00u", displayBackground && "_bfhklslw", wrapperShadowKey && shadowStyleMap[wrapperShadowKey], selected && "_1p1y1j28 _1rk81j28 _14r11j28 _1np21j28", isPlayButtonClickable && "_1y898vuz _19zy8vuz", isTickBoxSelectable && "_1yf91flm _1xp5rcbj", shouldDisplayTooltip && "_9m3z1osq _10pb1osq", _cardConstants.newFileExperienceClassName]),
|
|
80
81
|
"data-testid": testId,
|
|
81
82
|
ref: innerRef,
|
|
82
83
|
onClick: onClick
|
|
@@ -84,9 +85,7 @@ var Wrapper = exports.Wrapper = function Wrapper(props) {
|
|
|
84
85
|
,
|
|
85
86
|
onMouseEnter: onMouseEnter
|
|
86
87
|
}, _vcMedia.VcMediaWrapperProps, {
|
|
87
|
-
style: _objectSpread(_objectSpread({}, _objectSpread(
|
|
88
|
-
cursor: mediaCardCursor
|
|
89
|
-
} : undefined), getResponsiveStyles(breakpoint))), {}, {
|
|
88
|
+
style: _objectSpread(_objectSpread({}, _objectSpread((0, _defineProperty2.default)((0, _defineProperty2.default)({}, LOCAL_WIDTH_VARIABLE, width), LOCAL_HEIGHT_VARIABLE, height), getResponsiveStyles(breakpoint))), {}, {
|
|
90
89
|
"--_1jkcdu5": (0, _runtime.ix)("var(--ds-background-neutral, ".concat(_colors.N20, ")")),
|
|
91
90
|
"--_mt8cm6": (0, _runtime.ix)("var(--ds-background-input, ".concat(_colors.N0, ")")),
|
|
92
91
|
"--_13xf2t5": (0, _runtime.ix)("var(--ds-icon-subtle, ".concat(_colors.N100, ")"))
|
|
@@ -241,6 +241,7 @@ export const CardViewBase = ({
|
|
|
241
241
|
mediaName: name,
|
|
242
242
|
status: status,
|
|
243
243
|
progress: progress,
|
|
244
|
+
mediaCardCursor: mediaCardCursor,
|
|
244
245
|
selected: selected,
|
|
245
246
|
source: cardPreview === null || cardPreview === void 0 ? void 0 : cardPreview.source
|
|
246
247
|
}, renderTypeIcon && /*#__PURE__*/React.createElement(IconWrapper, {
|
|
@@ -29,7 +29,6 @@ import { AbuseModal } from '@atlaskit/media-ui/abuseModal';
|
|
|
29
29
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
30
30
|
import { getActiveTrace } from '@atlaskit/react-ufo/experience-trace-id-context';
|
|
31
31
|
import usePressTracing from '@atlaskit/react-ufo/use-press-tracing';
|
|
32
|
-
const IMAGE_LOAD_ERROR = 'image-load-error';
|
|
33
32
|
const traceContextRetriever = () => {
|
|
34
33
|
const trace = getActiveTrace();
|
|
35
34
|
if (trace && fg('platform-filecard-ufo-trace')) {
|
|
@@ -326,16 +325,10 @@ export const FileCard = ({
|
|
|
326
325
|
setStatus('error');
|
|
327
326
|
};
|
|
328
327
|
const onImageError = newCardPreview => {
|
|
329
|
-
var _onErrorRef$current;
|
|
330
328
|
if (metadata.mimeType === 'image/svg+xml') {
|
|
331
329
|
return;
|
|
332
330
|
}
|
|
333
331
|
onImageErrorBase(newCardPreview);
|
|
334
|
-
|
|
335
|
-
// The image error is not reflected in the status,
|
|
336
|
-
// as the preview might fail to load if the file itself is broken.
|
|
337
|
-
// In that case we want call onError callback.
|
|
338
|
-
(_onErrorRef$current = onErrorRef.current) === null || _onErrorRef$current === void 0 ? void 0 : _onErrorRef$current.call(onErrorRef, IMAGE_LOAD_ERROR);
|
|
339
332
|
};
|
|
340
333
|
const onSvgLoad = () => {
|
|
341
334
|
setPreviewDidRender(true);
|
|
@@ -3,7 +3,7 @@ export const ContentLoadingErrorMessage = ({
|
|
|
3
3
|
isHidden
|
|
4
4
|
}) =>
|
|
5
5
|
/*#__PURE__*/
|
|
6
|
-
// eslint-disable-next-line @atlaskit/design-system/use-primitives-text
|
|
6
|
+
// eslint-disable-next-line @atlaskit/design-system/use-primitives-text, @atlassian/i18n/no-literal-string-in-jsx
|
|
7
7
|
React.createElement("p", {
|
|
8
8
|
style: {
|
|
9
9
|
display: isHidden ? 'none' : 'block'
|
|
@@ -12,7 +12,8 @@ export const ImageContainer = ({
|
|
|
12
12
|
progress,
|
|
13
13
|
selected,
|
|
14
14
|
source,
|
|
15
|
-
centerElements
|
|
15
|
+
centerElements,
|
|
16
|
+
mediaCardCursor
|
|
16
17
|
}) => /*#__PURE__*/React.createElement("div", {
|
|
17
18
|
"data-testid": fileCardImageViewSelector
|
|
18
19
|
/**
|
|
@@ -27,5 +28,6 @@ export const ImageContainer = ({
|
|
|
27
28
|
"data-test-status": status,
|
|
28
29
|
"data-test-progress": progress,
|
|
29
30
|
"data-test-selected": selected,
|
|
30
|
-
"data-test-source": source
|
|
31
|
+
"data-test-source": source,
|
|
32
|
+
"data-cursor": mediaCardCursor
|
|
31
33
|
}, children);
|
|
@@ -16,6 +16,7 @@ button:focus+._1hlmjc5g{outline:solid var(--ds-border-width-focused,2px) var(--d
|
|
|
16
16
|
._1y898vuz:hover .media-card-play-button .play-icon-background{width:56px}
|
|
17
17
|
._1yf91j9a:hover .media-card-tickbox{background-color:var(--ds-background-input,#fff)}
|
|
18
18
|
._4t3ine4n{height:var(--media-wrapper-height)}
|
|
19
|
+
._5sb1v00u [data-cursor=wait]{cursor:wait}
|
|
19
20
|
._9m3z1osq>div{width:100%}
|
|
20
21
|
._bfhk1s4m{background-color:var(--ds-background-neutral,#f4f5f7)}
|
|
21
22
|
._c71l1osq{max-height:100%}
|
|
@@ -24,4 +25,5 @@ button:focus+._1hlmjc5g{outline:solid var(--ds-border-width-focused,2px) var(--d
|
|
|
24
25
|
._kqswh2mm{position:relative}
|
|
25
26
|
._mts3kb7n:focus-within .media-card-actions-bar{opacity:1}
|
|
26
27
|
._p12f1osq{max-width:100%}
|
|
27
|
-
._vchhusvi{box-sizing:border-box}
|
|
28
|
+
._vchhusvi{box-sizing:border-box}
|
|
29
|
+
._yfmhtlke [data-cursor=pointer]{cursor:pointer}
|
|
@@ -5,7 +5,6 @@ import * as React from 'react';
|
|
|
5
5
|
import { ax, ix } from "@compiled/react/runtime";
|
|
6
6
|
import { newFileExperienceClassName } from '../../cardConstants';
|
|
7
7
|
import { VcMediaWrapperProps } from '@atlaskit/react-ufo/vc-media';
|
|
8
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
8
|
import { N0, N100, N20, N60A, N90A, B100 } from '@atlaskit/theme/colors';
|
|
10
9
|
import { getDefaultCardDimensions } from '../../../utils/cardDimensions';
|
|
11
10
|
import { getCSSUnitValue } from '../../../utils/getCSSUnitValue';
|
|
@@ -37,6 +36,9 @@ const hideNativeBrowserTextSelectionStyles = null;
|
|
|
37
36
|
const clickableButtonPlayButtonStyles = null;
|
|
38
37
|
const selectableTickboxStyle = null;
|
|
39
38
|
const tooltipStyle = null;
|
|
39
|
+
|
|
40
|
+
// These styles target data attributes to enable the exclusion from TTVC metric calculation.
|
|
41
|
+
const cursorStyle = null;
|
|
40
42
|
const getResponsiveStyles = breakpoint => {
|
|
41
43
|
// dynamically setting the properties to avoid ratcheting build errors. These need to be removed however for the compiled transformation.
|
|
42
44
|
return breakpoint === 'small' ? {
|
|
@@ -56,7 +58,6 @@ export const Wrapper = props => {
|
|
|
56
58
|
onMouseEnter,
|
|
57
59
|
innerRef,
|
|
58
60
|
breakpoint,
|
|
59
|
-
mediaCardCursor,
|
|
60
61
|
disableOverlay,
|
|
61
62
|
selected,
|
|
62
63
|
displayBackground,
|
|
@@ -72,16 +73,12 @@ export const Wrapper = props => {
|
|
|
72
73
|
id: "newFileExperienceWrapper"
|
|
73
74
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
74
75
|
,
|
|
75
|
-
className: ax([wrapperStyles.default, displayBackground && "_bfhk1s4m", wrapperShadowKey && shadowStyleMap[wrapperShadowKey], selected && "_1p1y1j28 _1rk81j28 _14r11j28 _1np21j28", isPlayButtonClickable && "_1y898vuz _19zy8vuz", isTickBoxSelectable && "_1yf91j9a _1xp5kufk", shouldDisplayTooltip && "_9m3z1osq _10pb1osq", newFileExperienceClassName]),
|
|
76
|
+
className: ax([wrapperStyles.default, "_yfmhtlke _5sb1v00u", displayBackground && "_bfhk1s4m", wrapperShadowKey && shadowStyleMap[wrapperShadowKey], selected && "_1p1y1j28 _1rk81j28 _14r11j28 _1np21j28", isPlayButtonClickable && "_1y898vuz _19zy8vuz", isTickBoxSelectable && "_1yf91j9a _1xp5kufk", shouldDisplayTooltip && "_9m3z1osq _10pb1osq", newFileExperienceClassName]),
|
|
76
77
|
"data-testid": testId,
|
|
77
78
|
style: {
|
|
78
79
|
[LOCAL_WIDTH_VARIABLE]: width,
|
|
79
80
|
[LOCAL_HEIGHT_VARIABLE]: height,
|
|
80
81
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
81
|
-
...(fg('jfp-magma-media-cursor') ? {
|
|
82
|
-
cursor: mediaCardCursor
|
|
83
|
-
} : undefined),
|
|
84
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
85
82
|
...getResponsiveStyles(breakpoint)
|
|
86
83
|
},
|
|
87
84
|
ref: innerRef,
|
|
@@ -243,6 +243,7 @@ export var CardViewBase = function CardViewBase(_ref) {
|
|
|
243
243
|
mediaName: name,
|
|
244
244
|
status: status,
|
|
245
245
|
progress: progress,
|
|
246
|
+
mediaCardCursor: mediaCardCursor,
|
|
246
247
|
selected: selected,
|
|
247
248
|
source: cardPreview === null || cardPreview === void 0 ? void 0 : cardPreview.source
|
|
248
249
|
}, renderTypeIcon && /*#__PURE__*/React.createElement(IconWrapper, {
|
|
@@ -36,7 +36,6 @@ import { AbuseModal } from '@atlaskit/media-ui/abuseModal';
|
|
|
36
36
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
37
37
|
import { getActiveTrace } from '@atlaskit/react-ufo/experience-trace-id-context';
|
|
38
38
|
import usePressTracing from '@atlaskit/react-ufo/use-press-tracing';
|
|
39
|
-
var IMAGE_LOAD_ERROR = 'image-load-error';
|
|
40
39
|
var traceContextRetriever = function traceContextRetriever() {
|
|
41
40
|
var trace = getActiveTrace();
|
|
42
41
|
if (trace && fg('platform-filecard-ufo-trace')) {
|
|
@@ -395,16 +394,10 @@ export var FileCard = function FileCard(_ref) {
|
|
|
395
394
|
setStatus('error');
|
|
396
395
|
};
|
|
397
396
|
var onImageError = function onImageError(newCardPreview) {
|
|
398
|
-
var _onErrorRef$current;
|
|
399
397
|
if (metadata.mimeType === 'image/svg+xml') {
|
|
400
398
|
return;
|
|
401
399
|
}
|
|
402
400
|
onImageErrorBase(newCardPreview);
|
|
403
|
-
|
|
404
|
-
// The image error is not reflected in the status,
|
|
405
|
-
// as the preview might fail to load if the file itself is broken.
|
|
406
|
-
// In that case we want call onError callback.
|
|
407
|
-
(_onErrorRef$current = onErrorRef.current) === null || _onErrorRef$current === void 0 || _onErrorRef$current.call(onErrorRef, IMAGE_LOAD_ERROR);
|
|
408
401
|
};
|
|
409
402
|
var onSvgLoad = function onSvgLoad() {
|
|
410
403
|
setPreviewDidRender(true);
|
|
@@ -3,7 +3,7 @@ export var ContentLoadingErrorMessage = function ContentLoadingErrorMessage(_ref
|
|
|
3
3
|
var isHidden = _ref.isHidden;
|
|
4
4
|
return (
|
|
5
5
|
/*#__PURE__*/
|
|
6
|
-
// eslint-disable-next-line @atlaskit/design-system/use-primitives-text
|
|
6
|
+
// eslint-disable-next-line @atlaskit/design-system/use-primitives-text, @atlassian/i18n/no-literal-string-in-jsx
|
|
7
7
|
React.createElement("p", {
|
|
8
8
|
style: {
|
|
9
9
|
display: isHidden ? 'none' : 'block'
|
|
@@ -12,7 +12,8 @@ export var ImageContainer = function ImageContainer(_ref) {
|
|
|
12
12
|
progress = _ref.progress,
|
|
13
13
|
selected = _ref.selected,
|
|
14
14
|
source = _ref.source,
|
|
15
|
-
centerElements = _ref.centerElements
|
|
15
|
+
centerElements = _ref.centerElements,
|
|
16
|
+
mediaCardCursor = _ref.mediaCardCursor;
|
|
16
17
|
return /*#__PURE__*/React.createElement("div", {
|
|
17
18
|
"data-testid": fileCardImageViewSelector
|
|
18
19
|
/**
|
|
@@ -27,6 +28,7 @@ export var ImageContainer = function ImageContainer(_ref) {
|
|
|
27
28
|
"data-test-status": status,
|
|
28
29
|
"data-test-progress": progress,
|
|
29
30
|
"data-test-selected": selected,
|
|
30
|
-
"data-test-source": source
|
|
31
|
+
"data-test-source": source,
|
|
32
|
+
"data-cursor": mediaCardCursor
|
|
31
33
|
}, children);
|
|
32
34
|
};
|
|
@@ -16,6 +16,7 @@ button:focus+._1hlmjc5g{outline:solid var(--ds-border-width-focused,2px) var(--d
|
|
|
16
16
|
._1y898vuz:hover .media-card-play-button .play-icon-background{width:56px}
|
|
17
17
|
._1yf91flm:hover .media-card-tickbox{background-color:var(--_mt8cm6)}
|
|
18
18
|
._4t3ine4n{height:var(--media-wrapper-height)}
|
|
19
|
+
._5sb1v00u [data-cursor=wait]{cursor:wait}
|
|
19
20
|
._9m3z1osq>div{width:100%}
|
|
20
21
|
._bfhklslw{background-color:var(--_1jkcdu5)}
|
|
21
22
|
._c71l1osq{max-height:100%}
|
|
@@ -24,4 +25,5 @@ button:focus+._1hlmjc5g{outline:solid var(--ds-border-width-focused,2px) var(--d
|
|
|
24
25
|
._kqswh2mm{position:relative}
|
|
25
26
|
._mts3kb7n:focus-within .media-card-actions-bar{opacity:1}
|
|
26
27
|
._p12f1osq{max-width:100%}
|
|
27
|
-
._vchhusvi{box-sizing:border-box}
|
|
28
|
+
._vchhusvi{box-sizing:border-box}
|
|
29
|
+
._yfmhtlke [data-cursor=pointer]{cursor:pointer}
|
|
@@ -8,7 +8,6 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
8
8
|
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; }
|
|
9
9
|
import { newFileExperienceClassName } from '../../cardConstants';
|
|
10
10
|
import { VcMediaWrapperProps } from '@atlaskit/react-ufo/vc-media';
|
|
11
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
12
11
|
import { N0, N100, N20, N60A, N90A, B100 } from '@atlaskit/theme/colors';
|
|
13
12
|
import { getDefaultCardDimensions } from '../../../utils/cardDimensions';
|
|
14
13
|
import { getCSSUnitValue } from '../../../utils/getCSSUnitValue';
|
|
@@ -40,6 +39,9 @@ var hideNativeBrowserTextSelectionStyles = null;
|
|
|
40
39
|
var clickableButtonPlayButtonStyles = null;
|
|
41
40
|
var selectableTickboxStyle = null;
|
|
42
41
|
var tooltipStyle = null;
|
|
42
|
+
|
|
43
|
+
// These styles target data attributes to enable the exclusion from TTVC metric calculation.
|
|
44
|
+
var cursorStyle = null;
|
|
43
45
|
var getResponsiveStyles = function getResponsiveStyles(breakpoint) {
|
|
44
46
|
// dynamically setting the properties to avoid ratcheting build errors. These need to be removed however for the compiled transformation.
|
|
45
47
|
return breakpoint === 'small' ? _defineProperty(_defineProperty({}, 'fontSize', '11px'), 'lineHeight', '14px') : _defineProperty(_defineProperty({}, 'fontSize', '14px'), 'lineHeight', '22px');
|
|
@@ -52,7 +54,6 @@ export var Wrapper = function Wrapper(props) {
|
|
|
52
54
|
onMouseEnter = props.onMouseEnter,
|
|
53
55
|
innerRef = props.innerRef,
|
|
54
56
|
breakpoint = props.breakpoint,
|
|
55
|
-
mediaCardCursor = props.mediaCardCursor,
|
|
56
57
|
disableOverlay = props.disableOverlay,
|
|
57
58
|
selected = props.selected,
|
|
58
59
|
displayBackground = props.displayBackground,
|
|
@@ -67,7 +68,7 @@ export var Wrapper = function Wrapper(props) {
|
|
|
67
68
|
id: "newFileExperienceWrapper"
|
|
68
69
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
69
70
|
,
|
|
70
|
-
className: ax([wrapperStyles.default, displayBackground && "_bfhklslw", wrapperShadowKey && shadowStyleMap[wrapperShadowKey], selected && "_1p1y1j28 _1rk81j28 _14r11j28 _1np21j28", isPlayButtonClickable && "_1y898vuz _19zy8vuz", isTickBoxSelectable && "_1yf91flm _1xp5rcbj", shouldDisplayTooltip && "_9m3z1osq _10pb1osq", newFileExperienceClassName]),
|
|
71
|
+
className: ax([wrapperStyles.default, "_yfmhtlke _5sb1v00u", displayBackground && "_bfhklslw", wrapperShadowKey && shadowStyleMap[wrapperShadowKey], selected && "_1p1y1j28 _1rk81j28 _14r11j28 _1np21j28", isPlayButtonClickable && "_1y898vuz _19zy8vuz", isTickBoxSelectable && "_1yf91flm _1xp5rcbj", shouldDisplayTooltip && "_9m3z1osq _10pb1osq", newFileExperienceClassName]),
|
|
71
72
|
"data-testid": testId,
|
|
72
73
|
ref: innerRef,
|
|
73
74
|
onClick: onClick
|
|
@@ -75,9 +76,7 @@ export var Wrapper = function Wrapper(props) {
|
|
|
75
76
|
,
|
|
76
77
|
onMouseEnter: onMouseEnter
|
|
77
78
|
}, VcMediaWrapperProps, {
|
|
78
|
-
style: _objectSpread(_objectSpread({}, _objectSpread(
|
|
79
|
-
cursor: mediaCardCursor
|
|
80
|
-
} : undefined), getResponsiveStyles(breakpoint))), {}, {
|
|
79
|
+
style: _objectSpread(_objectSpread({}, _objectSpread(_defineProperty(_defineProperty({}, LOCAL_WIDTH_VARIABLE, width), LOCAL_HEIGHT_VARIABLE, height), getResponsiveStyles(breakpoint))), {}, {
|
|
81
80
|
"--_1jkcdu5": ix("var(--ds-background-neutral, ".concat(N20, ")")),
|
|
82
81
|
"--_mt8cm6": ix("var(--ds-background-input, ".concat(N0, ")")),
|
|
83
82
|
"--_13xf2t5": ix("var(--ds-icon-subtle, ".concat(N100, ")"))
|
|
@@ -6,8 +6,6 @@ import { type MediaCardErrorPrimaryReason } from '../errors';
|
|
|
6
6
|
import { type CardAppearance, type CardDimensions, type CardEventProps, type TitleBoxIcon } from '../types';
|
|
7
7
|
import { type MediaFilePreviewErrorPrimaryReason } from '@atlaskit/media-file-preview';
|
|
8
8
|
import { type CardAction } from './actions';
|
|
9
|
-
declare const IMAGE_LOAD_ERROR = "image-load-error";
|
|
10
|
-
export type ImageLoadErrorType = typeof IMAGE_LOAD_ERROR;
|
|
11
9
|
export interface FileCardProps extends CardEventProps {
|
|
12
10
|
/** Overlay the media file. */
|
|
13
11
|
readonly disableOverlay?: boolean;
|
|
@@ -57,7 +55,6 @@ export interface FileCardProps extends CardEventProps {
|
|
|
57
55
|
/** Sets options for viewer **/
|
|
58
56
|
readonly includeHashForDuplicateFiles?: boolean;
|
|
59
57
|
/** General Error handling include status errors and display errors*/
|
|
60
|
-
readonly onError?: (reason: MediaFilePreviewErrorPrimaryReason | MediaCardErrorPrimaryReason
|
|
58
|
+
readonly onError?: (reason: MediaFilePreviewErrorPrimaryReason | MediaCardErrorPrimaryReason) => void;
|
|
61
59
|
}
|
|
62
60
|
export declare const FileCard: ({ appearance, resizeMode, isLazy, disableOverlay, featureFlags, identifier, ssr, dimensions, originalDimensions, contextId, alt, actions, shouldEnableDownloadButton, useInlinePlayer, shouldOpenMediaViewer, onFullscreenChange, selectable, selected, testId, titleBoxBgColor, titleBoxIcon, shouldHideTooltip, mediaViewerItems, onClick, onMouseEnter, videoControlsWrapperRef, viewerOptions, includeHashForDuplicateFiles, onError, }: FileCardProps) => React.JSX.Element;
|
|
63
|
-
export {};
|
|
@@ -2,5 +2,5 @@ import React from 'react';
|
|
|
2
2
|
type ContentLoadingErrorMessageProps = {
|
|
3
3
|
isHidden?: boolean;
|
|
4
4
|
};
|
|
5
|
-
export declare const ContentLoadingErrorMessage: ({ isHidden }: ContentLoadingErrorMessageProps) => React.JSX.Element;
|
|
5
|
+
export declare const ContentLoadingErrorMessage: ({ isHidden, }: ContentLoadingErrorMessageProps) => React.JSX.Element;
|
|
6
6
|
export {};
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
+
import type { MediaCardCursor } from '../../../types';
|
|
1
2
|
type ImageContainerProps = {
|
|
2
3
|
children: React.ReactNode;
|
|
3
4
|
centerElements?: boolean;
|
|
4
5
|
testId: string;
|
|
6
|
+
mediaCardCursor?: MediaCardCursor;
|
|
5
7
|
mediaName?: string;
|
|
6
8
|
status?: string;
|
|
7
9
|
progress?: number;
|
|
8
10
|
selected?: boolean;
|
|
9
11
|
source?: string;
|
|
10
12
|
};
|
|
11
|
-
export declare const ImageContainer: ({ children, mediaName, status, progress, selected, source, centerElements, }: ImageContainerProps) => JSX.Element;
|
|
13
|
+
export declare const ImageContainer: ({ children, mediaName, status, progress, selected, source, centerElements, mediaCardCursor, }: ImageContainerProps) => JSX.Element;
|
|
12
14
|
export {};
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import type { MediaCardCursor } from '../../../types';
|
|
2
3
|
type ImageContainerProps = {
|
|
3
4
|
children: React.ReactNode;
|
|
4
5
|
centerElements?: boolean;
|
|
5
6
|
testId: string;
|
|
7
|
+
mediaCardCursor?: MediaCardCursor;
|
|
6
8
|
mediaName?: string;
|
|
7
9
|
status?: string;
|
|
8
10
|
progress?: number;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -11,7 +11,6 @@ import { type CardAction } from './card/actions';
|
|
|
11
11
|
import { type MediaCardError, type MediaCardErrorPrimaryReason } from './errors';
|
|
12
12
|
import { type ViewerOptionsProps } from '@atlaskit/media-viewer';
|
|
13
13
|
import type { MediaFilePreviewErrorPrimaryReason } from '@atlaskit/media-file-preview';
|
|
14
|
-
import type { ImageLoadErrorType } from './card/fileCard';
|
|
15
14
|
export type CardStatus = 'uploading' | 'loading' | 'processing' | 'loading-preview' | 'complete' | 'error' | 'failed-processing';
|
|
16
15
|
export type FilePreviewStatus = {
|
|
17
16
|
hasFilesize: boolean;
|
|
@@ -112,7 +111,7 @@ export interface CardProps extends SharedCardProps, CardEventProps {
|
|
|
112
111
|
/** General Media Settings */
|
|
113
112
|
readonly mediaSettings?: MediaSettings;
|
|
114
113
|
/** General Error handling include status errors and display errors*/
|
|
115
|
-
readonly onError?: (reason: MediaFilePreviewErrorPrimaryReason | MediaCardErrorPrimaryReason
|
|
114
|
+
readonly onError?: (reason: MediaFilePreviewErrorPrimaryReason | MediaCardErrorPrimaryReason) => void;
|
|
116
115
|
}
|
|
117
116
|
export interface CardState {
|
|
118
117
|
status: CardStatus;
|
|
@@ -3,4 +3,4 @@ export type ViewportDetectorProps = PropsWithChildren<{
|
|
|
3
3
|
cardEl: HTMLElement | null;
|
|
4
4
|
onVisible: () => void;
|
|
5
5
|
}>;
|
|
6
|
-
export declare const ViewportDetector: ({ cardEl, onVisible, children }: ViewportDetectorProps) => React.JSX.Element;
|
|
6
|
+
export declare const ViewportDetector: ({ cardEl, onVisible, children, }: ViewportDetectorProps) => React.JSX.Element;
|
|
@@ -6,8 +6,6 @@ import { type MediaCardErrorPrimaryReason } from '../errors';
|
|
|
6
6
|
import { type CardAppearance, type CardDimensions, type CardEventProps, type TitleBoxIcon } from '../types';
|
|
7
7
|
import { type MediaFilePreviewErrorPrimaryReason } from '@atlaskit/media-file-preview';
|
|
8
8
|
import { type CardAction } from './actions';
|
|
9
|
-
declare const IMAGE_LOAD_ERROR = "image-load-error";
|
|
10
|
-
export type ImageLoadErrorType = typeof IMAGE_LOAD_ERROR;
|
|
11
9
|
export interface FileCardProps extends CardEventProps {
|
|
12
10
|
/** Overlay the media file. */
|
|
13
11
|
readonly disableOverlay?: boolean;
|
|
@@ -57,7 +55,6 @@ export interface FileCardProps extends CardEventProps {
|
|
|
57
55
|
/** Sets options for viewer **/
|
|
58
56
|
readonly includeHashForDuplicateFiles?: boolean;
|
|
59
57
|
/** General Error handling include status errors and display errors*/
|
|
60
|
-
readonly onError?: (reason: MediaFilePreviewErrorPrimaryReason | MediaCardErrorPrimaryReason
|
|
58
|
+
readonly onError?: (reason: MediaFilePreviewErrorPrimaryReason | MediaCardErrorPrimaryReason) => void;
|
|
61
59
|
}
|
|
62
60
|
export declare const FileCard: ({ appearance, resizeMode, isLazy, disableOverlay, featureFlags, identifier, ssr, dimensions, originalDimensions, contextId, alt, actions, shouldEnableDownloadButton, useInlinePlayer, shouldOpenMediaViewer, onFullscreenChange, selectable, selected, testId, titleBoxBgColor, titleBoxIcon, shouldHideTooltip, mediaViewerItems, onClick, onMouseEnter, videoControlsWrapperRef, viewerOptions, includeHashForDuplicateFiles, onError, }: FileCardProps) => React.JSX.Element;
|
|
63
|
-
export {};
|
|
@@ -2,5 +2,5 @@ import React from 'react';
|
|
|
2
2
|
type ContentLoadingErrorMessageProps = {
|
|
3
3
|
isHidden?: boolean;
|
|
4
4
|
};
|
|
5
|
-
export declare const ContentLoadingErrorMessage: ({ isHidden }: ContentLoadingErrorMessageProps) => React.JSX.Element;
|
|
5
|
+
export declare const ContentLoadingErrorMessage: ({ isHidden, }: ContentLoadingErrorMessageProps) => React.JSX.Element;
|
|
6
6
|
export {};
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
+
import type { MediaCardCursor } from '../../../types';
|
|
1
2
|
type ImageContainerProps = {
|
|
2
3
|
children: React.ReactNode;
|
|
3
4
|
centerElements?: boolean;
|
|
4
5
|
testId: string;
|
|
6
|
+
mediaCardCursor?: MediaCardCursor;
|
|
5
7
|
mediaName?: string;
|
|
6
8
|
status?: string;
|
|
7
9
|
progress?: number;
|
|
8
10
|
selected?: boolean;
|
|
9
11
|
source?: string;
|
|
10
12
|
};
|
|
11
|
-
export declare const ImageContainer: ({ children, mediaName, status, progress, selected, source, centerElements, }: ImageContainerProps) => JSX.Element;
|
|
13
|
+
export declare const ImageContainer: ({ children, mediaName, status, progress, selected, source, centerElements, mediaCardCursor, }: ImageContainerProps) => JSX.Element;
|
|
12
14
|
export {};
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import type { MediaCardCursor } from '../../../types';
|
|
2
3
|
type ImageContainerProps = {
|
|
3
4
|
children: React.ReactNode;
|
|
4
5
|
centerElements?: boolean;
|
|
5
6
|
testId: string;
|
|
7
|
+
mediaCardCursor?: MediaCardCursor;
|
|
6
8
|
mediaName?: string;
|
|
7
9
|
status?: string;
|
|
8
10
|
progress?: number;
|
|
@@ -11,7 +11,6 @@ import { type CardAction } from './card/actions';
|
|
|
11
11
|
import { type MediaCardError, type MediaCardErrorPrimaryReason } from './errors';
|
|
12
12
|
import { type ViewerOptionsProps } from '@atlaskit/media-viewer';
|
|
13
13
|
import type { MediaFilePreviewErrorPrimaryReason } from '@atlaskit/media-file-preview';
|
|
14
|
-
import type { ImageLoadErrorType } from './card/fileCard';
|
|
15
14
|
export type CardStatus = 'uploading' | 'loading' | 'processing' | 'loading-preview' | 'complete' | 'error' | 'failed-processing';
|
|
16
15
|
export type FilePreviewStatus = {
|
|
17
16
|
hasFilesize: boolean;
|
|
@@ -112,7 +111,7 @@ export interface CardProps extends SharedCardProps, CardEventProps {
|
|
|
112
111
|
/** General Media Settings */
|
|
113
112
|
readonly mediaSettings?: MediaSettings;
|
|
114
113
|
/** General Error handling include status errors and display errors*/
|
|
115
|
-
readonly onError?: (reason: MediaFilePreviewErrorPrimaryReason | MediaCardErrorPrimaryReason
|
|
114
|
+
readonly onError?: (reason: MediaFilePreviewErrorPrimaryReason | MediaCardErrorPrimaryReason) => void;
|
|
116
115
|
}
|
|
117
116
|
export interface CardState {
|
|
118
117
|
status: CardStatus;
|
|
@@ -3,4 +3,4 @@ export type ViewportDetectorProps = PropsWithChildren<{
|
|
|
3
3
|
cardEl: HTMLElement | null;
|
|
4
4
|
onVisible: () => void;
|
|
5
5
|
}>;
|
|
6
|
-
export declare const ViewportDetector: ({ cardEl, onVisible, children }: ViewportDetectorProps) => React.JSX.Element;
|
|
6
|
+
export declare const ViewportDetector: ({ cardEl, onVisible, children, }: ViewportDetectorProps) => React.JSX.Element;
|
|
@@ -20,7 +20,10 @@ import { CardLoading, CardError, Card } from '../src';
|
|
|
20
20
|
const mediaClientConfig = createStorybookMediaClientConfig();
|
|
21
21
|
// standard
|
|
22
22
|
const successIdentifier: FileIdentifier = imageFileId;
|
|
23
|
-
export const standardCards
|
|
23
|
+
export const standardCards: {
|
|
24
|
+
title: string;
|
|
25
|
+
content: React.JSX.Element;
|
|
26
|
+
}[] = [
|
|
24
27
|
{
|
|
25
28
|
title: 'Image',
|
|
26
29
|
content: (
|
|
@@ -33,7 +36,10 @@ export const standardCards = [
|
|
|
33
36
|
},
|
|
34
37
|
];
|
|
35
38
|
|
|
36
|
-
export const cardWithContextId
|
|
39
|
+
export const cardWithContextId: {
|
|
40
|
+
title: string;
|
|
41
|
+
content: React.JSX.Element;
|
|
42
|
+
}[] = [
|
|
37
43
|
{
|
|
38
44
|
title: 'Image with parameter',
|
|
39
45
|
content: (
|
|
@@ -48,7 +54,10 @@ export const cardWithContextId = [
|
|
|
48
54
|
];
|
|
49
55
|
|
|
50
56
|
//error cards
|
|
51
|
-
export const errorCardsDark
|
|
57
|
+
export const errorCardsDark: {
|
|
58
|
+
title: string;
|
|
59
|
+
content: React.JSX.Element;
|
|
60
|
+
}[] = [
|
|
52
61
|
{
|
|
53
62
|
title: 'Image',
|
|
54
63
|
content: (
|
|
@@ -57,7 +66,10 @@ export const errorCardsDark = [
|
|
|
57
66
|
},
|
|
58
67
|
];
|
|
59
68
|
|
|
60
|
-
export const errorCards
|
|
69
|
+
export const errorCards: {
|
|
70
|
+
title: string;
|
|
71
|
+
content: React.JSX.Element;
|
|
72
|
+
}[] = [
|
|
61
73
|
{
|
|
62
74
|
title: 'Image',
|
|
63
75
|
content: (
|
|
@@ -77,7 +89,10 @@ export const errorCards = [
|
|
|
77
89
|
},
|
|
78
90
|
];
|
|
79
91
|
|
|
80
|
-
export const menuCards
|
|
92
|
+
export const menuCards: {
|
|
93
|
+
title: string;
|
|
94
|
+
content: React.JSX.Element;
|
|
95
|
+
}[] = [
|
|
81
96
|
{
|
|
82
97
|
title: 'Image',
|
|
83
98
|
content: (
|
|
@@ -92,10 +107,16 @@ export const menuCards = [
|
|
|
92
107
|
];
|
|
93
108
|
|
|
94
109
|
// api cards
|
|
95
|
-
export const apiCards
|
|
110
|
+
export const apiCards: {
|
|
111
|
+
title: string;
|
|
112
|
+
content: React.JSX.Element;
|
|
113
|
+
}[] = createApiCards('image', successIdentifier);
|
|
96
114
|
|
|
97
115
|
// no thumbnail
|
|
98
|
-
export const noThumbnailCards
|
|
116
|
+
export const noThumbnailCards: {
|
|
117
|
+
title: string;
|
|
118
|
+
content: React.JSX.Element;
|
|
119
|
+
}[] = [
|
|
99
120
|
{
|
|
100
121
|
title: 'Image',
|
|
101
122
|
content: (
|
|
@@ -105,7 +126,10 @@ export const noThumbnailCards = [
|
|
|
105
126
|
];
|
|
106
127
|
|
|
107
128
|
// lazy load
|
|
108
|
-
export const lazyLoadCards
|
|
129
|
+
export const lazyLoadCards: {
|
|
130
|
+
title: string;
|
|
131
|
+
content: React.JSX.Element;
|
|
132
|
+
}[] = [
|
|
109
133
|
{
|
|
110
134
|
title: 'Lazy',
|
|
111
135
|
content: (
|
|
@@ -131,7 +155,10 @@ export const lazyLoadCards = [
|
|
|
131
155
|
];
|
|
132
156
|
|
|
133
157
|
// no hover state cards
|
|
134
|
-
export const noHoverStateCards
|
|
158
|
+
export const noHoverStateCards: {
|
|
159
|
+
title: string;
|
|
160
|
+
content: React.JSX.Element;
|
|
161
|
+
}[] = [
|
|
135
162
|
{
|
|
136
163
|
title: 'Overlay disabled',
|
|
137
164
|
content: (
|
|
@@ -164,7 +191,10 @@ export const fileWithNoCollection: FileIdentifier = {
|
|
|
164
191
|
id: 'e84c54a4-38b2-463f-ae27-5ba043c3e4c2',
|
|
165
192
|
};
|
|
166
193
|
|
|
167
|
-
export const collectionConfigCards
|
|
194
|
+
export const collectionConfigCards: {
|
|
195
|
+
title: string;
|
|
196
|
+
content: React.JSX.Element;
|
|
197
|
+
}[] = [
|
|
168
198
|
{
|
|
169
199
|
title: 'Standalone file (NO collection)',
|
|
170
200
|
content: <Card identifier={fileWithNoCollection} mediaClientConfig={mediaClientConfig} />,
|
|
@@ -181,7 +211,10 @@ const divStyle = {
|
|
|
181
211
|
};
|
|
182
212
|
const dimensions = { height: 50, width: 50 };
|
|
183
213
|
|
|
184
|
-
export const lightDefaultCards
|
|
214
|
+
export const lightDefaultCards: {
|
|
215
|
+
title: string;
|
|
216
|
+
content: React.JSX.Element;
|
|
217
|
+
}[] = [
|
|
185
218
|
{
|
|
186
219
|
title: 'Medium Loading',
|
|
187
220
|
content: (
|
|
@@ -202,7 +235,10 @@ export const lightDefaultCards = [
|
|
|
202
235
|
},
|
|
203
236
|
];
|
|
204
237
|
|
|
205
|
-
export const lightResizedCards
|
|
238
|
+
export const lightResizedCards: {
|
|
239
|
+
title: string;
|
|
240
|
+
content: React.JSX.Element;
|
|
241
|
+
}[] = [
|
|
206
242
|
{
|
|
207
243
|
title: 'Medium Loading',
|
|
208
244
|
content: <CardLoading dimensions={dimensions} />,
|
|
@@ -214,25 +250,30 @@ export const lightResizedCards = [
|
|
|
214
250
|
];
|
|
215
251
|
|
|
216
252
|
// file cards
|
|
217
|
-
export const videoFileCard = (
|
|
253
|
+
export const videoFileCard: React.JSX.Element = (
|
|
218
254
|
<Card mediaClientConfig={mediaClientConfig} identifier={videoFileId} />
|
|
219
255
|
);
|
|
220
256
|
|
|
221
|
-
export const imageFileCard = (
|
|
257
|
+
export const imageFileCard: React.JSX.Element = (
|
|
222
258
|
<Card mediaClientConfig={mediaClientConfig} identifier={imageFileId} />
|
|
223
259
|
);
|
|
224
260
|
|
|
225
|
-
export const audioFileCard = (
|
|
261
|
+
export const audioFileCard: React.JSX.Element = (
|
|
226
262
|
<Card mediaClientConfig={mediaClientConfig} identifier={audioFileId} />
|
|
227
263
|
);
|
|
228
264
|
|
|
229
|
-
export const docFileCard
|
|
265
|
+
export const docFileCard: React.JSX.Element = (
|
|
266
|
+
<Card mediaClientConfig={mediaClientConfig} identifier={docFileId} />
|
|
267
|
+
);
|
|
230
268
|
|
|
231
|
-
export const unknownFileCard = (
|
|
269
|
+
export const unknownFileCard: React.JSX.Element = (
|
|
232
270
|
<Card mediaClientConfig={mediaClientConfig} identifier={unknownFileId} />
|
|
233
271
|
);
|
|
234
272
|
|
|
235
|
-
export const resizingDefaultCards
|
|
273
|
+
export const resizingDefaultCards: {
|
|
274
|
+
title: string;
|
|
275
|
+
content: React.JSX.Element;
|
|
276
|
+
}[] = [
|
|
236
277
|
{
|
|
237
278
|
title: 'Small',
|
|
238
279
|
content: <Card identifier={smallImageFileId} mediaClientConfig={mediaClientConfig} />,
|
|
@@ -247,7 +288,10 @@ export const resizingDefaultCards = [
|
|
|
247
288
|
},
|
|
248
289
|
];
|
|
249
290
|
|
|
250
|
-
export const croppedCards
|
|
291
|
+
export const croppedCards: {
|
|
292
|
+
title: string;
|
|
293
|
+
content: React.JSX.Element;
|
|
294
|
+
}[] = [
|
|
251
295
|
{
|
|
252
296
|
title: 'Small',
|
|
253
297
|
content: (
|
|
@@ -268,7 +312,10 @@ export const croppedCards = [
|
|
|
268
312
|
},
|
|
269
313
|
];
|
|
270
314
|
|
|
271
|
-
export const fitCards
|
|
315
|
+
export const fitCards: {
|
|
316
|
+
title: string;
|
|
317
|
+
content: React.JSX.Element;
|
|
318
|
+
}[] = [
|
|
272
319
|
{
|
|
273
320
|
title: 'Small',
|
|
274
321
|
content: (
|
|
@@ -289,7 +336,10 @@ export const fitCards = [
|
|
|
289
336
|
},
|
|
290
337
|
];
|
|
291
338
|
|
|
292
|
-
export const fullFitCards
|
|
339
|
+
export const fullFitCards: {
|
|
340
|
+
title: string;
|
|
341
|
+
content: React.JSX.Element;
|
|
342
|
+
}[] = [
|
|
293
343
|
{
|
|
294
344
|
title: 'Small',
|
|
295
345
|
content: (
|
|
@@ -322,7 +372,10 @@ export const fullFitCards = [
|
|
|
322
372
|
},
|
|
323
373
|
];
|
|
324
374
|
|
|
325
|
-
export const stretchyFitCards
|
|
375
|
+
export const stretchyFitCards: {
|
|
376
|
+
title: string;
|
|
377
|
+
content: React.JSX.Element;
|
|
378
|
+
}[] = [
|
|
326
379
|
{
|
|
327
380
|
title: 'Small',
|
|
328
381
|
content: (
|
|
@@ -33,7 +33,13 @@ export const mouseEnterHandler = (result: CardEvent) => {
|
|
|
33
33
|
console.log('mouseEnter', result.mediaItemDetails);
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
-
export const createApiCards = (
|
|
36
|
+
export const createApiCards = (
|
|
37
|
+
appearance: CardAppearance,
|
|
38
|
+
identifier: Identifier,
|
|
39
|
+
): {
|
|
40
|
+
title: string;
|
|
41
|
+
content: React.JSX.Element;
|
|
42
|
+
}[] => {
|
|
37
43
|
// API methods
|
|
38
44
|
const apiCards = [
|
|
39
45
|
{
|
|
@@ -74,7 +80,11 @@ export const closeAction = {
|
|
|
74
80
|
console.log('close');
|
|
75
81
|
},
|
|
76
82
|
};
|
|
77
|
-
export const deleteAction
|
|
83
|
+
export const deleteAction: {
|
|
84
|
+
label: string;
|
|
85
|
+
handler: () => void;
|
|
86
|
+
icon: React.JSX.Element;
|
|
87
|
+
} = {
|
|
78
88
|
label: 'Delete',
|
|
79
89
|
handler: () => {
|
|
80
90
|
console.log('delete');
|
|
@@ -121,7 +131,7 @@ export const MainWrapper = ({
|
|
|
121
131
|
children,
|
|
122
132
|
developmentOnly,
|
|
123
133
|
disableFeatureFlagWrapper = false,
|
|
124
|
-
}: MainWrapperProps) => {
|
|
134
|
+
}: MainWrapperProps): React.JSX.Element => {
|
|
125
135
|
enableMediaUfoLogger(payloadPublisher);
|
|
126
136
|
return (
|
|
127
137
|
<>
|
|
@@ -148,7 +158,7 @@ export const mediaCardErrorState = (error?: string): MediaCardError | undefined
|
|
|
148
158
|
}
|
|
149
159
|
};
|
|
150
160
|
|
|
151
|
-
export const SSRAnalyticsWrapper = ({ children }: PropsWithChildren<{}>) => {
|
|
161
|
+
export const SSRAnalyticsWrapper = ({ children }: PropsWithChildren<{}>): React.JSX.Element => {
|
|
152
162
|
const mockClient: AnalyticsWebClient = {
|
|
153
163
|
sendUIEvent: (e) => console.debug('UI event', e),
|
|
154
164
|
sendOperationalEvent: (e) => console.debug('Operational event', e),
|
|
@@ -15,7 +15,7 @@ export class SelectableCard extends Component<SelectableCardProps, { selected: b
|
|
|
15
15
|
this.state = { selected: false };
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
render() {
|
|
18
|
+
render(): React.JSX.Element | null {
|
|
19
19
|
const { mediaClientConfig, identifier } = this.props;
|
|
20
20
|
const { selected } = this.state;
|
|
21
21
|
|
|
@@ -12,7 +12,11 @@ export interface SimulateSsrParams
|
|
|
12
12
|
const randomStr = () => Math.random().toString(36).substr(2, 9);
|
|
13
13
|
const generateSsrPageId = () => `media-ssr-page-${randomStr()}-${randomStr()}`;
|
|
14
14
|
|
|
15
|
-
export const SimulateSsr = ({
|
|
15
|
+
export const SimulateSsr = ({
|
|
16
|
+
serverPage,
|
|
17
|
+
hydratePage,
|
|
18
|
+
...divProps
|
|
19
|
+
}: SimulateSsrParams): React.JSX.Element => {
|
|
16
20
|
const id = useMemo(generateSsrPageId, []);
|
|
17
21
|
|
|
18
22
|
useEffect(() => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/media-card",
|
|
3
|
-
"version": "79.
|
|
3
|
+
"version": "79.8.1",
|
|
4
4
|
"description": "Includes all media card related components, CardView, CardViewSmall, Card...",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@atlaskit/analytics-next": "^11.1.0",
|
|
35
35
|
"@atlaskit/dropdown-menu": "^16.3.0",
|
|
36
|
-
"@atlaskit/editor-shared-styles": "^3.
|
|
36
|
+
"@atlaskit/editor-shared-styles": "^3.10.0",
|
|
37
37
|
"@atlaskit/icon": "^29.0.0",
|
|
38
38
|
"@atlaskit/link": "^3.2.0",
|
|
39
39
|
"@atlaskit/media-client": "^35.6.0",
|
|
@@ -44,12 +44,12 @@
|
|
|
44
44
|
"@atlaskit/media-ui": "^28.7.0",
|
|
45
45
|
"@atlaskit/media-viewer": "^52.4.0",
|
|
46
46
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
47
|
-
"@atlaskit/primitives": "^16.
|
|
48
|
-
"@atlaskit/react-ufo": "^4.
|
|
47
|
+
"@atlaskit/primitives": "^16.2.0",
|
|
48
|
+
"@atlaskit/react-ufo": "^4.15.0",
|
|
49
49
|
"@atlaskit/spinner": "^19.0.0",
|
|
50
50
|
"@atlaskit/theme": "^21.0.0",
|
|
51
|
-
"@atlaskit/tokens": "^8.
|
|
52
|
-
"@atlaskit/tooltip": "^20.
|
|
51
|
+
"@atlaskit/tokens": "^8.1.0",
|
|
52
|
+
"@atlaskit/tooltip": "^20.10.0",
|
|
53
53
|
"@atlaskit/ufo": "^0.4.0",
|
|
54
54
|
"@atlaskit/visually-hidden": "^3.0.0",
|
|
55
55
|
"@babel/runtime": "^7.0.0",
|