@atlaskit/media-viewer 54.11.22 → 54.11.24

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 (94) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/dist/cjs/DownloadButton.js +14 -5
  3. package/dist/cjs/DownloadItem.js +3 -1
  4. package/dist/cjs/ErrorViewDownloadButton.js +3 -0
  5. package/dist/cjs/ToolbarDownloadButton.js +3 -0
  6. package/dist/cjs/analytics/ufoExperiences.js +1 -1
  7. package/dist/cjs/errorMessage.compiled.css +1 -0
  8. package/dist/cjs/errorMessage.js +11 -7
  9. package/dist/cjs/errorMessageWithAnalytics.js +2 -1
  10. package/dist/cjs/insetViewerContext.js +15 -15
  11. package/dist/cjs/loading.js +7 -2
  12. package/dist/cjs/styleWrappers.compiled.css +5 -1
  13. package/dist/cjs/styleWrappers.js +48 -15
  14. package/dist/cjs/viewers/archiveSidebar/archive-viewer-base.js +1 -1
  15. package/dist/cjs/viewers/audio.js +68 -27
  16. package/dist/cjs/viewers/codeViewer/CodeRendererAdvanced/CodeRendererAdvanced.compiled.css +6 -1
  17. package/dist/cjs/viewers/codeViewer/CodeRendererAdvanced/CodeRendererAdvanced.js +37 -9
  18. package/dist/cjs/viewers/codeViewer/CodeRendererAdvanced/theme.js +68 -53
  19. package/dist/cjs/viewers/codeViewer/CodeViewRenderer-2.js +15 -1
  20. package/dist/cjs/viewers/codeViewer/CodeViewerFooter.compiled.css +10 -0
  21. package/dist/cjs/viewers/codeViewer/CodeViewerFooter.js +41 -0
  22. package/dist/cjs/viewers/codeViewer/CodeViewerHeaderBar.js +6 -0
  23. package/dist/cjs/viewers/codeViewer/codeViewerRenderer-compiled.compiled.css +3 -1
  24. package/dist/cjs/viewers/codeViewer/codeViewerRenderer-compiled.js +8 -1
  25. package/dist/cjs/viewers/doc/DocViewer.js +7 -2
  26. package/dist/cjs/viewers/doc/passwordInput.compiled.css +3 -1
  27. package/dist/cjs/viewers/doc/passwordInput.js +12 -4
  28. package/dist/cjs/viewers/video.js +6 -6
  29. package/dist/es2019/DownloadButton.js +12 -4
  30. package/dist/es2019/DownloadItem.js +3 -1
  31. package/dist/es2019/ErrorViewDownloadButton.js +3 -0
  32. package/dist/es2019/ToolbarDownloadButton.js +3 -0
  33. package/dist/es2019/analytics/ufoExperiences.js +1 -1
  34. package/dist/es2019/errorMessage.compiled.css +1 -0
  35. package/dist/es2019/errorMessage.js +9 -5
  36. package/dist/es2019/errorMessageWithAnalytics.js +2 -1
  37. package/dist/es2019/insetViewerContext.js +11 -11
  38. package/dist/es2019/loading.js +7 -2
  39. package/dist/es2019/styleWrappers.compiled.css +4 -0
  40. package/dist/es2019/styleWrappers.js +59 -26
  41. package/dist/es2019/viewers/archiveSidebar/archive-viewer-base.js +2 -2
  42. package/dist/es2019/viewers/audio.js +52 -17
  43. package/dist/es2019/viewers/codeViewer/CodeRendererAdvanced/CodeRendererAdvanced.compiled.css +6 -1
  44. package/dist/es2019/viewers/codeViewer/CodeRendererAdvanced/CodeRendererAdvanced.js +29 -9
  45. package/dist/es2019/viewers/codeViewer/CodeRendererAdvanced/theme.js +21 -5
  46. package/dist/es2019/viewers/codeViewer/CodeViewRenderer-2.js +15 -1
  47. package/dist/es2019/viewers/codeViewer/CodeViewerFooter.compiled.css +10 -0
  48. package/dist/es2019/viewers/codeViewer/CodeViewerFooter.js +33 -0
  49. package/dist/es2019/viewers/codeViewer/CodeViewerHeaderBar.js +6 -0
  50. package/dist/es2019/viewers/codeViewer/codeViewerRenderer-compiled.compiled.css +3 -1
  51. package/dist/es2019/viewers/codeViewer/codeViewerRenderer-compiled.js +5 -1
  52. package/dist/es2019/viewers/doc/DocViewer.js +7 -2
  53. package/dist/es2019/viewers/doc/passwordInput.compiled.css +3 -1
  54. package/dist/es2019/viewers/doc/passwordInput.js +12 -4
  55. package/dist/es2019/viewers/video.js +7 -7
  56. package/dist/esm/DownloadButton.js +14 -5
  57. package/dist/esm/DownloadItem.js +3 -1
  58. package/dist/esm/ErrorViewDownloadButton.js +3 -0
  59. package/dist/esm/ToolbarDownloadButton.js +3 -0
  60. package/dist/esm/analytics/ufoExperiences.js +1 -1
  61. package/dist/esm/errorMessage.compiled.css +1 -0
  62. package/dist/esm/errorMessage.js +11 -7
  63. package/dist/esm/errorMessageWithAnalytics.js +2 -1
  64. package/dist/esm/insetViewerContext.js +14 -14
  65. package/dist/esm/loading.js +7 -2
  66. package/dist/esm/styleWrappers.compiled.css +5 -1
  67. package/dist/esm/styleWrappers.js +48 -15
  68. package/dist/esm/viewers/archiveSidebar/archive-viewer-base.js +2 -2
  69. package/dist/esm/viewers/audio.js +69 -28
  70. package/dist/esm/viewers/codeViewer/CodeRendererAdvanced/CodeRendererAdvanced.compiled.css +6 -1
  71. package/dist/esm/viewers/codeViewer/CodeRendererAdvanced/CodeRendererAdvanced.js +38 -11
  72. package/dist/esm/viewers/codeViewer/CodeRendererAdvanced/theme.js +67 -52
  73. package/dist/esm/viewers/codeViewer/CodeViewRenderer-2.js +15 -1
  74. package/dist/esm/viewers/codeViewer/CodeViewerFooter.compiled.css +10 -0
  75. package/dist/esm/viewers/codeViewer/CodeViewerFooter.js +32 -0
  76. package/dist/esm/viewers/codeViewer/CodeViewerHeaderBar.js +6 -0
  77. package/dist/esm/viewers/codeViewer/codeViewerRenderer-compiled.compiled.css +3 -1
  78. package/dist/esm/viewers/codeViewer/codeViewerRenderer-compiled.js +8 -1
  79. package/dist/esm/viewers/doc/DocViewer.js +7 -2
  80. package/dist/esm/viewers/doc/passwordInput.compiled.css +3 -1
  81. package/dist/esm/viewers/doc/passwordInput.js +12 -4
  82. package/dist/esm/viewers/video.js +7 -7
  83. package/dist/types/DownloadButton.d.ts +1 -1
  84. package/dist/types/DownloadButtonProps.d.ts +1 -0
  85. package/dist/types/DownloadItem.d.ts +1 -1
  86. package/dist/types/DownloadItemProps.d.ts +1 -0
  87. package/dist/types/errorMessage.d.ts +6 -1
  88. package/dist/types/insetViewerContext.d.ts +3 -3
  89. package/dist/types/styleWrappers.d.ts +2 -2
  90. package/dist/types/viewers/audio.d.ts +2 -16
  91. package/dist/types/viewers/codeViewer/CodeRendererAdvanced/theme.d.ts +1 -0
  92. package/dist/types/viewers/codeViewer/CodeViewerFooter.d.ts +7 -0
  93. package/dist/types/viewers/codeViewer/CodeViewerHeaderBar.d.ts +1 -1
  94. package/package.json +6 -5
@@ -26,6 +26,7 @@ var _flex = require("@atlaskit/primitives/components/flex");
26
26
  var _text = require("@atlaskit/primitives/text");
27
27
  var _xcss = require("@atlaskit/primitives/xcss/xcss");
28
28
  var _textField = _interopRequireDefault(require("@atlaskit/textfield/text-field"));
29
+ var _insetViewerContext = require("../../insetViewerContext");
29
30
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
30
31
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
31
32
  // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
@@ -35,7 +36,12 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
35
36
  var COLOR_SHADE = '#b6c2cf';
36
37
  var ERROR_COLOR = '#FD9891';
37
38
  var headingStyle = null;
39
+ var insetViewerHeadingStyle = null;
38
40
  var errorMessageWrapperStyle = null;
41
+ var errorMessageColorStyle = null;
42
+
43
+ // The message itself takes its color from the Text color prop, so this is just for the icon.
44
+ var insetViewerErrorMessageColorStyle = null;
39
45
  var errorMessageStyle = null;
40
46
  var headerStyles = (0, _xcss.xcss)({
41
47
  textAlign: 'center',
@@ -61,6 +67,7 @@ var PasswordInput = exports.PasswordInput = function PasswordInput(_ref) {
61
67
  formError = _useState2[0],
62
68
  setFormError = _useState2[1];
63
69
  var intl = (0, _reactIntl.useIntl)();
70
+ var isInsetViewer = (0, _insetViewerContext.useIsInsetViewer)();
64
71
  (0, _react.useEffect)(function () {
65
72
  var _onRenderRef$current;
66
73
  (_onRenderRef$current = onRenderRef.current) === null || _onRenderRef$current === void 0 || _onRenderRef$current.call(onRenderRef);
@@ -81,11 +88,11 @@ var PasswordInput = exports.PasswordInput = function PasswordInput(_ref) {
81
88
  justifyContent: "center"
82
89
  }, /*#__PURE__*/React.createElement(_lockLocked.default, {
83
90
  label: "",
84
- color: COLOR_SHADE
91
+ color: isInsetViewer ? "var(--ds-icon-subtle, #505258)" : COLOR_SHADE
85
92
  })), /*#__PURE__*/React.createElement(_box.Box, {
86
93
  xcss: headerStyles
87
94
  }, /*#__PURE__*/React.createElement("div", {
88
- className: (0, _runtime.ax)(["_151kfhey _18ewwu06 _1jyy9txx"])
95
+ className: (0, _runtime.ax)(["_151kfhey _18ewwu06 _1jyy9txx", isInsetViewer && "_1jyyazsu"])
89
96
  }, /*#__PURE__*/React.createElement(_heading.default, {
90
97
  as: "h1",
91
98
  size: "medium"
@@ -109,7 +116,7 @@ var PasswordInput = exports.PasswordInput = function PasswordInput(_ref) {
109
116
  }
110
117
  })), formError && /*#__PURE__*/React.createElement("div", {
111
118
  id: "".concat(fieldProps.id, "-error"),
112
- className: (0, _runtime.ax)(["_11c8wadc _19pk1b66 _1e0c1txw _4cvr1h6o _syaz1366 _125x1366"])
119
+ className: (0, _runtime.ax)(["_11c8wadc _19pk1b66 _1e0c1txw _4cvr1h6o", isInsetViewer ? "_syaz1tmw" : "_syaz1366 _125x1366"])
113
120
  }, /*#__PURE__*/React.createElement(_statusError.default, {
114
121
  color: "currentColor",
115
122
  label: "",
@@ -118,7 +125,8 @@ var PasswordInput = exports.PasswordInput = function PasswordInput(_ref) {
118
125
  id: "".concat(fieldProps.id, "-errorMessage"),
119
126
  className: (0, _runtime.ax)(["_19pkidpf _18u01b66"])
120
127
  }, /*#__PURE__*/React.createElement(_text.Text, {
121
- as: "p"
128
+ as: "p",
129
+ color: isInsetViewer ? 'color.text.danger' : undefined
122
130
  }, /*#__PURE__*/React.createElement(_reactIntl.FormattedMessage, _messages.messages.incorrect_password)))));
123
131
  }), /*#__PURE__*/React.createElement(_box.Box, {
124
132
  xcss: footerStyles
@@ -136,16 +136,16 @@ var _VideoViewer = /*#__PURE__*/function (_BaseViewer) {
136
136
  value: function componentDidMount() {
137
137
  _superPropGet(_VideoViewer, "componentDidMount", this, 3)([]);
138
138
  if (this.props.isInsetViewer) {
139
- var _this$props$setHasVid, _this$props3;
140
- (_this$props$setHasVid = (_this$props3 = this.props).setHasVideoControls) === null || _this$props$setHasVid === void 0 || _this$props$setHasVid.call(_this$props3, true);
139
+ var _this$props$setHasPla, _this$props3;
140
+ (_this$props$setHasPla = (_this$props3 = this.props).setHasPlayerControls) === null || _this$props$setHasPla === void 0 || _this$props$setHasPla.call(_this$props3, true);
141
141
  }
142
142
  }
143
143
  }, {
144
144
  key: "componentWillUnmount",
145
145
  value: function componentWillUnmount() {
146
146
  if (this.props.isInsetViewer) {
147
- var _this$props$setHasVid2, _this$props4;
148
- (_this$props$setHasVid2 = (_this$props4 = this.props).setHasVideoControls) === null || _this$props$setHasVid2 === void 0 || _this$props$setHasVid2.call(_this$props4, false);
147
+ var _this$props$setHasPla2, _this$props4;
148
+ (_this$props$setHasPla2 = (_this$props4 = this.props).setHasPlayerControls) === null || _this$props$setHasPla2 === void 0 || _this$props$setHasPla2.call(_this$props4, false);
149
149
  }
150
150
  _superPropGet(_VideoViewer, "componentWillUnmount", this, 3)([]);
151
151
  }
@@ -177,7 +177,7 @@ var _VideoViewer = /*#__PURE__*/function (_BaseViewer) {
177
177
  src: content
178
178
  });
179
179
  }
180
- return /*#__PURE__*/_react.default.createElement(_styleWrappers.CustomVideoPlayerWrapper, null, /*#__PURE__*/_react.default.createElement(_styleWrappers.FittedVideoFrame, {
180
+ return /*#__PURE__*/_react.default.createElement(_styleWrappers.CustomMediaPlayerWrapper, null, /*#__PURE__*/_react.default.createElement(_styleWrappers.FittedVideoFrame, {
181
181
  ref: this.setInsetVideoFrame
182
182
  }, /*#__PURE__*/_react.default.createElement(_styleWrappers.Video, {
183
183
  autoPlay: isAutoPlay,
@@ -226,7 +226,7 @@ var _VideoViewer = /*#__PURE__*/function (_BaseViewer) {
226
226
  var player = /*#__PURE__*/_react.default.createElement(_insetViewerProvider.InsetViewerProvider, {
227
227
  isInsetViewer: isInsetViewer
228
228
  }, playerElement);
229
- return /*#__PURE__*/_react.default.createElement(_styleWrappers.CustomVideoPlayerWrapper, {
229
+ return /*#__PURE__*/_react.default.createElement(_styleWrappers.CustomMediaPlayerWrapper, {
230
230
  "data-testid": "media-viewer-video-content"
231
231
  }, isInsetViewer ? /*#__PURE__*/_react.default.createElement(_styleWrappers.FittedVideoFrame, {
232
232
  ref: this.setInsetVideoFrame
@@ -2,18 +2,19 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import React, { useCallback } from 'react';
3
3
  import { useIntl } from 'react-intl';
4
4
  import { useAnalyticsEvents } from '@atlaskit/analytics-next/useAnalyticsEvents';
5
+ import Button from '@atlaskit/button/default/button';
5
6
  import DownloadIcon from '@atlaskit/icon/core/download';
6
7
  import MediaButton from '@atlaskit/media-ui/MediaButton';
7
8
  import { messages } from '@atlaskit/media-ui/messages';
8
9
  import Tooltip from '@atlaskit/tooltip/Tooltip';
9
10
  import { fireAnalytics } from './analytics/fireAnalytics';
10
- import { useIsInsetViewer } from './insetViewerContext';
11
11
  import { noop } from './noop';
12
12
  import { ViewerIconButton } from './viewer-icon-button';
13
13
  export function DownloadButton({
14
14
  analyticspayload,
15
15
  onClick: providedOnClick = noop,
16
16
  tooltip,
17
+ variant = 'default',
17
18
  ...rest
18
19
  }) {
19
20
  const {
@@ -22,18 +23,25 @@ export function DownloadButton({
22
23
  const {
23
24
  formatMessage
24
25
  } = useIntl();
25
- const isInsetViewer = useIsInsetViewer();
26
26
  const onClick = useCallback((event, analyticsEvent) => {
27
27
  fireAnalytics(analyticspayload, createAnalyticsEvent);
28
28
  providedOnClick(event, analyticsEvent);
29
29
  }, [analyticspayload, providedOnClick, createAnalyticsEvent]);
30
- const downloadButton = isInsetViewer ? /*#__PURE__*/React.createElement(ViewerIconButton, {
30
+ const downloadButton = variant === 'insetIcon' ? /*#__PURE__*/React.createElement(ViewerIconButton, {
31
31
  testId: rest.testId,
32
32
  isDisabled: rest.isDisabled,
33
33
  icon: DownloadIcon,
34
34
  label: formatMessage(messages.download),
35
35
  onClick: onClick
36
- }) : /*#__PURE__*/React.createElement(MediaButton, _extends({}, rest, {
36
+ }) : variant === 'insetText' ?
37
+ /*#__PURE__*/
38
+ // The themed button used elsewhere in the inset viewer for non-icons
39
+ React.createElement(Button, {
40
+ appearance: "primary",
41
+ testId: rest.testId,
42
+ isDisabled: rest.isDisabled,
43
+ onClick: onClick
44
+ }, rest.children) : /*#__PURE__*/React.createElement(MediaButton, _extends({}, rest, {
37
45
  onClick: onClick
38
46
  }));
39
47
  return tooltip ? /*#__PURE__*/React.createElement(Tooltip, {
@@ -14,6 +14,7 @@ export const DownloadItem = ({
14
14
  analyticspayload,
15
15
  traceContext,
16
16
  iconBefore,
17
+ variant,
17
18
  children,
18
19
  fallbackMediaName
19
20
  }) => {
@@ -49,6 +50,7 @@ export const DownloadItem = ({
49
50
  itemDownloader();
50
51
  }
51
52
  },
52
- iconBefore: iconBefore
53
+ iconBefore: iconBefore,
54
+ variant: variant
53
55
  }, children));
54
56
  };
@@ -3,6 +3,7 @@ import { FormattedMessage } from 'react-intl';
3
3
  import { messages } from '@atlaskit/media-ui/messages';
4
4
  import { createFailedPreviewDownloadButtonClickedEvent } from './analytics/events/ui/failedPreviewDownloadButtonClicked';
5
5
  import { DownloadItem } from './DownloadItem';
6
+ import { useIsInsetViewer } from './insetViewerContext';
6
7
  import { DownloadButtonWrapper } from './styleWrappers';
7
8
  export const ErrorViewDownloadButton = ({
8
9
  fileState,
@@ -11,12 +12,14 @@ export const ErrorViewDownloadButton = ({
11
12
  traceContext,
12
13
  collectionName
13
14
  }) => {
15
+ const isInsetViewer = useIsInsetViewer();
14
16
  const downloadEvent = createFailedPreviewDownloadButtonClickedEvent(fileState, error);
15
17
  const testId = 'media-viewer-error-download-button';
16
18
  return /*#__PURE__*/React.createElement(DownloadButtonWrapper, null, /*#__PURE__*/React.createElement(DownloadItem, {
17
19
  testId: testId,
18
20
  analyticspayload: downloadEvent,
19
21
  appearance: "primary",
22
+ variant: isInsetViewer ? 'insetText' : 'default',
20
23
  fileState: fileState,
21
24
  mediaClient: mediaClient,
22
25
  collectionName: collectionName,
@@ -3,6 +3,7 @@ import { isExternalImageIdentifier } from '@atlaskit/media-client/is-external-im
3
3
  import { createDownloadButtonClickedEvent } from './analytics/events/ui/downloadButtonClicked';
4
4
  import { downloadIcon } from './downloadIcon';
5
5
  import { DownloadItem } from './DownloadItem';
6
+ import { useIsInsetViewer } from './insetViewerContext';
6
7
  export const ToolbarDownloadButton = ({
7
8
  state,
8
9
  mediaClient,
@@ -10,6 +11,7 @@ export const ToolbarDownloadButton = ({
10
11
  traceContext,
11
12
  fallbackMediaName
12
13
  }) => {
14
+ const isInsetViewer = useIsInsetViewer();
13
15
  // TODO [MS-1731]: make it work for external files as well
14
16
  if (isExternalImageIdentifier(identifier)) {
15
17
  return null;
@@ -24,6 +26,7 @@ export const ToolbarDownloadButton = ({
24
26
  collectionName: identifier.collectionName,
25
27
  traceContext: traceContext,
26
28
  iconBefore: downloadIcon,
29
+ variant: isInsetViewer ? 'insetIcon' : 'default',
27
30
  fallbackMediaName: fallbackMediaName
28
31
  });
29
32
  };
@@ -4,7 +4,7 @@ import { fg } from '@atlaskit/platform-feature-flags/fg';
4
4
  import { UFOExperience } from '@atlaskit/ufo/experience';
5
5
  import { ExperiencePerformanceTypes, ExperienceTypes } from '@atlaskit/ufo/experience-types';
6
6
  const packageName = "@atlaskit/media-viewer";
7
- const packageVersion = "54.11.21";
7
+ const packageVersion = "54.11.23";
8
8
  let ufoExperience;
9
9
  const getExperience = () => {
10
10
  if (!ufoExperience) {
@@ -0,0 +1 @@
1
+ ._syazazsu{color:var(--ds-text-subtle,#505258)}
@@ -1,4 +1,7 @@
1
+ /* errorMessage.tsx generated by @compiled/babel-plugin v3.0.2 */
1
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
+ import "./errorMessage.compiled.css";
4
+ import { ax, ix } from "@compiled/react/runtime";
2
5
  import React from 'react';
3
6
  import { FormattedMessage } from 'react-intl';
4
7
  import { messages as i18nMessages } from '@atlaskit/media-ui/messages';
@@ -12,6 +15,9 @@ import { errorLoadingFile } from './error-images';
12
15
  import { getErrorMessageFromError } from './getErrorMessageFromError';
13
16
  import { getPrimaryErrorReason } from './getPrimaryErrorReason';
14
17
  import { ErrorMessageWrapper, ErrorImage } from './styleWrappers';
18
+ const styles = {
19
+ insetViewerLine: "_syazazsu"
20
+ };
15
21
  const errorLoadingFileImage = formatMessage => /*#__PURE__*/React.createElement(ErrorImage, {
16
22
  src: errorLoadingFile,
17
23
  alt: formatMessage(i18nMessages.error_loading_file)
@@ -115,11 +121,9 @@ export class ErrorMessage extends React.Component {
115
121
  const errorInfo = this.getErrorInfo();
116
122
  return /*#__PURE__*/React.createElement(ErrorMessageWrapper, {
117
123
  "data-testid": "media-viewer-error"
118
- }, /*#__PURE__*/React.createElement("div", null, errorInfo.icon, errorInfo.messages.map((formatMessage, i) =>
119
- /*#__PURE__*/
120
- // eslint-disable-next-line @atlaskit/design-system/use-primitives-text
121
- React.createElement("p", {
122
- key: `p${i}`
124
+ }, /*#__PURE__*/React.createElement("div", null, errorInfo.icon, errorInfo.messages.map((formatMessage, i) => /*#__PURE__*/React.createElement("p", {
125
+ key: `p${i}`,
126
+ className: ax([this.props.isInsetViewer && styles.insetViewerLine])
123
127
  }, /*#__PURE__*/React.createElement(FormattedMessage, formatMessage)))), this.props.children);
124
128
  }
125
129
  }
@@ -1,7 +1,8 @@
1
1
  import { injectIntl } from 'react-intl';
2
2
  import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
3
3
  import { ErrorMessage } from './errorMessage';
4
+ import { withInsetViewer } from './insetViewerContext';
4
5
 
5
6
  // @ts-ignore: [PIT-1685] Fails in post-office due to backwards incompatibility issue with React 18
6
- const ErroMsg = withAnalyticsEvents()(injectIntl(ErrorMessage));
7
+ const ErroMsg = withAnalyticsEvents()(withInsetViewer(injectIntl(ErrorMessage)));
7
8
  export default ErroMsg;
@@ -7,31 +7,31 @@ const MediaFooterControlsContext = /*#__PURE__*/createContext(null);
7
7
  const SetMediaFooterControlsContext = /*#__PURE__*/createContext(() => {});
8
8
 
9
9
  // Whether a viewer has registered video controls in the footer, which gives the footer extra room.
10
- const HasMediaFooterVideoControlsContext = /*#__PURE__*/createContext(false);
11
- const SetHasMediaFooterVideoControlsContext = /*#__PURE__*/createContext(() => {});
10
+ const HasMediaFooterPlayerControlsContext = /*#__PURE__*/createContext(false);
11
+ const SetHasMediaFooterPlayerControlsContext = /*#__PURE__*/createContext(() => {});
12
12
  export const InsetViewerProvider = ({
13
13
  isInsetViewer = false,
14
14
  children
15
15
  }) => {
16
16
  const [mediaFooterControls, setMediaFooterControls] = useState(null);
17
- const [hasVideoControls, setHasVideoControls] = useState(false);
17
+ const [hasPlayerControls, setHasPlayerControls] = useState(false);
18
18
  return /*#__PURE__*/React.createElement(InsetViewerContext.Provider, {
19
19
  value: isInsetViewer
20
20
  }, /*#__PURE__*/React.createElement(SetMediaFooterControlsContext.Provider, {
21
21
  value: setMediaFooterControls
22
22
  }, /*#__PURE__*/React.createElement(MediaFooterControlsContext.Provider, {
23
23
  value: mediaFooterControls
24
- }, /*#__PURE__*/React.createElement(SetHasMediaFooterVideoControlsContext.Provider, {
25
- value: setHasVideoControls
26
- }, /*#__PURE__*/React.createElement(HasMediaFooterVideoControlsContext.Provider, {
27
- value: hasVideoControls
24
+ }, /*#__PURE__*/React.createElement(SetHasMediaFooterPlayerControlsContext.Provider, {
25
+ value: setHasPlayerControls
26
+ }, /*#__PURE__*/React.createElement(HasMediaFooterPlayerControlsContext.Provider, {
27
+ value: hasPlayerControls
28
28
  }, children)))));
29
29
  };
30
30
  export const useIsInsetViewer = () => useContext(InsetViewerContext);
31
31
  export const useMediaFooterControls = () => useContext(MediaFooterControlsContext);
32
32
  export const useSetMediaFooterControls = () => useContext(SetMediaFooterControlsContext);
33
- export const useHasMediaFooterVideoControls = () => useContext(HasMediaFooterVideoControlsContext);
34
- export const useSetHasMediaFooterVideoControls = () => useContext(SetHasMediaFooterVideoControlsContext);
33
+ export const useHasMediaFooterPlayerControls = () => useContext(HasMediaFooterPlayerControlsContext);
34
+ export const useSetHasMediaFooterPlayerControls = () => useContext(SetHasMediaFooterPlayerControlsContext);
35
35
  export const withInsetViewer = WrappedComponent => {
36
36
  const WithInsetViewer = /*#__PURE__*/React.forwardRef((props, ref) => {
37
37
  const isInsetViewer = useIsInsetViewer();
@@ -47,12 +47,12 @@ export const withInsetViewerFooter = WrappedComponent => {
47
47
  const WithInsetViewerFooter = /*#__PURE__*/React.forwardRef((props, ref) => {
48
48
  const isInsetViewer = useIsInsetViewer();
49
49
  const mediaFooterControls = useMediaFooterControls();
50
- const setHasVideoControls = useSetHasMediaFooterVideoControls();
50
+ const setHasPlayerControls = useSetHasMediaFooterPlayerControls();
51
51
  return /*#__PURE__*/React.createElement(WrappedComponent, _extends({}, props, {
52
52
  ref: ref,
53
53
  isInsetViewer: isInsetViewer,
54
54
  mediaFooterControls: mediaFooterControls,
55
- setHasVideoControls: setHasVideoControls
55
+ setHasPlayerControls: setHasPlayerControls
56
56
  }));
57
57
  });
58
58
  WithInsetViewerFooter.displayName = `WithInsetViewerFooter(${WrappedComponent.displayName || WrappedComponent.name || 'Component'})`;
@@ -2,11 +2,16 @@ import React from 'react';
2
2
  import { useIntl } from 'react-intl';
3
3
  import { messages } from '@atlaskit/media-ui/messages';
4
4
  import AkSpinner from '@atlaskit/spinner/spinner';
5
+ import { useIsInsetViewer } from './insetViewerContext';
5
6
  export const Spinner = ({}) => {
6
7
  const intl = useIntl();
8
+ const isInsetViewer = useIsInsetViewer();
7
9
  return /*#__PURE__*/React.createElement(AkSpinner, {
8
- label: intl.formatMessage(messages.loading_file),
9
- appearance: "invert",
10
+ label: intl.formatMessage(messages.loading_file)
11
+ // The overlay viewer is always dark, so it inverts the spinner. The inset viewer follows the
12
+ // theme, so it uses the spinner's own subtle icon colour.
13
+ ,
14
+ appearance: isInsetViewer ? 'inherit' : 'invert',
10
15
  size: "large"
11
16
  });
12
17
  };
@@ -13,7 +13,9 @@
13
13
  ._154i1ejb{top:var(--ds-space-300,24px)}
14
14
  ._154i1ssb{top:50%}
15
15
  ._154i1wug{top:auto}
16
+ ._154i69le{top:calc(50% + var(--ds-space-800, 4pc)/2 + var(--ds-space-050, 4px)/2)}
16
17
  ._154iidpf{top:0}
18
+ ._154inuvu{top:calc(50% + var(--ds-space-800, 4pc)/2)}
17
19
  ._16jlidpf{flex-grow:0}
18
20
  ._16jlkb7n{flex-grow:1}
19
21
  ._16qs130s{box-shadow:var(--ds-shadow-overlay,0 8px 9pt #1e1f2126,0 0 1px #1e1f214f)}
@@ -40,6 +42,7 @@
40
42
  ._1bsb1osq{width:100%}
41
43
  ._1bsb1tcg{width:24px}
42
44
  ._1bsbauwl{width:100vw}
45
+ ._1bsbt4lq{width:calc(100% - 3pc)}
43
46
  ._1bsbyazj{width:calc(100% - 26pc)}
44
47
  ._1bsbze3t{width:var(--ds-space-0,0)}
45
48
  ._1bto1l2s{text-overflow:ellipsis}
@@ -117,6 +120,7 @@
117
120
  ._bfhk1i5c{background-color:var(--ds-blanket,#050c1f75)}
118
121
  ._bfhk1j28{background-color:transparent}
119
122
  ._bfhk1tzm{background-color:#22272b}
123
+ ._bfhki8nm{background-color:var(--ds-background-neutral,#0515240f)}
120
124
  ._bfhkr3uz{background-color:#000}
121
125
  ._bfhkvuon{background-color:var(--ds-surface,#fff)}
122
126
  ._c71l1osq{max-height:100%}
@@ -15,13 +15,15 @@ import SlideIn from '@atlaskit/motion/slide-in';
15
15
  import { Box } from '@atlaskit/primitives/box';
16
16
  // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
17
17
  import { xcss } from '@atlaskit/primitives/xcss/xcss';
18
- import { useHasMediaFooterVideoControls, useIsInsetViewer, useSetMediaFooterControls } from './insetViewerContext';
18
+ import { useHasMediaFooterPlayerControls, useIsInsetViewer, useSetMediaFooterControls } from './insetViewerContext';
19
19
  const INSET_HEADER_HEIGHT = "var(--ds-space-800, 64px)";
20
20
  // The horizontal gutter of the inset header, footer and fitted media, shared so they can't drift.
21
21
  // It is `space.300` at the default root font size, hard-coded because the fit maths needs a number
22
22
  // and resolving the token would mean reading the DOM on every resize.
23
23
  export const INSET_VIEWER_GUTTER_PX = 24;
24
24
  const INSET_SIDEBAR_WIDTH = '400px';
25
+ // The media footer is the header's height, and taller when it holds player controls.
26
+ const INSET_PLAYER_FOOTER_HEIGHT = `calc(${INSET_HEADER_HEIGHT} + ${"var(--ds-space-050, 4px)"})`;
25
27
  const insetSidebarWidthTransitionStyles = null;
26
28
  const insetSidebarSlotStyles = null;
27
29
  const insetSidebarSlotOpenStyles = null;
@@ -44,7 +46,7 @@ const insetViewerSidebarHeaderContentStyles = null;
44
46
  const insetViewerSidebarHeaderTitleStyles = null;
45
47
  const insetViewerMediaStageStyles = null;
46
48
  const insetViewerMediaFooterBarStyles = null;
47
- const insetViewerVideoMediaFooterBarStyles = null;
49
+ const insetViewerPlayerMediaFooterBarStyles = null;
48
50
  const listWrapperStyles = null;
49
51
  const insetViewerListWrapperStyles = null;
50
52
  const itemStageStyles = null;
@@ -69,7 +71,11 @@ const pdfWrapperStyles = null;
69
71
  const arrowStyles = null;
70
72
  const arrowWrapperStyles = null;
71
73
  const insetViewerArrowStyles = null;
74
+
75
+ // The arrows' container is the stage above the footer, so half the footer is added to centre them on
76
+ // the whole media column, wherever the footer's height changes.
72
77
  const insetViewerArrowWrapperStyles = null;
78
+ const insetViewerPlayerArrowWrapperStyles = null;
73
79
  const insetViewerLeftWrapperStyles = null;
74
80
  const insetViewerRightWrapperStyles = null;
75
81
  const arrowsWrapperStyles = null;
@@ -102,13 +108,23 @@ const metadataIconWrapperStyles = xcss({
102
108
  const rightHeaderStyles = null;
103
109
  const insetViewerRightHeaderStyles = null;
104
110
  const customAudioPlayerWrapperStyles = null;
111
+
112
+ // The controls are in the footer, so the player's play/pause blanket covers the whole stage.
113
+ const insetViewerCustomAudioPlayerWrapperStyles = null;
105
114
  const audioPlayerStyles = null;
115
+ const insetViewerAudioPlayerStyles = null;
116
+ const insetViewerAudioCoverStyles = null;
106
117
  const audioStyles = null;
107
118
  const audioCoverStyles = null;
108
119
  const defaultCoverWrapperStyles = null;
120
+ const defaultCoverScaleStyles = null;
109
121
  const downloadButtonWrapperStyles = null;
122
+
123
+ // The media button's text is fixed dark on its light blue, so it stays dark on hover. The inset
124
+ // viewer's themed button sets its own hover colors.
125
+ const downloadButtonWrapperHoverStyles = null;
110
126
  const customVideoPlayerWrapperStyles = null;
111
- const insetViewerCustomVideoPlayerWrapperStyles = null;
127
+ const insetViewerCustomMediaPlayerWrapperStyles = null;
112
128
  const insetViewerFittedVideoFrameStyles = null;
113
129
  const sidebarWrapperStyles = null;
114
130
  const insetViewerSidebarWrapperStyles = null;
@@ -204,11 +220,11 @@ export const MediaStage = ({
204
220
  }, children);
205
221
  export const MediaFooterBar = () => {
206
222
  const setMediaFooterControls = useSetMediaFooterControls();
207
- const hasVideoControls = useHasMediaFooterVideoControls();
223
+ const hasPlayerControls = useHasMediaFooterPlayerControls();
208
224
  return /*#__PURE__*/React.createElement("div", {
209
225
  ref: setMediaFooterControls,
210
226
  "data-testid": "media-viewer-media-footer",
211
- className: ax(["_1reoewfl _18m9ewfl _1o9zidpf _4t3ixncg _vchhusvi _1bsb1osq _1e0c1txw _4cvr1h6o _1bah1h6o _ca0qpxbi _u5f31tcg _n3tdpxbi _19bv1tcg _kqswh2mm _lcxv1rj4", hasVideoControls && "_4t3iz5ib _ca0qv47k"])
227
+ className: ax(["_1reoewfl _18m9ewfl _1o9zidpf _4t3ixncg _vchhusvi _1bsb1osq _1e0c1txw _4cvr1h6o _1bah1h6o _ca0qpxbi _u5f31tcg _n3tdpxbi _19bv1tcg _kqswh2mm _lcxv1rj4", hasPlayerControls && "_4t3iz5ib _ca0qv47k"])
212
228
  });
213
229
  };
214
230
  export const ListWrapper = ({
@@ -346,16 +362,18 @@ export const LeftWrapper = ({
346
362
  isArchiveSideBarVisible
347
363
  }) => {
348
364
  const isInsetViewer = useIsInsetViewer();
365
+ const hasPlayerControls = useHasMediaFooterPlayerControls();
349
366
  return /*#__PURE__*/React.createElement("div", {
350
- className: ax(["_kqswstnw _154i1ssb _t9ec1i34 _ca0qv47k _n3tdv47k _19bvv47k _u5f3v47k", "_y3gn1e5h _1ltvidpf", isArchiveSideBarVisible && "_1ltv1mjv", isInsetViewer && "_ca0qze3t _n3tdze3t _19bvze3t _u5f3ze3t", isInsetViewer && "_1ltv1ejb"])
367
+ className: ax(["_kqswstnw _154i1ssb _t9ec1i34 _ca0qv47k _n3tdv47k _19bvv47k _u5f3v47k", "_y3gn1e5h _1ltvidpf", isArchiveSideBarVisible && "_1ltv1mjv", isInsetViewer && "_154inuvu _ca0qze3t _n3tdze3t _19bvze3t _u5f3ze3t", isInsetViewer && hasPlayerControls && "_154i69le", isInsetViewer && "_1ltv1ejb"])
351
368
  }, children);
352
369
  };
353
370
  export const RightWrapper = ({
354
371
  children
355
372
  }) => {
356
373
  const isInsetViewer = useIsInsetViewer();
374
+ const hasPlayerControls = useHasMediaFooterPlayerControls();
357
375
  return /*#__PURE__*/React.createElement("div", {
358
- className: ax(["_kqswstnw _154i1ssb _t9ec1i34 _ca0qv47k _n3tdv47k _19bvv47k _u5f3v47k", "_y3gnusic _1xi2idpf", isInsetViewer && "_ca0qze3t _n3tdze3t _19bvze3t _u5f3ze3t", isInsetViewer && "_1xi21ejb"])
376
+ className: ax(["_kqswstnw _154i1ssb _t9ec1i34 _ca0qv47k _n3tdv47k _19bvv47k _u5f3v47k", "_y3gnusic _1xi2idpf", isInsetViewer && "_154inuvu _ca0qze3t _n3tdze3t _19bvze3t _u5f3ze3t", isInsetViewer && hasPlayerControls && "_154i69le", isInsetViewer && "_1xi21ejb"])
359
377
  }, children);
360
378
  };
361
379
 
@@ -488,16 +506,22 @@ export const RightHeader = ({
488
506
  };
489
507
  export const CustomAudioPlayerWrapper = ({
490
508
  children
491
- }) => /*#__PURE__*/React.createElement("div", {
492
- className: ax(["_kqswstnw _94n5idpf _1ltvidpf _1bsb1osq"])
493
- }, children);
509
+ }) => {
510
+ const isInsetViewer = useIsInsetViewer();
511
+ return /*#__PURE__*/React.createElement("div", {
512
+ className: ax(["_kqswstnw _94n5idpf _1ltvidpf _1bsb1osq", isInsetViewer && "_154iidpf _4t3i1osq"])
513
+ }, children);
514
+ };
494
515
  export const AudioPlayer = ({
495
516
  'data-testid': datatestId,
496
517
  children
497
- }) => /*#__PURE__*/React.createElement("div", {
498
- "data-testid": datatestId,
499
- className: ax(["_2rkofajl _1reo15vq _18m915vq _bfhk1tzm _4cvr1h6o _1bah1h6o _1bsb1kdj _4t3i1kdj _1e0c1txw _2lx21bp4 _kqswh2mm"])
500
- }, children);
518
+ }) => {
519
+ const isInsetViewer = useIsInsetViewer();
520
+ return /*#__PURE__*/React.createElement("div", {
521
+ "data-testid": datatestId,
522
+ className: ax(["_2rkofajl _1reo15vq _18m915vq _bfhk1tzm _4cvr1h6o _1bah1h6o _1bsb1kdj _4t3i1kdj _1e0c1txw _2lx21bp4 _kqswh2mm", isInsetViewer && "_2rko1mok _bfhki8nm _1bsbt4lq _4t3i1osq"])
523
+ }, children);
524
+ };
501
525
  AudioPlayer.displayName = 'AudioPlayer';
502
526
  export const Audio = /*#__PURE__*/forwardRef(({
503
527
  autoPlay,
@@ -515,22 +539,31 @@ export const Audio = /*#__PURE__*/forwardRef(({
515
539
  export const AudioCover = ({
516
540
  src,
517
541
  alt
518
- }) => /*#__PURE__*/React.createElement("img", {
519
- alt: alt,
520
- src: src,
521
- className: ax(["_1bsb1osq _4t3i1osq _5ralzm06 _bfhkr3uz"])
522
- });
542
+ }) => {
543
+ const isInsetViewer = useIsInsetViewer();
544
+ return /*#__PURE__*/React.createElement("img", {
545
+ alt: alt,
546
+ src: src,
547
+ className: ax(["_1bsb1osq _4t3i1osq _5ralzm06 _bfhkr3uz", isInsetViewer && "_bfhki8nm"])
548
+ });
549
+ };
523
550
  export const DefaultCoverWrapper = ({
524
551
  children
525
- }) => /*#__PURE__*/React.createElement("div", {
526
- className: ax(["_1bsb1osq _4t3i1osq _1e0c1txw _4cvr1h6o _1bah1h6o _syazi7uo _umc418ws"])
527
- }, children);
552
+ }) => {
553
+ const isInsetViewer = useIsInsetViewer();
554
+ return /*#__PURE__*/React.createElement("div", {
555
+ className: ax(["_1bsb1osq _4t3i1osq _1e0c1txw _4cvr1h6o _1bah1h6o _syazi7uo", !isInsetViewer && "_umc418ws"])
556
+ }, children);
557
+ };
528
558
  export const DownloadButtonWrapper = ({
529
559
  children
530
- }) => /*#__PURE__*/React.createElement("div", {
531
- className: ax(["_19pk1ejb _y3gn1h6o _1sfy1fjg _4pkp1fjg"])
532
- }, children);
533
- export const CustomVideoPlayerWrapper = /*#__PURE__*/forwardRef(({
560
+ }) => {
561
+ const isInsetViewer = useIsInsetViewer();
562
+ return /*#__PURE__*/React.createElement("div", {
563
+ className: ax(["_19pk1ejb _y3gn1h6o", !isInsetViewer && "_1sfy1fjg _4pkp1fjg"])
564
+ }, children);
565
+ };
566
+ export const CustomMediaPlayerWrapper = /*#__PURE__*/forwardRef(({
534
567
  'data-testid': datatestId,
535
568
  children
536
569
  }, ref) => {
@@ -21,7 +21,7 @@ import ErrorMessage from '../../errorMessageWithAnalytics';
21
21
  import { isMediaViewerError } from '../../isMediaViewerError';
22
22
  import { MAX_FILE_SIZE_SUPPORTED_BY_CODEVIEWER } from '../../item-viewer';
23
23
  import { Spinner } from '../../loading';
24
- import { CustomVideoPlayerWrapper, AudioPlayer, CustomAudioPlayerWrapper, DefaultCoverWrapper, ListWrapper } from '../../styleWrappers';
24
+ import { CustomMediaPlayerWrapper, AudioPlayer, CustomAudioPlayerWrapper, DefaultCoverWrapper, ListWrapper } from '../../styleWrappers';
25
25
  import { getMediaTypeFromFilename } from '../../utils/getMediaTypeFromFilename';
26
26
  import { getMimeTypeFromFilename } from '../../utils/getMimeTypeFromFilename';
27
27
  import { rejectAfter } from '../../utils/rejectAfter';
@@ -248,7 +248,7 @@ export class ArchiveViewerBase extends BaseViewer {
248
248
  onError: this.onViewerError('archiveviewer-imageviewer-onerror', selectedArchiveEntry)
249
249
  }));
250
250
  case 'video':
251
- return /*#__PURE__*/React.createElement(ArchiveItemViewerWrapper, null, /*#__PURE__*/React.createElement(CustomVideoPlayerWrapper, {
251
+ return /*#__PURE__*/React.createElement(ArchiveItemViewerWrapper, null, /*#__PURE__*/React.createElement(CustomMediaPlayerWrapper, {
252
252
  "data-testid": "media-viewer-video-content"
253
253
  }, /*#__PURE__*/React.createElement(CustomMediaPlayer, {
254
254
  type: "video",