@atlaskit/media-viewer 54.9.9 → 54.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/cjs/analytics/ufoExperiences.js +1 -1
  3. package/dist/cjs/insetViewerContext.js +34 -0
  4. package/dist/cjs/list.js +6 -3
  5. package/dist/cjs/media-viewer.js +19 -3
  6. package/dist/cjs/navigation.js +30 -11
  7. package/dist/cjs/styleWrappers.compiled.css +36 -1
  8. package/dist/cjs/styleWrappers.js +188 -120
  9. package/dist/cjs/viewers/image/interactive-img-component.js +5 -1
  10. package/dist/cjs/viewers/image/interactive-img.js +3 -2
  11. package/dist/cjs/viewers/svg/index.js +5 -0
  12. package/dist/es2019/analytics/ufoExperiences.js +1 -1
  13. package/dist/es2019/insetViewerContext.js +21 -0
  14. package/dist/es2019/list.js +7 -4
  15. package/dist/es2019/media-viewer.js +18 -4
  16. package/dist/es2019/navigation.js +28 -11
  17. package/dist/es2019/styleWrappers.compiled.css +36 -1
  18. package/dist/es2019/styleWrappers.js +92 -21
  19. package/dist/es2019/viewers/image/interactive-img-component.js +5 -1
  20. package/dist/es2019/viewers/image/interactive-img.js +3 -2
  21. package/dist/es2019/viewers/svg/index.js +5 -0
  22. package/dist/esm/analytics/ufoExperiences.js +1 -1
  23. package/dist/esm/insetViewerContext.js +25 -0
  24. package/dist/esm/list.js +7 -4
  25. package/dist/esm/media-viewer.js +20 -4
  26. package/dist/esm/navigation.js +30 -11
  27. package/dist/esm/styleWrappers.compiled.css +36 -1
  28. package/dist/esm/styleWrappers.js +187 -119
  29. package/dist/esm/viewers/image/interactive-img-component.js +5 -1
  30. package/dist/esm/viewers/image/interactive-img.js +3 -2
  31. package/dist/esm/viewers/svg/index.js +5 -0
  32. package/dist/types/components/types.d.ts +6 -0
  33. package/dist/types/insetViewerContext.d.ts +10 -0
  34. package/dist/types/navigation.d.ts +3 -1
  35. package/dist/types/styleWrappers.d.ts +8 -0
  36. package/dist/types/viewers/image/interactive-img.d.ts +2 -1
  37. package/package.json +5 -2
@@ -2,9 +2,10 @@ import React, { useState, useRef } from 'react';
2
2
  import { getRandomTelemetryId } from '@atlaskit/media-common';
3
3
  import { hideControlsClassName } from '@atlaskit/media-ui/classNames';
4
4
  import Header from './headerWithIntl';
5
+ import { useIsInsetViewer } from './insetViewerContext';
5
6
  import { ItemViewer } from './item-viewer';
6
7
  import { Navigation } from './navigation';
7
- import { HeaderWrapper, ListWrapper } from './styleWrappers';
8
+ import { HeaderWrapper, ItemStage, ListWrapper } from './styleWrappers';
8
9
  export const List = ({
9
10
  defaultSelectedItem,
10
11
  onClose,
@@ -26,7 +27,9 @@ export const List = ({
26
27
  const traceContext = useRef({
27
28
  traceId: getRandomTelemetryId()
28
29
  });
29
- return /*#__PURE__*/React.createElement(ListWrapper, null, /*#__PURE__*/React.createElement(HeaderWrapper
30
+ const isInsetViewer = useIsInsetViewer();
31
+ const ViewerWrapper = isInsetViewer ? ItemStage : React.Fragment;
32
+ return /*#__PURE__*/React.createElement(ListWrapper, null, !isInsetViewer && /*#__PURE__*/React.createElement(HeaderWrapper
30
33
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
31
34
  , {
32
35
  className: hideControlsClassName,
@@ -42,7 +45,7 @@ export const List = ({
42
45
  onSetArchiveSideBarVisible: setIsArchiveSideBarVisible,
43
46
  traceContext: traceContext.current,
44
47
  fallbackMediaNameFetcher: fallbackMediaNameFetcher
45
- })), /*#__PURE__*/React.createElement(ItemViewer, {
48
+ })), /*#__PURE__*/React.createElement(ViewerWrapper, null, /*#__PURE__*/React.createElement(ItemViewer, {
46
49
  identifier: selectedItem,
47
50
  showControls: showControls,
48
51
  onClose: onClose,
@@ -51,7 +54,7 @@ export const List = ({
51
54
  featureFlags: featureFlags,
52
55
  viewerOptions: viewerOptions,
53
56
  traceContext: traceContext.current
54
- }), /*#__PURE__*/React.createElement(Navigation, {
57
+ })), /*#__PURE__*/React.createElement(Navigation, {
55
58
  items: items,
56
59
  selectedItem: selectedItem,
57
60
  onChange: nextSelectedItem => {
@@ -8,13 +8,15 @@ import { useAnalyticsEvents } from '@atlaskit/analytics-next/useAnalyticsEvents'
8
8
  import { isFileIdentifier } from '@atlaskit/media-client';
9
9
  import { Shortcut } from '@atlaskit/media-ui/shortcut';
10
10
  import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
11
+ import { fg } from '@atlaskit/platform-feature-flags/fg';
11
12
  import { createModalEvent } from './analytics/events/screen/modal';
12
13
  import { createClosedEvent } from './analytics/events/ui/closed';
13
14
  import { fireAnalytics } from './analytics/fireAnalytics';
14
15
  import { mediaViewerPopupClass } from './classnames';
15
16
  import { Content } from './content';
17
+ import { InsetViewerProvider } from './insetViewerContext';
16
18
  import { List } from './list';
17
- import { Blanket, SidebarWrapper } from './styleWrappers';
19
+ import { Blanket, BlanketCloseButton, InsetViewerLayout, InsetViewerShell, MediaColumn, MediaStage, SidebarWrapper } from './styleWrappers';
18
20
  const getIdentifierId = identifier => isFileIdentifier(identifier) ? identifier.id : undefined;
19
21
  const MediaViewerComponent = ({
20
22
  featureFlags,
@@ -41,6 +43,10 @@ const MediaViewerComponent = ({
41
43
  onSidebarVisibilityChange
42
44
  } = isExperimentEnabled('cc_comments_media_viewer_sidebar') ? extensions !== null && extensions !== void 0 ? extensions : {} : {};
43
45
  const [isSidebarVisible, setIsSidebarVisibleState] = useState(defaultSidebarVisible !== null && defaultSidebarVisible !== void 0 ? defaultSidebarVisible : false);
46
+ // The inset presentation has its own feature gate, separate from the functionality above. The
47
+ // value flows out through InsetViewerProvider, so with the gate off every downstream
48
+ // useIsInsetViewer() is false and the full-bleed overlay renders unchanged.
49
+ const isInsetViewer = fg('cc_comments_inset_media_viewer') && !!(extensions !== null && extensions !== void 0 && extensions.useInsetViewer);
44
50
  const setIsSidebarVisible = useCallback(isVisible => {
45
51
  setIsSidebarVisibleState(isVisible);
46
52
  onSidebarVisibilityChange === null || onSidebarVisibilityChange === void 0 ? void 0 : onSidebarVisibilityChange(isVisible);
@@ -134,19 +140,27 @@ const MediaViewerComponent = ({
134
140
  }));
135
141
  }
136
142
  };
143
+ const ConditionalInsetViewerShell = isInsetViewer ? InsetViewerShell : React.Fragment;
144
+ const ConditionalInsetViewerLayout = isInsetViewer ? InsetViewerLayout : React.Fragment;
145
+ const ConditionalInsetMediaColumn = isInsetViewer ? MediaColumn : React.Fragment;
146
+ const ConditionalInsetMediaStage = isInsetViewer ? MediaStage : React.Fragment;
137
147
  const content = /*#__PURE__*/React.createElement("div", {
138
148
  ref: innerRef
149
+ }, /*#__PURE__*/React.createElement(InsetViewerProvider, {
150
+ isInsetViewer: isInsetViewer
139
151
  }, /*#__PURE__*/React.createElement(Blanket, {
140
152
  "data-testid": "media-viewer-popup"
141
153
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
142
154
  ,
143
155
  className: mediaViewerPopupClass
144
- }, /*#__PURE__*/React.createElement(Shortcut, {
156
+ }, isInsetViewer ? /*#__PURE__*/React.createElement(BlanketCloseButton, {
157
+ onClick: () => handlePreviewClose('blanket')
158
+ }) : null, /*#__PURE__*/React.createElement(Shortcut, {
145
159
  code: 'Escape',
146
160
  handler: () => {
147
161
  handlePreviewClose('escKey');
148
162
  }
149
- }), /*#__PURE__*/React.createElement(Content, {
163
+ }), /*#__PURE__*/React.createElement(ConditionalInsetViewerShell, null, /*#__PURE__*/React.createElement(ConditionalInsetViewerLayout, null, /*#__PURE__*/React.createElement(ConditionalInsetMediaColumn, null, /*#__PURE__*/React.createElement(ConditionalInsetMediaStage, null, /*#__PURE__*/React.createElement(Content, {
150
164
  isSidebarVisible: isSidebarVisible,
151
165
  onClose: (_e, analyticsEvent) => {
152
166
  var _analyticsEvent$paylo;
@@ -183,7 +197,7 @@ const MediaViewerComponent = ({
183
197
  featureFlags: featureFlags,
184
198
  viewerOptions: viewerOptions,
185
199
  fallbackMediaNameFetcher: fallbackMediaNameFetcher
186
- })), renderSidebar()));
200
+ })))), renderSidebar())))));
187
201
  return intl ? content : /*#__PURE__*/React.createElement(IntlProvider, {
188
202
  locale: "en"
189
203
  }, content);
@@ -3,6 +3,9 @@
3
3
  import React from 'react';
4
4
  import { Component } from 'react';
5
5
  import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
6
+ import IconButton from '@atlaskit/button/icon/button';
7
+ import ArrowLeftIcon from '@atlaskit/icon/core/arrow-left';
8
+ import ArrowRightIcon from '@atlaskit/icon/core/arrow-right';
6
9
  import ArrowLeftCircleIcon from '@atlaskit/icon/core/chevron-left';
7
10
  import ArrowRightCircleIcon from '@atlaskit/icon/core/chevron-right';
8
11
  import { hideControlsClassName } from '@atlaskit/media-ui/classNames';
@@ -12,6 +15,7 @@ import { fg } from '@atlaskit/platform-feature-flags/fg';
12
15
  import { Pressable, xcss } from '@atlaskit/primitives';
13
16
  import { createNavigatedEvent } from './analytics/events/ui/createNavigatedEvent';
14
17
  import { fireAnalytics } from './analytics/fireAnalytics';
18
+ import { withInsetViewer } from './insetViewerContext';
15
19
  import { ArrowsWrapper, RightWrapper, LeftWrapper, Arrow } from './styleWrappers';
16
20
  import { getSelectedIndex } from './utils/getSelectedIndex';
17
21
  export const nextNavButtonId = 'media-viewer-navigation-next';
@@ -82,6 +86,27 @@ export class NavigationBase extends Component {
82
86
  } = this.props;
83
87
  return getSelectedIndex(items, selectedItem);
84
88
  }
89
+ renderArrowButton(direction, label, clickHandler, testId) {
90
+ if (this.props.isInsetViewer) {
91
+ const Icon = direction === 'next' ? ArrowRightIcon : ArrowLeftIcon;
92
+ return /*#__PURE__*/React.createElement(IconButton, {
93
+ appearance: "default",
94
+ shape: "circle",
95
+ spacing: "default",
96
+ label: label,
97
+ icon: Icon,
98
+ onClick: clickHandler('mouse'),
99
+ testId: testId,
100
+ isTooltipDisabled: false
101
+ });
102
+ }
103
+ const Icon = direction === 'next' ? NextIcon : PreviousIcon;
104
+ return /*#__PURE__*/React.createElement(Icon, {
105
+ label: label,
106
+ clickHandler: clickHandler,
107
+ testId: testId
108
+ });
109
+ }
85
110
  render() {
86
111
  const {
87
112
  items,
@@ -108,11 +133,7 @@ export class NavigationBase extends Component {
108
133
  code: 'ArrowLeft',
109
134
  handler: prev('keyboard'),
110
135
  eventType: 'keyup'
111
- }), /*#__PURE__*/React.createElement(PreviousIcon, {
112
- label: fg('platform_media_a11y_nav_button_labels') ? 'Previous attachment' : 'Previous',
113
- clickHandler: prev,
114
- testId: prevNavButtonId
115
- })) : null), /*#__PURE__*/React.createElement(RightWrapper, null, isRightVisible ?
136
+ }), this.renderArrowButton('prev', fg('platform_media_a11y_nav_button_labels') ? 'Previous attachment' : 'Previous', prev, prevNavButtonId)) : null), /*#__PURE__*/React.createElement(RightWrapper, null, isRightVisible ?
116
137
  /*#__PURE__*/
117
138
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
118
139
  React.createElement(Arrow, {
@@ -121,11 +142,7 @@ export class NavigationBase extends Component {
121
142
  code: 'ArrowRight',
122
143
  handler: next('keyboard'),
123
144
  eventType: 'keyup'
124
- }), /*#__PURE__*/React.createElement(NextIcon, {
125
- label: fg('platform_media_a11y_nav_button_labels') ? 'Next attachment' : 'Next',
126
- clickHandler: next,
127
- testId: nextNavButtonId
128
- })) : null));
145
+ }), this.renderArrowButton('next', fg('platform_media_a11y_nav_button_labels') ? 'Next attachment' : 'Next', next, nextNavButtonId)) : null));
129
146
  }
130
147
  }
131
- export const Navigation = withAnalyticsEvents({})(NavigationBase);
148
+ export const Navigation = withAnalyticsEvents({})(withInsetViewer(NavigationBase));
@@ -1,11 +1,18 @@
1
1
  ._11q75a80{background:linear-gradient(180deg,#101214,rgba(14,22,36,0)) no-repeat}
2
2
  ._151kfhey._151kfhey h1{font:var(--ds-font-body,normal 400 14px/20px "Atlassian Sans",ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,"Helvetica Neue",sans-serif)}
3
3
  ._2rkofajl{border-radius:var(--ds-radius-small,3px)}
4
- ._zulpu2gc{gap:var(--ds-space-100,8px)}._11pt15ty svg{filter:drop-shadow(0 1px 1px rgb(9 30 66/25%)) drop-shadow(0 0 1px rgb(9 30 66/31%))}
4
+ ._2rkopb1k{border-radius:var(--ds-radius-xlarge,9pt)}
5
+ ._zulpu2gc{gap:var(--ds-space-100,8px)}
6
+ ._189eidpf{border-width:0}
7
+ ._1ii7cs5v{grid-row:2}
8
+ ._yyhykb7n{grid-column:1}._11pt15ty svg{filter:drop-shadow(0 1px 1px rgb(9 30 66/25%)) drop-shadow(0 0 1px rgb(9 30 66/31%))}
9
+ ._152tidpf{inset-block-start:0}
5
10
  ._154i1ejb{top:var(--ds-space-300,24px)}
6
11
  ._154i1ssb{top:50%}
7
12
  ._154iidpf{top:0}
13
+ ._16jlidpf{flex-grow:0}
8
14
  ._16jlkb7n{flex-grow:1}
15
+ ._16qs130s{box-shadow:var(--ds-shadow-overlay,0 8px 9pt #1e1f2126,0 0 1px #1e1f214f)}
9
16
  ._18ew1wq8._18ew1wq8 h1{font-weight:var(--ds-font-weight-medium,500)}
10
17
  ._18m915vq{overflow-y:hidden}
11
18
  ._18m91wug{overflow-y:auto}
@@ -13,9 +20,11 @@
13
20
  ._19bv1mjv{padding-left:300px}
14
21
  ._19bvidpf{padding-left:0}
15
22
  ._19bvv47k{padding-left:var(--ds-space-250,20px)}
23
+ ._19bvze3t{padding-left:var(--ds-space-0,0)}
16
24
  ._19kzstnw >*{position:absolute}
17
25
  ._19pk1ejb{margin-top:var(--ds-space-300,24px)}
18
26
  ._1bah1h6o{justify-content:center}
27
+ ._1bah1y6m{justify-content:flex-start}
19
28
  ._1bahusic{justify-content:right}
20
29
  ._1bsb1ber{width:26pc}
21
30
  ._1bsb1kdj{width:25pc}
@@ -24,6 +33,8 @@
24
33
  ._1bsbauwl{width:100vw}
25
34
  ._1bsbyazj{width:calc(100% - 26pc)}
26
35
  ._1bto1l2s{text-overflow:ellipsis}
36
+ ._1e02idpf{inset-inline-start:0}
37
+ ._1e0c11p5{display:grid}
27
38
  ._1e0c1o8l{display:inline-block}
28
39
  ._1e0c1txw{display:flex}
29
40
  ._1ghp1kxc video{max-height:100vh}
@@ -31,17 +42,22 @@
31
42
  ._1jyy1poe._1jyy1poe h1{color:#c7d1db}
32
43
  ._1kemd8h4{image-rendering:pixelated}
33
44
  ._1l1f1n9t .mvng-hide-controls{position:fixed}
45
+ ._1ltv1ejb{left:var(--ds-space-300,24px)}
34
46
  ._1ltv1mjv{left:300px}
35
47
  ._1ltvidpf{left:0}
48
+ ._1o9zidpf{flex-shrink:0}
36
49
  ._1o9zkb7n{flex-shrink:1}
37
50
  ._1p351l2s._1p351l2s h1{text-overflow:ellipsis}
38
51
  ._1p6zkb7n video{flex-grow:1}
39
52
  ._1p8j15vq._1p8j15vq h1{overflow-y:hidden}
40
53
  ._1pby1qpw{z-index:520}
41
54
  ._1pby3tda{z-index:521}
55
+ ._1pbykb7n{z-index:1}
42
56
  ._1pbyuou7{z-index:522}
43
57
  ._1reo15vq{overflow-x:hidden}
44
58
  ._1reo1wug{overflow-x:auto}
59
+ ._1tkeidpf{min-height:0}
60
+ ._1ul9idpf{min-width:0}
45
61
  ._1ul9uuw1{min-width:200px}
46
62
  ._1vgl1rj4 >*{pointer-events:all}
47
63
  ._1vnlkb7n video{flex-shrink:1}
@@ -52,6 +68,8 @@
52
68
  ._20ka1poe._20ka1poe button:active svg{color:#c7d1db}
53
69
  ._2hwx1jfw{margin-right:var(--ds-space-500,40px)}
54
70
  ._2lx21bp4{flex-direction:column}
71
+ ._2z051h8r{grid-template-rows:var(--ds-space-800,4pc) minmax(0,1fr)}
72
+ ._4cvr1fhb{align-items:stretch}
55
73
  ._4cvr1h6o{align-items:center}
56
74
  ._4cvresu3{align-items:flex-end}
57
75
  ._4t3i1kdj{height:25pc}
@@ -60,17 +78,26 @@
60
78
  ._4t3i1uc6{height:98px}
61
79
  ._4t3izwfg{height:2pc}
62
80
  ._5ralzm06{object-fit:scale-down}
81
+ ._7dir1j9a button{background-color:var(--ds-background-input,#fff)}
82
+ ._80om73ad{cursor:default}
63
83
  ._80omtlke{cursor:pointer}
64
84
  ._8at415vq._8at415vq h1{overflow-x:hidden}
65
85
  ._8g8b1q9c._8g8b1q9c h1{white-space:nowrap}
66
86
  ._94n5idpf{bottom:0}
87
+ ._bfhk1bhr{background-color:var(--ds-surface-overlay,#fff)}
88
+ ._bfhk1i5c{background-color:var(--ds-blanket,#050c1f75)}
89
+ ._bfhk1j28{background-color:transparent}
67
90
  ._bfhk1tzm{background-color:#22272b}
68
91
  ._bfhkr3uz{background-color:#000}
69
92
  ._bfhkvuon{background-color:var(--ds-surface,#fff)}
93
+ ._c71l1osq{max-height:100%}
70
94
  ._ca0q1azu{padding-top:var(--ds-space-100,8px) var(--ds-space-300,24px)}
71
95
  ._ca0q1ejb{padding-top:var(--ds-space-300,24px)}
96
+ ._ca0qidpf{padding-top:0}
72
97
  ._ca0qv47k{padding-top:var(--ds-space-250,20px)}
98
+ ._ca0qze3t{padding-top:var(--ds-space-0,0)}
73
99
  ._di7o9txx._di7o9txx button:hover svg{color:#b6c2cf}
100
+ ._i0dl1wug{flex-basis:auto}
74
101
  ._i0dlf1ug{flex-basis:0%}
75
102
  ._k48p1wq8{font-weight:var(--ds-font-weight-medium,500)}
76
103
  ._kqsw1n9t{position:fixed}
@@ -79,8 +106,10 @@
79
106
  ._lcxv1rj4{pointer-events:all}
80
107
  ._lcxvglyw{pointer-events:none}
81
108
  ._n3td1ejb{padding-bottom:var(--ds-space-300,24px)}
109
+ ._n3tdidpf{padding-bottom:0}
82
110
  ._n3tdu2gc{padding-bottom:var(--ds-space-100,8px)}
83
111
  ._n3tdv47k{padding-bottom:var(--ds-space-250,20px)}
112
+ ._n3tdze3t{padding-bottom:var(--ds-space-0,0)}
84
113
  ._o5721q9c{white-space:nowrap}
85
114
  ._otyru2gc{margin-bottom:var(--ds-space-100,8px)}
86
115
  ._ouxl1klg{background-position:300px 0}
@@ -88,13 +117,17 @@
88
117
  ._p12f1osq{max-width:100%}
89
118
  ._qbrxf1ug video{flex-basis:0%}
90
119
  ._qvww1osq._qvww1osq h1{max-width:100%}
120
+ ._rjxpidpf{inset-inline-end:0}
91
121
  ._s7n4nkob{vertical-align:middle}
92
122
  ._syaz1poe{color:#c7d1db}
93
123
  ._syazi7uo{color:var(--ds-text,#292a2e)}
94
124
  ._t9ec1i34{transform:translateY(-50%)}
95
125
  ._tzy41w01{opacity:.85}
96
126
  ._u5f31ejb{padding-right:var(--ds-space-300,24px)}
127
+ ._u5f3idpf{padding-right:0}
97
128
  ._u5f3v47k{padding-right:var(--ds-space-250,20px)}
129
+ ._u5f3ze3t{padding-right:var(--ds-space-0,0)}
130
+ ._u7coidpf{inset-block-end:0}
98
131
  ._uiztglyw{-webkit-user-select:none;-ms-user-select:none;user-select:none}
99
132
  ._umc418ws >*{transform:scale(2)}
100
133
  ._vchhusvi{box-sizing:border-box}
@@ -102,7 +135,9 @@
102
135
  ._y3gn1e5h{text-align:left}
103
136
  ._y3gn1h6o{text-align:center}
104
137
  ._y3gnusic{text-align:right}
138
+ ._yv0ehpfy{grid-template-columns:minmax(0,1fr) auto}
105
139
  ._z18o1kxc video{height:100vh}
106
140
  ._zcqx1osq p{line-height:100%}
107
141
  ._4pkp1fjg button:hover{color:#161a1d!important}
142
+ ._6pupl4ek button:hover{background-color:var(--ds-background-input-hovered,#f8f8f8)}
108
143
  ._1sfy1fjg button:active{color:#161a1d!important}
@@ -11,13 +11,25 @@ import { useMergeRefs } from 'use-callback-ref';
11
11
  import Heading from '@atlaskit/heading/heading';
12
12
  // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
13
13
  import { Box, xcss } from '@atlaskit/primitives';
14
+ import { useIsInsetViewer } from './insetViewerContext';
15
+ const INSET_HEADER_HEIGHT = "var(--ds-space-800, 64px)";
14
16
  const blanketStyles = null;
17
+ const insetViewerBlanketStyles = null;
18
+ const blanketCloseButtonStyles = null;
19
+ const insetViewerShellStyles = null;
20
+ const insetViewerLayoutStyles = null;
15
21
  const headerWrapperStyles = null;
16
22
  const archiveHeaderWrapperStyles = null;
23
+ const insetViewerMediaColumnStyles = null;
24
+ const insetViewerMediaStageStyles = null;
17
25
  const listWrapperStyles = null;
26
+ const insetViewerListWrapperStyles = null;
27
+ const itemStageStyles = null;
28
+ const insetViewerItemStageStyles = null;
18
29
  const closeButtonWrapperStyles = null;
19
30
  const contentWrapperStyles = null;
20
31
  const contentWrapperStyleWithSideBar = null;
32
+ const insetViewerContentWrapperStyles = null;
21
33
  const zoomWrapperStyles = null;
22
34
  const zoomCenterControlsStyles = null;
23
35
  const zoomRightControlsStyles = null;
@@ -29,6 +41,10 @@ const videoStyles = null;
29
41
  const pdfWrapperStyles = null;
30
42
  const arrowStyles = null;
31
43
  const arrowWrapperStyles = null;
44
+ const insetViewerArrowStyles = null;
45
+ const insetViewerArrowWrapperStyles = null;
46
+ const insetViewerLeftWrapperStyles = null;
47
+ const insetViewerRightWrapperStyles = null;
32
48
  const arrowsWrapperStyles = null;
33
49
  const leftWrapperStyles = null;
34
50
  const leftWrapperStylesWithSideBar = null;
@@ -67,14 +83,38 @@ export const Blanket = ({
67
83
  'data-testid': datatestId,
68
84
  className,
69
85
  children
86
+ }) => {
87
+ const isInsetViewer = useIsInsetViewer();
88
+ return /*#__PURE__*/React.createElement("div", {
89
+ "data-testid": datatestId
90
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
91
+ ,
92
+ className: ax(["_kqsw1n9t _154iidpf _1ltvidpf _94n5idpf _1xi2idpf _bfhk1tzm _1pby1qpw _1e0c1txw", isInsetViewer && "_4cvr1h6o _1bah1h6o _bfhk1i5c _ca0q1ejb _u5f31ejb _n3td1ejb _19bv1ejb _vchhusvi", className]),
93
+ role: "dialog",
94
+ "aria-modal": "true",
95
+ "aria-labelledby": "media.media-viewer.file.name"
96
+ }, children);
97
+ };
98
+
99
+ // Mouse-only: keyboard and screen reader users close with Escape or the visible close button.
100
+ export const BlanketCloseButton = ({
101
+ onClick
102
+ }) => /*#__PURE__*/React.createElement("button", {
103
+ type: "button",
104
+ "aria-hidden": true,
105
+ tabIndex: -1,
106
+ onClick: onClick,
107
+ className: ax(["_189eidpf _kqswstnw _152tidpf _rjxpidpf _u7coidpf _1e02idpf _ca0qidpf _u5f3idpf _n3tdidpf _19bvidpf _bfhk1j28 _80om73ad"])
108
+ });
109
+ export const InsetViewerShell = ({
110
+ children
111
+ }) => /*#__PURE__*/React.createElement("div", {
112
+ className: ax(["_1reo15vq _18m915vq _2rkopb1k _1e0c1txw _2lx21bp4 _kqswh2mm _1pbykb7n _1bsb1osq _4t3i1osq _1tkeidpf _c71l1osq _bfhk1bhr _16qs130s"])
113
+ }, children);
114
+ export const InsetViewerLayout = ({
115
+ children
70
116
  }) => /*#__PURE__*/React.createElement("div", {
71
- "data-testid": datatestId
72
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
73
- ,
74
- className: ax(["_kqsw1n9t _154iidpf _1ltvidpf _94n5idpf _1xi2idpf _bfhk1tzm _1pby1qpw _1e0c1txw", className]),
75
- role: "dialog",
76
- "aria-modal": "true",
77
- "aria-labelledby": "media.media-viewer.file.name"
117
+ className: ax(["_1e0c11p5 _yv0ehpfy _2z051h8r _1bsb1osq _4t3i1osq _1tkeidpf"])
78
118
  }, children);
79
119
  export const HeaderWrapper = ({
80
120
  className,
@@ -87,12 +127,30 @@ export const HeaderWrapper = ({
87
127
  }, children);
88
128
  };
89
129
  HeaderWrapper.displayName = 'HeaderWrapper';
90
- export const ListWrapper = ({
130
+ export const MediaColumn = ({
91
131
  children
92
132
  }) => /*#__PURE__*/React.createElement("div", {
93
- className: ax(["_1bsb1osq _4t3i1osq _kqswh2mm _1e0c1txw _4cvr1h6o _1bah1h6o"])
133
+ className: ax(["_1reo15vq _18m915vq _yyhykb7n _1ii7cs5v _1e0c1txw _2lx21bp4 _4t3i1osq _1ul9idpf _1tkeidpf"])
94
134
  }, children);
135
+ export const MediaStage = ({
136
+ children
137
+ }) => /*#__PURE__*/React.createElement("div", {
138
+ className: ax(["_16jlkb7n _1o9zkb7n _i0dlf1ug _1reo15vq _18m915vq _1ul9idpf _1tkeidpf _kqswh2mm"])
139
+ }, children);
140
+ export const ListWrapper = ({
141
+ children
142
+ }) => {
143
+ const isInsetViewer = useIsInsetViewer();
144
+ return /*#__PURE__*/React.createElement("div", {
145
+ className: ax(["_1bsb1osq _4t3i1osq _kqswh2mm _1e0c1txw _4cvr1h6o _1bah1h6o", isInsetViewer && "_1reo15vq _18m915vq _2lx21bp4 _4cvr1fhb _1bah1y6m"])
146
+ }, children);
147
+ };
95
148
  ListWrapper.displayName = 'ListWrapper';
149
+ export const ItemStage = ({
150
+ children
151
+ }) => /*#__PURE__*/React.createElement("div", {
152
+ className: ax(["_16jlkb7n _1o9zkb7n _i0dlf1ug _1reo15vq _18m915vq _kqswh2mm _1bsb1osq _1ul9idpf _1tkeidpf", "_1e0c1txw _4cvr1h6o _1bah1h6o"])
153
+ }, children);
96
154
  export const ArrowsWrapper = ({
97
155
  children
98
156
  }) => /*#__PURE__*/React.createElement("div", {
@@ -108,9 +166,12 @@ export const CloseButtonWrapper = ({
108
166
  export const ContentWrapper = ({
109
167
  isSidebarVisible,
110
168
  children
111
- }) => /*#__PURE__*/React.createElement("div", {
112
- className: ax(["_1bsb1osq", isSidebarVisible && "_1bsbyazj"])
113
- }, children);
169
+ }) => {
170
+ const isInsetViewer = useIsInsetViewer();
171
+ return /*#__PURE__*/React.createElement("div", {
172
+ className: ax([!isInsetViewer && "_1bsb1osq", isInsetViewer && "_16jlidpf _1o9zidpf _i0dl1wug _1reo15vq _18m915vq _1bsb1osq _1ul9idpf _1tkeidpf _4t3i1osq _kqswh2mm", isSidebarVisible && !isInsetViewer && "_1bsbyazj"])
173
+ }, children);
174
+ };
114
175
  export const ZoomWrapper = ({
115
176
  className,
116
177
  children
@@ -184,20 +245,30 @@ export const PDFWrapper = /*#__PURE__*/forwardRef((props, ref) => {
184
245
  export const Arrow = ({
185
246
  className,
186
247
  children
187
- }) => /*#__PURE__*/React.createElement("span", {
188
- className: ax(["_80omtlke _11pt15ty _di7o9txx _20ka1poe", className])
189
- }, children);
248
+ }) => {
249
+ const isInsetViewer = useIsInsetViewer();
250
+ return /*#__PURE__*/React.createElement("span", {
251
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
252
+ className: ax([!isInsetViewer && "_80omtlke _11pt15ty _di7o9txx _20ka1poe", isInsetViewer && "_80omtlke _7dir1j9a _6pupl4ek", className])
253
+ }, children);
254
+ };
190
255
  export const LeftWrapper = ({
191
256
  children,
192
257
  isArchiveSideBarVisible
193
- }) => /*#__PURE__*/React.createElement("div", {
194
- className: ax(["_kqswstnw _154i1ssb _t9ec1i34 _ca0qv47k _n3tdv47k _19bvv47k _u5f3v47k", "_y3gn1e5h _1ltvidpf", isArchiveSideBarVisible && "_1ltv1mjv"])
195
- }, children);
258
+ }) => {
259
+ const isInsetViewer = useIsInsetViewer();
260
+ return /*#__PURE__*/React.createElement("div", {
261
+ className: ax(["_kqswstnw _154i1ssb _t9ec1i34 _ca0qv47k _n3tdv47k _19bvv47k _u5f3v47k", "_y3gn1e5h _1ltvidpf", isArchiveSideBarVisible && "_1ltv1mjv", isInsetViewer && "_ca0qze3t _n3tdze3t _19bvze3t _u5f3ze3t", isInsetViewer && "_1ltv1ejb"])
262
+ }, children);
263
+ };
196
264
  export const RightWrapper = ({
197
265
  children
198
- }) => /*#__PURE__*/React.createElement("div", {
199
- className: ax(["_kqswstnw _154i1ssb _t9ec1i34 _ca0qv47k _n3tdv47k _19bvv47k _u5f3v47k", "_y3gnusic _1xi2idpf"])
200
- }, children);
266
+ }) => {
267
+ const isInsetViewer = useIsInsetViewer();
268
+ return /*#__PURE__*/React.createElement("div", {
269
+ className: ax(["_kqswstnw _154i1ssb _t9ec1i34 _ca0qv47k _n3tdv47k _19bvv47k _u5f3v47k", "_y3gnusic _1xi2idpf", isInsetViewer && "_ca0qze3t _n3tdze3t _19bvze3t _u5f3ze3t", isInsetViewer && "_1xi21ejb"])
270
+ }, children);
271
+ };
201
272
 
202
273
  // header.tsx
203
274
 
@@ -45,8 +45,12 @@ export class InteractiveImgComponent extends React.Component {
45
45
  _defineProperty(this, "onImageClicked", e => {
46
46
  const {
47
47
  onClose,
48
- onBlanketClicked
48
+ onBlanketClicked,
49
+ isInsetViewer
49
50
  } = this.props;
51
+ if (isInsetViewer) {
52
+ return;
53
+ }
50
54
  if (e.target === e.currentTarget && onBlanketClicked) {
51
55
  onBlanketClicked();
52
56
  }
@@ -1,10 +1,11 @@
1
1
  import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
2
2
  import { ANALYTICS_MEDIA_CHANNEL } from '@atlaskit/media-common';
3
3
  import { createClosedEvent } from '../../analytics/events/ui/closed';
4
+ import { withInsetViewer } from '../../insetViewerContext';
4
5
  import { InteractiveImgComponent } from './interactive-img-component';
5
- export const InteractiveImg = withAnalyticsEvents({
6
+ export const InteractiveImg = withInsetViewer(withAnalyticsEvents({
6
7
  onBlanketClicked: createAnalyticsEvent => {
7
8
  const event = createAnalyticsEvent(createClosedEvent('blanket'));
8
9
  event.fire(ANALYTICS_MEDIA_CHANNEL);
9
10
  }
10
- })(InteractiveImgComponent);
11
+ })(InteractiveImgComponent));
@@ -8,6 +8,7 @@ import { messages } from '@atlaskit/media-ui/messages';
8
8
  import { Vector2 } from '@atlaskit/media-ui/vector2';
9
9
  import { createClosedEvent } from '../../analytics/events/ui/closed';
10
10
  import { ZoomLevel } from '../../domain/zoomLevel';
11
+ import { useIsInsetViewer } from '../../insetViewerContext';
11
12
  import { MediaViewerError } from '../../MediaViewerError';
12
13
  import { BaselineExtend } from '../../styleWrappers';
13
14
  import { ZoomControls } from '../../zoomControls';
@@ -30,6 +31,7 @@ const SvgViewerBase = ({
30
31
  const wrapperRef = useRef(null);
31
32
  const [wrapperScroll, setWrapperScroll] = useState();
32
33
  const intl = useIntl();
34
+ const isInsetViewer = useIsInsetViewer();
33
35
  const onResize = useCallback(() => {
34
36
  if (!wrapperRef.current || !camera) {
35
37
  return;
@@ -80,6 +82,9 @@ const SvgViewerBase = ({
80
82
  onError(error);
81
83
  };
82
84
  const onSvgClicked = e => {
85
+ if (isInsetViewer) {
86
+ return;
87
+ }
83
88
  if (e.target === e.currentTarget) {
84
89
  onBlanketClicked === null || onBlanketClicked === void 0 ? void 0 : onBlanketClicked();
85
90
  onClose === null || onClose === void 0 ? void 0 : onClose();
@@ -7,7 +7,7 @@ import { fg } from '@atlaskit/platform-feature-flags/fg';
7
7
  import { UFOExperience } from '@atlaskit/ufo/experience';
8
8
  import { ExperiencePerformanceTypes, ExperienceTypes } from '@atlaskit/ufo/experience-types';
9
9
  var packageName = "@atlaskit/media-viewer";
10
- var packageVersion = "54.9.8";
10
+ var packageVersion = "54.10.0";
11
11
  var ufoExperience;
12
12
  var getExperience = function getExperience() {
13
13
  if (!ufoExperience) {
@@ -0,0 +1,25 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import React, { createContext, useContext } from 'react';
3
+ var InsetViewerContext = /*#__PURE__*/createContext(false);
4
+ export var InsetViewerProvider = function InsetViewerProvider(_ref) {
5
+ var _ref$isInsetViewer = _ref.isInsetViewer,
6
+ isInsetViewer = _ref$isInsetViewer === void 0 ? false : _ref$isInsetViewer,
7
+ children = _ref.children;
8
+ return /*#__PURE__*/React.createElement(InsetViewerContext.Provider, {
9
+ value: isInsetViewer
10
+ }, children);
11
+ };
12
+ export var useIsInsetViewer = function useIsInsetViewer() {
13
+ return useContext(InsetViewerContext);
14
+ };
15
+ export var withInsetViewer = function withInsetViewer(WrappedComponent) {
16
+ var WithInsetViewer = /*#__PURE__*/React.forwardRef(function (props, ref) {
17
+ var isInsetViewer = useIsInsetViewer();
18
+ return /*#__PURE__*/React.createElement(WrappedComponent, _extends({}, props, {
19
+ ref: ref,
20
+ isInsetViewer: isInsetViewer
21
+ }));
22
+ });
23
+ WithInsetViewer.displayName = "WithInsetViewer(".concat(WrappedComponent.displayName || WrappedComponent.name || 'Component', ")");
24
+ return WithInsetViewer;
25
+ };
package/dist/esm/list.js CHANGED
@@ -3,9 +3,10 @@ import React, { useState, useRef } from 'react';
3
3
  import { getRandomTelemetryId } from '@atlaskit/media-common';
4
4
  import { hideControlsClassName } from '@atlaskit/media-ui/classNames';
5
5
  import Header from './headerWithIntl';
6
+ import { useIsInsetViewer } from './insetViewerContext';
6
7
  import { ItemViewer } from './item-viewer';
7
8
  import { Navigation } from './navigation';
8
- import { HeaderWrapper, ListWrapper } from './styleWrappers';
9
+ import { HeaderWrapper, ItemStage, ListWrapper } from './styleWrappers';
9
10
  export var List = function List(_ref) {
10
11
  var defaultSelectedItem = _ref.defaultSelectedItem,
11
12
  onClose = _ref.onClose,
@@ -35,7 +36,9 @@ export var List = function List(_ref) {
35
36
  var traceContext = useRef({
36
37
  traceId: getRandomTelemetryId()
37
38
  });
38
- return /*#__PURE__*/React.createElement(ListWrapper, null, /*#__PURE__*/React.createElement(HeaderWrapper
39
+ var isInsetViewer = useIsInsetViewer();
40
+ var ViewerWrapper = isInsetViewer ? ItemStage : React.Fragment;
41
+ return /*#__PURE__*/React.createElement(ListWrapper, null, !isInsetViewer && /*#__PURE__*/React.createElement(HeaderWrapper
39
42
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
40
43
  , {
41
44
  className: hideControlsClassName,
@@ -51,7 +54,7 @@ export var List = function List(_ref) {
51
54
  onSetArchiveSideBarVisible: setIsArchiveSideBarVisible,
52
55
  traceContext: traceContext.current,
53
56
  fallbackMediaNameFetcher: fallbackMediaNameFetcher
54
- })), /*#__PURE__*/React.createElement(ItemViewer, {
57
+ })), /*#__PURE__*/React.createElement(ViewerWrapper, null, /*#__PURE__*/React.createElement(ItemViewer, {
55
58
  identifier: selectedItem,
56
59
  showControls: showControls,
57
60
  onClose: onClose,
@@ -60,7 +63,7 @@ export var List = function List(_ref) {
60
63
  featureFlags: featureFlags,
61
64
  viewerOptions: viewerOptions,
62
65
  traceContext: traceContext.current
63
- }), /*#__PURE__*/React.createElement(Navigation, {
66
+ })), /*#__PURE__*/React.createElement(Navigation, {
64
67
  items: items,
65
68
  selectedItem: selectedItem,
66
69
  onChange: function onChange(nextSelectedItem) {