@atlaskit/media-card 78.2.2 → 78.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/cjs/card/card.js +1 -1
- package/dist/cjs/card/cardView.js +31 -10
- package/dist/cjs/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/cjs/card/ui/actionsBar/cardActions/cardActionIconButton.js +44 -54
- package/dist/cjs/card/ui/actionsBar/cardActions/cardActionsView.js +4 -19
- package/dist/cjs/card/ui/titleBox/styles.js +4 -1
- package/dist/cjs/card/ui/titleBox/titleBox.js +20 -22
- package/dist/cjs/card/ui/titleBox/titleBoxComponents.js +25 -23
- 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 +31 -11
- package/dist/es2019/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/es2019/card/ui/actionsBar/cardActions/cardActionIconButton.js +45 -32
- package/dist/es2019/card/ui/actionsBar/cardActions/cardActionsView.js +4 -17
- package/dist/es2019/card/ui/titleBox/styles.js +3 -1
- package/dist/es2019/card/ui/titleBox/titleBox.js +25 -28
- package/dist/es2019/card/ui/titleBox/titleBoxComponents.js +25 -23
- 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 +32 -11
- package/dist/esm/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/esm/card/ui/actionsBar/cardActions/cardActionIconButton.js +43 -51
- package/dist/esm/card/ui/actionsBar/cardActions/cardActionsView.js +4 -19
- package/dist/esm/card/ui/titleBox/styles.js +4 -1
- package/dist/esm/card/ui/titleBox/titleBox.js +19 -21
- package/dist/esm/card/ui/titleBox/titleBoxComponents.js +25 -23
- package/dist/esm/inline/loader.js +1 -1
- package/dist/esm/utils/ufoExperiences.js +1 -1
- package/dist/types/card/ui/actionsBar/cardActions/cardActionIconButton.d.ts +4 -5
- package/dist/types/card/ui/titleBox/styles.d.ts +9 -2
- package/dist/types/card/ui/titleBox/titleBox.d.ts +5 -3
- package/dist/types/card/ui/titleBox/types.d.ts +4 -2
- package/dist/types-ts4.5/card/ui/actionsBar/cardActions/cardActionIconButton.d.ts +4 -5
- package/dist/types-ts4.5/card/ui/titleBox/styles.d.ts +9 -2
- package/dist/types-ts4.5/card/ui/titleBox/titleBox.d.ts +5 -3
- package/dist/types-ts4.5/card/ui/titleBox/types.d.ts +4 -2
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/media-card
|
|
2
2
|
|
|
3
|
+
## 78.2.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#139310](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/139310)
|
|
8
|
+
[`3037eb69f8dbc`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/3037eb69f8dbc) -
|
|
9
|
+
Updated Media card and UI to avoid unnecessary re-renders to avoid contributing to TTVC metrics
|
|
10
|
+
|
|
3
11
|
## 78.2.2
|
|
4
12
|
|
|
5
13
|
### Patch 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 && Object.prototype.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.2.
|
|
24
|
+
var packageVersion = "78.2.3";
|
|
25
25
|
var CardBase = exports.CardBase = function CardBase(_ref) {
|
|
26
26
|
var identifier = _ref.identifier,
|
|
27
27
|
otherProps = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
@@ -16,7 +16,6 @@ var _spinner = _interopRequireDefault(require("@atlaskit/spinner"));
|
|
|
16
16
|
var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
|
|
17
17
|
var _mediaUi = require("@atlaskit/media-ui");
|
|
18
18
|
var _analytics = require("../utils/analytics");
|
|
19
|
-
var _actions = require("./actions");
|
|
20
19
|
var _imageRenderer = require("./ui/imageRenderer/imageRenderer");
|
|
21
20
|
var _titleBox = require("./ui/titleBox/titleBox");
|
|
22
21
|
var _failedTitleBox = require("./ui/titleBox/failedTitleBox");
|
|
@@ -32,6 +31,7 @@ var _wrapper = require("./ui/wrapper");
|
|
|
32
31
|
var _classnames = require("./classnames");
|
|
33
32
|
var _useBreakpoint = require("./useBreakpoint");
|
|
34
33
|
var _openMediaViewerButton = _interopRequireDefault(require("./ui/openMediaViewerButton/openMediaViewerButton"));
|
|
34
|
+
var _useCurrentValueRef = require("../utils/useCurrentValueRef");
|
|
35
35
|
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); }
|
|
36
36
|
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 && Object.prototype.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; }
|
|
37
37
|
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; }
|
|
@@ -125,7 +125,7 @@ var CardViewBase = exports.CardViewBase = function CardViewBase(_ref) {
|
|
|
125
125
|
renderImageRenderer: !!cardPreview,
|
|
126
126
|
renderPlayButton: !!cardPreview && mediaType === 'video',
|
|
127
127
|
renderBlanket: !disableOverlay,
|
|
128
|
-
renderTitleBox: !disableOverlay
|
|
128
|
+
renderTitleBox: !disableOverlay,
|
|
129
129
|
renderTickBox: !disableOverlay && !!selectable
|
|
130
130
|
};
|
|
131
131
|
switch (status) {
|
|
@@ -205,13 +205,33 @@ var CardViewBase = exports.CardViewBase = function CardViewBase(_ref) {
|
|
|
205
205
|
var isTickBoxSelectable = !disableOverlay && !!selectable && !selected;
|
|
206
206
|
// Disable tooltip for Media Single
|
|
207
207
|
var shouldDisplayTooltip = !disableOverlay && !shouldHideTooltip;
|
|
208
|
-
var hasTitleBox = !!(renderTitleBox || renderFailedTitleBox);
|
|
209
208
|
var _ref5 = metadata || {},
|
|
210
209
|
mediaType = _ref5.mediaType,
|
|
211
210
|
mimeType = _ref5.mimeType,
|
|
212
211
|
name = _ref5.name,
|
|
213
212
|
createdAt = _ref5.createdAt;
|
|
214
|
-
var
|
|
213
|
+
var isTitleBoxVisible = renderTitleBox && name;
|
|
214
|
+
var hasVisibleTitleBox = !!(isTitleBoxVisible || renderFailedTitleBox);
|
|
215
|
+
var metadataRef = (0, _useCurrentValueRef.useCurrentValueRef)(metadata);
|
|
216
|
+
var actionsWithDetails = (0, _react2.useMemo)(function () {
|
|
217
|
+
if (!actions) {
|
|
218
|
+
return [];
|
|
219
|
+
}
|
|
220
|
+
return actions.map(function (action) {
|
|
221
|
+
return _objectSpread(_objectSpread({}, action), {}, {
|
|
222
|
+
handler: function handler() {
|
|
223
|
+
if (!metadataRef.current) {
|
|
224
|
+
action.handler();
|
|
225
|
+
} else {
|
|
226
|
+
action.handler({
|
|
227
|
+
type: 'file',
|
|
228
|
+
details: metadataRef.current
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
});
|
|
234
|
+
}, [actions, metadataRef]);
|
|
215
235
|
var contents = (0, _react.jsx)(_react2.default.Fragment, null, (0, _react.jsx)(_wrapper.ImageContainer, {
|
|
216
236
|
testId: _classnames.fileCardImageViewSelector,
|
|
217
237
|
mediaName: name,
|
|
@@ -221,7 +241,7 @@ var CardViewBase = exports.CardViewBase = function CardViewBase(_ref) {
|
|
|
221
241
|
source: cardPreview === null || cardPreview === void 0 ? void 0 : cardPreview.source
|
|
222
242
|
}, renderTypeIcon && (0, _react.jsx)(_iconWrapper.IconWrapper, {
|
|
223
243
|
breakpoint: breakpoint,
|
|
224
|
-
hasTitleBox:
|
|
244
|
+
hasTitleBox: hasVisibleTitleBox
|
|
225
245
|
}, (0, _react.jsx)(_mimeTypeIcon.MimeTypeIcon, {
|
|
226
246
|
testId: "media-card-file-type-icon",
|
|
227
247
|
mediaType: mediaType,
|
|
@@ -229,7 +249,7 @@ var CardViewBase = exports.CardViewBase = function CardViewBase(_ref) {
|
|
|
229
249
|
name: name
|
|
230
250
|
}), iconMessage), renderSpinner && (0, _react.jsx)(_iconWrapper.IconWrapper, {
|
|
231
251
|
breakpoint: breakpoint,
|
|
232
|
-
hasTitleBox:
|
|
252
|
+
hasTitleBox: hasVisibleTitleBox
|
|
233
253
|
}, (0, _react.jsx)(_spinner.default, {
|
|
234
254
|
testId: "media-card-loading",
|
|
235
255
|
interactionName: "media-card-loading"
|
|
@@ -245,22 +265,23 @@ var CardViewBase = exports.CardViewBase = function CardViewBase(_ref) {
|
|
|
245
265
|
forceSyncDisplay: forceSyncDisplay
|
|
246
266
|
}), renderPlayButton && (0, _react.jsx)(_iconWrapper.IconWrapper, {
|
|
247
267
|
breakpoint: breakpoint,
|
|
248
|
-
hasTitleBox:
|
|
268
|
+
hasTitleBox: hasVisibleTitleBox
|
|
249
269
|
}, (0, _react.jsx)(_playButton.PlayButton, null)), renderBlanket && (0, _react.jsx)(_blanket.Blanket, {
|
|
250
270
|
isFixed: isFixedBlanket
|
|
251
|
-
}), renderTitleBox &&
|
|
271
|
+
}), renderTitleBox && (0, _react.jsx)(_titleBox.TitleBox, {
|
|
252
272
|
name: name,
|
|
253
273
|
createdAt: overriddenCreationDate !== null && overriddenCreationDate !== void 0 ? overriddenCreationDate : createdAt,
|
|
254
274
|
breakpoint: breakpoint,
|
|
255
275
|
titleBoxIcon: titleBoxIcon,
|
|
256
|
-
titleBoxBgColor: titleBoxBgColor
|
|
276
|
+
titleBoxBgColor: titleBoxBgColor,
|
|
277
|
+
hidden: !isTitleBoxVisible
|
|
257
278
|
}), renderFailedTitleBox && (0, _react.jsx)(_failedTitleBox.FailedTitleBox, {
|
|
258
279
|
breakpoint: breakpoint,
|
|
259
280
|
customMessage: customTitleMessage
|
|
260
281
|
}), renderProgressBar && (0, _react.jsx)(_progressBar.ProgressBar, {
|
|
261
282
|
progress: progress,
|
|
262
283
|
breakpoint: breakpoint,
|
|
263
|
-
positionBottom: !
|
|
284
|
+
positionBottom: !hasVisibleTitleBox
|
|
264
285
|
}), renderTickBox && (0, _react.jsx)(_tickBox.TickBox, {
|
|
265
286
|
selected: selected
|
|
266
287
|
})), disableOverlay || !actions || actions.length === 0 ? null : (0, _react.jsx)(_actionsBar.ActionsBar, {
|
|
@@ -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.2.
|
|
93
|
+
var packageVersion = "78.2.3";
|
|
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)({
|
|
@@ -1,62 +1,52 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.CardActionIconButton = void 0;
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
12
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
13
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
14
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
15
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
16
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
17
10
|
var _cardActionButton = require("./cardActionButton");
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}]);
|
|
61
|
-
return CardActionIconButton;
|
|
62
|
-
}(_react.Component);
|
|
11
|
+
var _analytics = require("../../../../utils/analytics");
|
|
12
|
+
var CardActionIconButton = exports.CardActionIconButton = function CardActionIconButton(_ref) {
|
|
13
|
+
var icon = _ref.icon,
|
|
14
|
+
label = _ref.label,
|
|
15
|
+
filename = _ref.filename,
|
|
16
|
+
triggerColor = _ref.triggerColor,
|
|
17
|
+
onClick = _ref.onClick,
|
|
18
|
+
isPrimary = _ref.isPrimary,
|
|
19
|
+
variant = _ref.variant;
|
|
20
|
+
var _useAnalyticsEvents = (0, _analyticsNext.useAnalyticsEvents)(),
|
|
21
|
+
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
22
|
+
|
|
23
|
+
// this is to prevent currently focused text to loose cursor on clicking card action
|
|
24
|
+
// this does not prevent onclick behavior
|
|
25
|
+
var onMouseDown = function onMouseDown(event) {
|
|
26
|
+
event.preventDefault();
|
|
27
|
+
};
|
|
28
|
+
var handleClick = function handleClick(e) {
|
|
29
|
+
var actionSubjectId = isPrimary ? 'mediaCardPrimaryActionButton' : 'mediaCardSecondaryActionButton';
|
|
30
|
+
(0, _analytics.fireMediaCardEvent)({
|
|
31
|
+
eventType: 'ui',
|
|
32
|
+
action: 'clicked',
|
|
33
|
+
actionSubject: 'button',
|
|
34
|
+
actionSubjectId: actionSubjectId,
|
|
35
|
+
attributes: {
|
|
36
|
+
label: label
|
|
37
|
+
}
|
|
38
|
+
}, createAnalyticsEvent);
|
|
39
|
+
onClick === null || onClick === void 0 || onClick(e);
|
|
40
|
+
};
|
|
41
|
+
return /*#__PURE__*/_react.default.createElement(_cardActionButton.CardActionButton, {
|
|
42
|
+
onClick: handleClick,
|
|
43
|
+
onMouseDown: onMouseDown
|
|
44
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
45
|
+
,
|
|
46
|
+
style: {
|
|
47
|
+
color: triggerColor
|
|
48
|
+
},
|
|
49
|
+
label: filename ? "".concat(filename, " \u2014 ").concat(label) : label,
|
|
50
|
+
variant: variant
|
|
51
|
+
}, icon);
|
|
52
|
+
};
|
|
@@ -16,16 +16,11 @@ var _cardActionIconButton = require("./cardActionIconButton");
|
|
|
16
16
|
var _styles = require("./styles");
|
|
17
17
|
var _cardActionsDropdownMenu = require("./cardActionsDropdownMenu");
|
|
18
18
|
var _preventClickThrough = require("../../../../utils/preventClickThrough");
|
|
19
|
-
var _analytics = require("../../../../utils/analytics");
|
|
20
|
-
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
21
19
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
22
20
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /**
|
|
23
21
|
* @jsxRuntime classic
|
|
24
22
|
* @jsx jsx
|
|
25
23
|
*/ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
26
|
-
var CardActionIconButtonWithProps = function CardActionIconButtonWithProps(props) {
|
|
27
|
-
return (0, _react.jsx)(_cardActionIconButton.CardActionIconButton, props);
|
|
28
|
-
};
|
|
29
24
|
var CardActionsView = exports.CardActionsView = /*#__PURE__*/function (_Component) {
|
|
30
25
|
(0, _inherits2.default)(CardActionsView, _Component);
|
|
31
26
|
var _super = _createSuper(CardActionsView);
|
|
@@ -56,21 +51,11 @@ var CardActionsView = exports.CardActionsView = /*#__PURE__*/function (_Componen
|
|
|
56
51
|
var icon = action.icon,
|
|
57
52
|
handler = action.handler,
|
|
58
53
|
label = action.label;
|
|
59
|
-
|
|
60
|
-
var CardActionIconButtonWithAnalytics = (0, _analyticsNext.withAnalyticsEvents)({
|
|
61
|
-
onClick: (0, _analytics.createAndFireMediaCardEvent)({
|
|
62
|
-
eventType: 'ui',
|
|
63
|
-
action: 'clicked',
|
|
64
|
-
actionSubject: 'button',
|
|
65
|
-
actionSubjectId: actionSubjectId,
|
|
66
|
-
attributes: {
|
|
67
|
-
label: label
|
|
68
|
-
}
|
|
69
|
-
})
|
|
70
|
-
})(CardActionIconButtonWithProps);
|
|
71
|
-
return (0, _react.jsx)(CardActionIconButtonWithAnalytics, {
|
|
54
|
+
return (0, _react.jsx)(_cardActionIconButton.CardActionIconButton, {
|
|
72
55
|
icon: icon,
|
|
73
|
-
label:
|
|
56
|
+
label: label,
|
|
57
|
+
filename: filename,
|
|
58
|
+
isPrimary: isPrimary,
|
|
74
59
|
triggerColor: triggerColor,
|
|
75
60
|
onClick: function onClick() {
|
|
76
61
|
return handler();
|
|
@@ -21,6 +21,8 @@ var generateResponsiveStyles = function generateResponsiveStyles() {
|
|
|
21
21
|
var HEX_REGEX = /^#[0-9A-F]{6}$/i;
|
|
22
22
|
var titleBoxWrapperStyles = exports.titleBoxWrapperStyles = function titleBoxWrapperStyles(_ref) {
|
|
23
23
|
var breakpoint = _ref.breakpoint,
|
|
24
|
+
_ref$display = _ref.display,
|
|
25
|
+
display = _ref$display === void 0 ? 'flex' : _ref$display,
|
|
24
26
|
titleBoxBgColor = _ref.titleBoxBgColor;
|
|
25
27
|
return (0, _react.css)({
|
|
26
28
|
position: 'absolute',
|
|
@@ -32,7 +34,8 @@ var titleBoxWrapperStyles = exports.titleBoxWrapperStyles = function titleBoxWra
|
|
|
32
34
|
color: "var(--ds-text, ".concat(_colors.N800, ")"),
|
|
33
35
|
cursor: 'inherit',
|
|
34
36
|
pointerEvents: 'none',
|
|
35
|
-
|
|
37
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
38
|
+
display: display,
|
|
36
39
|
flexDirection: 'column',
|
|
37
40
|
justifyContent: 'center'
|
|
38
41
|
},
|
|
@@ -4,42 +4,40 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.TitleBox =
|
|
7
|
+
exports.TitleBox = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _reactIntlNext = require("react-intl-next");
|
|
10
10
|
var _lockFilled = _interopRequireDefault(require("@atlaskit/icon/glyph/lock-filled"));
|
|
11
11
|
var _truncateText = require("@atlaskit/media-ui/truncateText");
|
|
12
12
|
var _formatDate = require("@atlaskit/media-ui/formatDate");
|
|
13
13
|
var _titleBoxComponents = require("./titleBoxComponents");
|
|
14
|
-
var
|
|
15
|
-
|
|
14
|
+
var placeholderText = " ";
|
|
15
|
+
var isValidTimestamp = function isValidTimestamp(timeStamp) {
|
|
16
|
+
return new Date(timeStamp).getTime() > 0;
|
|
17
|
+
};
|
|
18
|
+
var TitleBox = exports.TitleBox = (0, _reactIntlNext.injectIntl)(function (_ref) {
|
|
19
|
+
var _intl$locale;
|
|
20
|
+
var name = _ref.name,
|
|
21
|
+
createdAt = _ref.createdAt,
|
|
22
|
+
breakpoint = _ref.breakpoint,
|
|
23
|
+
titleBoxBgColor = _ref.titleBoxBgColor,
|
|
24
|
+
titleBoxIcon = _ref.titleBoxIcon,
|
|
25
|
+
hidden = _ref.hidden,
|
|
16
26
|
intl = _ref.intl;
|
|
17
|
-
var _ref2 = intl || {
|
|
18
|
-
locale: 'en'
|
|
19
|
-
},
|
|
20
|
-
_ref2$locale = _ref2.locale,
|
|
21
|
-
locale = _ref2$locale === void 0 ? 'en' : _ref2$locale;
|
|
22
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, (0, _formatDate.formatDate)(timestamp, locale));
|
|
23
|
-
});
|
|
24
|
-
var TitleBox = exports.TitleBox = function TitleBox(_ref3) {
|
|
25
|
-
var name = _ref3.name,
|
|
26
|
-
createdAt = _ref3.createdAt,
|
|
27
|
-
breakpoint = _ref3.breakpoint,
|
|
28
|
-
titleBoxBgColor = _ref3.titleBoxBgColor,
|
|
29
|
-
titleBoxIcon = _ref3.titleBoxIcon;
|
|
30
27
|
return /*#__PURE__*/_react.default.createElement(_titleBoxComponents.TitleBoxWrapper, {
|
|
28
|
+
hidden: hidden,
|
|
31
29
|
breakpoint: breakpoint,
|
|
32
30
|
titleBoxBgColor: titleBoxBgColor
|
|
33
31
|
}, /*#__PURE__*/_react.default.createElement(_titleBoxComponents.TitleBoxHeader, {
|
|
34
32
|
hasIconOverlap: !!titleBoxIcon && !createdAt
|
|
35
33
|
}, /*#__PURE__*/_react.default.createElement(_truncateText.Truncate, {
|
|
36
|
-
text: name
|
|
37
|
-
})),
|
|
34
|
+
text: name !== null && name !== void 0 ? name : placeholderText
|
|
35
|
+
})), /*#__PURE__*/_react.default.createElement(_titleBoxComponents.TitleBoxFooter, {
|
|
38
36
|
hasIconOverlap: !!titleBoxIcon
|
|
39
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
40
|
-
timestamp: createdAt
|
|
41
|
-
})) : null, titleBoxIcon === 'LockFilledIcon' && /*#__PURE__*/_react.default.createElement(_titleBoxComponents.TitleBoxIcon, null, /*#__PURE__*/_react.default.createElement(_lockFilled.default, {
|
|
37
|
+
}, createdAt !== undefined && isValidTimestamp(createdAt) ? (0, _formatDate.formatDate)(createdAt, (_intl$locale = intl === null || intl === void 0 ? void 0 : intl.locale) !== null && _intl$locale !== void 0 ? _intl$locale : 'en') : placeholderText), titleBoxIcon === 'LockFilledIcon' && /*#__PURE__*/_react.default.createElement(_titleBoxComponents.TitleBoxIcon, null, /*#__PURE__*/_react.default.createElement(_lockFilled.default, {
|
|
42
38
|
label: "",
|
|
43
39
|
size: "small"
|
|
44
40
|
})));
|
|
45
|
-
}
|
|
41
|
+
}, {
|
|
42
|
+
enforceContext: false
|
|
43
|
+
});
|
|
@@ -14,7 +14,8 @@ var _styles = require("./styles");
|
|
|
14
14
|
|
|
15
15
|
var TitleBoxWrapper = exports.TitleBoxWrapper = function TitleBoxWrapper(props) {
|
|
16
16
|
var breakpoint = props.breakpoint,
|
|
17
|
-
titleBoxBgColor = props.titleBoxBgColor
|
|
17
|
+
titleBoxBgColor = props.titleBoxBgColor,
|
|
18
|
+
hidden = props.hidden;
|
|
18
19
|
return (0, _react.jsx)("div", {
|
|
19
20
|
id: "titleBoxWrapper",
|
|
20
21
|
"data-testid": "media-title-box"
|
|
@@ -22,42 +23,43 @@ var TitleBoxWrapper = exports.TitleBoxWrapper = function TitleBoxWrapper(props)
|
|
|
22
23
|
,
|
|
23
24
|
css: (0, _styles.titleBoxWrapperStyles)({
|
|
24
25
|
breakpoint: breakpoint,
|
|
26
|
+
display: hidden ? 'none' : 'flex',
|
|
25
27
|
titleBoxBgColor: titleBoxBgColor
|
|
26
28
|
})
|
|
27
29
|
}, props.children);
|
|
28
30
|
};
|
|
29
31
|
var TitleBoxHeader = exports.TitleBoxHeader = function TitleBoxHeader(props) {
|
|
30
32
|
var hasIconOverlap = props.hasIconOverlap;
|
|
31
|
-
return (
|
|
33
|
+
return (0, _react.jsx)("div", {
|
|
34
|
+
id: "titleBoxHeader",
|
|
35
|
+
"data-testid": "title-box-header"
|
|
32
36
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}, props.children)
|
|
39
|
-
);
|
|
37
|
+
,
|
|
38
|
+
css: (0, _styles.titleBoxHeaderStyles)({
|
|
39
|
+
hasIconOverlap: hasIconOverlap
|
|
40
|
+
})
|
|
41
|
+
}, props.children);
|
|
40
42
|
};
|
|
41
43
|
var TitleBoxFooter = exports.TitleBoxFooter = function TitleBoxFooter(props) {
|
|
42
44
|
var hasIconOverlap = props.hasIconOverlap;
|
|
43
|
-
return (
|
|
45
|
+
return (0, _react.jsx)("div", {
|
|
46
|
+
id: "titleBoxFooter",
|
|
47
|
+
"data-testid": "title-box-footer"
|
|
44
48
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}, props.children)
|
|
51
|
-
);
|
|
49
|
+
,
|
|
50
|
+
css: (0, _styles.titleBoxFooterStyles)({
|
|
51
|
+
hasIconOverlap: hasIconOverlap
|
|
52
|
+
})
|
|
53
|
+
}, props.children);
|
|
52
54
|
};
|
|
53
55
|
var TitleBoxIcon = exports.TitleBoxIcon = function TitleBoxIcon(props) {
|
|
54
|
-
return (
|
|
56
|
+
return (0, _react.jsx)("div", {
|
|
57
|
+
id: "titleBoxIcon",
|
|
58
|
+
"data-testid": "title-box-icon"
|
|
55
59
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}, props.children)
|
|
60
|
-
);
|
|
60
|
+
,
|
|
61
|
+
css: _styles.titleBoxIconStyles
|
|
62
|
+
}, props.children);
|
|
61
63
|
};
|
|
62
64
|
var ErrorMessageWrapper = exports.ErrorMessageWrapper = function ErrorMessageWrapper(props) {
|
|
63
65
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
@@ -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.2.
|
|
122
|
+
packageName: "78.2.3",
|
|
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.2.
|
|
18
|
+
var packageVersion = "78.2.3";
|
|
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.2.
|
|
12
|
+
const packageVersion = "78.2.3";
|
|
13
13
|
export const CardBase = ({
|
|
14
14
|
identifier,
|
|
15
15
|
...otherProps
|
|
@@ -4,14 +4,13 @@
|
|
|
4
4
|
*/
|
|
5
5
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
6
6
|
import { jsx } from '@emotion/react';
|
|
7
|
-
import React, { useEffect, useState, useRef } from 'react';
|
|
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
10
|
import SpinnerIcon from '@atlaskit/spinner';
|
|
11
11
|
import Tooltip from '@atlaskit/tooltip';
|
|
12
12
|
import { messages } from '@atlaskit/media-ui';
|
|
13
13
|
import { createAndFireMediaCardEvent } from '../utils/analytics';
|
|
14
|
-
import { attachDetailsToActions } from './actions';
|
|
15
14
|
import { ImageRenderer } from './ui/imageRenderer/imageRenderer';
|
|
16
15
|
import { TitleBox } from './ui/titleBox/titleBox';
|
|
17
16
|
import { FailedTitleBox } from './ui/titleBox/failedTitleBox';
|
|
@@ -27,6 +26,7 @@ import { Wrapper, ImageContainer } from './ui/wrapper';
|
|
|
27
26
|
import { fileCardImageViewSelector } from './classnames';
|
|
28
27
|
import { useBreakpoint } from './useBreakpoint';
|
|
29
28
|
import OpenMediaViewerButton from './ui/openMediaViewerButton/openMediaViewerButton';
|
|
29
|
+
import { useCurrentValueRef } from '../utils/useCurrentValueRef';
|
|
30
30
|
export const CardViewBase = ({
|
|
31
31
|
innerRef,
|
|
32
32
|
onImageLoad,
|
|
@@ -112,7 +112,7 @@ export const CardViewBase = ({
|
|
|
112
112
|
renderImageRenderer: !!cardPreview,
|
|
113
113
|
renderPlayButton: !!cardPreview && mediaType === 'video',
|
|
114
114
|
renderBlanket: !disableOverlay,
|
|
115
|
-
renderTitleBox: !disableOverlay
|
|
115
|
+
renderTitleBox: !disableOverlay,
|
|
116
116
|
renderTickBox: !disableOverlay && !!selectable
|
|
117
117
|
};
|
|
118
118
|
switch (status) {
|
|
@@ -200,14 +200,33 @@ export const CardViewBase = ({
|
|
|
200
200
|
const isTickBoxSelectable = !disableOverlay && !!selectable && !selected;
|
|
201
201
|
// Disable tooltip for Media Single
|
|
202
202
|
const shouldDisplayTooltip = !disableOverlay && !shouldHideTooltip;
|
|
203
|
-
const hasTitleBox = !!(renderTitleBox || renderFailedTitleBox);
|
|
204
203
|
const {
|
|
205
204
|
mediaType,
|
|
206
205
|
mimeType,
|
|
207
206
|
name,
|
|
208
207
|
createdAt
|
|
209
208
|
} = metadata || {};
|
|
210
|
-
const
|
|
209
|
+
const isTitleBoxVisible = renderTitleBox && name;
|
|
210
|
+
const hasVisibleTitleBox = !!(isTitleBoxVisible || renderFailedTitleBox);
|
|
211
|
+
const metadataRef = useCurrentValueRef(metadata);
|
|
212
|
+
const actionsWithDetails = useMemo(() => {
|
|
213
|
+
if (!actions) {
|
|
214
|
+
return [];
|
|
215
|
+
}
|
|
216
|
+
return actions.map(action => ({
|
|
217
|
+
...action,
|
|
218
|
+
handler: () => {
|
|
219
|
+
if (!metadataRef.current) {
|
|
220
|
+
action.handler();
|
|
221
|
+
} else {
|
|
222
|
+
action.handler({
|
|
223
|
+
type: 'file',
|
|
224
|
+
details: metadataRef.current
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}));
|
|
229
|
+
}, [actions, metadataRef]);
|
|
211
230
|
const contents = jsx(React.Fragment, null, jsx(ImageContainer, {
|
|
212
231
|
testId: fileCardImageViewSelector,
|
|
213
232
|
mediaName: name,
|
|
@@ -217,7 +236,7 @@ export const CardViewBase = ({
|
|
|
217
236
|
source: cardPreview === null || cardPreview === void 0 ? void 0 : cardPreview.source
|
|
218
237
|
}, renderTypeIcon && jsx(IconWrapper, {
|
|
219
238
|
breakpoint: breakpoint,
|
|
220
|
-
hasTitleBox:
|
|
239
|
+
hasTitleBox: hasVisibleTitleBox
|
|
221
240
|
}, jsx(MimeTypeIcon, {
|
|
222
241
|
testId: "media-card-file-type-icon",
|
|
223
242
|
mediaType: mediaType,
|
|
@@ -225,7 +244,7 @@ export const CardViewBase = ({
|
|
|
225
244
|
name: name
|
|
226
245
|
}), iconMessage), renderSpinner && jsx(IconWrapper, {
|
|
227
246
|
breakpoint: breakpoint,
|
|
228
|
-
hasTitleBox:
|
|
247
|
+
hasTitleBox: hasVisibleTitleBox
|
|
229
248
|
}, jsx(SpinnerIcon, {
|
|
230
249
|
testId: "media-card-loading",
|
|
231
250
|
interactionName: "media-card-loading"
|
|
@@ -241,22 +260,23 @@ export const CardViewBase = ({
|
|
|
241
260
|
forceSyncDisplay: forceSyncDisplay
|
|
242
261
|
}), renderPlayButton && jsx(IconWrapper, {
|
|
243
262
|
breakpoint: breakpoint,
|
|
244
|
-
hasTitleBox:
|
|
263
|
+
hasTitleBox: hasVisibleTitleBox
|
|
245
264
|
}, jsx(PlayButton, null)), renderBlanket && jsx(Blanket, {
|
|
246
265
|
isFixed: isFixedBlanket
|
|
247
|
-
}), renderTitleBox &&
|
|
266
|
+
}), renderTitleBox && jsx(TitleBox, {
|
|
248
267
|
name: name,
|
|
249
268
|
createdAt: overriddenCreationDate !== null && overriddenCreationDate !== void 0 ? overriddenCreationDate : createdAt,
|
|
250
269
|
breakpoint: breakpoint,
|
|
251
270
|
titleBoxIcon: titleBoxIcon,
|
|
252
|
-
titleBoxBgColor: titleBoxBgColor
|
|
271
|
+
titleBoxBgColor: titleBoxBgColor,
|
|
272
|
+
hidden: !isTitleBoxVisible
|
|
253
273
|
}), renderFailedTitleBox && jsx(FailedTitleBox, {
|
|
254
274
|
breakpoint: breakpoint,
|
|
255
275
|
customMessage: customTitleMessage
|
|
256
276
|
}), renderProgressBar && jsx(ProgressBar, {
|
|
257
277
|
progress: progress,
|
|
258
278
|
breakpoint: breakpoint,
|
|
259
|
-
positionBottom: !
|
|
279
|
+
positionBottom: !hasVisibleTitleBox
|
|
260
280
|
}), renderTickBox && jsx(TickBox, {
|
|
261
281
|
selected: selected
|
|
262
282
|
})), disableOverlay || !actions || actions.length === 0 ? null : jsx(ActionsBar, {
|
|
@@ -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.2.
|
|
69
|
+
const packageVersion = "78.2.3";
|
|
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({
|