@atlaskit/media-card 77.10.0 → 77.10.2

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.
Files changed (52) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/card/card.js +1 -1
  3. package/dist/cjs/card/cardView.js +1 -0
  4. package/dist/cjs/card/media-card-analytics-error-boundary.js +1 -1
  5. package/dist/cjs/card/ui/actionsBar/actionsBar.js +2 -0
  6. package/dist/cjs/card/ui/actionsBar/cardActions/cardActionButton.js +5 -2
  7. package/dist/cjs/card/ui/actionsBar/cardActions/cardActionIconButton.js +2 -0
  8. package/dist/cjs/card/ui/actionsBar/cardActions/cardActionsView.js +2 -0
  9. package/dist/cjs/card/ui/actionsBar/cardActions/styles.js +1 -1
  10. package/dist/cjs/card/v2/cardV2.js +1 -1
  11. package/dist/cjs/card/v2/cardViewV2.js +1 -0
  12. package/dist/cjs/card/v2/cardviews/cardViewWrapper.js +1 -0
  13. package/dist/cjs/inline/loader.js +1 -1
  14. package/dist/cjs/utils/ufoExperiences.js +1 -1
  15. package/dist/es2019/card/card.js +1 -1
  16. package/dist/es2019/card/cardView.js +1 -0
  17. package/dist/es2019/card/media-card-analytics-error-boundary.js +1 -1
  18. package/dist/es2019/card/ui/actionsBar/actionsBar.js +2 -0
  19. package/dist/es2019/card/ui/actionsBar/cardActions/cardActionButton.js +4 -2
  20. package/dist/es2019/card/ui/actionsBar/cardActions/cardActionIconButton.js +2 -0
  21. package/dist/es2019/card/ui/actionsBar/cardActions/cardActionsView.js +2 -0
  22. package/dist/es2019/card/ui/actionsBar/cardActions/styles.js +2 -0
  23. package/dist/es2019/card/v2/cardV2.js +1 -1
  24. package/dist/es2019/card/v2/cardViewV2.js +1 -0
  25. package/dist/es2019/card/v2/cardviews/cardViewWrapper.js +1 -0
  26. package/dist/es2019/inline/loader.js +1 -1
  27. package/dist/es2019/utils/ufoExperiences.js +1 -1
  28. package/dist/esm/card/card.js +1 -1
  29. package/dist/esm/card/cardView.js +1 -0
  30. package/dist/esm/card/media-card-analytics-error-boundary.js +1 -1
  31. package/dist/esm/card/ui/actionsBar/actionsBar.js +2 -0
  32. package/dist/esm/card/ui/actionsBar/cardActions/cardActionButton.js +4 -2
  33. package/dist/esm/card/ui/actionsBar/cardActions/cardActionIconButton.js +2 -0
  34. package/dist/esm/card/ui/actionsBar/cardActions/cardActionsView.js +2 -0
  35. package/dist/esm/card/ui/actionsBar/cardActions/styles.js +1 -1
  36. package/dist/esm/card/v2/cardV2.js +1 -1
  37. package/dist/esm/card/v2/cardViewV2.js +1 -0
  38. package/dist/esm/card/v2/cardviews/cardViewWrapper.js +1 -0
  39. package/dist/esm/inline/loader.js +1 -1
  40. package/dist/esm/utils/ufoExperiences.js +1 -1
  41. package/dist/types/card/ui/actionsBar/cardActions/cardActionButton.d.ts +1 -1
  42. package/dist/types/card/ui/actionsBar/cardActions/cardActionIconButton.d.ts +2 -1
  43. package/dist/types/card/ui/actionsBar/cardActions/cardActionsView.d.ts +1 -0
  44. package/dist/types/card/ui/actionsBar/cardActions/styles.d.ts +4 -3
  45. package/dist/types/card/ui/actionsBar/types.d.ts +1 -0
  46. package/dist/types-ts4.5/card/ui/actionsBar/cardActions/cardActionButton.d.ts +1 -1
  47. package/dist/types-ts4.5/card/ui/actionsBar/cardActions/cardActionIconButton.d.ts +2 -1
  48. package/dist/types-ts4.5/card/ui/actionsBar/cardActions/cardActionsView.d.ts +1 -0
  49. package/dist/types-ts4.5/card/ui/actionsBar/cardActions/styles.d.ts +4 -3
  50. package/dist/types-ts4.5/card/ui/actionsBar/types.d.ts +1 -0
  51. package/example-helpers/ssrHelpers.tsx +43 -0
  52. package/package.json +3 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/media-card
2
2
 
3
+ ## 77.10.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#74855](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/74855) [`60e3eb23093b`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/60e3eb23093b) - Fixed accessiblity issue where passing label was not adding an accessible aria-label tag
8
+
9
+ ## 77.10.1
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+
3
15
  ## 77.10.0
4
16
 
5
17
  ### Minor Changes
@@ -50,7 +50,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
50
50
  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); }; }
51
51
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
52
52
  var packageName = "@atlaskit/media-card";
53
- var packageVersion = "77.10.0";
53
+ var packageVersion = "77.10.2";
54
54
  var CardBase = exports.CardBase = /*#__PURE__*/function (_Component) {
55
55
  (0, _inherits2.default)(CardBase, _Component);
56
56
  var _super = _createSuper(CardBase);
@@ -389,6 +389,7 @@ var CardViewBase = exports.CardViewBase = /*#__PURE__*/function (_React$Componen
389
389
  return null;
390
390
  }
391
391
  return (0, _react.jsx)(_actionsBar.ActionsBar, {
392
+ filename: metadata === null || metadata === void 0 ? void 0 : metadata.name,
392
393
  actions: actionsWithDetails
393
394
  });
394
395
  }
@@ -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 = "77.10.0";
93
+ var packageVersion = "77.10.2";
94
94
  var MediaCardAnalyticsErrorBoundary = (0, _mediaCommon.withMediaAnalyticsContext)({
95
95
  packageVersion: packageVersion,
96
96
  packageName: packageName,
@@ -27,6 +27,7 @@ var ActionsBar = exports.ActionsBar = /*#__PURE__*/function (_React$Component) {
27
27
  value: function render() {
28
28
  var _this$props = this.props,
29
29
  isFixed = _this$props.isFixed,
30
+ filename = _this$props.filename,
30
31
  actions = _this$props.actions;
31
32
  if (actions.length === 0) {
32
33
  return null;
@@ -34,6 +35,7 @@ var ActionsBar = exports.ActionsBar = /*#__PURE__*/function (_React$Component) {
34
35
  return /*#__PURE__*/_react.default.createElement(_actionsBarWrapper.ActionsBarWrapper, {
35
36
  isFixed: isFixed
36
37
  }, /*#__PURE__*/_react.default.createElement(_cardActions.CardActionsView, {
38
+ filename: filename,
37
39
  actions: actions,
38
40
  variant: _cardActions.CardActionIconButtonVariant.filled
39
41
  }));
@@ -1,22 +1,25 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
7
  exports.CardActionButton = void 0;
8
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
7
9
  var _react = require("react");
8
10
  var _react2 = require("@emotion/react");
9
11
  var _styles = require("./styles");
10
12
  /**@jsx jsx */
11
13
 
12
14
  var CardActionButton = exports.CardActionButton = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
13
- return (0, _react2.jsx)("div", {
15
+ return (0, _react2.jsx)("button", (0, _extends2.default)({}, props, {
14
16
  id: "cardActionButton",
15
17
  "data-testid": "media-card-primary-action",
18
+ "aria-label": props.label,
16
19
  css: (0, _styles.cardActionButtonStyles)(props),
17
20
  style: props.style,
18
21
  onClick: props.onClick,
19
22
  onMouseDown: props.onMouseDown,
20
23
  ref: ref
21
- }, props.children);
24
+ }), props.children);
22
25
  });
@@ -41,6 +41,7 @@ var CardActionIconButton = exports.CardActionIconButton = /*#__PURE__*/function
41
41
  value: function render() {
42
42
  var _this$props = this.props,
43
43
  icon = _this$props.icon,
44
+ label = _this$props.label,
44
45
  triggerColor = _this$props.triggerColor,
45
46
  onClick = _this$props.onClick,
46
47
  variant = _this$props.variant;
@@ -50,6 +51,7 @@ var CardActionIconButton = exports.CardActionIconButton = /*#__PURE__*/function
50
51
  style: {
51
52
  color: triggerColor
52
53
  },
54
+ label: label,
53
55
  variant: variant
54
56
  }, icon);
55
57
  }
@@ -48,6 +48,7 @@ var CardActionsView = exports.CardActionsView = /*#__PURE__*/function (_Componen
48
48
  value: function renderActionIconButton(action, isPrimary) {
49
49
  var _this$props = this.props,
50
50
  triggerColor = _this$props.triggerColor,
51
+ filename = _this$props.filename,
51
52
  variant = _this$props.variant;
52
53
  var icon = action.icon,
53
54
  handler = action.handler,
@@ -66,6 +67,7 @@ var CardActionsView = exports.CardActionsView = /*#__PURE__*/function (_Componen
66
67
  })(CardActionIconButtonWithProps);
67
68
  return (0, _react.jsx)(CardActionIconButtonWithAnalytics, {
68
69
  icon: icon,
70
+ label: filename ? "".concat(filename, " \u2014 ").concat(label) : label,
69
71
  triggerColor: triggerColor,
70
72
  onClick: function onClick() {
71
73
  return handler();
@@ -26,5 +26,5 @@ var getVariantStyles = function getVariantStyles(variant) {
26
26
  };
27
27
  var cardActionButtonStyles = exports.cardActionButtonStyles = function cardActionButtonStyles(_ref) {
28
28
  var variant = _ref.variant;
29
- return (0, _react.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n ", "\n ", "\n ", "\n color: ", ";\n\n &:hover {\n cursor: pointer;\n }\n\n ", "\n"])), _mediaUi.center, _mediaUi.borderRadius, (0, _mediaUi.size)(26), "var(--ds-icon, ".concat(_colors.N500, ")"), getVariantStyles(variant));
29
+ return (0, _react.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n appearance: none;\n border: none;\n ", "\n ", "\n ", "\n color: ", ";\n\n &:hover {\n cursor: pointer;\n }\n\n ", "\n"])), _mediaUi.center, _mediaUi.borderRadius, (0, _mediaUi.size)(26), "var(--ds-icon, ".concat(_colors.N500, ")"), getVariantStyles(variant));
30
30
  };
@@ -16,7 +16,7 @@ var _externalImageCard = require("./externalImageCard");
16
16
  var _fileCard = require("./fileCard");
17
17
  var _excluded = ["identifier"];
18
18
  var packageName = "@atlaskit/media-card";
19
- var packageVersion = "77.10.0";
19
+ var packageVersion = "77.10.2";
20
20
  var CardV2Base = exports.CardV2Base = function CardV2Base(_ref) {
21
21
  var identifier = _ref.identifier,
22
22
  otherProps = (0, _objectWithoutProperties2.default)(_ref, _excluded);
@@ -262,6 +262,7 @@ var CardViewV2Base = exports.CardViewV2Base = function CardViewV2Base(_ref) {
262
262
  }), renderTickBox && (0, _react.jsx)(_tickBox.TickBox, {
263
263
  selected: selected
264
264
  })), disableOverlay || !actions || actions.length === 0 ? null : (0, _react.jsx)(_actionsBar.ActionsBar, {
265
+ filename: name,
265
266
  actions: actionsWithDetails
266
267
  }));
267
268
  return (0, _react.jsx)(_react2.default.Fragment, null, shouldOpenMediaViewer && (0, _react.jsx)(_openMediaViewerButton.default, {
@@ -69,6 +69,7 @@ var CardViewWrapper = exports.CardViewWrapper = /*#__PURE__*/_react2.default.for
69
69
  }, props), children, customBlanket ? customBlanket() : defaultBlanket, customTitleBox ? customTitleBox() : defaultTitleBox, !disableOverlay && !!selectable && (0, _react.jsx)(_tickBox.TickBox, {
70
70
  selected: selected
71
71
  }), progressBar && progressBar()), !disableOverlay && actions && actions.length !== 0 && (0, _react.jsx)(_actionsBar.ActionsBar, {
72
+ filename: name,
72
73
  actions: actionsWithDetails
73
74
  }));
74
75
  var shouldRenderPlayButton = function shouldRenderPlayButton() {
@@ -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: "77.10.0",
122
+ packageName: "77.10.2",
123
123
  componentName: 'mediaInlineCard',
124
124
  component: 'mediaInlineCard'
125
125
  };
@@ -14,7 +14,7 @@ var _mediaClient = require("@atlaskit/media-client");
14
14
  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; }
15
15
  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; }
16
16
  var packageName = "@atlaskit/media-card";
17
- var packageVersion = "77.10.0";
17
+ var packageVersion = "77.10.2";
18
18
  var concurrentExperience;
19
19
  var getExperience = function getExperience(id) {
20
20
  if (!concurrentExperience) {
@@ -28,7 +28,7 @@ import { completeUfoExperience, startUfoExperience, abortUfoExperience } from '.
28
28
  import { generateUniqueId } from '../utils/generateUniqueId';
29
29
  import { DateOverrideContext } from '../dateOverrideContext';
30
30
  const packageName = "@atlaskit/media-card";
31
- const packageVersion = "77.10.0";
31
+ const packageVersion = "77.10.2";
32
32
  export class CardBase extends Component {
33
33
  constructor(props) {
34
34
  super(props);
@@ -376,6 +376,7 @@ export class CardViewBase extends React.Component {
376
376
  return null;
377
377
  }
378
378
  return jsx(ActionsBar, {
379
+ filename: metadata === null || metadata === void 0 ? void 0 : metadata.name,
379
380
  actions: actionsWithDetails
380
381
  });
381
382
  }
@@ -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 = "77.10.0";
69
+ const packageVersion = "77.10.2";
70
70
  const MediaCardAnalyticsErrorBoundary = withMediaAnalyticsContext({
71
71
  packageVersion,
72
72
  packageName,
@@ -5,6 +5,7 @@ export class ActionsBar extends React.Component {
5
5
  render() {
6
6
  const {
7
7
  isFixed,
8
+ filename,
8
9
  actions
9
10
  } = this.props;
10
11
  if (actions.length === 0) {
@@ -13,6 +14,7 @@ export class ActionsBar extends React.Component {
13
14
  return /*#__PURE__*/React.createElement(ActionsBarWrapper, {
14
15
  isFixed: isFixed
15
16
  }, /*#__PURE__*/React.createElement(CardActionsView, {
17
+ filename: filename,
16
18
  actions: actions,
17
19
  variant: CardActionIconButtonVariant.filled
18
20
  }));
@@ -1,15 +1,17 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
1
2
  /**@jsx jsx */
2
3
  import { forwardRef } from 'react';
3
4
  import { jsx } from '@emotion/react';
4
5
  import { cardActionButtonStyles } from './styles';
5
6
  export const CardActionButton = /*#__PURE__*/forwardRef((props, ref) => {
6
- return jsx("div", {
7
+ return jsx("button", _extends({}, props, {
7
8
  id: "cardActionButton",
8
9
  "data-testid": "media-card-primary-action",
10
+ "aria-label": props.label,
9
11
  css: cardActionButtonStyles(props),
10
12
  style: props.style,
11
13
  onClick: props.onClick,
12
14
  onMouseDown: props.onMouseDown,
13
15
  ref: ref
14
- }, props.children);
16
+ }), props.children);
15
17
  });
@@ -14,6 +14,7 @@ export class CardActionIconButton extends Component {
14
14
  render() {
15
15
  const {
16
16
  icon,
17
+ label,
17
18
  triggerColor,
18
19
  onClick,
19
20
  variant
@@ -24,6 +25,7 @@ export class CardActionIconButton extends Component {
24
25
  style: {
25
26
  color: triggerColor
26
27
  },
28
+ label: label,
27
29
  variant: variant
28
30
  }, icon);
29
31
  }
@@ -25,6 +25,7 @@ export class CardActionsView extends Component {
25
25
  renderActionIconButton(action, isPrimary) {
26
26
  const {
27
27
  triggerColor,
28
+ filename,
28
29
  variant
29
30
  } = this.props;
30
31
  const {
@@ -46,6 +47,7 @@ export class CardActionsView extends Component {
46
47
  })(CardActionIconButtonWithProps);
47
48
  return jsx(CardActionIconButtonWithAnalytics, {
48
49
  icon: icon,
50
+ label: filename ? `${filename} — ${label}` : label,
49
51
  triggerColor: triggerColor,
50
52
  onClick: () => handler(),
51
53
  variant: variant
@@ -43,6 +43,8 @@ const getVariantStyles = variant => {
43
43
  export const cardActionButtonStyles = ({
44
44
  variant
45
45
  }) => css`
46
+ appearance: none;
47
+ border: none;
46
48
  ${center}
47
49
  ${borderRadius}
48
50
  ${size(26)}
@@ -7,7 +7,7 @@ import { IntlProvider, injectIntl } from 'react-intl-next';
7
7
  import { ExternalImageCard } from './externalImageCard';
8
8
  import { FileCard } from './fileCard';
9
9
  const packageName = "@atlaskit/media-card";
10
- const packageVersion = "77.10.0";
10
+ const packageVersion = "77.10.2";
11
11
  export const CardV2Base = ({
12
12
  identifier,
13
13
  ...otherProps
@@ -257,6 +257,7 @@ export const CardViewV2Base = ({
257
257
  }), renderTickBox && jsx(TickBox, {
258
258
  selected: selected
259
259
  })), disableOverlay || !actions || actions.length === 0 ? null : jsx(ActionsBar, {
260
+ filename: name,
260
261
  actions: actionsWithDetails
261
262
  }));
262
263
  return jsx(React.Fragment, null, shouldOpenMediaViewer && jsx(OpenMediaViewerButton, {
@@ -60,6 +60,7 @@ export const CardViewWrapper = /*#__PURE__*/React.forwardRef(({
60
60
  }, props), children, customBlanket ? customBlanket() : defaultBlanket, customTitleBox ? customTitleBox() : defaultTitleBox, !disableOverlay && !!selectable && jsx(TickBox, {
61
61
  selected: selected
62
62
  }), progressBar && progressBar()), !disableOverlay && actions && actions.length !== 0 && jsx(ActionsBar, {
63
+ filename: name,
63
64
  actions: actionsWithDetails
64
65
  }));
65
66
  const shouldRenderPlayButton = () => {
@@ -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: "77.10.0",
40
+ packageName: "77.10.2",
41
41
  componentName: 'mediaInlineCard',
42
42
  component: 'mediaInlineCard'
43
43
  };
@@ -4,7 +4,7 @@ import { extractErrorInfo, getRenderErrorRequestMetadata } from './analytics';
4
4
  import { MediaCardError } from '../errors';
5
5
  import { getMediaEnvironment, getMediaRegion } from '@atlaskit/media-client';
6
6
  const packageName = "@atlaskit/media-card";
7
- const packageVersion = "77.10.0";
7
+ const packageVersion = "77.10.2";
8
8
  let concurrentExperience;
9
9
  const getExperience = id => {
10
10
  if (!concurrentExperience) {
@@ -41,7 +41,7 @@ import { completeUfoExperience, startUfoExperience, abortUfoExperience } from '.
41
41
  import { generateUniqueId } from '../utils/generateUniqueId';
42
42
  import { DateOverrideContext } from '../dateOverrideContext';
43
43
  var packageName = "@atlaskit/media-card";
44
- var packageVersion = "77.10.0";
44
+ var packageVersion = "77.10.2";
45
45
  export var CardBase = /*#__PURE__*/function (_Component) {
46
46
  _inherits(CardBase, _Component);
47
47
  var _super = _createSuper(CardBase);
@@ -383,6 +383,7 @@ export var CardViewBase = /*#__PURE__*/function (_React$Component) {
383
383
  return null;
384
384
  }
385
385
  return jsx(ActionsBar, {
386
+ filename: metadata === null || metadata === void 0 ? void 0 : metadata.name,
386
387
  actions: actionsWithDetails
387
388
  });
388
389
  }
@@ -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 = "77.10.0";
86
+ var packageVersion = "77.10.2";
87
87
  var MediaCardAnalyticsErrorBoundary = withMediaAnalyticsContext({
88
88
  packageVersion: packageVersion,
89
89
  packageName: packageName,
@@ -20,6 +20,7 @@ export var ActionsBar = /*#__PURE__*/function (_React$Component) {
20
20
  value: function render() {
21
21
  var _this$props = this.props,
22
22
  isFixed = _this$props.isFixed,
23
+ filename = _this$props.filename,
23
24
  actions = _this$props.actions;
24
25
  if (actions.length === 0) {
25
26
  return null;
@@ -27,6 +28,7 @@ export var ActionsBar = /*#__PURE__*/function (_React$Component) {
27
28
  return /*#__PURE__*/React.createElement(ActionsBarWrapper, {
28
29
  isFixed: isFixed
29
30
  }, /*#__PURE__*/React.createElement(CardActionsView, {
31
+ filename: filename,
30
32
  actions: actions,
31
33
  variant: CardActionIconButtonVariant.filled
32
34
  }));
@@ -1,15 +1,17 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
1
2
  /**@jsx jsx */
2
3
  import { forwardRef } from 'react';
3
4
  import { jsx } from '@emotion/react';
4
5
  import { cardActionButtonStyles } from './styles';
5
6
  export var CardActionButton = /*#__PURE__*/forwardRef(function (props, ref) {
6
- return jsx("div", {
7
+ return jsx("button", _extends({}, props, {
7
8
  id: "cardActionButton",
8
9
  "data-testid": "media-card-primary-action",
10
+ "aria-label": props.label,
9
11
  css: cardActionButtonStyles(props),
10
12
  style: props.style,
11
13
  onClick: props.onClick,
12
14
  onMouseDown: props.onMouseDown,
13
15
  ref: ref
14
- }, props.children);
16
+ }), props.children);
15
17
  });
@@ -32,6 +32,7 @@ export var CardActionIconButton = /*#__PURE__*/function (_Component) {
32
32
  value: function render() {
33
33
  var _this$props = this.props,
34
34
  icon = _this$props.icon,
35
+ label = _this$props.label,
35
36
  triggerColor = _this$props.triggerColor,
36
37
  onClick = _this$props.onClick,
37
38
  variant = _this$props.variant;
@@ -41,6 +42,7 @@ export var CardActionIconButton = /*#__PURE__*/function (_Component) {
41
42
  style: {
42
43
  color: triggerColor
43
44
  },
45
+ label: label,
44
46
  variant: variant
45
47
  }, icon);
46
48
  }
@@ -42,6 +42,7 @@ export var CardActionsView = /*#__PURE__*/function (_Component) {
42
42
  value: function renderActionIconButton(action, isPrimary) {
43
43
  var _this$props = this.props,
44
44
  triggerColor = _this$props.triggerColor,
45
+ filename = _this$props.filename,
45
46
  variant = _this$props.variant;
46
47
  var icon = action.icon,
47
48
  handler = action.handler,
@@ -60,6 +61,7 @@ export var CardActionsView = /*#__PURE__*/function (_Component) {
60
61
  })(CardActionIconButtonWithProps);
61
62
  return jsx(CardActionIconButtonWithAnalytics, {
62
63
  icon: icon,
64
+ label: filename ? "".concat(filename, " \u2014 ").concat(label) : label,
63
65
  triggerColor: triggerColor,
64
66
  onClick: function onClick() {
65
67
  return handler();
@@ -19,5 +19,5 @@ var getVariantStyles = function getVariantStyles(variant) {
19
19
  };
20
20
  export var cardActionButtonStyles = function cardActionButtonStyles(_ref) {
21
21
  var variant = _ref.variant;
22
- return css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n ", "\n ", "\n ", "\n color: ", ";\n\n &:hover {\n cursor: pointer;\n }\n\n ", "\n"])), center, borderRadius, size(26), "var(--ds-icon, ".concat(N500, ")"), getVariantStyles(variant));
22
+ return css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n appearance: none;\n border: none;\n ", "\n ", "\n ", "\n color: ", ";\n\n &:hover {\n cursor: pointer;\n }\n\n ", "\n"])), center, borderRadius, size(26), "var(--ds-icon, ".concat(N500, ")"), getVariantStyles(variant));
23
23
  };
@@ -9,7 +9,7 @@ import { IntlProvider, injectIntl } from 'react-intl-next';
9
9
  import { ExternalImageCard } from './externalImageCard';
10
10
  import { FileCard } from './fileCard';
11
11
  var packageName = "@atlaskit/media-card";
12
- var packageVersion = "77.10.0";
12
+ var packageVersion = "77.10.2";
13
13
  export var CardV2Base = function CardV2Base(_ref) {
14
14
  var identifier = _ref.identifier,
15
15
  otherProps = _objectWithoutProperties(_ref, _excluded);
@@ -253,6 +253,7 @@ export var CardViewV2Base = function CardViewV2Base(_ref) {
253
253
  }), renderTickBox && jsx(TickBox, {
254
254
  selected: selected
255
255
  })), disableOverlay || !actions || actions.length === 0 ? null : jsx(ActionsBar, {
256
+ filename: name,
256
257
  actions: actionsWithDetails
257
258
  }));
258
259
  return jsx(React.Fragment, null, shouldOpenMediaViewer && jsx(OpenMediaViewerButton, {
@@ -62,6 +62,7 @@ export var CardViewWrapper = /*#__PURE__*/React.forwardRef(function (_ref, ref)
62
62
  }, props), children, customBlanket ? customBlanket() : defaultBlanket, customTitleBox ? customTitleBox() : defaultTitleBox, !disableOverlay && !!selectable && jsx(TickBox, {
63
63
  selected: selected
64
64
  }), progressBar && progressBar()), !disableOverlay && actions && actions.length !== 0 && jsx(ActionsBar, {
65
+ filename: name,
65
66
  actions: actionsWithDetails
66
67
  }));
67
68
  var shouldRenderPlayButton = function shouldRenderPlayButton() {
@@ -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: "77.10.0",
106
+ packageName: "77.10.2",
107
107
  componentName: 'mediaInlineCard',
108
108
  component: 'mediaInlineCard'
109
109
  };
@@ -7,7 +7,7 @@ import { extractErrorInfo, getRenderErrorRequestMetadata } from './analytics';
7
7
  import { MediaCardError } from '../errors';
8
8
  import { getMediaEnvironment, getMediaRegion } from '@atlaskit/media-client';
9
9
  var packageName = "@atlaskit/media-card";
10
- var packageVersion = "77.10.0";
10
+ var packageVersion = "77.10.2";
11
11
  var concurrentExperience;
12
12
  var getExperience = function getExperience(id) {
13
13
  if (!concurrentExperience) {
@@ -1,3 +1,3 @@
1
1
  /// <reference types="react" />
2
2
  import { CardActionButtonOwnProps } from './styles';
3
- export declare const CardActionButton: import("react").ForwardRefExoticComponent<CardActionButtonOwnProps & import("react").RefAttributes<HTMLDivElement>>;
3
+ export declare const CardActionButton: import("react").ForwardRefExoticComponent<CardActionButtonOwnProps & import("react").RefAttributes<HTMLButtonElement>>;
@@ -2,9 +2,10 @@ import { Component, ReactNode, MouseEvent } from 'react';
2
2
  import { CardActionIconButtonVariant } from './styles';
3
3
  export type CardActionIconButtonProps = {
4
4
  readonly icon: ReactNode;
5
+ readonly label?: string;
5
6
  readonly variant?: CardActionIconButtonVariant;
6
7
  readonly triggerColor?: string;
7
- readonly onClick?: (event: MouseEvent<HTMLDivElement>) => void;
8
+ readonly onClick?: (event: MouseEvent<HTMLButtonElement>) => void;
8
9
  };
9
10
  export declare class CardActionIconButton extends Component<CardActionIconButtonProps> {
10
11
  render(): JSX.Element;
@@ -3,6 +3,7 @@ import { CardAction } from '../../../actions';
3
3
  import { CardActionIconButtonVariant } from './styles';
4
4
  export interface CardActionsViewProps {
5
5
  readonly actions: CardAction[];
6
+ readonly filename?: string;
6
7
  readonly onToggle?: (attrs: {
7
8
  isOpen: boolean;
8
9
  }) => void;
@@ -7,12 +7,13 @@ export declare enum CardActionIconButtonVariant {
7
7
  }
8
8
  export type CardActionButtonOwnProps = {
9
9
  variant?: CardActionIconButtonVariant;
10
+ label?: string;
10
11
  style?: {
11
12
  color: string | undefined;
12
13
  };
13
- onClick?: (event: React.MouseEvent<HTMLDivElement>, analyticsEvent?: UIAnalyticsEvent) => void;
14
- onMouseDown?: (event: MouseEvent<HTMLDivElement>) => void;
14
+ onClick?: (event: React.MouseEvent<HTMLButtonElement>, analyticsEvent?: UIAnalyticsEvent) => void;
15
+ onMouseDown?: (event: MouseEvent<HTMLButtonElement>) => void;
15
16
  children?: React.ReactNode;
16
17
  };
17
- export type CardActionButtonProps = CardActionButtonOwnProps & HTMLAttributes<HTMLDivElement>;
18
+ export type CardActionButtonProps = CardActionButtonOwnProps & HTMLAttributes<HTMLButtonElement>;
18
19
  export declare const cardActionButtonStyles: ({ variant, }: CardActionButtonProps) => import("@emotion/react").SerializedStyles;
@@ -2,6 +2,7 @@ import { ReactNode } from 'react';
2
2
  import { CardAction } from '../../actions';
3
3
  export interface ActionsBarProps {
4
4
  actions: Array<CardAction>;
5
+ filename?: string;
5
6
  isFixed?: boolean;
6
7
  }
7
8
  export type ActionBarWrapperProps = {
@@ -1,3 +1,3 @@
1
1
  /// <reference types="react" />
2
2
  import { CardActionButtonOwnProps } from './styles';
3
- export declare const CardActionButton: import("react").ForwardRefExoticComponent<CardActionButtonOwnProps & import("react").RefAttributes<HTMLDivElement>>;
3
+ export declare const CardActionButton: import("react").ForwardRefExoticComponent<CardActionButtonOwnProps & import("react").RefAttributes<HTMLButtonElement>>;
@@ -2,9 +2,10 @@ import { Component, ReactNode, MouseEvent } from 'react';
2
2
  import { CardActionIconButtonVariant } from './styles';
3
3
  export type CardActionIconButtonProps = {
4
4
  readonly icon: ReactNode;
5
+ readonly label?: string;
5
6
  readonly variant?: CardActionIconButtonVariant;
6
7
  readonly triggerColor?: string;
7
- readonly onClick?: (event: MouseEvent<HTMLDivElement>) => void;
8
+ readonly onClick?: (event: MouseEvent<HTMLButtonElement>) => void;
8
9
  };
9
10
  export declare class CardActionIconButton extends Component<CardActionIconButtonProps> {
10
11
  render(): JSX.Element;
@@ -3,6 +3,7 @@ import { CardAction } from '../../../actions';
3
3
  import { CardActionIconButtonVariant } from './styles';
4
4
  export interface CardActionsViewProps {
5
5
  readonly actions: CardAction[];
6
+ readonly filename?: string;
6
7
  readonly onToggle?: (attrs: {
7
8
  isOpen: boolean;
8
9
  }) => void;
@@ -7,12 +7,13 @@ export declare enum CardActionIconButtonVariant {
7
7
  }
8
8
  export type CardActionButtonOwnProps = {
9
9
  variant?: CardActionIconButtonVariant;
10
+ label?: string;
10
11
  style?: {
11
12
  color: string | undefined;
12
13
  };
13
- onClick?: (event: React.MouseEvent<HTMLDivElement>, analyticsEvent?: UIAnalyticsEvent) => void;
14
- onMouseDown?: (event: MouseEvent<HTMLDivElement>) => void;
14
+ onClick?: (event: React.MouseEvent<HTMLButtonElement>, analyticsEvent?: UIAnalyticsEvent) => void;
15
+ onMouseDown?: (event: MouseEvent<HTMLButtonElement>) => void;
15
16
  children?: React.ReactNode;
16
17
  };
17
- export type CardActionButtonProps = CardActionButtonOwnProps & HTMLAttributes<HTMLDivElement>;
18
+ export type CardActionButtonProps = CardActionButtonOwnProps & HTMLAttributes<HTMLButtonElement>;
18
19
  export declare const cardActionButtonStyles: ({ variant, }: CardActionButtonProps) => import("@emotion/react").SerializedStyles;
@@ -2,6 +2,7 @@ import { ReactNode } from 'react';
2
2
  import { CardAction } from '../../actions';
3
3
  export interface ActionsBarProps {
4
4
  actions: Array<CardAction>;
5
+ filename?: string;
5
6
  isFixed?: boolean;
6
7
  }
7
8
  export type ActionBarWrapperProps = {
@@ -0,0 +1,43 @@
1
+ import React, { useEffect, useMemo } from 'react';
2
+ import ReactDOM from 'react-dom';
3
+ import ReactDOMServer from 'react-dom/server';
4
+ import { SSRAnalyticsWrapper } from '.';
5
+
6
+ export interface SimulateSsrParams
7
+ extends React.DetailedHTMLProps<
8
+ React.HTMLAttributes<HTMLDivElement>,
9
+ HTMLDivElement
10
+ > {
11
+ serverPage: React.ReactNode;
12
+ hydratePage?: React.ReactNode;
13
+ }
14
+
15
+ const randomStr = () => Math.random().toString(36).substr(2, 9);
16
+ const generateSsrPageId = () => `media-ssr-page-${randomStr()}-${randomStr()}`;
17
+
18
+ export const SimulateSsr = ({
19
+ serverPage,
20
+ hydratePage,
21
+ ...divProps
22
+ }: SimulateSsrParams) => {
23
+ const id = useMemo(generateSsrPageId, []);
24
+
25
+ useEffect(() => {
26
+ const txt = ReactDOMServer.renderToString(
27
+ <SSRAnalyticsWrapper>{serverPage}</SSRAnalyticsWrapper>,
28
+ );
29
+ const elem = document.querySelector(`#${id}`);
30
+ if (elem) {
31
+ elem.innerHTML = txt;
32
+ if (hydratePage) {
33
+ ReactDOM.hydrate(
34
+ <SSRAnalyticsWrapper>{hydratePage}</SSRAnalyticsWrapper>,
35
+ elem,
36
+ );
37
+ }
38
+ }
39
+ }, [id, hydratePage, serverPage]);
40
+
41
+ // eslint-disable-next-line @atlaskit/design-system/prefer-primitives
42
+ return <div id={id} {...divProps}></div>;
43
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/media-card",
3
- "version": "77.10.0",
3
+ "version": "77.10.2",
4
4
  "description": "Includes all media card related components, CardView, CardViewSmall, Card...",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -43,13 +43,13 @@
43
43
  "@atlaskit/media-client": "^26.2.0",
44
44
  "@atlaskit/media-client-react": "^2.0.0",
45
45
  "@atlaskit/media-common": "^11.0.0",
46
- "@atlaskit/media-file-preview": "^0.4.0",
46
+ "@atlaskit/media-file-preview": "^0.5.0",
47
47
  "@atlaskit/media-ui": "^25.1.0",
48
48
  "@atlaskit/media-viewer": "^48.2.0",
49
49
  "@atlaskit/platform-feature-flags": "^0.2.2",
50
50
  "@atlaskit/spinner": "^16.0.0",
51
51
  "@atlaskit/theme": "^12.6.0",
52
- "@atlaskit/tokens": "^1.37.0",
52
+ "@atlaskit/tokens": "^1.38.0",
53
53
  "@atlaskit/tooltip": "^18.1.0",
54
54
  "@atlaskit/ufo": "^0.2.0",
55
55
  "@babel/runtime": "^7.0.0",