@atlaskit/media-card 78.15.4 → 78.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/dist/cjs/card/actions.js +9 -6
- package/dist/cjs/card/card.js +1 -1
- package/dist/cjs/card/fileCard.js +10 -4
- package/dist/cjs/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/cjs/card/ui/actionsBar/cardActions/cardActionIconButton.js +14 -3
- package/dist/cjs/card/ui/actionsBar/cardActions/cardActionsDropdownMenu.js +6 -2
- package/dist/cjs/card/ui/actionsBar/cardActions/cardActionsView.js +6 -2
- package/dist/cjs/card/ui/actionsBar/cardActions/styles.js +1 -2
- package/dist/cjs/card/ui/wrapper/styles.js +1 -2
- package/dist/cjs/inline/loader.js +1 -1
- package/dist/cjs/utils/ufoExperiences.js +1 -1
- package/dist/es2019/card/actions.js +15 -9
- package/dist/es2019/card/card.js +1 -1
- package/dist/es2019/card/fileCard.js +10 -3
- package/dist/es2019/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/es2019/card/ui/actionsBar/cardActions/cardActionIconButton.js +14 -3
- package/dist/es2019/card/ui/actionsBar/cardActions/cardActionsDropdownMenu.js +4 -2
- package/dist/es2019/card/ui/actionsBar/cardActions/cardActionsView.js +6 -2
- package/dist/es2019/card/ui/actionsBar/cardActions/styles.js +1 -2
- package/dist/es2019/card/ui/wrapper/styles.js +1 -2
- package/dist/es2019/inline/loader.js +1 -1
- package/dist/es2019/utils/ufoExperiences.js +1 -1
- package/dist/esm/card/actions.js +9 -6
- package/dist/esm/card/card.js +1 -1
- package/dist/esm/card/fileCard.js +10 -4
- package/dist/esm/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/esm/card/ui/actionsBar/cardActions/cardActionIconButton.js +14 -3
- package/dist/esm/card/ui/actionsBar/cardActions/cardActionsDropdownMenu.js +6 -2
- package/dist/esm/card/ui/actionsBar/cardActions/cardActionsView.js +6 -2
- package/dist/esm/card/ui/actionsBar/cardActions/styles.js +1 -2
- package/dist/esm/card/ui/wrapper/styles.js +1 -2
- package/dist/esm/inline/loader.js +1 -1
- package/dist/esm/utils/ufoExperiences.js +1 -1
- package/dist/types/card/actions.d.ts +6 -5
- package/dist/types/card/ui/actionsBar/cardActions/cardActionIconButton.d.ts +3 -1
- package/dist/types/card/ui/actionsBar/cardActions/styles.d.ts +1 -0
- package/dist/types-ts4.5/card/actions.d.ts +6 -5
- package/dist/types-ts4.5/card/ui/actionsBar/cardActions/cardActionIconButton.d.ts +3 -1
- package/dist/types-ts4.5/card/ui/actionsBar/cardActions/styles.d.ts +1 -0
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/media-card
|
|
2
2
|
|
|
3
|
+
## 78.16.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#179931](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/179931)
|
|
8
|
+
[`9ecf438a10ba5`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/9ecf438a10ba5) -
|
|
9
|
+
Disable Media downloads based on Product security policy. Option added to Media Client Config
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#179934](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/179934)
|
|
14
|
+
[`be121b1cf4f54`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/be121b1cf4f54) -
|
|
15
|
+
Internal changes to typography font family style definitions.
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
3
18
|
## 78.15.4
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
package/dist/cjs/card/actions.js
CHANGED
|
@@ -9,6 +9,7 @@ exports.createDownloadAction = void 0;
|
|
|
9
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
10
|
var _react = _interopRequireDefault(require("react"));
|
|
11
11
|
var _download = _interopRequireDefault(require("@atlaskit/icon/core/migration/download"));
|
|
12
|
+
var _mediaUi = require("@atlaskit/media-ui");
|
|
12
13
|
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; }
|
|
13
14
|
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; }
|
|
14
15
|
function attachDetailsToActions(actions, details) {
|
|
@@ -23,14 +24,16 @@ function attachDetailsToActions(actions, details) {
|
|
|
23
24
|
});
|
|
24
25
|
});
|
|
25
26
|
}
|
|
26
|
-
var createDownloadAction = exports.createDownloadAction = function createDownloadAction(
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
var createDownloadAction = exports.createDownloadAction = function createDownloadAction(baseAction, formatMessage) {
|
|
28
|
+
var label = baseAction.isDisabled ? 'Download Disabled' : 'Download';
|
|
29
|
+
var tooltip = baseAction.isDisabled ? formatMessage(_mediaUi.messages.download_disabled_security_policy) : undefined;
|
|
30
|
+
return _objectSpread(_objectSpread({}, baseAction), {}, {
|
|
31
|
+
label: label,
|
|
32
|
+
tooltip: tooltip,
|
|
29
33
|
icon: /*#__PURE__*/_react.default.createElement(_download.default, {
|
|
30
34
|
color: "currentColor",
|
|
31
35
|
spacing: "spacious",
|
|
32
36
|
label: "Download"
|
|
33
|
-
})
|
|
34
|
-
|
|
35
|
-
};
|
|
37
|
+
})
|
|
38
|
+
});
|
|
36
39
|
};
|
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.16.0";
|
|
25
25
|
var CardBase = exports.CardBase = function CardBase(_ref) {
|
|
26
26
|
var identifier = _ref.identifier,
|
|
27
27
|
otherProps = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
@@ -37,6 +37,7 @@ var _mediaFilePreview = require("@atlaskit/media-file-preview");
|
|
|
37
37
|
var _actions = require("./actions");
|
|
38
38
|
var _performance = require("./performance");
|
|
39
39
|
var _dateOverrideContext = require("../dateOverrideContext");
|
|
40
|
+
var _reactIntlNext = require("react-intl-next");
|
|
40
41
|
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); }
|
|
41
42
|
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; }
|
|
42
43
|
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; }
|
|
@@ -75,6 +76,8 @@ var FileCard = exports.FileCard = function FileCard(_ref) {
|
|
|
75
76
|
videoControlsWrapperRef = _ref.videoControlsWrapperRef,
|
|
76
77
|
viewerOptions = _ref.viewerOptions,
|
|
77
78
|
includeHashForDuplicateFiles = _ref.includeHashForDuplicateFiles;
|
|
79
|
+
var _useIntl = (0, _reactIntlNext.useIntl)(),
|
|
80
|
+
formatMessage = _useIntl.formatMessage;
|
|
78
81
|
var _useAnalyticsEvents = (0, _analyticsNext.useAnalyticsEvents)(),
|
|
79
82
|
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
80
83
|
//----------------------------------------------------------------//
|
|
@@ -246,7 +249,7 @@ var FileCard = exports.FileCard = function FileCard(_ref) {
|
|
|
246
249
|
}, [fileStateValue === null || fileStateValue === void 0 ? void 0 : fileStateValue.status, metadata.id, metadata.mediaType, metadata.mimeType, metadata.size]);
|
|
247
250
|
var computedActions = (0, _react.useMemo)(function () {
|
|
248
251
|
if (finalStatus === 'failed-processing' || shouldEnableDownloadButton) {
|
|
249
|
-
var
|
|
252
|
+
var handler = /*#__PURE__*/function () {
|
|
250
253
|
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
251
254
|
var _error;
|
|
252
255
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
@@ -270,16 +273,19 @@ var FileCard = exports.FileCard = function FileCard(_ref) {
|
|
|
270
273
|
}
|
|
271
274
|
}, _callee, null, [[0, 6]]);
|
|
272
275
|
}));
|
|
273
|
-
return function
|
|
276
|
+
return function handler() {
|
|
274
277
|
return _ref2.apply(this, arguments);
|
|
275
278
|
};
|
|
276
279
|
}();
|
|
277
|
-
var downloadAction = (0, _actions.createDownloadAction)(
|
|
280
|
+
var downloadAction = (0, _actions.createDownloadAction)({
|
|
281
|
+
handler: handler,
|
|
282
|
+
isDisabled: mediaClient.config.enforceDataSecurityPolicy
|
|
283
|
+
}, formatMessage);
|
|
278
284
|
return [downloadAction].concat((0, _toConsumableArray2.default)(actions !== null && actions !== void 0 ? actions : []));
|
|
279
285
|
} else {
|
|
280
286
|
return actions;
|
|
281
287
|
}
|
|
282
|
-
}, [actions, identifier.collectionName, identifier.id, mediaClient.file, metadata.name, shouldEnableDownloadButton, finalStatus, createAnalyticsEvent, fileAttributes, fileStateValue === null || fileStateValue === void 0 ? void 0 : fileStateValue.metadataTraceContext, traceContext]);
|
|
288
|
+
}, [actions, identifier.collectionName, identifier.id, mediaClient.file, mediaClient.config.enforceDataSecurityPolicy, metadata.name, shouldEnableDownloadButton, finalStatus, createAnalyticsEvent, fileAttributes, fileStateValue === null || fileStateValue === void 0 ? void 0 : fileStateValue.metadataTraceContext, traceContext, formatMessage]);
|
|
283
289
|
|
|
284
290
|
//----------------------------------------------------------------//
|
|
285
291
|
//---------------------- Analytics ------------------------------//
|
|
@@ -87,7 +87,7 @@ var WrappedMediaCardAnalyticsErrorBoundary = /*#__PURE__*/function (_React$Compo
|
|
|
87
87
|
}(_react.default.Component);
|
|
88
88
|
(0, _defineProperty2.default)(WrappedMediaCardAnalyticsErrorBoundary, "displayName", 'MediaCardAnalyticsErrorBoundary');
|
|
89
89
|
var packageName = "@atlaskit/media-card";
|
|
90
|
-
var packageVersion = "78.
|
|
90
|
+
var packageVersion = "78.16.0";
|
|
91
91
|
|
|
92
92
|
// @ts-ignore: [PIT-1685] Fails in post-office due to backwards incompatibility issue with React 18
|
|
93
93
|
var MediaCardAnalyticsErrorBoundary = (0, _mediaCommon.withMediaAnalyticsContext)({
|
|
@@ -8,6 +8,7 @@ exports.CardActionIconButton = void 0;
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
10
10
|
var _cardActionButton = require("./cardActionButton");
|
|
11
|
+
var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
|
|
11
12
|
var _analytics = require("../../../../utils/analytics");
|
|
12
13
|
var CardActionIconButton = exports.CardActionIconButton = function CardActionIconButton(_ref) {
|
|
13
14
|
var icon = _ref.icon,
|
|
@@ -16,7 +17,9 @@ var CardActionIconButton = exports.CardActionIconButton = function CardActionIco
|
|
|
16
17
|
triggerColor = _ref.triggerColor,
|
|
17
18
|
onClick = _ref.onClick,
|
|
18
19
|
isPrimary = _ref.isPrimary,
|
|
19
|
-
variant = _ref.variant
|
|
20
|
+
variant = _ref.variant,
|
|
21
|
+
isDisabled = _ref.isDisabled,
|
|
22
|
+
tooltip = _ref.tooltip;
|
|
20
23
|
var _useAnalyticsEvents = (0, _analyticsNext.useAnalyticsEvents)(),
|
|
21
24
|
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
22
25
|
|
|
@@ -38,7 +41,7 @@ var CardActionIconButton = exports.CardActionIconButton = function CardActionIco
|
|
|
38
41
|
}, createAnalyticsEvent);
|
|
39
42
|
onClick === null || onClick === void 0 || onClick(e);
|
|
40
43
|
};
|
|
41
|
-
|
|
44
|
+
var cardActionButton = /*#__PURE__*/_react.default.createElement(_cardActionButton.CardActionButton, {
|
|
42
45
|
onClick: handleClick,
|
|
43
46
|
onMouseDown: onMouseDown
|
|
44
47
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
@@ -47,6 +50,14 @@ var CardActionIconButton = exports.CardActionIconButton = function CardActionIco
|
|
|
47
50
|
color: triggerColor
|
|
48
51
|
},
|
|
49
52
|
label: filename ? "".concat(filename, " \u2014 ").concat(label) : label,
|
|
50
|
-
variant: variant
|
|
53
|
+
variant: variant,
|
|
54
|
+
disabled: isDisabled
|
|
51
55
|
}, icon);
|
|
56
|
+
var useTooltip = !!tooltip && false; // TODO: Tooltip breaks Button positioning
|
|
57
|
+
|
|
58
|
+
return useTooltip ? /*#__PURE__*/_react.default.createElement(_tooltip.default, {
|
|
59
|
+
content: tooltip,
|
|
60
|
+
position: "bottom",
|
|
61
|
+
tag: "span"
|
|
62
|
+
}, cardActionButton) : cardActionButton;
|
|
52
63
|
};
|
|
@@ -25,7 +25,8 @@ var DropdownItemWithProps = function DropdownItemWithProps(props) {
|
|
|
25
25
|
};
|
|
26
26
|
var createDropdownItemWithAnalytics = function createDropdownItemWithAnalytics(action, index) {
|
|
27
27
|
var label = action.label,
|
|
28
|
-
handler = action.handler
|
|
28
|
+
handler = action.handler,
|
|
29
|
+
isDisabled = action.isDisabled;
|
|
29
30
|
var DropdownItemWithAnalytics = (0, _analyticsNext.withAnalyticsEvents)({
|
|
30
31
|
onClick: (0, _analytics.createAndFireMediaCardEvent)({
|
|
31
32
|
eventType: 'ui',
|
|
@@ -39,7 +40,10 @@ var createDropdownItemWithAnalytics = function createDropdownItemWithAnalytics(a
|
|
|
39
40
|
})(DropdownItemWithProps);
|
|
40
41
|
return /*#__PURE__*/_react.default.createElement(DropdownItemWithAnalytics, {
|
|
41
42
|
key: index,
|
|
42
|
-
onClick:
|
|
43
|
+
onClick: function onClick() {
|
|
44
|
+
return handler();
|
|
45
|
+
},
|
|
46
|
+
isDisabled: isDisabled
|
|
43
47
|
}, label);
|
|
44
48
|
};
|
|
45
49
|
var CardActionsDropdownMenu = exports.CardActionsDropdownMenu = function CardActionsDropdownMenu(_ref) {
|
|
@@ -49,7 +49,9 @@ var CardActionsView = exports.CardActionsView = /*#__PURE__*/function (_Componen
|
|
|
49
49
|
variant = _this$props.variant;
|
|
50
50
|
var icon = action.icon,
|
|
51
51
|
handler = action.handler,
|
|
52
|
-
label = action.label
|
|
52
|
+
label = action.label,
|
|
53
|
+
isDisabled = action.isDisabled,
|
|
54
|
+
tooltip = action.tooltip;
|
|
53
55
|
return (0, _react.jsx)(_cardActionIconButton.CardActionIconButton, {
|
|
54
56
|
icon: icon,
|
|
55
57
|
label: label,
|
|
@@ -59,7 +61,9 @@ var CardActionsView = exports.CardActionsView = /*#__PURE__*/function (_Componen
|
|
|
59
61
|
onClick: function onClick() {
|
|
60
62
|
return handler();
|
|
61
63
|
},
|
|
62
|
-
variant: variant
|
|
64
|
+
variant: variant,
|
|
65
|
+
isDisabled: isDisabled,
|
|
66
|
+
tooltip: tooltip
|
|
63
67
|
});
|
|
64
68
|
}
|
|
65
69
|
}, {
|
|
@@ -8,13 +8,12 @@ var _react = require("@emotion/react");
|
|
|
8
8
|
var _colors = require("@atlaskit/theme/colors");
|
|
9
9
|
var _mediaUi = require("@atlaskit/media-ui");
|
|
10
10
|
var _styles = require("../../styles");
|
|
11
|
-
var _constants = require("@atlaskit/theme/constants");
|
|
12
11
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
13
12
|
|
|
14
13
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
15
14
|
var wrapperStyles = exports.wrapperStyles = (0, _react.css)({
|
|
16
15
|
boxSizing: 'border-box',
|
|
17
|
-
fontFamily: (
|
|
16
|
+
fontFamily: "var(--ds-font-family-body, ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)",
|
|
18
17
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
19
18
|
'*': {
|
|
20
19
|
boxSizing: 'border-box'
|
|
@@ -7,7 +7,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.wrapperStyles = void 0;
|
|
8
8
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
9
9
|
var _react = require("@emotion/react");
|
|
10
|
-
var _constants = require("@atlaskit/theme/constants");
|
|
11
10
|
var _mediaUi = require("@atlaskit/media-ui");
|
|
12
11
|
var _colors = require("@atlaskit/theme/colors");
|
|
13
12
|
var _selection = require("@atlaskit/editor-shared-styles/selection");
|
|
@@ -26,6 +25,6 @@ var wrapperStyles = exports.wrapperStyles = function wrapperStyles(_ref) {
|
|
|
26
25
|
isTickBoxSelectable = _ref.isTickBoxSelectable,
|
|
27
26
|
shouldDisplayTooltip = _ref.shouldDisplayTooltip,
|
|
28
27
|
mediaCardCursor = _ref.mediaCardCursor;
|
|
29
|
-
return (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n\t", "\n\tbox-sizing: border-box;\n\t* {\n\t\tbox-sizing: border-box;\n\t}\n\tposition: relative;\n\tfont-family: ", ";\n\t", "\n\t", "\n ", "\n ", "\n ", "\n ", ";\n\t", "\n\n\t/* We use classnames from here exceptionally to be able to handle styles when the Card is on hover */\n ", "\n ", "\n &:hover .", " {\n\t\t", "\n\t}\n\t&:hover .", ", &:focus-within .", " {\n\t\t", "\n\t}\n\n\t/* Tooltip does not support percentage dimensions. We enforce them here */\n\t", "\n\n\tbutton:focus + & {\n\t\toutline: solid 2px ", ";\n\t}\n"])), (0, _styles.transition)(), (
|
|
28
|
+
return (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n\t", "\n\tbox-sizing: border-box;\n\t* {\n\t\tbox-sizing: border-box;\n\t}\n\tposition: relative;\n\tfont-family: ", ";\n\t", "\n\t", "\n ", "\n ", "\n ", "\n ", ";\n\t", "\n\n\t/* We use classnames from here exceptionally to be able to handle styles when the Card is on hover */\n ", "\n ", "\n &:hover .", " {\n\t\t", "\n\t}\n\t&:hover .", ", &:focus-within .", " {\n\t\t", "\n\t}\n\n\t/* Tooltip does not support percentage dimensions. We enforce them here */\n\t", "\n\n\tbutton:focus + & {\n\t\toutline: solid 2px ", ";\n\t}\n"])), (0, _styles.transition)(), "var(--ds-font-family-body, ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)", (0, _styles.getWrapperDimensions)(dimensions, appearance), displayBackground && "background: ".concat("var(--ds-background-neutral, ".concat(_colors.N20, ")"), ";"), _mediaUi.borderRadius, (0, _styles.getCursorStyle)(mediaCardCursor), (0, _styles.getWrapperShadow)(disableOverlay, selected), (0, _styles.generateResponsiveStyles)(breakpoint), _selection.hideNativeBrowserTextSelectionStyles, (0, _styles.getClickablePlayButtonStyles)(isPlayButtonClickable), (0, _styles.getSelectableTickBoxStyles)(isTickBoxSelectable), _styles2.blanketClassName, _styles2.fixedBlanketStyles, _styles3.actionsBarClassName, _styles3.actionsBarClassName, _styles3.fixedActionBarStyles, shouldDisplayTooltip && "> div { width: 100%; height: 100%; }", "var(--ds-border-focused, ".concat(_colors.B100, ")"));
|
|
30
29
|
};
|
|
31
30
|
wrapperStyles.displayName = 'NewFileExperienceWrapper';
|
|
@@ -117,7 +117,7 @@ var MediaInlineCardLoader = exports.default = /*#__PURE__*/function (_React$Pure
|
|
|
117
117
|
ErrorBoundary = _this$state.ErrorBoundary;
|
|
118
118
|
var analyticsContext = {
|
|
119
119
|
packageVersion: "@atlaskit/media-card",
|
|
120
|
-
packageName: "78.
|
|
120
|
+
packageName: "78.16.0",
|
|
121
121
|
componentName: 'mediaInlineCard',
|
|
122
122
|
component: 'mediaInlineCard'
|
|
123
123
|
};
|
|
@@ -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.16.0";
|
|
19
19
|
var concurrentExperience;
|
|
20
20
|
var getExperience = function getExperience(id) {
|
|
21
21
|
if (!concurrentExperience) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import DownloadIcon from '@atlaskit/icon/core/migration/download';
|
|
3
|
+
import { messages } from '@atlaskit/media-ui';
|
|
3
4
|
export function attachDetailsToActions(actions, details) {
|
|
4
5
|
return actions.map(action => ({
|
|
5
6
|
...action,
|
|
@@ -11,12 +12,17 @@ export function attachDetailsToActions(actions, details) {
|
|
|
11
12
|
}
|
|
12
13
|
}));
|
|
13
14
|
}
|
|
14
|
-
export const createDownloadAction =
|
|
15
|
-
label: 'Download'
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
label
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
15
|
+
export const createDownloadAction = (baseAction, formatMessage) => {
|
|
16
|
+
const label = baseAction.isDisabled ? 'Download Disabled' : 'Download';
|
|
17
|
+
const tooltip = baseAction.isDisabled ? formatMessage(messages.download_disabled_security_policy) : undefined;
|
|
18
|
+
return {
|
|
19
|
+
...baseAction,
|
|
20
|
+
label,
|
|
21
|
+
tooltip,
|
|
22
|
+
icon: /*#__PURE__*/React.createElement(DownloadIcon, {
|
|
23
|
+
color: "currentColor",
|
|
24
|
+
spacing: "spacious",
|
|
25
|
+
label: "Download"
|
|
26
|
+
})
|
|
27
|
+
};
|
|
28
|
+
};
|
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 UFOLabel from '@atlaskit/react-ufo/label';
|
|
11
11
|
const packageName = "@atlaskit/media-card";
|
|
12
|
-
const packageVersion = "78.
|
|
12
|
+
const packageVersion = "78.16.0";
|
|
13
13
|
export const CardBase = ({
|
|
14
14
|
identifier,
|
|
15
15
|
...otherProps
|
|
@@ -25,6 +25,7 @@ import { createDownloadAction } from './actions';
|
|
|
25
25
|
import { performanceNow } from './performance';
|
|
26
26
|
import { useContext } from 'react';
|
|
27
27
|
import { DateOverrideContext } from '../dateOverrideContext';
|
|
28
|
+
import { useIntl } from 'react-intl-next';
|
|
28
29
|
export const FileCard = ({
|
|
29
30
|
appearance = 'auto',
|
|
30
31
|
resizeMode = 'crop',
|
|
@@ -56,6 +57,9 @@ export const FileCard = ({
|
|
|
56
57
|
viewerOptions,
|
|
57
58
|
includeHashForDuplicateFiles
|
|
58
59
|
}) => {
|
|
60
|
+
const {
|
|
61
|
+
formatMessage
|
|
62
|
+
} = useIntl();
|
|
59
63
|
const {
|
|
60
64
|
createAnalyticsEvent
|
|
61
65
|
} = useAnalyticsEvents();
|
|
@@ -200,7 +204,7 @@ export const FileCard = ({
|
|
|
200
204
|
}, [fileStateValue === null || fileStateValue === void 0 ? void 0 : fileStateValue.status, metadata.id, metadata.mediaType, metadata.mimeType, metadata.size]);
|
|
201
205
|
const computedActions = useMemo(() => {
|
|
202
206
|
if (finalStatus === 'failed-processing' || shouldEnableDownloadButton) {
|
|
203
|
-
const
|
|
207
|
+
const handler = async () => {
|
|
204
208
|
try {
|
|
205
209
|
await mediaClient.file.downloadBinary(identifier.id, metadata.name, identifier.collectionName, traceContext);
|
|
206
210
|
fireDownloadSucceededEvent(createAnalyticsEvent, fileAttributes, traceContext, fileStateValue === null || fileStateValue === void 0 ? void 0 : fileStateValue.metadataTraceContext);
|
|
@@ -209,12 +213,15 @@ export const FileCard = ({
|
|
|
209
213
|
fireDownloadFailedEvent(createAnalyticsEvent, fileAttributes, error, traceContext, fileStateValue === null || fileStateValue === void 0 ? void 0 : fileStateValue.metadataTraceContext);
|
|
210
214
|
}
|
|
211
215
|
};
|
|
212
|
-
const downloadAction = createDownloadAction(
|
|
216
|
+
const downloadAction = createDownloadAction({
|
|
217
|
+
handler,
|
|
218
|
+
isDisabled: mediaClient.config.enforceDataSecurityPolicy
|
|
219
|
+
}, formatMessage);
|
|
213
220
|
return [downloadAction, ...(actions !== null && actions !== void 0 ? actions : [])];
|
|
214
221
|
} else {
|
|
215
222
|
return actions;
|
|
216
223
|
}
|
|
217
|
-
}, [actions, identifier.collectionName, identifier.id, mediaClient.file, metadata.name, shouldEnableDownloadButton, finalStatus, createAnalyticsEvent, fileAttributes, fileStateValue === null || fileStateValue === void 0 ? void 0 : fileStateValue.metadataTraceContext, traceContext]);
|
|
224
|
+
}, [actions, identifier.collectionName, identifier.id, mediaClient.file, mediaClient.config.enforceDataSecurityPolicy, metadata.name, shouldEnableDownloadButton, finalStatus, createAnalyticsEvent, fileAttributes, fileStateValue === null || fileStateValue === void 0 ? void 0 : fileStateValue.metadataTraceContext, traceContext, formatMessage]);
|
|
218
225
|
|
|
219
226
|
//----------------------------------------------------------------//
|
|
220
227
|
//---------------------- Analytics ------------------------------//
|
|
@@ -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.16.0";
|
|
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({
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
3
3
|
import { CardActionButton } from './cardActionButton';
|
|
4
|
+
import Tooltip from '@atlaskit/tooltip';
|
|
4
5
|
import { fireMediaCardEvent } from '../../../../utils/analytics';
|
|
5
6
|
export const CardActionIconButton = ({
|
|
6
7
|
icon,
|
|
@@ -9,7 +10,9 @@ export const CardActionIconButton = ({
|
|
|
9
10
|
triggerColor,
|
|
10
11
|
onClick,
|
|
11
12
|
isPrimary,
|
|
12
|
-
variant
|
|
13
|
+
variant,
|
|
14
|
+
isDisabled,
|
|
15
|
+
tooltip
|
|
13
16
|
}) => {
|
|
14
17
|
const {
|
|
15
18
|
createAnalyticsEvent
|
|
@@ -33,7 +36,7 @@ export const CardActionIconButton = ({
|
|
|
33
36
|
}, createAnalyticsEvent);
|
|
34
37
|
onClick === null || onClick === void 0 ? void 0 : onClick(e);
|
|
35
38
|
};
|
|
36
|
-
|
|
39
|
+
const cardActionButton = /*#__PURE__*/React.createElement(CardActionButton, {
|
|
37
40
|
onClick: handleClick,
|
|
38
41
|
onMouseDown: onMouseDown
|
|
39
42
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
@@ -42,6 +45,14 @@ export const CardActionIconButton = ({
|
|
|
42
45
|
color: triggerColor
|
|
43
46
|
},
|
|
44
47
|
label: filename ? `${filename} — ${label}` : label,
|
|
45
|
-
variant: variant
|
|
48
|
+
variant: variant,
|
|
49
|
+
disabled: isDisabled
|
|
46
50
|
}, icon);
|
|
51
|
+
const useTooltip = !!tooltip && false; // TODO: Tooltip breaks Button positioning
|
|
52
|
+
|
|
53
|
+
return useTooltip ? /*#__PURE__*/React.createElement(Tooltip, {
|
|
54
|
+
content: tooltip,
|
|
55
|
+
position: "bottom",
|
|
56
|
+
tag: "span"
|
|
57
|
+
}, cardActionButton) : cardActionButton;
|
|
47
58
|
};
|
|
@@ -13,7 +13,8 @@ const DropdownItemWithProps = props => /*#__PURE__*/React.createElement(Dropdown
|
|
|
13
13
|
const createDropdownItemWithAnalytics = (action, index) => {
|
|
14
14
|
const {
|
|
15
15
|
label,
|
|
16
|
-
handler
|
|
16
|
+
handler,
|
|
17
|
+
isDisabled
|
|
17
18
|
} = action;
|
|
18
19
|
const DropdownItemWithAnalytics = withAnalyticsEvents({
|
|
19
20
|
onClick: createAndFireMediaCardEvent({
|
|
@@ -28,7 +29,8 @@ const createDropdownItemWithAnalytics = (action, index) => {
|
|
|
28
29
|
})(DropdownItemWithProps);
|
|
29
30
|
return /*#__PURE__*/React.createElement(DropdownItemWithAnalytics, {
|
|
30
31
|
key: index,
|
|
31
|
-
onClick: handler
|
|
32
|
+
onClick: () => handler(),
|
|
33
|
+
isDisabled: isDisabled
|
|
32
34
|
}, label);
|
|
33
35
|
};
|
|
34
36
|
export const CardActionsDropdownMenu = ({
|
|
@@ -32,7 +32,9 @@ export class CardActionsView extends Component {
|
|
|
32
32
|
const {
|
|
33
33
|
icon,
|
|
34
34
|
handler,
|
|
35
|
-
label
|
|
35
|
+
label,
|
|
36
|
+
isDisabled,
|
|
37
|
+
tooltip
|
|
36
38
|
} = action;
|
|
37
39
|
return jsx(CardActionIconButton, {
|
|
38
40
|
icon: icon,
|
|
@@ -41,7 +43,9 @@ export class CardActionsView extends Component {
|
|
|
41
43
|
isPrimary: isPrimary,
|
|
42
44
|
triggerColor: triggerColor,
|
|
43
45
|
onClick: () => handler(),
|
|
44
|
-
variant: variant
|
|
46
|
+
variant: variant,
|
|
47
|
+
isDisabled: isDisabled,
|
|
48
|
+
tooltip: tooltip
|
|
45
49
|
});
|
|
46
50
|
}
|
|
47
51
|
renderOtherActionButtons(actions) {
|
|
@@ -3,12 +3,11 @@ import { css } from '@emotion/react';
|
|
|
3
3
|
import { N500, N0 } from '@atlaskit/theme/colors';
|
|
4
4
|
import { borderRadius, size, center } from '@atlaskit/media-ui';
|
|
5
5
|
import { rgba } from '../../styles';
|
|
6
|
-
import { fontFamily } from '@atlaskit/theme/constants';
|
|
7
6
|
|
|
8
7
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
9
8
|
export const wrapperStyles = css({
|
|
10
9
|
boxSizing: 'border-box',
|
|
11
|
-
fontFamily:
|
|
10
|
+
fontFamily: "var(--ds-font-family-body, ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)",
|
|
12
11
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
13
12
|
'*': {
|
|
14
13
|
boxSizing: 'border-box'
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
2
2
|
import { css } from '@emotion/react';
|
|
3
|
-
import { fontFamily } from '@atlaskit/theme/constants';
|
|
4
3
|
import { borderRadius } from '@atlaskit/media-ui';
|
|
5
4
|
import { N20, B100 } from '@atlaskit/theme/colors';
|
|
6
5
|
import { hideNativeBrowserTextSelectionStyles } from '@atlaskit/editor-shared-styles/selection';
|
|
@@ -26,7 +25,7 @@ export const wrapperStyles = ({
|
|
|
26
25
|
box-sizing: border-box;
|
|
27
26
|
}
|
|
28
27
|
position: relative;
|
|
29
|
-
font-family: ${
|
|
28
|
+
font-family: ${"var(--ds-font-family-body, ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)"};
|
|
30
29
|
${getWrapperDimensions(dimensions, appearance)}
|
|
31
30
|
${displayBackground && `background: ${`var(--ds-background-neutral, ${N20})`};`}
|
|
32
31
|
${borderRadius}
|
|
@@ -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.16.0",
|
|
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.16.0";
|
|
9
9
|
let concurrentExperience;
|
|
10
10
|
const getExperience = id => {
|
|
11
11
|
if (!concurrentExperience) {
|
package/dist/esm/card/actions.js
CHANGED
|
@@ -3,6 +3,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
3
3
|
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; }
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import DownloadIcon from '@atlaskit/icon/core/migration/download';
|
|
6
|
+
import { messages } from '@atlaskit/media-ui';
|
|
6
7
|
export function attachDetailsToActions(actions, details) {
|
|
7
8
|
return actions.map(function (action) {
|
|
8
9
|
return _objectSpread(_objectSpread({}, action), {}, {
|
|
@@ -15,14 +16,16 @@ export function attachDetailsToActions(actions, details) {
|
|
|
15
16
|
});
|
|
16
17
|
});
|
|
17
18
|
}
|
|
18
|
-
export var createDownloadAction = function createDownloadAction(
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
export var createDownloadAction = function createDownloadAction(baseAction, formatMessage) {
|
|
20
|
+
var label = baseAction.isDisabled ? 'Download Disabled' : 'Download';
|
|
21
|
+
var tooltip = baseAction.isDisabled ? formatMessage(messages.download_disabled_security_policy) : undefined;
|
|
22
|
+
return _objectSpread(_objectSpread({}, baseAction), {}, {
|
|
23
|
+
label: label,
|
|
24
|
+
tooltip: tooltip,
|
|
21
25
|
icon: /*#__PURE__*/React.createElement(DownloadIcon, {
|
|
22
26
|
color: "currentColor",
|
|
23
27
|
spacing: "spacious",
|
|
24
28
|
label: "Download"
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
};
|
|
29
|
+
})
|
|
30
|
+
});
|
|
28
31
|
};
|
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 UFOLabel from '@atlaskit/react-ufo/label';
|
|
13
13
|
var packageName = "@atlaskit/media-card";
|
|
14
|
-
var packageVersion = "78.
|
|
14
|
+
var packageVersion = "78.16.0";
|
|
15
15
|
export var CardBase = function CardBase(_ref) {
|
|
16
16
|
var identifier = _ref.identifier,
|
|
17
17
|
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
@@ -32,6 +32,7 @@ import { createDownloadAction } from './actions';
|
|
|
32
32
|
import { performanceNow } from './performance';
|
|
33
33
|
import { useContext } from 'react';
|
|
34
34
|
import { DateOverrideContext } from '../dateOverrideContext';
|
|
35
|
+
import { useIntl } from 'react-intl-next';
|
|
35
36
|
export var FileCard = function FileCard(_ref) {
|
|
36
37
|
var _ref$appearance = _ref.appearance,
|
|
37
38
|
appearance = _ref$appearance === void 0 ? 'auto' : _ref$appearance,
|
|
@@ -66,6 +67,8 @@ export var FileCard = function FileCard(_ref) {
|
|
|
66
67
|
videoControlsWrapperRef = _ref.videoControlsWrapperRef,
|
|
67
68
|
viewerOptions = _ref.viewerOptions,
|
|
68
69
|
includeHashForDuplicateFiles = _ref.includeHashForDuplicateFiles;
|
|
70
|
+
var _useIntl = useIntl(),
|
|
71
|
+
formatMessage = _useIntl.formatMessage;
|
|
69
72
|
var _useAnalyticsEvents = useAnalyticsEvents(),
|
|
70
73
|
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
71
74
|
//----------------------------------------------------------------//
|
|
@@ -237,7 +240,7 @@ export var FileCard = function FileCard(_ref) {
|
|
|
237
240
|
}, [fileStateValue === null || fileStateValue === void 0 ? void 0 : fileStateValue.status, metadata.id, metadata.mediaType, metadata.mimeType, metadata.size]);
|
|
238
241
|
var computedActions = useMemo(function () {
|
|
239
242
|
if (finalStatus === 'failed-processing' || shouldEnableDownloadButton) {
|
|
240
|
-
var
|
|
243
|
+
var handler = /*#__PURE__*/function () {
|
|
241
244
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
242
245
|
var _error;
|
|
243
246
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
@@ -261,16 +264,19 @@ export var FileCard = function FileCard(_ref) {
|
|
|
261
264
|
}
|
|
262
265
|
}, _callee, null, [[0, 6]]);
|
|
263
266
|
}));
|
|
264
|
-
return function
|
|
267
|
+
return function handler() {
|
|
265
268
|
return _ref2.apply(this, arguments);
|
|
266
269
|
};
|
|
267
270
|
}();
|
|
268
|
-
var downloadAction = createDownloadAction(
|
|
271
|
+
var downloadAction = createDownloadAction({
|
|
272
|
+
handler: handler,
|
|
273
|
+
isDisabled: mediaClient.config.enforceDataSecurityPolicy
|
|
274
|
+
}, formatMessage);
|
|
269
275
|
return [downloadAction].concat(_toConsumableArray(actions !== null && actions !== void 0 ? actions : []));
|
|
270
276
|
} else {
|
|
271
277
|
return actions;
|
|
272
278
|
}
|
|
273
|
-
}, [actions, identifier.collectionName, identifier.id, mediaClient.file, metadata.name, shouldEnableDownloadButton, finalStatus, createAnalyticsEvent, fileAttributes, fileStateValue === null || fileStateValue === void 0 ? void 0 : fileStateValue.metadataTraceContext, traceContext]);
|
|
279
|
+
}, [actions, identifier.collectionName, identifier.id, mediaClient.file, mediaClient.config.enforceDataSecurityPolicy, metadata.name, shouldEnableDownloadButton, finalStatus, createAnalyticsEvent, fileAttributes, fileStateValue === null || fileStateValue === void 0 ? void 0 : fileStateValue.metadataTraceContext, traceContext, formatMessage]);
|
|
274
280
|
|
|
275
281
|
//----------------------------------------------------------------//
|
|
276
282
|
//---------------------- Analytics ------------------------------//
|
|
@@ -80,7 +80,7 @@ var WrappedMediaCardAnalyticsErrorBoundary = /*#__PURE__*/function (_React$Compo
|
|
|
80
80
|
}(React.Component);
|
|
81
81
|
_defineProperty(WrappedMediaCardAnalyticsErrorBoundary, "displayName", 'MediaCardAnalyticsErrorBoundary');
|
|
82
82
|
var packageName = "@atlaskit/media-card";
|
|
83
|
-
var packageVersion = "78.
|
|
83
|
+
var packageVersion = "78.16.0";
|
|
84
84
|
|
|
85
85
|
// @ts-ignore: [PIT-1685] Fails in post-office due to backwards incompatibility issue with React 18
|
|
86
86
|
var MediaCardAnalyticsErrorBoundary = withMediaAnalyticsContext({
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
3
3
|
import { CardActionButton } from './cardActionButton';
|
|
4
|
+
import Tooltip from '@atlaskit/tooltip';
|
|
4
5
|
import { fireMediaCardEvent } from '../../../../utils/analytics';
|
|
5
6
|
export var CardActionIconButton = function CardActionIconButton(_ref) {
|
|
6
7
|
var icon = _ref.icon,
|
|
@@ -9,7 +10,9 @@ export var CardActionIconButton = function CardActionIconButton(_ref) {
|
|
|
9
10
|
triggerColor = _ref.triggerColor,
|
|
10
11
|
onClick = _ref.onClick,
|
|
11
12
|
isPrimary = _ref.isPrimary,
|
|
12
|
-
variant = _ref.variant
|
|
13
|
+
variant = _ref.variant,
|
|
14
|
+
isDisabled = _ref.isDisabled,
|
|
15
|
+
tooltip = _ref.tooltip;
|
|
13
16
|
var _useAnalyticsEvents = useAnalyticsEvents(),
|
|
14
17
|
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
15
18
|
|
|
@@ -31,7 +34,7 @@ export var CardActionIconButton = function CardActionIconButton(_ref) {
|
|
|
31
34
|
}, createAnalyticsEvent);
|
|
32
35
|
onClick === null || onClick === void 0 || onClick(e);
|
|
33
36
|
};
|
|
34
|
-
|
|
37
|
+
var cardActionButton = /*#__PURE__*/React.createElement(CardActionButton, {
|
|
35
38
|
onClick: handleClick,
|
|
36
39
|
onMouseDown: onMouseDown
|
|
37
40
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
@@ -40,6 +43,14 @@ export var CardActionIconButton = function CardActionIconButton(_ref) {
|
|
|
40
43
|
color: triggerColor
|
|
41
44
|
},
|
|
42
45
|
label: filename ? "".concat(filename, " \u2014 ").concat(label) : label,
|
|
43
|
-
variant: variant
|
|
46
|
+
variant: variant,
|
|
47
|
+
disabled: isDisabled
|
|
44
48
|
}, icon);
|
|
49
|
+
var useTooltip = !!tooltip && false; // TODO: Tooltip breaks Button positioning
|
|
50
|
+
|
|
51
|
+
return useTooltip ? /*#__PURE__*/React.createElement(Tooltip, {
|
|
52
|
+
content: tooltip,
|
|
53
|
+
position: "bottom",
|
|
54
|
+
tag: "span"
|
|
55
|
+
}, cardActionButton) : cardActionButton;
|
|
45
56
|
};
|
|
@@ -16,7 +16,8 @@ var DropdownItemWithProps = function DropdownItemWithProps(props) {
|
|
|
16
16
|
};
|
|
17
17
|
var createDropdownItemWithAnalytics = function createDropdownItemWithAnalytics(action, index) {
|
|
18
18
|
var label = action.label,
|
|
19
|
-
handler = action.handler
|
|
19
|
+
handler = action.handler,
|
|
20
|
+
isDisabled = action.isDisabled;
|
|
20
21
|
var DropdownItemWithAnalytics = withAnalyticsEvents({
|
|
21
22
|
onClick: createAndFireMediaCardEvent({
|
|
22
23
|
eventType: 'ui',
|
|
@@ -30,7 +31,10 @@ var createDropdownItemWithAnalytics = function createDropdownItemWithAnalytics(a
|
|
|
30
31
|
})(DropdownItemWithProps);
|
|
31
32
|
return /*#__PURE__*/React.createElement(DropdownItemWithAnalytics, {
|
|
32
33
|
key: index,
|
|
33
|
-
onClick:
|
|
34
|
+
onClick: function onClick() {
|
|
35
|
+
return handler();
|
|
36
|
+
},
|
|
37
|
+
isDisabled: isDisabled
|
|
34
38
|
}, label);
|
|
35
39
|
};
|
|
36
40
|
export var CardActionsDropdownMenu = function CardActionsDropdownMenu(_ref) {
|
|
@@ -44,7 +44,9 @@ export var CardActionsView = /*#__PURE__*/function (_Component) {
|
|
|
44
44
|
variant = _this$props.variant;
|
|
45
45
|
var icon = action.icon,
|
|
46
46
|
handler = action.handler,
|
|
47
|
-
label = action.label
|
|
47
|
+
label = action.label,
|
|
48
|
+
isDisabled = action.isDisabled,
|
|
49
|
+
tooltip = action.tooltip;
|
|
48
50
|
return jsx(CardActionIconButton, {
|
|
49
51
|
icon: icon,
|
|
50
52
|
label: label,
|
|
@@ -54,7 +56,9 @@ export var CardActionsView = /*#__PURE__*/function (_Component) {
|
|
|
54
56
|
onClick: function onClick() {
|
|
55
57
|
return handler();
|
|
56
58
|
},
|
|
57
|
-
variant: variant
|
|
59
|
+
variant: variant,
|
|
60
|
+
isDisabled: isDisabled,
|
|
61
|
+
tooltip: tooltip
|
|
58
62
|
});
|
|
59
63
|
}
|
|
60
64
|
}, {
|
|
@@ -3,12 +3,11 @@ import { css } from '@emotion/react';
|
|
|
3
3
|
import { N500, N0 } from '@atlaskit/theme/colors';
|
|
4
4
|
import { borderRadius, size, center } from '@atlaskit/media-ui';
|
|
5
5
|
import { rgba } from '../../styles';
|
|
6
|
-
import { fontFamily } from '@atlaskit/theme/constants';
|
|
7
6
|
|
|
8
7
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
9
8
|
export var wrapperStyles = css({
|
|
10
9
|
boxSizing: 'border-box',
|
|
11
|
-
fontFamily:
|
|
10
|
+
fontFamily: "var(--ds-font-family-body, ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)",
|
|
12
11
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
13
12
|
'*': {
|
|
14
13
|
boxSizing: 'border-box'
|
|
@@ -2,7 +2,6 @@ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral
|
|
|
2
2
|
var _templateObject;
|
|
3
3
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
4
4
|
import { css } from '@emotion/react';
|
|
5
|
-
import { fontFamily } from '@atlaskit/theme/constants';
|
|
6
5
|
import { borderRadius } from '@atlaskit/media-ui';
|
|
7
6
|
import { N20, B100 } from '@atlaskit/theme/colors';
|
|
8
7
|
import { hideNativeBrowserTextSelectionStyles } from '@atlaskit/editor-shared-styles/selection';
|
|
@@ -21,6 +20,6 @@ export var wrapperStyles = function wrapperStyles(_ref) {
|
|
|
21
20
|
isTickBoxSelectable = _ref.isTickBoxSelectable,
|
|
22
21
|
shouldDisplayTooltip = _ref.shouldDisplayTooltip,
|
|
23
22
|
mediaCardCursor = _ref.mediaCardCursor;
|
|
24
|
-
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n\t", "\n\tbox-sizing: border-box;\n\t* {\n\t\tbox-sizing: border-box;\n\t}\n\tposition: relative;\n\tfont-family: ", ";\n\t", "\n\t", "\n ", "\n ", "\n ", "\n ", ";\n\t", "\n\n\t/* We use classnames from here exceptionally to be able to handle styles when the Card is on hover */\n ", "\n ", "\n &:hover .", " {\n\t\t", "\n\t}\n\t&:hover .", ", &:focus-within .", " {\n\t\t", "\n\t}\n\n\t/* Tooltip does not support percentage dimensions. We enforce them here */\n\t", "\n\n\tbutton:focus + & {\n\t\toutline: solid 2px ", ";\n\t}\n"])), transition(),
|
|
23
|
+
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n\t", "\n\tbox-sizing: border-box;\n\t* {\n\t\tbox-sizing: border-box;\n\t}\n\tposition: relative;\n\tfont-family: ", ";\n\t", "\n\t", "\n ", "\n ", "\n ", "\n ", ";\n\t", "\n\n\t/* We use classnames from here exceptionally to be able to handle styles when the Card is on hover */\n ", "\n ", "\n &:hover .", " {\n\t\t", "\n\t}\n\t&:hover .", ", &:focus-within .", " {\n\t\t", "\n\t}\n\n\t/* Tooltip does not support percentage dimensions. We enforce them here */\n\t", "\n\n\tbutton:focus + & {\n\t\toutline: solid 2px ", ";\n\t}\n"])), transition(), "var(--ds-font-family-body, ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)", getWrapperDimensions(dimensions, appearance), displayBackground && "background: ".concat("var(--ds-background-neutral, ".concat(N20, ")"), ";"), borderRadius, getCursorStyle(mediaCardCursor), getWrapperShadow(disableOverlay, selected), generateResponsiveStyles(breakpoint), hideNativeBrowserTextSelectionStyles, getClickablePlayButtonStyles(isPlayButtonClickable), getSelectableTickBoxStyles(isTickBoxSelectable), blanketClassName, fixedBlanketStyles, actionsBarClassName, actionsBarClassName, fixedActionBarStyles, shouldDisplayTooltip && "> div { width: 100%; height: 100%; }", "var(--ds-border-focused, ".concat(B100, ")"));
|
|
25
24
|
};
|
|
26
25
|
wrapperStyles.displayName = 'NewFileExperienceWrapper';
|
|
@@ -101,7 +101,7 @@ var MediaInlineCardLoader = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
101
101
|
ErrorBoundary = _this$state.ErrorBoundary;
|
|
102
102
|
var analyticsContext = {
|
|
103
103
|
packageVersion: "@atlaskit/media-card",
|
|
104
|
-
packageName: "78.
|
|
104
|
+
packageName: "78.16.0",
|
|
105
105
|
componentName: 'mediaInlineCard',
|
|
106
106
|
component: 'mediaInlineCard'
|
|
107
107
|
};
|
|
@@ -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.16.0";
|
|
12
12
|
var concurrentExperience;
|
|
13
13
|
var getExperience = function getExperience(id) {
|
|
14
14
|
if (!concurrentExperience) {
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { type FileItem, type FileDetails } from '@atlaskit/media-client';
|
|
2
2
|
import { type ReactNode } from 'react';
|
|
3
|
+
import { type MessageDescriptor } from 'react-intl-next';
|
|
3
4
|
export interface CardAction {
|
|
4
5
|
label?: string;
|
|
5
6
|
handler: CardEventHandler;
|
|
6
7
|
icon?: ReactNode;
|
|
8
|
+
isDisabled?: boolean;
|
|
9
|
+
tooltip?: string;
|
|
7
10
|
}
|
|
8
11
|
export type CardEventHandler = (item?: FileItem, event?: Event) => void;
|
|
9
12
|
export declare function attachDetailsToActions(actions: Array<CardAction>, details: FileDetails): Array<CardAction>;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
handler: CardEventHandler;
|
|
14
|
-
};
|
|
13
|
+
type FormatMessageFn = (descriptor: MessageDescriptor) => string;
|
|
14
|
+
export declare const createDownloadAction: (baseAction: CardAction, formatMessage: FormatMessageFn) => CardAction;
|
|
15
|
+
export {};
|
|
@@ -7,6 +7,8 @@ export type CardActionIconButtonProps = {
|
|
|
7
7
|
readonly filename?: string;
|
|
8
8
|
readonly variant?: CardActionIconButtonVariant;
|
|
9
9
|
readonly triggerColor?: string;
|
|
10
|
+
readonly isDisabled?: boolean;
|
|
11
|
+
readonly tooltip?: string;
|
|
10
12
|
readonly onClick?: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
11
13
|
};
|
|
12
|
-
export declare const CardActionIconButton: ({ icon, label, filename, triggerColor, onClick, isPrimary, variant, }: CardActionIconButtonProps) => JSX.Element;
|
|
14
|
+
export declare const CardActionIconButton: ({ icon, label, filename, triggerColor, onClick, isPrimary, variant, isDisabled, tooltip, }: CardActionIconButtonProps) => JSX.Element;
|
|
@@ -14,6 +14,7 @@ export type CardActionButtonOwnProps = {
|
|
|
14
14
|
};
|
|
15
15
|
onClick?: (event: React.MouseEvent<HTMLButtonElement>, analyticsEvent?: UIAnalyticsEvent) => void;
|
|
16
16
|
onMouseDown?: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
17
|
+
disabled?: boolean;
|
|
17
18
|
children?: React.ReactNode;
|
|
18
19
|
};
|
|
19
20
|
export type CardActionButtonProps = CardActionButtonOwnProps & HTMLAttributes<HTMLButtonElement>;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { type FileItem, type FileDetails } from '@atlaskit/media-client';
|
|
2
2
|
import { type ReactNode } from 'react';
|
|
3
|
+
import { type MessageDescriptor } from 'react-intl-next';
|
|
3
4
|
export interface CardAction {
|
|
4
5
|
label?: string;
|
|
5
6
|
handler: CardEventHandler;
|
|
6
7
|
icon?: ReactNode;
|
|
8
|
+
isDisabled?: boolean;
|
|
9
|
+
tooltip?: string;
|
|
7
10
|
}
|
|
8
11
|
export type CardEventHandler = (item?: FileItem, event?: Event) => void;
|
|
9
12
|
export declare function attachDetailsToActions(actions: Array<CardAction>, details: FileDetails): Array<CardAction>;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
handler: CardEventHandler;
|
|
14
|
-
};
|
|
13
|
+
type FormatMessageFn = (descriptor: MessageDescriptor) => string;
|
|
14
|
+
export declare const createDownloadAction: (baseAction: CardAction, formatMessage: FormatMessageFn) => CardAction;
|
|
15
|
+
export {};
|
|
@@ -7,6 +7,8 @@ export type CardActionIconButtonProps = {
|
|
|
7
7
|
readonly filename?: string;
|
|
8
8
|
readonly variant?: CardActionIconButtonVariant;
|
|
9
9
|
readonly triggerColor?: string;
|
|
10
|
+
readonly isDisabled?: boolean;
|
|
11
|
+
readonly tooltip?: string;
|
|
10
12
|
readonly onClick?: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
11
13
|
};
|
|
12
|
-
export declare const CardActionIconButton: ({ icon, label, filename, triggerColor, onClick, isPrimary, variant, }: CardActionIconButtonProps) => JSX.Element;
|
|
14
|
+
export declare const CardActionIconButton: ({ icon, label, filename, triggerColor, onClick, isPrimary, variant, isDisabled, tooltip, }: CardActionIconButtonProps) => JSX.Element;
|
|
@@ -14,6 +14,7 @@ export type CardActionButtonOwnProps = {
|
|
|
14
14
|
};
|
|
15
15
|
onClick?: (event: React.MouseEvent<HTMLButtonElement>, analyticsEvent?: UIAnalyticsEvent) => void;
|
|
16
16
|
onMouseDown?: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
17
|
+
disabled?: boolean;
|
|
17
18
|
children?: React.ReactNode;
|
|
18
19
|
};
|
|
19
20
|
export type CardActionButtonProps = CardActionButtonOwnProps & HTMLAttributes<HTMLButtonElement>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/media-card",
|
|
3
|
-
"version": "78.
|
|
3
|
+
"version": "78.16.0",
|
|
4
4
|
"description": "Includes all media card related components, CardView, CardViewSmall, Card...",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -39,18 +39,18 @@
|
|
|
39
39
|
"@atlaskit/dropdown-menu": "^12.23.0",
|
|
40
40
|
"@atlaskit/editor-shared-styles": "^3.2.0",
|
|
41
41
|
"@atlaskit/icon": "^23.1.0",
|
|
42
|
-
"@atlaskit/media-client": "^28.
|
|
42
|
+
"@atlaskit/media-client": "^28.6.0",
|
|
43
43
|
"@atlaskit/media-client-react": "^2.4.0",
|
|
44
44
|
"@atlaskit/media-common": "^11.7.0",
|
|
45
45
|
"@atlaskit/media-file-preview": "^0.9.0",
|
|
46
|
-
"@atlaskit/media-ui": "^27.
|
|
47
|
-
"@atlaskit/media-viewer": "^49.
|
|
46
|
+
"@atlaskit/media-ui": "^27.1.0",
|
|
47
|
+
"@atlaskit/media-viewer": "^49.5.0",
|
|
48
48
|
"@atlaskit/platform-feature-flags": "^0.3.0",
|
|
49
49
|
"@atlaskit/primitives": "^13.3.0",
|
|
50
50
|
"@atlaskit/react-ufo": "^2.5.0",
|
|
51
51
|
"@atlaskit/spinner": "^16.3.0",
|
|
52
52
|
"@atlaskit/theme": "^14.0.0",
|
|
53
|
-
"@atlaskit/tokens": "^2.
|
|
53
|
+
"@atlaskit/tokens": "^2.5.0",
|
|
54
54
|
"@atlaskit/tooltip": "^19.0.0",
|
|
55
55
|
"@atlaskit/ufo": "^0.3.0",
|
|
56
56
|
"@atlaskit/visually-hidden": "^1.5.0",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"@atlaskit/analytics-namespaced-context": "^6.12.0",
|
|
74
74
|
"@atlaskit/form": "^10.6.0",
|
|
75
75
|
"@atlaskit/inline-message": "^13.0.0",
|
|
76
|
-
"@atlaskit/media-core": "^34.
|
|
76
|
+
"@atlaskit/media-core": "^34.4.0",
|
|
77
77
|
"@atlaskit/media-picker": "^67.0.0",
|
|
78
78
|
"@atlaskit/media-state": "^1.2.0",
|
|
79
79
|
"@atlaskit/media-test-data": "^2.7.0",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"@atlaskit/radio": "^7.0.0",
|
|
82
82
|
"@atlaskit/range": "^8.0.0",
|
|
83
83
|
"@atlaskit/ssr": "*",
|
|
84
|
-
"@atlaskit/toggle": "^
|
|
84
|
+
"@atlaskit/toggle": "^14.0.0",
|
|
85
85
|
"@atlaskit/visual-regression": "*",
|
|
86
86
|
"@atlassian/feature-flags-test-utils": "^0.2.0",
|
|
87
87
|
"@atlassian/ufo": "^0.4.0",
|