@atlaskit/media-card 78.3.0 → 78.4.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 +27 -0
- package/dist/cjs/card/card.js +1 -1
- package/dist/cjs/card/cardView.js +4 -4
- package/dist/cjs/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/cjs/card/svgView/svgView.js +1 -1
- package/dist/cjs/card/ui/cardSpinner/cardSpinner.js +159 -0
- package/dist/cjs/card/ui/cardSpinner/constants.js +13 -0
- package/dist/cjs/card/ui/cardSpinner/types.js +1 -0
- package/dist/cjs/card/ui/imageRenderer/imageRenderer.js +4 -4
- package/dist/cjs/card/ui/tickBox/tickBoxWrapper.js +1 -1
- package/dist/cjs/card/ui/unhandledErrorCard/index.js +1 -2
- 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 +4 -4
- package/dist/es2019/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/es2019/card/svgView/svgView.js +1 -1
- package/dist/es2019/card/ui/cardSpinner/cardSpinner.js +150 -0
- package/dist/es2019/card/ui/cardSpinner/constants.js +7 -0
- package/dist/es2019/card/ui/cardSpinner/types.js +0 -0
- package/dist/es2019/card/ui/imageRenderer/imageRenderer.js +4 -4
- package/dist/es2019/card/ui/tickBox/tickBoxWrapper.js +1 -1
- package/dist/es2019/card/ui/unhandledErrorCard/index.js +1 -2
- 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 +4 -4
- package/dist/esm/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/esm/card/svgView/svgView.js +1 -1
- package/dist/esm/card/ui/cardSpinner/cardSpinner.js +152 -0
- package/dist/esm/card/ui/cardSpinner/constants.js +7 -0
- package/dist/esm/card/ui/cardSpinner/types.js +0 -0
- package/dist/esm/card/ui/imageRenderer/imageRenderer.js +4 -4
- package/dist/esm/card/ui/tickBox/tickBoxWrapper.js +1 -1
- package/dist/esm/card/ui/unhandledErrorCard/index.js +1 -2
- package/dist/esm/inline/loader.js +1 -1
- package/dist/esm/utils/ufoExperiences.js +1 -1
- package/dist/types/card/ui/cardSpinner/cardSpinner.d.ts +22 -0
- package/dist/types/card/ui/cardSpinner/constants.d.ts +4 -0
- package/dist/types/card/ui/cardSpinner/types.d.ts +36 -0
- package/dist/types/card/ui/imageRenderer/imageRenderer.d.ts +1 -1
- package/dist/types-ts4.5/card/ui/cardSpinner/cardSpinner.d.ts +22 -0
- package/dist/types-ts4.5/card/ui/cardSpinner/constants.d.ts +4 -0
- package/dist/types-ts4.5/card/ui/cardSpinner/types.d.ts +36 -0
- package/dist/types-ts4.5/card/ui/imageRenderer/imageRenderer.d.ts +1 -1
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
# @atlaskit/media-card
|
|
2
2
|
|
|
3
|
+
## 78.4.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#141583](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/141583)
|
|
8
|
+
[`ba6def6b9d3ce`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/ba6def6b9d3ce) -
|
|
9
|
+
Updated Media card and UI to avoid contributing to TTVC metrics
|
|
10
|
+
|
|
11
|
+
- Media card will always render the `img`, even while it is still loading (in that case, the `img`
|
|
12
|
+
will just be hidden). It will also use a custom loading spinner with no interaction context.
|
|
13
|
+
- Media image will allow a null value for the image source. It will also always render the `img`
|
|
14
|
+
tag and switch the css prop `display` according to the `src` value.
|
|
15
|
+
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
18
|
+
## 78.4.0
|
|
19
|
+
|
|
20
|
+
### Minor Changes
|
|
21
|
+
|
|
22
|
+
- [#140915](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/140915)
|
|
23
|
+
[`36b5acc412af5`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/36b5acc412af5) -
|
|
24
|
+
Design system typography uplift
|
|
25
|
+
|
|
26
|
+
### Patch Changes
|
|
27
|
+
|
|
28
|
+
- Updated dependencies
|
|
29
|
+
|
|
3
30
|
## 78.3.0
|
|
4
31
|
|
|
5
32
|
### Minor Changes
|
package/dist/cjs/card/card.js
CHANGED
|
@@ -21,7 +21,7 @@ var _excluded = ["identifier"];
|
|
|
21
21
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
22
22
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
23
23
|
var packageName = "@atlaskit/media-card";
|
|
24
|
-
var packageVersion = "78.
|
|
24
|
+
var packageVersion = "78.4.1";
|
|
25
25
|
var CardBase = exports.CardBase = function CardBase(_ref) {
|
|
26
26
|
var identifier = _ref.identifier,
|
|
27
27
|
otherProps = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
@@ -12,7 +12,7 @@ var _react = require("@emotion/react");
|
|
|
12
12
|
var _react2 = _interopRequireWildcard(require("react"));
|
|
13
13
|
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
14
14
|
var _mimeTypeIcon = require("@atlaskit/media-ui/mime-type-icon");
|
|
15
|
-
var
|
|
15
|
+
var _cardSpinner = _interopRequireDefault(require("./ui/cardSpinner/cardSpinner"));
|
|
16
16
|
var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
|
|
17
17
|
var _mediaUi = require("@atlaskit/media-ui");
|
|
18
18
|
var _analytics = require("../utils/analytics");
|
|
@@ -122,7 +122,7 @@ var CardViewBase = exports.CardViewBase = function CardViewBase(_ref) {
|
|
|
122
122
|
var isZeroSize = metadata && metadata.size === 0;
|
|
123
123
|
var defaultConfig = {
|
|
124
124
|
renderTypeIcon: !didImageRender,
|
|
125
|
-
renderImageRenderer:
|
|
125
|
+
renderImageRenderer: true,
|
|
126
126
|
renderPlayButton: !!cardPreview && mediaType === 'video',
|
|
127
127
|
renderBlanket: !disableOverlay,
|
|
128
128
|
renderTitleBox: !disableOverlay,
|
|
@@ -250,10 +250,10 @@ var CardViewBase = exports.CardViewBase = function CardViewBase(_ref) {
|
|
|
250
250
|
}), iconMessage), renderSpinner && (0, _react.jsx)(_iconWrapper.IconWrapper, {
|
|
251
251
|
breakpoint: breakpoint,
|
|
252
252
|
hasTitleBox: hasVisibleTitleBox
|
|
253
|
-
}, (0, _react.jsx)(
|
|
253
|
+
}, (0, _react.jsx)(_cardSpinner.default, {
|
|
254
254
|
testId: "media-card-loading",
|
|
255
255
|
interactionName: "media-card-loading"
|
|
256
|
-
})), renderImageRenderer &&
|
|
256
|
+
})), renderImageRenderer && (0, _react.jsx)(_imageRenderer.ImageRenderer, {
|
|
257
257
|
cardPreview: cardPreview,
|
|
258
258
|
mediaType: (metadata === null || metadata === void 0 ? void 0 : metadata.mediaType) || 'unknown',
|
|
259
259
|
alt: alt !== null && alt !== void 0 ? alt : name,
|
|
@@ -90,7 +90,7 @@ var WrappedMediaCardAnalyticsErrorBoundary = /*#__PURE__*/function (_React$Compo
|
|
|
90
90
|
}(_react.default.Component);
|
|
91
91
|
(0, _defineProperty2.default)(WrappedMediaCardAnalyticsErrorBoundary, "displayName", 'MediaCardAnalyticsErrorBoundary');
|
|
92
92
|
var packageName = "@atlaskit/media-card";
|
|
93
|
-
var packageVersion = "78.
|
|
93
|
+
var packageVersion = "78.4.1";
|
|
94
94
|
|
|
95
95
|
// @ts-ignore: [PIT-1685] Fails in post-office due to backwards incompatibility issue with React 18
|
|
96
96
|
var MediaCardAnalyticsErrorBoundary = (0, _mediaCommon.withMediaAnalyticsContext)({
|
|
@@ -123,7 +123,7 @@ var SvgViewBase = exports.SvgViewBase = function SvgViewBase(_ref) {
|
|
|
123
123
|
visibility: didSvgRender ? 'visible' : 'hidden'
|
|
124
124
|
}, svgDimensions),
|
|
125
125
|
ref: imgRef
|
|
126
|
-
}),
|
|
126
|
+
}), !didSvgRender && (0, _react.jsx)(_imageRenderer.ImageRenderer, {
|
|
127
127
|
cardPreview: cardPreview,
|
|
128
128
|
onImageLoad: onPreviewLoad,
|
|
129
129
|
mediaType: 'image',
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _react2 = require("@emotion/react");
|
|
10
|
+
var _colors = require("@atlaskit/theme/colors");
|
|
11
|
+
var _constants = require("./constants");
|
|
12
|
+
/**
|
|
13
|
+
* @jsxRuntime classic
|
|
14
|
+
* @jsx jsx
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Note: CardSpinner is almost a direct copy of Spinner from '@atlaskit/spinner', the only difference
|
|
19
|
+
* being the removal of interaction tracing.
|
|
20
|
+
* Removing interaction tracing ensures that Media Card is not contributing to Jira's TTAI and TTVC metrics.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Returns the appropriate circle stroke color.
|
|
27
|
+
*/
|
|
28
|
+
function getStrokeColor(appearance) {
|
|
29
|
+
return appearance === 'inherit' ? "var(--ds-icon-subtle, ".concat(_colors.N500, ")") : "var(--ds-icon-inverse, ".concat(_colors.N0, ")");
|
|
30
|
+
}
|
|
31
|
+
var rotate = (0, _react2.keyframes)({
|
|
32
|
+
to: {
|
|
33
|
+
transform: 'rotate(360deg)'
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
var rotateStyles = (0, _react2.css)({
|
|
37
|
+
animation: "".concat(rotate, " 0.86s infinite"),
|
|
38
|
+
animationTimingFunction: 'cubic-bezier(0.4, 0.15, 0.6, 0.85)',
|
|
39
|
+
transformOrigin: 'center'
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* There are three parts to the load in animation:
|
|
44
|
+
* 1. Fade in
|
|
45
|
+
* 2. Accelerated spin
|
|
46
|
+
* 3. Stretch the spinner line
|
|
47
|
+
*/
|
|
48
|
+
var loadIn = (0, _react2.keyframes)({
|
|
49
|
+
from: {
|
|
50
|
+
transform: 'rotate(50deg)',
|
|
51
|
+
opacity: 0,
|
|
52
|
+
strokeDashoffset: 60
|
|
53
|
+
},
|
|
54
|
+
to: {
|
|
55
|
+
transform: 'rotate(230deg)',
|
|
56
|
+
opacity: 1,
|
|
57
|
+
strokeDashoffset: 50
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
var loadInStyles = (0, _react2.css)({
|
|
61
|
+
animation: "".concat(loadIn, " 1s ease-in-out"),
|
|
62
|
+
/**
|
|
63
|
+
* When the animation completes, stay at the last frame of the animation.
|
|
64
|
+
*/
|
|
65
|
+
animationFillMode: 'forwards',
|
|
66
|
+
/**
|
|
67
|
+
* We are going to animate this in.
|
|
68
|
+
*/
|
|
69
|
+
opacity: 0
|
|
70
|
+
});
|
|
71
|
+
var wrapperStyles = (0, _react2.css)({
|
|
72
|
+
display: 'inline-flex',
|
|
73
|
+
/**
|
|
74
|
+
* Align better inline with text.
|
|
75
|
+
*/
|
|
76
|
+
verticalAlign: 'middle'
|
|
77
|
+
});
|
|
78
|
+
var circleStyles = (0, _react2.css)({
|
|
79
|
+
fill: 'none',
|
|
80
|
+
strokeDasharray: 60,
|
|
81
|
+
strokeDashoffset: 'inherit',
|
|
82
|
+
strokeLinecap: 'round',
|
|
83
|
+
strokeWidth: 1.5,
|
|
84
|
+
'@media screen and (forced-colors: active)': {
|
|
85
|
+
filter: 'grayscale(100%)',
|
|
86
|
+
stroke: 'CanvasText'
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* __Spinner__
|
|
92
|
+
*
|
|
93
|
+
* A spinner is an animated spinning icon that lets users know content is being loaded.
|
|
94
|
+
*
|
|
95
|
+
* - [Examples](https://atlassian.design/components/spinner/examples)
|
|
96
|
+
* - [Code](https://atlassian.design/components/spinner/code)
|
|
97
|
+
* - [Usage](https://atlassian.design/components/spinner/usage)
|
|
98
|
+
*/
|
|
99
|
+
var CardSpinner = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.forwardRef(function Spinner(_ref, ref) {
|
|
100
|
+
var _ref$appearance = _ref.appearance,
|
|
101
|
+
appearance = _ref$appearance === void 0 ? 'inherit' : _ref$appearance,
|
|
102
|
+
_ref$delay = _ref.delay,
|
|
103
|
+
delay = _ref$delay === void 0 ? 0 : _ref$delay,
|
|
104
|
+
label = _ref.label,
|
|
105
|
+
_ref$size = _ref.size,
|
|
106
|
+
providedSize = _ref$size === void 0 ? 'medium' : _ref$size,
|
|
107
|
+
testId = _ref.testId;
|
|
108
|
+
var size = typeof providedSize === 'number' ? providedSize : _constants.presetSizes[providedSize];
|
|
109
|
+
var animationDelay = "".concat(delay, "ms");
|
|
110
|
+
var stroke = getStrokeColor(appearance);
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* The Spinner animation uses a combination of two
|
|
114
|
+
* css animations on two separate elements.
|
|
115
|
+
*/
|
|
116
|
+
return (0, _react2.jsx)("span", {
|
|
117
|
+
/**
|
|
118
|
+
* This span exists to off-load animations from the circle element,
|
|
119
|
+
* which were causing performance issues (style recalculations)
|
|
120
|
+
* on Safari and older versions of Chrome.
|
|
121
|
+
*
|
|
122
|
+
* This can be removed and styles placed back on the circle element once
|
|
123
|
+
* Safari fixes this bug and off-loads rendering to the GPU from the CPU.
|
|
124
|
+
*/
|
|
125
|
+
css: [wrapperStyles, rotateStyles],
|
|
126
|
+
"data-testid": testId && "".concat(testId, "-wrapper")
|
|
127
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
128
|
+
,
|
|
129
|
+
style: {
|
|
130
|
+
animationDelay: animationDelay,
|
|
131
|
+
width: size,
|
|
132
|
+
height: size
|
|
133
|
+
}
|
|
134
|
+
}, (0, _react2.jsx)("svg", {
|
|
135
|
+
height: size,
|
|
136
|
+
width: size,
|
|
137
|
+
viewBox: "0 0 16 16",
|
|
138
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
139
|
+
"data-testid": testId,
|
|
140
|
+
ref: ref,
|
|
141
|
+
"aria-label": label || undefined,
|
|
142
|
+
css: loadInStyles
|
|
143
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
144
|
+
,
|
|
145
|
+
style: {
|
|
146
|
+
animationDelay: animationDelay
|
|
147
|
+
},
|
|
148
|
+
role: label ? 'img' : 'none'
|
|
149
|
+
}, (0, _react2.jsx)("circle", {
|
|
150
|
+
cx: "8",
|
|
151
|
+
cy: "8",
|
|
152
|
+
r: "7",
|
|
153
|
+
css: circleStyles,
|
|
154
|
+
style: {
|
|
155
|
+
stroke: stroke
|
|
156
|
+
}
|
|
157
|
+
})));
|
|
158
|
+
}));
|
|
159
|
+
var _default = exports.default = CardSpinner;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -32,15 +32,15 @@ var ImageRenderer = exports.ImageRenderer = function ImageRenderer(_ref) {
|
|
|
32
32
|
}
|
|
33
33
|
}, [mediaType, onDisplayImageRef]);
|
|
34
34
|
var onLoad = function onLoad() {
|
|
35
|
-
onImageLoad && onImageLoad(cardPreview);
|
|
35
|
+
onImageLoad && cardPreview && onImageLoad(cardPreview);
|
|
36
36
|
};
|
|
37
37
|
var onError = function onError() {
|
|
38
|
-
onImageError && onImageError(cardPreview);
|
|
38
|
+
onImageError && cardPreview && onImageError(cardPreview);
|
|
39
39
|
};
|
|
40
40
|
return /*#__PURE__*/_react.default.createElement(_mediaUi.MediaImage, (0, _extends2.default)({
|
|
41
|
-
dataURI: cardPreview.dataURI,
|
|
41
|
+
dataURI: cardPreview === null || cardPreview === void 0 ? void 0 : cardPreview.dataURI,
|
|
42
42
|
alt: alt,
|
|
43
|
-
previewOrientation: cardPreview.orientation,
|
|
43
|
+
previewOrientation: cardPreview === null || cardPreview === void 0 ? void 0 : cardPreview.orientation,
|
|
44
44
|
onImageLoad: onLoad,
|
|
45
45
|
onImageError: onError,
|
|
46
46
|
loading: nativeLazyLoad ? 'lazy' : undefined,
|
|
@@ -23,7 +23,7 @@ var wrapperStyles = function wrapperStyles(selected) {
|
|
|
23
23
|
return (0, _react.css)(
|
|
24
24
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
25
25
|
_styles2.transition && (0, _styles2.transition)(), {
|
|
26
|
-
|
|
26
|
+
font: "var(--ds-font-body, normal 400 14px/20px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)",
|
|
27
27
|
width: '14px',
|
|
28
28
|
height: '14px',
|
|
29
29
|
position: 'absolute',
|
|
@@ -14,7 +14,6 @@ var _react = require("react");
|
|
|
14
14
|
var _react2 = require("@emotion/react");
|
|
15
15
|
var _warning = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/warning"));
|
|
16
16
|
var _colors = require("@atlaskit/theme/colors");
|
|
17
|
-
var _constants = require("@atlaskit/theme/constants");
|
|
18
17
|
var _mediaUi = require("@atlaskit/media-ui");
|
|
19
18
|
var _utils = require("../../../utils");
|
|
20
19
|
function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = (0, _getPrototypeOf2.default)(t); if (r) { var s = (0, _getPrototypeOf2.default)(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return (0, _possibleConstructorReturn2.default)(this, e); }; }
|
|
@@ -66,7 +65,7 @@ var wrapperStyles = function wrapperStyles() {
|
|
|
66
65
|
flexDirection: 'column',
|
|
67
66
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
68
67
|
p: {
|
|
69
|
-
|
|
68
|
+
font: "var(--ds-font-body, normal 400 14px/20px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)",
|
|
70
69
|
textAlign: 'center',
|
|
71
70
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
72
71
|
display: shouldShowText(getConvertedDimension(dimensions)) ? 'block' : 'none'
|
|
@@ -119,7 +119,7 @@ var MediaInlineCardLoader = exports.default = /*#__PURE__*/function (_React$Pure
|
|
|
119
119
|
ErrorBoundary = _this$state.ErrorBoundary;
|
|
120
120
|
var analyticsContext = {
|
|
121
121
|
packageVersion: "@atlaskit/media-card",
|
|
122
|
-
packageName: "78.
|
|
122
|
+
packageName: "78.4.1",
|
|
123
123
|
componentName: 'mediaInlineCard',
|
|
124
124
|
component: 'mediaInlineCard'
|
|
125
125
|
};
|
|
@@ -15,7 +15,7 @@ var _mediaClient = require("@atlaskit/media-client");
|
|
|
15
15
|
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; }
|
|
16
16
|
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; }
|
|
17
17
|
var packageName = "@atlaskit/media-card";
|
|
18
|
-
var packageVersion = "78.
|
|
18
|
+
var packageVersion = "78.4.1";
|
|
19
19
|
var concurrentExperience;
|
|
20
20
|
var getExperience = function getExperience(id) {
|
|
21
21
|
if (!concurrentExperience) {
|
package/dist/es2019/card/card.js
CHANGED
|
@@ -9,7 +9,7 @@ import { startResourceObserver, setAnalyticsContext } from '../utils/mediaPerfor
|
|
|
9
9
|
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
10
10
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
11
11
|
const packageName = "@atlaskit/media-card";
|
|
12
|
-
const packageVersion = "78.
|
|
12
|
+
const packageVersion = "78.4.1";
|
|
13
13
|
export const CardBase = ({
|
|
14
14
|
identifier,
|
|
15
15
|
...otherProps
|
|
@@ -7,7 +7,7 @@ import { jsx } from '@emotion/react';
|
|
|
7
7
|
import React, { useEffect, useState, useRef, useMemo } from 'react';
|
|
8
8
|
import { withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
9
9
|
import { MimeTypeIcon } from '@atlaskit/media-ui/mime-type-icon';
|
|
10
|
-
import
|
|
10
|
+
import CardSpinner from './ui/cardSpinner/cardSpinner';
|
|
11
11
|
import Tooltip from '@atlaskit/tooltip';
|
|
12
12
|
import { messages } from '@atlaskit/media-ui';
|
|
13
13
|
import { createAndFireMediaCardEvent } from '../utils/analytics';
|
|
@@ -109,7 +109,7 @@ export const CardViewBase = ({
|
|
|
109
109
|
const isZeroSize = metadata && metadata.size === 0;
|
|
110
110
|
const defaultConfig = {
|
|
111
111
|
renderTypeIcon: !didImageRender,
|
|
112
|
-
renderImageRenderer:
|
|
112
|
+
renderImageRenderer: true,
|
|
113
113
|
renderPlayButton: !!cardPreview && mediaType === 'video',
|
|
114
114
|
renderBlanket: !disableOverlay,
|
|
115
115
|
renderTitleBox: !disableOverlay,
|
|
@@ -245,10 +245,10 @@ export const CardViewBase = ({
|
|
|
245
245
|
}), iconMessage), renderSpinner && jsx(IconWrapper, {
|
|
246
246
|
breakpoint: breakpoint,
|
|
247
247
|
hasTitleBox: hasVisibleTitleBox
|
|
248
|
-
}, jsx(
|
|
248
|
+
}, jsx(CardSpinner, {
|
|
249
249
|
testId: "media-card-loading",
|
|
250
250
|
interactionName: "media-card-loading"
|
|
251
|
-
})), renderImageRenderer &&
|
|
251
|
+
})), renderImageRenderer && jsx(ImageRenderer, {
|
|
252
252
|
cardPreview: cardPreview,
|
|
253
253
|
mediaType: (metadata === null || metadata === void 0 ? void 0 : metadata.mediaType) || 'unknown',
|
|
254
254
|
alt: alt !== null && alt !== void 0 ? alt : name,
|
|
@@ -66,7 +66,7 @@ class WrappedMediaCardAnalyticsErrorBoundary extends React.Component {
|
|
|
66
66
|
}
|
|
67
67
|
_defineProperty(WrappedMediaCardAnalyticsErrorBoundary, "displayName", 'MediaCardAnalyticsErrorBoundary');
|
|
68
68
|
const packageName = "@atlaskit/media-card";
|
|
69
|
-
const packageVersion = "78.
|
|
69
|
+
const packageVersion = "78.4.1";
|
|
70
70
|
|
|
71
71
|
// @ts-ignore: [PIT-1685] Fails in post-office due to backwards incompatibility issue with React 18
|
|
72
72
|
const MediaCardAnalyticsErrorBoundary = withMediaAnalyticsContext({
|
|
@@ -104,7 +104,7 @@ export const SvgViewBase = ({
|
|
|
104
104
|
...svgDimensions
|
|
105
105
|
},
|
|
106
106
|
ref: imgRef
|
|
107
|
-
}),
|
|
107
|
+
}), !didSvgRender && jsx(ImageRenderer, {
|
|
108
108
|
cardPreview: cardPreview,
|
|
109
109
|
onImageLoad: onPreviewLoad,
|
|
110
110
|
mediaType: 'image',
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Note: CardSpinner is almost a direct copy of Spinner from '@atlaskit/spinner', the only difference
|
|
8
|
+
* being the removal of interaction tracing.
|
|
9
|
+
* Removing interaction tracing ensures that Media Card is not contributing to Jira's TTAI and TTVC metrics.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import React from 'react';
|
|
13
|
+
|
|
14
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
15
|
+
import { css, jsx, keyframes } from '@emotion/react';
|
|
16
|
+
import { N0, N500 } from '@atlaskit/theme/colors';
|
|
17
|
+
import { presetSizes } from './constants';
|
|
18
|
+
/**
|
|
19
|
+
* Returns the appropriate circle stroke color.
|
|
20
|
+
*/
|
|
21
|
+
function getStrokeColor(appearance) {
|
|
22
|
+
return appearance === 'inherit' ? `var(--ds-icon-subtle, ${N500})` : `var(--ds-icon-inverse, ${N0})`;
|
|
23
|
+
}
|
|
24
|
+
const rotate = keyframes({
|
|
25
|
+
to: {
|
|
26
|
+
transform: 'rotate(360deg)'
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
const rotateStyles = css({
|
|
30
|
+
animation: `${rotate} 0.86s infinite`,
|
|
31
|
+
animationTimingFunction: 'cubic-bezier(0.4, 0.15, 0.6, 0.85)',
|
|
32
|
+
transformOrigin: 'center'
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* There are three parts to the load in animation:
|
|
37
|
+
* 1. Fade in
|
|
38
|
+
* 2. Accelerated spin
|
|
39
|
+
* 3. Stretch the spinner line
|
|
40
|
+
*/
|
|
41
|
+
const loadIn = keyframes({
|
|
42
|
+
from: {
|
|
43
|
+
transform: 'rotate(50deg)',
|
|
44
|
+
opacity: 0,
|
|
45
|
+
strokeDashoffset: 60
|
|
46
|
+
},
|
|
47
|
+
to: {
|
|
48
|
+
transform: 'rotate(230deg)',
|
|
49
|
+
opacity: 1,
|
|
50
|
+
strokeDashoffset: 50
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
const loadInStyles = css({
|
|
54
|
+
animation: `${loadIn} 1s ease-in-out`,
|
|
55
|
+
/**
|
|
56
|
+
* When the animation completes, stay at the last frame of the animation.
|
|
57
|
+
*/
|
|
58
|
+
animationFillMode: 'forwards',
|
|
59
|
+
/**
|
|
60
|
+
* We are going to animate this in.
|
|
61
|
+
*/
|
|
62
|
+
opacity: 0
|
|
63
|
+
});
|
|
64
|
+
const wrapperStyles = css({
|
|
65
|
+
display: 'inline-flex',
|
|
66
|
+
/**
|
|
67
|
+
* Align better inline with text.
|
|
68
|
+
*/
|
|
69
|
+
verticalAlign: 'middle'
|
|
70
|
+
});
|
|
71
|
+
const circleStyles = css({
|
|
72
|
+
fill: 'none',
|
|
73
|
+
strokeDasharray: 60,
|
|
74
|
+
strokeDashoffset: 'inherit',
|
|
75
|
+
strokeLinecap: 'round',
|
|
76
|
+
strokeWidth: 1.5,
|
|
77
|
+
'@media screen and (forced-colors: active)': {
|
|
78
|
+
filter: 'grayscale(100%)',
|
|
79
|
+
stroke: 'CanvasText'
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* __Spinner__
|
|
85
|
+
*
|
|
86
|
+
* A spinner is an animated spinning icon that lets users know content is being loaded.
|
|
87
|
+
*
|
|
88
|
+
* - [Examples](https://atlassian.design/components/spinner/examples)
|
|
89
|
+
* - [Code](https://atlassian.design/components/spinner/code)
|
|
90
|
+
* - [Usage](https://atlassian.design/components/spinner/usage)
|
|
91
|
+
*/
|
|
92
|
+
const CardSpinner = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function Spinner({
|
|
93
|
+
appearance = 'inherit',
|
|
94
|
+
delay = 0,
|
|
95
|
+
label,
|
|
96
|
+
size: providedSize = 'medium',
|
|
97
|
+
testId
|
|
98
|
+
}, ref) {
|
|
99
|
+
const size = typeof providedSize === 'number' ? providedSize : presetSizes[providedSize];
|
|
100
|
+
const animationDelay = `${delay}ms`;
|
|
101
|
+
const stroke = getStrokeColor(appearance);
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* The Spinner animation uses a combination of two
|
|
105
|
+
* css animations on two separate elements.
|
|
106
|
+
*/
|
|
107
|
+
return jsx("span", {
|
|
108
|
+
/**
|
|
109
|
+
* This span exists to off-load animations from the circle element,
|
|
110
|
+
* which were causing performance issues (style recalculations)
|
|
111
|
+
* on Safari and older versions of Chrome.
|
|
112
|
+
*
|
|
113
|
+
* This can be removed and styles placed back on the circle element once
|
|
114
|
+
* Safari fixes this bug and off-loads rendering to the GPU from the CPU.
|
|
115
|
+
*/
|
|
116
|
+
css: [wrapperStyles, rotateStyles],
|
|
117
|
+
"data-testid": testId && `${testId}-wrapper`
|
|
118
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
119
|
+
,
|
|
120
|
+
style: {
|
|
121
|
+
animationDelay,
|
|
122
|
+
width: size,
|
|
123
|
+
height: size
|
|
124
|
+
}
|
|
125
|
+
}, jsx("svg", {
|
|
126
|
+
height: size,
|
|
127
|
+
width: size,
|
|
128
|
+
viewBox: "0 0 16 16",
|
|
129
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
130
|
+
"data-testid": testId,
|
|
131
|
+
ref: ref,
|
|
132
|
+
"aria-label": label || undefined,
|
|
133
|
+
css: loadInStyles
|
|
134
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
135
|
+
,
|
|
136
|
+
style: {
|
|
137
|
+
animationDelay
|
|
138
|
+
},
|
|
139
|
+
role: label ? 'img' : 'none'
|
|
140
|
+
}, jsx("circle", {
|
|
141
|
+
cx: "8",
|
|
142
|
+
cy: "8",
|
|
143
|
+
r: "7",
|
|
144
|
+
css: circleStyles,
|
|
145
|
+
style: {
|
|
146
|
+
stroke
|
|
147
|
+
}
|
|
148
|
+
})));
|
|
149
|
+
}));
|
|
150
|
+
export default CardSpinner;
|
|
File without changes
|
|
@@ -23,15 +23,15 @@ export const ImageRenderer = ({
|
|
|
23
23
|
}
|
|
24
24
|
}, [mediaType, onDisplayImageRef]);
|
|
25
25
|
const onLoad = () => {
|
|
26
|
-
onImageLoad && onImageLoad(cardPreview);
|
|
26
|
+
onImageLoad && cardPreview && onImageLoad(cardPreview);
|
|
27
27
|
};
|
|
28
28
|
const onError = () => {
|
|
29
|
-
onImageError && onImageError(cardPreview);
|
|
29
|
+
onImageError && cardPreview && onImageError(cardPreview);
|
|
30
30
|
};
|
|
31
31
|
return /*#__PURE__*/React.createElement(MediaImage, _extends({
|
|
32
|
-
dataURI: cardPreview.dataURI,
|
|
32
|
+
dataURI: cardPreview === null || cardPreview === void 0 ? void 0 : cardPreview.dataURI,
|
|
33
33
|
alt: alt,
|
|
34
|
-
previewOrientation: cardPreview.orientation,
|
|
34
|
+
previewOrientation: cardPreview === null || cardPreview === void 0 ? void 0 : cardPreview.orientation,
|
|
35
35
|
onImageLoad: onLoad,
|
|
36
36
|
onImageError: onError,
|
|
37
37
|
loading: nativeLazyLoad ? 'lazy' : undefined,
|
|
@@ -14,7 +14,7 @@ const getSelectedStyles = selected => selected ? `background-color: ${`var(--ds-
|
|
|
14
14
|
const wrapperStyles = selected => css(
|
|
15
15
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
16
16
|
transition && transition(), {
|
|
17
|
-
|
|
17
|
+
font: "var(--ds-font-body, normal 400 14px/20px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)",
|
|
18
18
|
width: '14px',
|
|
19
19
|
height: '14px',
|
|
20
20
|
position: 'absolute',
|
|
@@ -7,7 +7,6 @@ import { Component } from 'react';
|
|
|
7
7
|
import { css, jsx } from '@emotion/react';
|
|
8
8
|
import WarningIcon from '@atlaskit/icon/glyph/editor/warning';
|
|
9
9
|
import { N20, N800, Y500 } from '@atlaskit/theme/colors';
|
|
10
|
-
import { fontSize } from '@atlaskit/theme/constants';
|
|
11
10
|
import { center, borderRadius } from '@atlaskit/media-ui';
|
|
12
11
|
import { defaultImageCardDimensions } from '../../../utils';
|
|
13
12
|
const isPercentage = value => /^\d+(\.\d+)?%$/.test(value);
|
|
@@ -52,7 +51,7 @@ const wrapperStyles = (dimensions = defaultImageCardDimensions) => {
|
|
|
52
51
|
flexDirection: 'column',
|
|
53
52
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
54
53
|
p: {
|
|
55
|
-
|
|
54
|
+
font: "var(--ds-font-body, normal 400 14px/20px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)",
|
|
56
55
|
textAlign: 'center',
|
|
57
56
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
58
57
|
display: shouldShowText(getConvertedDimension(dimensions)) ? 'block' : 'none'
|
|
@@ -37,7 +37,7 @@ export default class MediaInlineCardLoader extends React.PureComponent {
|
|
|
37
37
|
} = this.state;
|
|
38
38
|
const analyticsContext = {
|
|
39
39
|
packageVersion: "@atlaskit/media-card",
|
|
40
|
-
packageName: "78.
|
|
40
|
+
packageName: "78.4.1",
|
|
41
41
|
componentName: 'mediaInlineCard',
|
|
42
42
|
component: 'mediaInlineCard'
|
|
43
43
|
};
|
|
@@ -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.
|
|
8
|
+
const packageVersion = "78.4.1";
|
|
9
9
|
let concurrentExperience;
|
|
10
10
|
const getExperience = id => {
|
|
11
11
|
if (!concurrentExperience) {
|
package/dist/esm/card/card.js
CHANGED
|
@@ -11,7 +11,7 @@ import { startResourceObserver, setAnalyticsContext } from '../utils/mediaPerfor
|
|
|
11
11
|
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
12
12
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
13
|
var packageName = "@atlaskit/media-card";
|
|
14
|
-
var packageVersion = "78.
|
|
14
|
+
var packageVersion = "78.4.1";
|
|
15
15
|
export var CardBase = function CardBase(_ref) {
|
|
16
16
|
var identifier = _ref.identifier,
|
|
17
17
|
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
@@ -11,7 +11,7 @@ import { jsx } from '@emotion/react';
|
|
|
11
11
|
import React, { useEffect, useState, useRef, useMemo } from 'react';
|
|
12
12
|
import { withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
13
13
|
import { MimeTypeIcon } from '@atlaskit/media-ui/mime-type-icon';
|
|
14
|
-
import
|
|
14
|
+
import CardSpinner from './ui/cardSpinner/cardSpinner';
|
|
15
15
|
import Tooltip from '@atlaskit/tooltip';
|
|
16
16
|
import { messages } from '@atlaskit/media-ui';
|
|
17
17
|
import { createAndFireMediaCardEvent } from '../utils/analytics';
|
|
@@ -114,7 +114,7 @@ export var CardViewBase = function CardViewBase(_ref) {
|
|
|
114
114
|
var isZeroSize = metadata && metadata.size === 0;
|
|
115
115
|
var defaultConfig = {
|
|
116
116
|
renderTypeIcon: !didImageRender,
|
|
117
|
-
renderImageRenderer:
|
|
117
|
+
renderImageRenderer: true,
|
|
118
118
|
renderPlayButton: !!cardPreview && mediaType === 'video',
|
|
119
119
|
renderBlanket: !disableOverlay,
|
|
120
120
|
renderTitleBox: !disableOverlay,
|
|
@@ -242,10 +242,10 @@ export var CardViewBase = function CardViewBase(_ref) {
|
|
|
242
242
|
}), iconMessage), renderSpinner && jsx(IconWrapper, {
|
|
243
243
|
breakpoint: breakpoint,
|
|
244
244
|
hasTitleBox: hasVisibleTitleBox
|
|
245
|
-
}, jsx(
|
|
245
|
+
}, jsx(CardSpinner, {
|
|
246
246
|
testId: "media-card-loading",
|
|
247
247
|
interactionName: "media-card-loading"
|
|
248
|
-
})), renderImageRenderer &&
|
|
248
|
+
})), renderImageRenderer && jsx(ImageRenderer, {
|
|
249
249
|
cardPreview: cardPreview,
|
|
250
250
|
mediaType: (metadata === null || metadata === void 0 ? void 0 : metadata.mediaType) || 'unknown',
|
|
251
251
|
alt: alt !== null && alt !== void 0 ? alt : name,
|
|
@@ -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.
|
|
86
|
+
var packageVersion = "78.4.1";
|
|
87
87
|
|
|
88
88
|
// @ts-ignore: [PIT-1685] Fails in post-office due to backwards incompatibility issue with React 18
|
|
89
89
|
var MediaCardAnalyticsErrorBoundary = withMediaAnalyticsContext({
|
|
@@ -115,7 +115,7 @@ export var SvgViewBase = function SvgViewBase(_ref) {
|
|
|
115
115
|
visibility: didSvgRender ? 'visible' : 'hidden'
|
|
116
116
|
}, svgDimensions),
|
|
117
117
|
ref: imgRef
|
|
118
|
-
}),
|
|
118
|
+
}), !didSvgRender && jsx(ImageRenderer, {
|
|
119
119
|
cardPreview: cardPreview,
|
|
120
120
|
onImageLoad: onPreviewLoad,
|
|
121
121
|
mediaType: 'image',
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Note: CardSpinner is almost a direct copy of Spinner from '@atlaskit/spinner', the only difference
|
|
8
|
+
* being the removal of interaction tracing.
|
|
9
|
+
* Removing interaction tracing ensures that Media Card is not contributing to Jira's TTAI and TTVC metrics.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import React from 'react';
|
|
13
|
+
|
|
14
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
15
|
+
import { css, jsx, keyframes } from '@emotion/react';
|
|
16
|
+
import { N0, N500 } from '@atlaskit/theme/colors';
|
|
17
|
+
import { presetSizes } from './constants';
|
|
18
|
+
/**
|
|
19
|
+
* Returns the appropriate circle stroke color.
|
|
20
|
+
*/
|
|
21
|
+
function getStrokeColor(appearance) {
|
|
22
|
+
return appearance === 'inherit' ? "var(--ds-icon-subtle, ".concat(N500, ")") : "var(--ds-icon-inverse, ".concat(N0, ")");
|
|
23
|
+
}
|
|
24
|
+
var rotate = keyframes({
|
|
25
|
+
to: {
|
|
26
|
+
transform: 'rotate(360deg)'
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
var rotateStyles = css({
|
|
30
|
+
animation: "".concat(rotate, " 0.86s infinite"),
|
|
31
|
+
animationTimingFunction: 'cubic-bezier(0.4, 0.15, 0.6, 0.85)',
|
|
32
|
+
transformOrigin: 'center'
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* There are three parts to the load in animation:
|
|
37
|
+
* 1. Fade in
|
|
38
|
+
* 2. Accelerated spin
|
|
39
|
+
* 3. Stretch the spinner line
|
|
40
|
+
*/
|
|
41
|
+
var loadIn = keyframes({
|
|
42
|
+
from: {
|
|
43
|
+
transform: 'rotate(50deg)',
|
|
44
|
+
opacity: 0,
|
|
45
|
+
strokeDashoffset: 60
|
|
46
|
+
},
|
|
47
|
+
to: {
|
|
48
|
+
transform: 'rotate(230deg)',
|
|
49
|
+
opacity: 1,
|
|
50
|
+
strokeDashoffset: 50
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
var loadInStyles = css({
|
|
54
|
+
animation: "".concat(loadIn, " 1s ease-in-out"),
|
|
55
|
+
/**
|
|
56
|
+
* When the animation completes, stay at the last frame of the animation.
|
|
57
|
+
*/
|
|
58
|
+
animationFillMode: 'forwards',
|
|
59
|
+
/**
|
|
60
|
+
* We are going to animate this in.
|
|
61
|
+
*/
|
|
62
|
+
opacity: 0
|
|
63
|
+
});
|
|
64
|
+
var wrapperStyles = css({
|
|
65
|
+
display: 'inline-flex',
|
|
66
|
+
/**
|
|
67
|
+
* Align better inline with text.
|
|
68
|
+
*/
|
|
69
|
+
verticalAlign: 'middle'
|
|
70
|
+
});
|
|
71
|
+
var circleStyles = css({
|
|
72
|
+
fill: 'none',
|
|
73
|
+
strokeDasharray: 60,
|
|
74
|
+
strokeDashoffset: 'inherit',
|
|
75
|
+
strokeLinecap: 'round',
|
|
76
|
+
strokeWidth: 1.5,
|
|
77
|
+
'@media screen and (forced-colors: active)': {
|
|
78
|
+
filter: 'grayscale(100%)',
|
|
79
|
+
stroke: 'CanvasText'
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* __Spinner__
|
|
85
|
+
*
|
|
86
|
+
* A spinner is an animated spinning icon that lets users know content is being loaded.
|
|
87
|
+
*
|
|
88
|
+
* - [Examples](https://atlassian.design/components/spinner/examples)
|
|
89
|
+
* - [Code](https://atlassian.design/components/spinner/code)
|
|
90
|
+
* - [Usage](https://atlassian.design/components/spinner/usage)
|
|
91
|
+
*/
|
|
92
|
+
var CardSpinner = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function Spinner(_ref, ref) {
|
|
93
|
+
var _ref$appearance = _ref.appearance,
|
|
94
|
+
appearance = _ref$appearance === void 0 ? 'inherit' : _ref$appearance,
|
|
95
|
+
_ref$delay = _ref.delay,
|
|
96
|
+
delay = _ref$delay === void 0 ? 0 : _ref$delay,
|
|
97
|
+
label = _ref.label,
|
|
98
|
+
_ref$size = _ref.size,
|
|
99
|
+
providedSize = _ref$size === void 0 ? 'medium' : _ref$size,
|
|
100
|
+
testId = _ref.testId;
|
|
101
|
+
var size = typeof providedSize === 'number' ? providedSize : presetSizes[providedSize];
|
|
102
|
+
var animationDelay = "".concat(delay, "ms");
|
|
103
|
+
var stroke = getStrokeColor(appearance);
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* The Spinner animation uses a combination of two
|
|
107
|
+
* css animations on two separate elements.
|
|
108
|
+
*/
|
|
109
|
+
return jsx("span", {
|
|
110
|
+
/**
|
|
111
|
+
* This span exists to off-load animations from the circle element,
|
|
112
|
+
* which were causing performance issues (style recalculations)
|
|
113
|
+
* on Safari and older versions of Chrome.
|
|
114
|
+
*
|
|
115
|
+
* This can be removed and styles placed back on the circle element once
|
|
116
|
+
* Safari fixes this bug and off-loads rendering to the GPU from the CPU.
|
|
117
|
+
*/
|
|
118
|
+
css: [wrapperStyles, rotateStyles],
|
|
119
|
+
"data-testid": testId && "".concat(testId, "-wrapper")
|
|
120
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
121
|
+
,
|
|
122
|
+
style: {
|
|
123
|
+
animationDelay: animationDelay,
|
|
124
|
+
width: size,
|
|
125
|
+
height: size
|
|
126
|
+
}
|
|
127
|
+
}, jsx("svg", {
|
|
128
|
+
height: size,
|
|
129
|
+
width: size,
|
|
130
|
+
viewBox: "0 0 16 16",
|
|
131
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
132
|
+
"data-testid": testId,
|
|
133
|
+
ref: ref,
|
|
134
|
+
"aria-label": label || undefined,
|
|
135
|
+
css: loadInStyles
|
|
136
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
137
|
+
,
|
|
138
|
+
style: {
|
|
139
|
+
animationDelay: animationDelay
|
|
140
|
+
},
|
|
141
|
+
role: label ? 'img' : 'none'
|
|
142
|
+
}, jsx("circle", {
|
|
143
|
+
cx: "8",
|
|
144
|
+
cy: "8",
|
|
145
|
+
r: "7",
|
|
146
|
+
css: circleStyles,
|
|
147
|
+
style: {
|
|
148
|
+
stroke: stroke
|
|
149
|
+
}
|
|
150
|
+
})));
|
|
151
|
+
}));
|
|
152
|
+
export default CardSpinner;
|
|
File without changes
|
|
@@ -22,15 +22,15 @@ export var ImageRenderer = function ImageRenderer(_ref) {
|
|
|
22
22
|
}
|
|
23
23
|
}, [mediaType, onDisplayImageRef]);
|
|
24
24
|
var onLoad = function onLoad() {
|
|
25
|
-
onImageLoad && onImageLoad(cardPreview);
|
|
25
|
+
onImageLoad && cardPreview && onImageLoad(cardPreview);
|
|
26
26
|
};
|
|
27
27
|
var onError = function onError() {
|
|
28
|
-
onImageError && onImageError(cardPreview);
|
|
28
|
+
onImageError && cardPreview && onImageError(cardPreview);
|
|
29
29
|
};
|
|
30
30
|
return /*#__PURE__*/React.createElement(MediaImage, _extends({
|
|
31
|
-
dataURI: cardPreview.dataURI,
|
|
31
|
+
dataURI: cardPreview === null || cardPreview === void 0 ? void 0 : cardPreview.dataURI,
|
|
32
32
|
alt: alt,
|
|
33
|
-
previewOrientation: cardPreview.orientation,
|
|
33
|
+
previewOrientation: cardPreview === null || cardPreview === void 0 ? void 0 : cardPreview.orientation,
|
|
34
34
|
onImageLoad: onLoad,
|
|
35
35
|
onImageError: onError,
|
|
36
36
|
loading: nativeLazyLoad ? 'lazy' : undefined,
|
|
@@ -16,7 +16,7 @@ var wrapperStyles = function wrapperStyles(selected) {
|
|
|
16
16
|
return css(
|
|
17
17
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
18
18
|
transition && transition(), {
|
|
19
|
-
|
|
19
|
+
font: "var(--ds-font-body, normal 400 14px/20px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)",
|
|
20
20
|
width: '14px',
|
|
21
21
|
height: '14px',
|
|
22
22
|
position: 'absolute',
|
|
@@ -14,7 +14,6 @@ import { Component } from 'react';
|
|
|
14
14
|
import { css, jsx } from '@emotion/react';
|
|
15
15
|
import WarningIcon from '@atlaskit/icon/glyph/editor/warning';
|
|
16
16
|
import { N20, N800, Y500 } from '@atlaskit/theme/colors';
|
|
17
|
-
import { fontSize } from '@atlaskit/theme/constants';
|
|
18
17
|
import { center, borderRadius } from '@atlaskit/media-ui';
|
|
19
18
|
import { defaultImageCardDimensions } from '../../../utils';
|
|
20
19
|
var isPercentage = function isPercentage(value) {
|
|
@@ -61,7 +60,7 @@ var wrapperStyles = function wrapperStyles() {
|
|
|
61
60
|
flexDirection: 'column',
|
|
62
61
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
63
62
|
p: {
|
|
64
|
-
|
|
63
|
+
font: "var(--ds-font-body, normal 400 14px/20px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)",
|
|
65
64
|
textAlign: 'center',
|
|
66
65
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
67
66
|
display: shouldShowText(getConvertedDimension(dimensions)) ? 'block' : 'none'
|
|
@@ -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.
|
|
106
|
+
packageName: "78.4.1",
|
|
107
107
|
componentName: 'mediaInlineCard',
|
|
108
108
|
component: 'mediaInlineCard'
|
|
109
109
|
};
|
|
@@ -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.
|
|
11
|
+
var packageVersion = "78.4.1";
|
|
12
12
|
var concurrentExperience;
|
|
13
13
|
var getExperience = function getExperience(id) {
|
|
14
14
|
if (!concurrentExperience) {
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Note: CardSpinner is almost a direct copy of Spinner from '@atlaskit/spinner', the only difference
|
|
7
|
+
* being the removal of interaction tracing.
|
|
8
|
+
* Removing interaction tracing ensures that Media Card is not contributing to Jira's TTAI and TTVC metrics.
|
|
9
|
+
*/
|
|
10
|
+
import React from 'react';
|
|
11
|
+
import { type SpinnerProps } from './types';
|
|
12
|
+
/**
|
|
13
|
+
* __Spinner__
|
|
14
|
+
*
|
|
15
|
+
* A spinner is an animated spinning icon that lets users know content is being loaded.
|
|
16
|
+
*
|
|
17
|
+
* - [Examples](https://atlassian.design/components/spinner/examples)
|
|
18
|
+
* - [Code](https://atlassian.design/components/spinner/code)
|
|
19
|
+
* - [Usage](https://atlassian.design/components/spinner/usage)
|
|
20
|
+
*/
|
|
21
|
+
declare const CardSpinner: React.MemoExoticComponent<React.ForwardRefExoticComponent<SpinnerProps & React.RefAttributes<SVGSVGElement>>>;
|
|
22
|
+
export default CardSpinner;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export type PresetSize = 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge';
|
|
2
|
+
export type Size = PresetSize | number;
|
|
3
|
+
export type Appearance = 'inherit' | 'invert';
|
|
4
|
+
export type SpinnerProps = {
|
|
5
|
+
/**
|
|
6
|
+
* You can use this to invert the current theme.
|
|
7
|
+
* This is useful when you are displaying a spinner on a background that is not the same background color scheme as the main content.
|
|
8
|
+
*/
|
|
9
|
+
appearance?: Appearance;
|
|
10
|
+
/**
|
|
11
|
+
* Delay the intro animation of `Spinner`.
|
|
12
|
+
* This is not to be used to avoid quick flickering of `Spinner`.
|
|
13
|
+
* `Spinner` will automatically fade in and takes ~200ms to become partially visible.
|
|
14
|
+
* This prop can be helpful for **long delays** such as `500-1000ms` for when you want to not
|
|
15
|
+
* show a `Spinner` until some longer period of time has elapsed.
|
|
16
|
+
*/
|
|
17
|
+
delay?: number;
|
|
18
|
+
/**
|
|
19
|
+
* An optional `interactionName` used to identify when this component is holding an interaction.
|
|
20
|
+
*/
|
|
21
|
+
interactionName?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Describes what the spinner is doing for assistive technologies. For example, "loading", "submitting", or "processing".
|
|
24
|
+
*/
|
|
25
|
+
label?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Size of the spinner. The available sizes are `xsmall`, `small`, `medium`, `large`, and `xlarge`. For most use cases, we recommend `medium`.
|
|
28
|
+
*/
|
|
29
|
+
size?: Size;
|
|
30
|
+
/**
|
|
31
|
+
* A `testId` prop is provided for specified elements,
|
|
32
|
+
* which is a unique string that appears as a data attribute `data-testid` in the rendered code,
|
|
33
|
+
* serving as a hook for automated tests.
|
|
34
|
+
*/
|
|
35
|
+
testId?: string;
|
|
36
|
+
};
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { type MediaType, type ImageResizeMode } from '@atlaskit/media-client';
|
|
3
3
|
import { type CardPreview } from '../../../types';
|
|
4
4
|
export type ImageRendererProps = {
|
|
5
|
-
readonly cardPreview
|
|
5
|
+
readonly cardPreview?: CardPreview;
|
|
6
6
|
readonly mediaType: MediaType;
|
|
7
7
|
readonly alt?: string;
|
|
8
8
|
readonly resizeMode?: ImageResizeMode;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Note: CardSpinner is almost a direct copy of Spinner from '@atlaskit/spinner', the only difference
|
|
7
|
+
* being the removal of interaction tracing.
|
|
8
|
+
* Removing interaction tracing ensures that Media Card is not contributing to Jira's TTAI and TTVC metrics.
|
|
9
|
+
*/
|
|
10
|
+
import React from 'react';
|
|
11
|
+
import { type SpinnerProps } from './types';
|
|
12
|
+
/**
|
|
13
|
+
* __Spinner__
|
|
14
|
+
*
|
|
15
|
+
* A spinner is an animated spinning icon that lets users know content is being loaded.
|
|
16
|
+
*
|
|
17
|
+
* - [Examples](https://atlassian.design/components/spinner/examples)
|
|
18
|
+
* - [Code](https://atlassian.design/components/spinner/code)
|
|
19
|
+
* - [Usage](https://atlassian.design/components/spinner/usage)
|
|
20
|
+
*/
|
|
21
|
+
declare const CardSpinner: React.MemoExoticComponent<React.ForwardRefExoticComponent<SpinnerProps & React.RefAttributes<SVGSVGElement>>>;
|
|
22
|
+
export default CardSpinner;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export type PresetSize = 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge';
|
|
2
|
+
export type Size = PresetSize | number;
|
|
3
|
+
export type Appearance = 'inherit' | 'invert';
|
|
4
|
+
export type SpinnerProps = {
|
|
5
|
+
/**
|
|
6
|
+
* You can use this to invert the current theme.
|
|
7
|
+
* This is useful when you are displaying a spinner on a background that is not the same background color scheme as the main content.
|
|
8
|
+
*/
|
|
9
|
+
appearance?: Appearance;
|
|
10
|
+
/**
|
|
11
|
+
* Delay the intro animation of `Spinner`.
|
|
12
|
+
* This is not to be used to avoid quick flickering of `Spinner`.
|
|
13
|
+
* `Spinner` will automatically fade in and takes ~200ms to become partially visible.
|
|
14
|
+
* This prop can be helpful for **long delays** such as `500-1000ms` for when you want to not
|
|
15
|
+
* show a `Spinner` until some longer period of time has elapsed.
|
|
16
|
+
*/
|
|
17
|
+
delay?: number;
|
|
18
|
+
/**
|
|
19
|
+
* An optional `interactionName` used to identify when this component is holding an interaction.
|
|
20
|
+
*/
|
|
21
|
+
interactionName?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Describes what the spinner is doing for assistive technologies. For example, "loading", "submitting", or "processing".
|
|
24
|
+
*/
|
|
25
|
+
label?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Size of the spinner. The available sizes are `xsmall`, `small`, `medium`, `large`, and `xlarge`. For most use cases, we recommend `medium`.
|
|
28
|
+
*/
|
|
29
|
+
size?: Size;
|
|
30
|
+
/**
|
|
31
|
+
* A `testId` prop is provided for specified elements,
|
|
32
|
+
* which is a unique string that appears as a data attribute `data-testid` in the rendered code,
|
|
33
|
+
* serving as a hook for automated tests.
|
|
34
|
+
*/
|
|
35
|
+
testId?: string;
|
|
36
|
+
};
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { type MediaType, type ImageResizeMode } from '@atlaskit/media-client';
|
|
3
3
|
import { type CardPreview } from '../../../types';
|
|
4
4
|
export type ImageRendererProps = {
|
|
5
|
-
readonly cardPreview
|
|
5
|
+
readonly cardPreview?: CardPreview;
|
|
6
6
|
readonly mediaType: MediaType;
|
|
7
7
|
readonly alt?: string;
|
|
8
8
|
readonly resizeMode?: ImageResizeMode;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/media-card",
|
|
3
|
-
"version": "78.
|
|
3
|
+
"version": "78.4.1",
|
|
4
4
|
"description": "Includes all media card related components, CardView, CardViewSmall, Card...",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -38,19 +38,19 @@
|
|
|
38
38
|
"@atlaskit/analytics-next": "^10.1.0",
|
|
39
39
|
"@atlaskit/dropdown-menu": "^12.18.0",
|
|
40
40
|
"@atlaskit/editor-shared-styles": "^2.13.0",
|
|
41
|
-
"@atlaskit/icon": "^22.
|
|
41
|
+
"@atlaskit/icon": "^22.18.0",
|
|
42
42
|
"@atlaskit/media-client": "^28.0.0",
|
|
43
43
|
"@atlaskit/media-client-react": "^2.2.0",
|
|
44
44
|
"@atlaskit/media-common": "^11.4.0",
|
|
45
|
-
"@atlaskit/media-file-preview": "^0.
|
|
45
|
+
"@atlaskit/media-file-preview": "^0.9.0",
|
|
46
46
|
"@atlaskit/media-svg": "^0.2.0",
|
|
47
|
-
"@atlaskit/media-ui": "^25.
|
|
48
|
-
"@atlaskit/media-viewer": "^48.
|
|
47
|
+
"@atlaskit/media-ui": "^25.14.0",
|
|
48
|
+
"@atlaskit/media-viewer": "^48.10.0",
|
|
49
49
|
"@atlaskit/platform-feature-flags": "^0.3.0",
|
|
50
50
|
"@atlaskit/primitives": "^12.1.0",
|
|
51
51
|
"@atlaskit/spinner": "^16.3.0",
|
|
52
52
|
"@atlaskit/theme": "^13.0.0",
|
|
53
|
-
"@atlaskit/tokens": "^1.
|
|
53
|
+
"@atlaskit/tokens": "^1.60.0",
|
|
54
54
|
"@atlaskit/tooltip": "^18.7.0",
|
|
55
55
|
"@atlaskit/ufo": "^0.3.0",
|
|
56
56
|
"@atlaskit/ufo-interaction-ignore": "^1.3.0",
|
|
@@ -75,10 +75,10 @@
|
|
|
75
75
|
"@atlaskit/form": "^10.5.0",
|
|
76
76
|
"@atlaskit/inline-message": "^12.3.0",
|
|
77
77
|
"@atlaskit/media-core": "^34.3.0",
|
|
78
|
-
"@atlaskit/media-picker": "^66.
|
|
78
|
+
"@atlaskit/media-picker": "^66.6.0",
|
|
79
79
|
"@atlaskit/media-state": "^1.1.0",
|
|
80
80
|
"@atlaskit/media-test-data": "^2.6.0",
|
|
81
|
-
"@atlaskit/media-test-helpers": "^34.
|
|
81
|
+
"@atlaskit/media-test-helpers": "^34.3.0",
|
|
82
82
|
"@atlaskit/radio": "^6.5.0",
|
|
83
83
|
"@atlaskit/range": "^7.4.0",
|
|
84
84
|
"@atlaskit/ssr": "*",
|