@atlaskit/media-viewer 54.9.8 → 54.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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
@@ -9,13 +9,15 @@ import { useAnalyticsEvents } from '@atlaskit/analytics-next/useAnalyticsEvents'
9
9
  import { isFileIdentifier } from '@atlaskit/media-client';
10
10
  import { Shortcut } from '@atlaskit/media-ui/shortcut';
11
11
  import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
12
+ import { fg } from '@atlaskit/platform-feature-flags/fg';
12
13
  import { createModalEvent } from './analytics/events/screen/modal';
13
14
  import { createClosedEvent } from './analytics/events/ui/closed';
14
15
  import { fireAnalytics } from './analytics/fireAnalytics';
15
16
  import { mediaViewerPopupClass } from './classnames';
16
17
  import { Content } from './content';
18
+ import { InsetViewerProvider } from './insetViewerContext';
17
19
  import { List } from './list';
18
- import { Blanket, SidebarWrapper } from './styleWrappers';
20
+ import { Blanket, BlanketCloseButton, InsetViewerLayout, InsetViewerShell, MediaColumn, MediaStage, SidebarWrapper } from './styleWrappers';
19
21
  var getIdentifierId = function getIdentifierId(identifier) {
20
22
  return isFileIdentifier(identifier) ? identifier.id : undefined;
21
23
  };
@@ -45,6 +47,10 @@ var MediaViewerComponent = function MediaViewerComponent(_ref) {
45
47
  _useState2 = _slicedToArray(_useState, 2),
46
48
  isSidebarVisible = _useState2[0],
47
49
  setIsSidebarVisibleState = _useState2[1];
50
+ // The inset presentation has its own feature gate, separate from the functionality above. The
51
+ // value flows out through InsetViewerProvider, so with the gate off every downstream
52
+ // useIsInsetViewer() is false and the full-bleed overlay renders unchanged.
53
+ var isInsetViewer = fg('cc_comments_inset_media_viewer') && !!(extensions !== null && extensions !== void 0 && extensions.useInsetViewer);
48
54
  var setIsSidebarVisible = useCallback(function (isVisible) {
49
55
  setIsSidebarVisibleState(isVisible);
50
56
  onSidebarVisibilityChange === null || onSidebarVisibilityChange === void 0 || onSidebarVisibilityChange(isVisible);
@@ -150,19 +156,29 @@ var MediaViewerComponent = function MediaViewerComponent(_ref) {
150
156
  }));
151
157
  }
152
158
  };
159
+ var ConditionalInsetViewerShell = isInsetViewer ? InsetViewerShell : React.Fragment;
160
+ var ConditionalInsetViewerLayout = isInsetViewer ? InsetViewerLayout : React.Fragment;
161
+ var ConditionalInsetMediaColumn = isInsetViewer ? MediaColumn : React.Fragment;
162
+ var ConditionalInsetMediaStage = isInsetViewer ? MediaStage : React.Fragment;
153
163
  var content = /*#__PURE__*/React.createElement("div", {
154
164
  ref: innerRef
165
+ }, /*#__PURE__*/React.createElement(InsetViewerProvider, {
166
+ isInsetViewer: isInsetViewer
155
167
  }, /*#__PURE__*/React.createElement(Blanket, {
156
168
  "data-testid": "media-viewer-popup"
157
169
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
158
170
  ,
159
171
  className: mediaViewerPopupClass
160
- }, /*#__PURE__*/React.createElement(Shortcut, {
172
+ }, isInsetViewer ? /*#__PURE__*/React.createElement(BlanketCloseButton, {
173
+ onClick: function onClick() {
174
+ return handlePreviewClose('blanket');
175
+ }
176
+ }) : null, /*#__PURE__*/React.createElement(Shortcut, {
161
177
  code: 'Escape',
162
178
  handler: function handler() {
163
179
  handlePreviewClose('escKey');
164
180
  }
165
- }), /*#__PURE__*/React.createElement(Content, {
181
+ }), /*#__PURE__*/React.createElement(ConditionalInsetViewerShell, null, /*#__PURE__*/React.createElement(ConditionalInsetViewerLayout, null, /*#__PURE__*/React.createElement(ConditionalInsetMediaColumn, null, /*#__PURE__*/React.createElement(ConditionalInsetMediaStage, null, /*#__PURE__*/React.createElement(Content, {
166
182
  isSidebarVisible: isSidebarVisible,
167
183
  onClose: function onClose(_e, analyticsEvent) {
168
184
  var _analyticsEvent$paylo;
@@ -201,7 +217,7 @@ var MediaViewerComponent = function MediaViewerComponent(_ref) {
201
217
  featureFlags: featureFlags,
202
218
  viewerOptions: viewerOptions,
203
219
  fallbackMediaNameFetcher: fallbackMediaNameFetcher
204
- })), renderSidebar()));
220
+ })))), renderSidebar())))));
205
221
  return intl ? content : /*#__PURE__*/React.createElement(IntlProvider, {
206
222
  locale: "en"
207
223
  }, content);
@@ -10,6 +10,9 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
10
10
  import React from 'react';
11
11
  import { Component } from 'react';
12
12
  import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
13
+ import IconButton from '@atlaskit/button/icon/button';
14
+ import ArrowLeftIcon from '@atlaskit/icon/core/arrow-left';
15
+ import ArrowRightIcon from '@atlaskit/icon/core/arrow-right';
13
16
  import ArrowLeftCircleIcon from '@atlaskit/icon/core/chevron-left';
14
17
  import ArrowRightCircleIcon from '@atlaskit/icon/core/chevron-right';
15
18
  import { hideControlsClassName } from '@atlaskit/media-ui/classNames';
@@ -19,6 +22,7 @@ import { fg } from '@atlaskit/platform-feature-flags/fg';
19
22
  import { Pressable, xcss } from '@atlaskit/primitives';
20
23
  import { createNavigatedEvent } from './analytics/events/ui/createNavigatedEvent';
21
24
  import { fireAnalytics } from './analytics/fireAnalytics';
25
+ import { withInsetViewer } from './insetViewerContext';
22
26
  import { ArrowsWrapper, RightWrapper, LeftWrapper, Arrow } from './styleWrappers';
23
27
  import { getSelectedIndex } from './utils/getSelectedIndex';
24
28
  export var nextNavButtonId = 'media-viewer-navigation-next';
@@ -96,6 +100,29 @@ export var NavigationBase = /*#__PURE__*/function (_Component) {
96
100
  selectedItem = _this$props2.selectedItem;
97
101
  return getSelectedIndex(items, selectedItem);
98
102
  }
103
+ }, {
104
+ key: "renderArrowButton",
105
+ value: function renderArrowButton(direction, label, clickHandler, testId) {
106
+ if (this.props.isInsetViewer) {
107
+ var _Icon = direction === 'next' ? ArrowRightIcon : ArrowLeftIcon;
108
+ return /*#__PURE__*/React.createElement(IconButton, {
109
+ appearance: "default",
110
+ shape: "circle",
111
+ spacing: "default",
112
+ label: label,
113
+ icon: _Icon,
114
+ onClick: clickHandler('mouse'),
115
+ testId: testId,
116
+ isTooltipDisabled: false
117
+ });
118
+ }
119
+ var Icon = direction === 'next' ? NextIcon : PreviousIcon;
120
+ return /*#__PURE__*/React.createElement(Icon, {
121
+ label: label,
122
+ clickHandler: clickHandler,
123
+ testId: testId
124
+ });
125
+ }
99
126
  }, {
100
127
  key: "render",
101
128
  value: function render() {
@@ -126,11 +153,7 @@ export var NavigationBase = /*#__PURE__*/function (_Component) {
126
153
  code: 'ArrowLeft',
127
154
  handler: prev('keyboard'),
128
155
  eventType: 'keyup'
129
- }), /*#__PURE__*/React.createElement(PreviousIcon, {
130
- label: fg('platform_media_a11y_nav_button_labels') ? 'Previous attachment' : 'Previous',
131
- clickHandler: prev,
132
- testId: prevNavButtonId
133
- })) : null), /*#__PURE__*/React.createElement(RightWrapper, null, isRightVisible ?
156
+ }), this.renderArrowButton('prev', fg('platform_media_a11y_nav_button_labels') ? 'Previous attachment' : 'Previous', prev, prevNavButtonId)) : null), /*#__PURE__*/React.createElement(RightWrapper, null, isRightVisible ?
134
157
  /*#__PURE__*/
135
158
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
136
159
  React.createElement(Arrow, {
@@ -139,12 +162,8 @@ export var NavigationBase = /*#__PURE__*/function (_Component) {
139
162
  code: 'ArrowRight',
140
163
  handler: next('keyboard'),
141
164
  eventType: 'keyup'
142
- }), /*#__PURE__*/React.createElement(NextIcon, {
143
- label: fg('platform_media_a11y_nav_button_labels') ? 'Next attachment' : 'Next',
144
- clickHandler: next,
145
- testId: nextNavButtonId
146
- })) : null));
165
+ }), this.renderArrowButton('next', fg('platform_media_a11y_nav_button_labels') ? 'Next attachment' : 'Next', next, nextNavButtonId)) : null));
147
166
  }
148
167
  }]);
149
168
  }(Component);
150
- export var Navigation = withAnalyticsEvents({})(NavigationBase);
169
+ export var 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
+ ._2z055wi5{grid-template-rows:var(--_1dd8ooc)}
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}