@micromag/viewer 0.2.333 → 0.2.338
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/css/styles.css +4 -4
- package/es/index.js +149 -169
- package/lib/index.js +149 -169
- package/package.json +8 -8
package/es/index.js
CHANGED
|
@@ -14,7 +14,6 @@ import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
|
14
14
|
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
15
15
|
import { Helmet } from 'react-helmet';
|
|
16
16
|
import classNames from 'classnames';
|
|
17
|
-
import { useIntl, FormattedMessage } from 'react-intl';
|
|
18
17
|
import { useDrag } from 'react-use-gesture';
|
|
19
18
|
import { useSpring, config } from '@react-spring/core';
|
|
20
19
|
import { animated } from '@react-spring/web';
|
|
@@ -166,16 +165,12 @@ var ViewerMenuDots = function ViewerMenuDots(_ref) {
|
|
|
166
165
|
closeable = _ref.closeable,
|
|
167
166
|
onClose = _ref.onClose,
|
|
168
167
|
className = _ref.className;
|
|
169
|
-
var intl = useIntl();
|
|
170
168
|
return /*#__PURE__*/React.createElement("nav", {
|
|
171
|
-
className: classNames([styles$4.container, (_ref2 = {}, _defineProperty(_ref2, className, className !== null), _defineProperty(_ref2, styles$4.vertical, direction === 'vertical'), _defineProperty(_ref2, styles$4.withShadow, withShadow), _ref2)])
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
"value": "Screen shortcuts list"
|
|
177
|
-
}]
|
|
178
|
-
})
|
|
169
|
+
className: classNames([styles$4.container, (_ref2 = {}, _defineProperty(_ref2, className, className !== null), _defineProperty(_ref2, styles$4.vertical, direction === 'vertical'), _defineProperty(_ref2, styles$4.withShadow, withShadow), _ref2)]) // aria-label={intl.formatMessage({
|
|
170
|
+
// defaultMessage: 'Screen shortcuts list',
|
|
171
|
+
// description: 'Nav label',
|
|
172
|
+
// })}
|
|
173
|
+
|
|
179
174
|
}, /*#__PURE__*/React.createElement("ul", {
|
|
180
175
|
className: styles$4.items
|
|
181
176
|
}, items.map(function (item, index) {
|
|
@@ -189,19 +184,14 @@ var ViewerMenuDots = function ViewerMenuDots(_ref) {
|
|
|
189
184
|
if (onClickItem !== null) {
|
|
190
185
|
onClickItem(index);
|
|
191
186
|
}
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
"value": "index"
|
|
201
|
-
}]
|
|
202
|
-
}, {
|
|
203
|
-
index: index + 1
|
|
204
|
-
})
|
|
187
|
+
} // aria-label={intl.formatMessage(
|
|
188
|
+
// {
|
|
189
|
+
// defaultMessage: 'Screen {index}',
|
|
190
|
+
// description: 'Button label',
|
|
191
|
+
// },
|
|
192
|
+
// { index: index + 1 },
|
|
193
|
+
// )}
|
|
194
|
+
|
|
205
195
|
}, /*#__PURE__*/React.createElement("span", {
|
|
206
196
|
className: styles$4.dot,
|
|
207
197
|
style: {
|
|
@@ -215,20 +205,15 @@ var ViewerMenuDots = function ViewerMenuDots(_ref) {
|
|
|
215
205
|
color: colorAccent
|
|
216
206
|
}), /*#__PURE__*/React.createElement("button", {
|
|
217
207
|
type: "button",
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
"defaultMessage": [{
|
|
228
|
-
"type": 0,
|
|
229
|
-
"value": "Menu"
|
|
230
|
-
}]
|
|
231
|
-
}),
|
|
208
|
+
"aria-label": "Menu" // title={intl.formatMessage({
|
|
209
|
+
// defaultMessage: 'Menu',
|
|
210
|
+
// description: 'Button label',
|
|
211
|
+
// })}
|
|
212
|
+
// aria-label={intl.formatMessage({
|
|
213
|
+
// defaultMessage: 'Menu',
|
|
214
|
+
// description: 'Button label',
|
|
215
|
+
// })}
|
|
216
|
+
,
|
|
232
217
|
className: styles$4.menuButton,
|
|
233
218
|
onClick: function onClick() {
|
|
234
219
|
if (onClickItem !== null) {
|
|
@@ -244,20 +229,15 @@ var ViewerMenuDots = function ViewerMenuDots(_ref) {
|
|
|
244
229
|
type: "button",
|
|
245
230
|
className: styles$4.closeButton,
|
|
246
231
|
onClick: onClose,
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
"defaultMessage": [{
|
|
257
|
-
"type": 0,
|
|
258
|
-
"value": "Close"
|
|
259
|
-
}]
|
|
260
|
-
})
|
|
232
|
+
"aria-label": "Close" // title={intl.formatMessage({
|
|
233
|
+
// defaultMessage: 'Close',
|
|
234
|
+
// description: 'Button label',
|
|
235
|
+
// })}
|
|
236
|
+
// aria-label={intl.formatMessage({
|
|
237
|
+
// defaultMessage: 'Close',
|
|
238
|
+
// description: 'Button label',
|
|
239
|
+
// })}
|
|
240
|
+
|
|
261
241
|
}, /*#__PURE__*/React.createElement(FontAwesomeIcon, {
|
|
262
242
|
icon: faTimes
|
|
263
243
|
}))) : null));
|
|
@@ -392,7 +372,6 @@ var ShareButton = function ShareButton(_ref) {
|
|
|
392
372
|
onShare = _ref.onShare,
|
|
393
373
|
children = _ref.children,
|
|
394
374
|
focusable = _ref.focusable;
|
|
395
|
-
var intl = useIntl();
|
|
396
375
|
|
|
397
376
|
var _useState = useState(false),
|
|
398
377
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -418,21 +397,15 @@ var ShareButton = function ShareButton(_ref) {
|
|
|
418
397
|
className: classNames([styles$2.container, _defineProperty({}, className, className !== null)])
|
|
419
398
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
420
399
|
className: classNames([_defineProperty({}, buttonClassName, buttonClassName !== null)]),
|
|
421
|
-
onClick: onShareIconClick
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
})
|
|
429
|
-
|
|
430
|
-
"id": "7tw6U2",
|
|
431
|
-
"defaultMessage": [{
|
|
432
|
-
"type": 0,
|
|
433
|
-
"value": "Share"
|
|
434
|
-
}]
|
|
435
|
-
}),
|
|
400
|
+
onClick: onShareIconClick // title={intl.formatMessage({
|
|
401
|
+
// defaultMessage: 'Share',
|
|
402
|
+
// description: 'Button label',
|
|
403
|
+
// })}
|
|
404
|
+
// aria-label={intl.formatMessage({
|
|
405
|
+
// defaultMessage: 'Share',
|
|
406
|
+
// description: 'Button label',
|
|
407
|
+
// })}
|
|
408
|
+
,
|
|
436
409
|
focusable: focusable
|
|
437
410
|
}, children), /*#__PURE__*/React.createElement(ShareModal, {
|
|
438
411
|
className: styles$2.shareModal,
|
|
@@ -447,7 +420,7 @@ var ShareButton = function ShareButton(_ref) {
|
|
|
447
420
|
ShareButton.propTypes = propTypes$4;
|
|
448
421
|
ShareButton.defaultProps = defaultProps$4;
|
|
449
422
|
|
|
450
|
-
var styles$1 = {"container":"micromag-viewer-menus-menu-preview-container","screenButton":"micromag-viewer-menus-menu-preview-screenButton","activeScreenBorder":"micromag-viewer-menus-menu-preview-activeScreenBorder","itemContent":"micromag-viewer-menus-menu-preview-itemContent","scroll":"micromag-viewer-menus-menu-preview-scroll","
|
|
423
|
+
var styles$1 = {"container":"micromag-viewer-menus-menu-preview-container","screenButton":"micromag-viewer-menus-menu-preview-screenButton","activeScreenBorder":"micromag-viewer-menus-menu-preview-activeScreenBorder","itemContent":"micromag-viewer-menus-menu-preview-itemContent","scroll":"micromag-viewer-menus-menu-preview-scroll","header":"micromag-viewer-menus-menu-preview-header","button":"micromag-viewer-menus-menu-preview-button","shareButton":"micromag-viewer-menus-menu-preview-shareButton","disabled":"micromag-viewer-menus-menu-preview-disabled","icon":"micromag-viewer-menus-menu-preview-icon","buttons":"micromag-viewer-menus-menu-preview-buttons","organisation":"micromag-viewer-menus-menu-preview-organisation","title":"micromag-viewer-menus-menu-preview-title","content":"micromag-viewer-menus-menu-preview-content","nav":"micromag-viewer-menus-menu-preview-nav","item":"micromag-viewer-menus-menu-preview-item","items":"micromag-viewer-menus-menu-preview-items","active":"micromag-viewer-menus-menu-preview-active","screenContainer":"micromag-viewer-menus-menu-preview-screenContainer","screenContent":"micromag-viewer-menus-menu-preview-screenContent"};
|
|
451
424
|
|
|
452
425
|
var propTypes$3 = {
|
|
453
426
|
viewerTheme: PropTypes$1.viewerTheme,
|
|
@@ -500,7 +473,6 @@ var ViewerMenuPreview = function ViewerMenuPreview(_ref) {
|
|
|
500
473
|
fullscreenActive = _ref.fullscreenActive,
|
|
501
474
|
fullscreenEnabled = _ref.fullscreenEnabled,
|
|
502
475
|
className = _ref.className;
|
|
503
|
-
var intl = useIntl();
|
|
504
476
|
var screenSizeRatio = "".concat(3 / 2 / thumbsPerLine * 100, "%");
|
|
505
477
|
var screenRatioHeight = screenWidth * 3 / 2;
|
|
506
478
|
var hasSize = screenWidth > 0;
|
|
@@ -623,42 +595,30 @@ var ViewerMenuPreview = function ViewerMenuPreview(_ref) {
|
|
|
623
595
|
icon: faShare
|
|
624
596
|
})), fullscreenEnabled ? /*#__PURE__*/React.createElement(Button, {
|
|
625
597
|
className: styles$1.button,
|
|
626
|
-
onClick: toggleFullscreen
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
})
|
|
634
|
-
|
|
635
|
-
"id": "AuxqcG",
|
|
636
|
-
"defaultMessage": [{
|
|
637
|
-
"type": 0,
|
|
638
|
-
"value": "Fullscreen"
|
|
639
|
-
}]
|
|
640
|
-
}),
|
|
598
|
+
onClick: toggleFullscreen // title={intl.formatMessage({
|
|
599
|
+
// defaultMessage: 'Fullscreen',
|
|
600
|
+
// description: 'Button label',
|
|
601
|
+
// })}
|
|
602
|
+
// aria-label={intl.formatMessage({
|
|
603
|
+
// defaultMessage: 'Fullscreen',
|
|
604
|
+
// description: 'Button label',
|
|
605
|
+
// })}
|
|
606
|
+
,
|
|
641
607
|
focusable: focusable
|
|
642
608
|
}, /*#__PURE__*/React.createElement(FontAwesomeIcon, {
|
|
643
609
|
className: styles$1.icon,
|
|
644
610
|
icon: fullscreenActive ? faCompress : faExpand
|
|
645
611
|
})) : null, /*#__PURE__*/React.createElement(Button, {
|
|
646
612
|
className: styles$1.button,
|
|
647
|
-
onClick: onClose
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
})
|
|
655
|
-
|
|
656
|
-
"id": "dj/p/q",
|
|
657
|
-
"defaultMessage": [{
|
|
658
|
-
"type": 0,
|
|
659
|
-
"value": "Close"
|
|
660
|
-
}]
|
|
661
|
-
}),
|
|
613
|
+
onClick: onClose // title={intl.formatMessage({
|
|
614
|
+
// defaultMessage: 'Close',
|
|
615
|
+
// description: 'Button label',
|
|
616
|
+
// })}
|
|
617
|
+
// aria-label={intl.formatMessage({
|
|
618
|
+
// defaultMessage: 'Close',
|
|
619
|
+
// description: 'Button label',
|
|
620
|
+
// })}
|
|
621
|
+
,
|
|
662
622
|
focusable: focusable
|
|
663
623
|
}, /*#__PURE__*/React.createElement(FontAwesomeIcon, {
|
|
664
624
|
className: styles$1.icon,
|
|
@@ -674,26 +634,21 @@ var ViewerMenuPreview = function ViewerMenuPreview(_ref) {
|
|
|
674
634
|
}, /*#__PURE__*/React.createElement("ul", {
|
|
675
635
|
className: styles$1.items
|
|
676
636
|
}, items.map(function (item, index) {
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
"type": 0,
|
|
693
|
-
"value": "(current screen)"
|
|
694
|
-
}]
|
|
695
|
-
})) : '';
|
|
696
|
-
var screenAriaLabel = screenIndexLabel + isCurrentScreenLabel;
|
|
637
|
+
// const screenIndexLabel = intl.formatMessage(
|
|
638
|
+
// {
|
|
639
|
+
// defaultMessage: 'Screen {index}',
|
|
640
|
+
// description: 'Button label',
|
|
641
|
+
// },
|
|
642
|
+
// { index: index + 1 },
|
|
643
|
+
// );
|
|
644
|
+
// const isCurrentScreenLabel =
|
|
645
|
+
// current === index
|
|
646
|
+
// ? ` ${intl.formatMessage({
|
|
647
|
+
// defaultMessage: '(current screen)',
|
|
648
|
+
// description: 'Button label',
|
|
649
|
+
// })}`
|
|
650
|
+
// : '';
|
|
651
|
+
// const screenAriaLabel = screenIndexLabel + isCurrentScreenLabel;
|
|
697
652
|
return /*#__PURE__*/React.createElement("li", {
|
|
698
653
|
className: classNames([styles$1.item, _defineProperty({}, styles$1.active, current === index)]),
|
|
699
654
|
key: "item-".concat(index),
|
|
@@ -727,8 +682,13 @@ var ViewerMenuPreview = function ViewerMenuPreview(_ref) {
|
|
|
727
682
|
className: styles$1.screenButton,
|
|
728
683
|
onClick: function onClick() {
|
|
729
684
|
onClickItem(index);
|
|
685
|
+
} // aria-label={screenAriaLabel}
|
|
686
|
+
,
|
|
687
|
+
onKeyUp: function onKeyUp(e) {
|
|
688
|
+
if (e.key === 'Enter') {
|
|
689
|
+
onClickItem(index);
|
|
690
|
+
}
|
|
730
691
|
},
|
|
731
|
-
"aria-label": screenAriaLabel,
|
|
732
692
|
tabIndex: focusable ? '0' : '-1'
|
|
733
693
|
}));
|
|
734
694
|
})))))) : null;
|
|
@@ -814,6 +774,7 @@ var Viewer = function Viewer(_ref) {
|
|
|
814
774
|
onEnd = _ref.onEnd,
|
|
815
775
|
onViewModeChange = _ref.onViewModeChange,
|
|
816
776
|
className = _ref.className;
|
|
777
|
+
// const intl = useIntl();
|
|
817
778
|
var parsedStory = useParsedStory(story, {
|
|
818
779
|
disabled: storyIsParsed
|
|
819
780
|
}) || {};
|
|
@@ -933,11 +894,14 @@ var Viewer = function Viewer(_ref) {
|
|
|
933
894
|
}
|
|
934
895
|
}, [currentScreen, trackScreenView, trackingEnabled]); // Handle interaction enable
|
|
935
896
|
|
|
897
|
+
var currentScreenRef = useRef(null);
|
|
936
898
|
var onScreenPrevious = useCallback(function () {
|
|
937
899
|
changeIndex(Math.max(0, screenIndex - 1));
|
|
900
|
+
currentScreenRef.current.focus();
|
|
938
901
|
}, [changeIndex]);
|
|
939
902
|
var onScreenNext = useCallback(function () {
|
|
940
903
|
changeIndex(Math.min(screens.length - 1, screenIndex + 1));
|
|
904
|
+
currentScreenRef.current.focus();
|
|
941
905
|
}, [changeIndex]);
|
|
942
906
|
var screensCount = screens.length;
|
|
943
907
|
|
|
@@ -1107,7 +1071,22 @@ var Viewer = function Viewer(_ref) {
|
|
|
1107
1071
|
}, {
|
|
1108
1072
|
axis: 'y',
|
|
1109
1073
|
filterTaps: true
|
|
1110
|
-
});
|
|
1074
|
+
});
|
|
1075
|
+
|
|
1076
|
+
var setPreviewMenu = function setPreviewMenu(opened) {
|
|
1077
|
+
setMenuSpring.start({
|
|
1078
|
+
y: opened ? 1 : 0
|
|
1079
|
+
});
|
|
1080
|
+
menuOpened.current = opened;
|
|
1081
|
+
setPreviewMenuOpen(opened);
|
|
1082
|
+
};
|
|
1083
|
+
|
|
1084
|
+
var openPreviewMenu = useCallback(function () {
|
|
1085
|
+
setPreviewMenu(true);
|
|
1086
|
+
}, [setMenuSpring, setPreviewMenuOpen]);
|
|
1087
|
+
var closePreviewMenu = useCallback(function () {
|
|
1088
|
+
setPreviewMenu(false);
|
|
1089
|
+
}, [setMenuSpring, setPreviewMenuOpen]); // Handle dot menu item click
|
|
1111
1090
|
|
|
1112
1091
|
var onClickDotsMenuItem = useCallback(function (index) {
|
|
1113
1092
|
onInteractionPrivate();
|
|
@@ -1117,11 +1096,7 @@ var Viewer = function Viewer(_ref) {
|
|
|
1117
1096
|
if (goToScreen) {
|
|
1118
1097
|
changeIndex(index);
|
|
1119
1098
|
} else {
|
|
1120
|
-
|
|
1121
|
-
y: menuOpened.current ? 0 : 1
|
|
1122
|
-
});
|
|
1123
|
-
menuOpened.current = !menuOpened.current;
|
|
1124
|
-
setPreviewMenuOpen(menuOpened.current);
|
|
1099
|
+
openPreviewMenu();
|
|
1125
1100
|
}
|
|
1126
1101
|
|
|
1127
1102
|
if (trackingEnabled) {
|
|
@@ -1133,15 +1108,11 @@ var Viewer = function Viewer(_ref) {
|
|
|
1133
1108
|
screenIndex: index
|
|
1134
1109
|
});
|
|
1135
1110
|
}
|
|
1136
|
-
}, [changeIndex, landscape, trackingEnabled, trackEvent,
|
|
1111
|
+
}, [changeIndex, landscape, trackingEnabled, trackEvent, screenType, onInteractionPrivate]); // handle preview menu item click
|
|
1137
1112
|
|
|
1138
1113
|
var onClickPreviewMenuItem = useCallback(function (index) {
|
|
1139
1114
|
changeIndex(index);
|
|
1140
|
-
|
|
1141
|
-
y: 0
|
|
1142
|
-
});
|
|
1143
|
-
menuOpened.current = false;
|
|
1144
|
-
setPreviewMenuOpen(false);
|
|
1115
|
+
closePreviewMenu();
|
|
1145
1116
|
|
|
1146
1117
|
if (trackingEnabled) {
|
|
1147
1118
|
trackEvent('viewer_menu', 'click_screen_change', "Screen ".concat(index + 1), {
|
|
@@ -1152,15 +1123,6 @@ var Viewer = function Viewer(_ref) {
|
|
|
1152
1123
|
}
|
|
1153
1124
|
}, [changeIndex, trackingEnabled, trackEvent, screenId, screenType]); // Handle preview menu close click
|
|
1154
1125
|
|
|
1155
|
-
var closePreviewMenu = useCallback(function () {
|
|
1156
|
-
if (menuOpened.current) {
|
|
1157
|
-
setMenuSpring.start({
|
|
1158
|
-
y: 0
|
|
1159
|
-
});
|
|
1160
|
-
menuOpened.current = false;
|
|
1161
|
-
setPreviewMenuOpen(false);
|
|
1162
|
-
}
|
|
1163
|
-
}, [setMenuSpring, setPreviewMenuOpen]);
|
|
1164
1126
|
var onClickPreviewMenuClose = useCallback(function () {
|
|
1165
1127
|
closePreviewMenu();
|
|
1166
1128
|
|
|
@@ -1213,32 +1175,43 @@ var Viewer = function Viewer(_ref) {
|
|
|
1213
1175
|
return;
|
|
1214
1176
|
}
|
|
1215
1177
|
|
|
1216
|
-
var
|
|
1178
|
+
var code = e.code;
|
|
1217
1179
|
|
|
1218
|
-
switch (
|
|
1219
|
-
case
|
|
1180
|
+
switch (code) {
|
|
1181
|
+
case 'KeyF':
|
|
1182
|
+
toggleFullscreen();
|
|
1183
|
+
break;
|
|
1184
|
+
|
|
1185
|
+
case 'KeyM':
|
|
1186
|
+
setPreviewMenu(!menuOpened.current);
|
|
1187
|
+
break;
|
|
1188
|
+
|
|
1189
|
+
case 'Escape':
|
|
1220
1190
|
closePreviewMenu();
|
|
1221
1191
|
break;
|
|
1222
1192
|
|
|
1223
|
-
case
|
|
1193
|
+
case 'ArrowLeft':
|
|
1224
1194
|
// left
|
|
1225
1195
|
onScreenPrevious();
|
|
1226
1196
|
break;
|
|
1227
1197
|
|
|
1228
|
-
case
|
|
1198
|
+
case 'ArrowRight': // right
|
|
1229
1199
|
|
|
1230
|
-
case
|
|
1200
|
+
case 'Space':
|
|
1231
1201
|
// spacebar
|
|
1232
1202
|
onScreenNext();
|
|
1233
1203
|
break;
|
|
1234
1204
|
}
|
|
1235
1205
|
};
|
|
1236
1206
|
|
|
1237
|
-
|
|
1207
|
+
if (renderContext === 'view') {
|
|
1208
|
+
window.addEventListener('keydown', onKey);
|
|
1209
|
+
}
|
|
1210
|
+
|
|
1238
1211
|
return function () {
|
|
1239
1212
|
window.removeEventListener('keydown', onKey);
|
|
1240
1213
|
};
|
|
1241
|
-
}, [closePreviewMenu, onScreenPrevious, onScreenNext]);
|
|
1214
|
+
}, [renderContext, closePreviewMenu, onScreenPrevious, onScreenNext]);
|
|
1242
1215
|
|
|
1243
1216
|
var _ref11 = currentScreen || {},
|
|
1244
1217
|
screenParameters = _ref11.parameters;
|
|
@@ -1327,7 +1300,13 @@ var Viewer = function Viewer(_ref) {
|
|
|
1327
1300
|
});
|
|
1328
1301
|
var key = "screen-viewer-".concat(scr.id || '', "-").concat(i + 1);
|
|
1329
1302
|
var screenTransform = landscape ? "translateX(calc(".concat((screenWidth + landscapeScreenMargin) * (i - screenIndex), "px - 50%)) scale(").concat(current ? 1 : 0.9, ")") : "translateX(".concat(current ? 0 : '100%', ")");
|
|
1330
|
-
return /*#__PURE__*/React.createElement("
|
|
1303
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, current && screenIndex > 0 ? /*#__PURE__*/React.createElement("button", {
|
|
1304
|
+
type: "button",
|
|
1305
|
+
className: "sr-only",
|
|
1306
|
+
onClick: onScreenPrevious,
|
|
1307
|
+
tabIndex: "-1"
|
|
1308
|
+
}, "Go to previous screen") : null, /*#__PURE__*/React.createElement("div", {
|
|
1309
|
+
ref: current ? currentScreenRef : null,
|
|
1331
1310
|
key: key,
|
|
1332
1311
|
style: {
|
|
1333
1312
|
width: landscape ? screenWidth : null,
|
|
@@ -1335,30 +1314,31 @@ var Viewer = function Viewer(_ref) {
|
|
|
1335
1314
|
transform: !withoutScreensTransforms ? screenTransform : null
|
|
1336
1315
|
},
|
|
1337
1316
|
className: classNames([styles.screen, _defineProperty({}, styles.current, current)]),
|
|
1317
|
+
tabIndex: active ? '0' : '-1'
|
|
1318
|
+
/* eslint-disable-line */
|
|
1319
|
+
,
|
|
1320
|
+
"aria-hidden": current ? null : 'true' // aria-label={intl.formatMessage(
|
|
1321
|
+
// {
|
|
1322
|
+
// defaultMessage: 'Screen {index}',
|
|
1323
|
+
// description: 'Button label',
|
|
1324
|
+
// },
|
|
1325
|
+
// { index: i + 1 },
|
|
1326
|
+
// )}
|
|
1327
|
+
,
|
|
1328
|
+
onKeyUp: function onKeyUp(e) {
|
|
1329
|
+
if (e.key === 'Enter') {
|
|
1330
|
+
onScreenClick(e, i);
|
|
1331
|
+
}
|
|
1332
|
+
},
|
|
1338
1333
|
onClick: function onClick(e) {
|
|
1339
1334
|
onScreenClick(e, i);
|
|
1340
1335
|
}
|
|
1341
|
-
}, viewerScreen, current && screenIndex
|
|
1342
|
-
type: "button",
|
|
1343
|
-
className: "sr-only",
|
|
1344
|
-
onClick: onScreenPrevious
|
|
1345
|
-
}, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
1346
|
-
id: "zYH/31",
|
|
1347
|
-
defaultMessage: [{
|
|
1348
|
-
"type": 0,
|
|
1349
|
-
"value": "Go to previous screen"
|
|
1350
|
-
}]
|
|
1351
|
-
})) : null, current && screenIndex < screens.length ? /*#__PURE__*/React.createElement("button", {
|
|
1336
|
+
}, viewerScreen), current && screenIndex < screens.length ? /*#__PURE__*/React.createElement("button", {
|
|
1352
1337
|
type: "button",
|
|
1353
1338
|
className: "sr-only",
|
|
1354
|
-
onClick: onScreenNext
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
defaultMessage: [{
|
|
1358
|
-
"type": 0,
|
|
1359
|
-
"value": "Go to next screen"
|
|
1360
|
-
}]
|
|
1361
|
-
})) : null);
|
|
1339
|
+
onClick: onScreenNext,
|
|
1340
|
+
tabIndex: "-1"
|
|
1341
|
+
}, "Go to next screen") : null);
|
|
1362
1342
|
})) : null)));
|
|
1363
1343
|
};
|
|
1364
1344
|
|