@micromag/viewer 0.3.496 → 0.3.497
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 +10 -10
- package/es/index.js +372 -169
- package/lib/index.js +374 -171
- package/package.json +11 -10
package/lib/index.js
CHANGED
|
@@ -23,12 +23,13 @@ var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
|
23
23
|
var web = require('@react-spring/web');
|
|
24
24
|
var classNames = require('classnames');
|
|
25
25
|
var reactHelmet = require('react-helmet');
|
|
26
|
+
var reactIntl = require('react-intl');
|
|
26
27
|
var EventEmitter = require('wolfy87-eventemitter');
|
|
27
28
|
var components = require('@micromag/core/components');
|
|
28
29
|
var hooks = require('@micromag/core/hooks');
|
|
29
30
|
var utils = require('@micromag/core/utils');
|
|
30
31
|
var all = require('@micromag/elements/all');
|
|
31
|
-
var
|
|
32
|
+
var FocusLock = require('react-focus-lock');
|
|
32
33
|
var core$1 = require('@react-spring/core');
|
|
33
34
|
var Scroll = require('@micromag/element-scroll');
|
|
34
35
|
var ShareOptions = require('@micromag/element-share-options');
|
|
@@ -186,7 +187,7 @@ if (typeof history !== "undefined" && typeof window[patchKey] === "undefined") {
|
|
|
186
187
|
});
|
|
187
188
|
}
|
|
188
189
|
|
|
189
|
-
var _excluded$
|
|
190
|
+
var _excluded$b = ["children"],
|
|
190
191
|
_excluded2 = ["path", "nest", "match"],
|
|
191
192
|
_excluded3 = ["to", "href", "onClick", "asChild", "children", "replace", "state"];
|
|
192
193
|
|
|
@@ -296,7 +297,7 @@ var matchRoute = function matchRoute(parser, route, path, loose) {
|
|
|
296
297
|
|
|
297
298
|
var Router = function Router(_ref3) {
|
|
298
299
|
var children = _ref3.children,
|
|
299
|
-
props = _objectWithoutProperties(_ref3, _excluded$
|
|
300
|
+
props = _objectWithoutProperties(_ref3, _excluded$b);
|
|
300
301
|
// the router we will inherit from - it is the closest router in the tree,
|
|
301
302
|
// unless the custom `hook` is provided (in that case it's the default one)
|
|
302
303
|
var parent_ = useRouter();
|
|
@@ -737,9 +738,34 @@ function useScreenInteraction() {
|
|
|
737
738
|
};
|
|
738
739
|
}
|
|
739
740
|
|
|
740
|
-
|
|
741
|
+
function checkDraggable(el) {
|
|
742
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
743
|
+
var parentDistance = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
|
|
744
|
+
var _ref = options || {},
|
|
745
|
+
_ref$maxParentDistanc = _ref.maxParentDistance,
|
|
746
|
+
maxParentDistance = _ref$maxParentDistanc === void 0 ? 5 : _ref$maxParentDistanc;
|
|
747
|
+
var _ref2 = el || {},
|
|
748
|
+
_ref2$tagName = _ref2.tagName,
|
|
749
|
+
tagName = _ref2$tagName === void 0 ? null : _ref2$tagName,
|
|
750
|
+
_ref2$parentNode = _ref2.parentNode,
|
|
751
|
+
parentNode = _ref2$parentNode === void 0 ? null : _ref2$parentNode,
|
|
752
|
+
_ref2$dataset = _ref2.dataset,
|
|
753
|
+
dataset = _ref2$dataset === void 0 ? {} : _ref2$dataset;
|
|
754
|
+
if (tagName === 'BODY') {
|
|
755
|
+
return false;
|
|
756
|
+
}
|
|
757
|
+
if (typeof dataset.draggable !== 'undefined') {
|
|
758
|
+
return true;
|
|
759
|
+
}
|
|
760
|
+
if (parentDistance < maxParentDistance) {
|
|
761
|
+
return checkDraggable(parentNode, options, parentDistance + 1);
|
|
762
|
+
}
|
|
763
|
+
return false;
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
var styles$g = {"container":"micromag-viewer-buttons-button-container","asLink":"micromag-viewer-buttons-button-asLink","icon":"micromag-viewer-buttons-button-icon","label":"micromag-viewer-buttons-button-label","withIcon":"micromag-viewer-buttons-button-withIcon","right":"micromag-viewer-buttons-button-right","icon-right":"micromag-viewer-buttons-button-icon-right","withIconColumns":"micromag-viewer-buttons-button-withIconColumns","linkDisabled":"micromag-viewer-buttons-button-linkDisabled","focus-visible":"micromag-viewer-buttons-button-focus-visible"};
|
|
741
767
|
|
|
742
|
-
var _excluded$
|
|
768
|
+
var _excluded$a = ["type", "theme", "size", "href", "external", "direct", "target", "label", "children", "focusable", "active", "icon", "iconPosition", "disabled", "loading", "disableOnLoading", "withoutTheme", "asLink", "ariaLabel", "onClick", "className", "iconClassName", "labelClassName", "refButton"];
|
|
743
769
|
var propTypes$n = {
|
|
744
770
|
type: PropTypes.string,
|
|
745
771
|
theme: core.PropTypes.buttonTheme,
|
|
@@ -759,6 +785,7 @@ var propTypes$n = {
|
|
|
759
785
|
disableOnLoading: PropTypes.bool,
|
|
760
786
|
withoutTheme: PropTypes.bool,
|
|
761
787
|
asLink: PropTypes.bool,
|
|
788
|
+
ariaLabel: PropTypes.string,
|
|
762
789
|
className: PropTypes.string,
|
|
763
790
|
iconClassName: PropTypes.string,
|
|
764
791
|
labelClassName: PropTypes.string,
|
|
@@ -786,6 +813,7 @@ var defaultProps$n = {
|
|
|
786
813
|
disableOnLoading: true,
|
|
787
814
|
withoutTheme: false,
|
|
788
815
|
asLink: false,
|
|
816
|
+
ariaLabel: null,
|
|
789
817
|
className: null,
|
|
790
818
|
iconClassName: null,
|
|
791
819
|
labelClassName: null,
|
|
@@ -811,12 +839,13 @@ var Button = function Button(_ref) {
|
|
|
811
839
|
disableOnLoading = _ref.disableOnLoading;
|
|
812
840
|
_ref.withoutTheme;
|
|
813
841
|
var asLink = _ref.asLink,
|
|
842
|
+
ariaLabel = _ref.ariaLabel,
|
|
814
843
|
onClick = _ref.onClick,
|
|
815
844
|
className = _ref.className,
|
|
816
845
|
iconClassName = _ref.iconClassName,
|
|
817
846
|
labelClassName = _ref.labelClassName,
|
|
818
847
|
refButton = _ref.refButton,
|
|
819
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
848
|
+
props = _objectWithoutProperties(_ref, _excluded$a);
|
|
820
849
|
var finalLabel = label || children;
|
|
821
850
|
var text = finalLabel !== null ? /*#__PURE__*/React.createElement(components.Label, null, finalLabel) : null;
|
|
822
851
|
var hasChildren = label !== null && children !== null;
|
|
@@ -871,6 +900,7 @@ var Button = function Button(_ref) {
|
|
|
871
900
|
onClick: onClick,
|
|
872
901
|
disabled: disabled || disableOnLoading && loading,
|
|
873
902
|
ref: refButton,
|
|
903
|
+
"aria-label": ariaLabel,
|
|
874
904
|
tabIndex: focusable ? '0' : '-1'
|
|
875
905
|
}), content);
|
|
876
906
|
};
|
|
@@ -878,9 +908,9 @@ Button.propTypes = propTypes$n;
|
|
|
878
908
|
Button.defaultProps = defaultProps$n;
|
|
879
909
|
var Button$1 = Button;
|
|
880
910
|
|
|
881
|
-
var styles$f = {"container":"micromag-viewer-buttons-icon-button-container","label":"micromag-viewer-buttons-icon-button-label","icon":"micromag-viewer-buttons-icon-button-icon"};
|
|
911
|
+
var styles$f = {"container":"micromag-viewer-buttons-icon-button-container","label":"micromag-viewer-buttons-icon-button-label","icon":"micromag-viewer-buttons-icon-button-icon","focus-visible":"micromag-viewer-buttons-icon-button-focus-visible"};
|
|
882
912
|
|
|
883
|
-
var _excluded$
|
|
913
|
+
var _excluded$9 = ["iconClassName", "className"];
|
|
884
914
|
var propTypes$m = {
|
|
885
915
|
iconClassName: PropTypes.string,
|
|
886
916
|
className: PropTypes.string
|
|
@@ -892,7 +922,7 @@ var defaultProps$m = {
|
|
|
892
922
|
var IconButton = function IconButton(_ref) {
|
|
893
923
|
var iconClassName = _ref.iconClassName,
|
|
894
924
|
className = _ref.className,
|
|
895
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
925
|
+
props = _objectWithoutProperties(_ref, _excluded$9);
|
|
896
926
|
return /*#__PURE__*/React.createElement(Button$1, Object.assign({
|
|
897
927
|
className: classNames([styles$f.container, _defineProperty({}, className, className !== null)]),
|
|
898
928
|
labelClassName: styles$f.label,
|
|
@@ -903,7 +933,7 @@ IconButton.propTypes = propTypes$m;
|
|
|
903
933
|
IconButton.defaultProps = defaultProps$m;
|
|
904
934
|
var IconButton$1 = IconButton;
|
|
905
935
|
|
|
906
|
-
var _excluded$
|
|
936
|
+
var _excluded$8 = ["single", "className"];
|
|
907
937
|
var propTypes$l = {
|
|
908
938
|
single: PropTypes.bool,
|
|
909
939
|
className: PropTypes.string
|
|
@@ -915,7 +945,7 @@ var defaultProps$l = {
|
|
|
915
945
|
var CloseMenuButton = function CloseMenuButton(_ref) {
|
|
916
946
|
var single = _ref.single,
|
|
917
947
|
className = _ref.className,
|
|
918
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
948
|
+
props = _objectWithoutProperties(_ref, _excluded$8);
|
|
919
949
|
var intl = reactIntl.useIntl();
|
|
920
950
|
return /*#__PURE__*/React.createElement(IconButton$1, Object.assign({
|
|
921
951
|
className: classNames([_defineProperty({}, className, className !== null)]),
|
|
@@ -962,7 +992,7 @@ CloseMenuButton.propTypes = propTypes$l;
|
|
|
962
992
|
CloseMenuButton.defaultProps = defaultProps$l;
|
|
963
993
|
var CloseMenuButton$1 = CloseMenuButton;
|
|
964
994
|
|
|
965
|
-
var _excluded$
|
|
995
|
+
var _excluded$7 = ["className", "iconClassName"];
|
|
966
996
|
var propTypes$k = {
|
|
967
997
|
className: PropTypes.string,
|
|
968
998
|
iconClassName: PropTypes.string
|
|
@@ -974,7 +1004,7 @@ var defaultProps$k = {
|
|
|
974
1004
|
var MenuButton = function MenuButton(_ref) {
|
|
975
1005
|
var className = _ref.className;
|
|
976
1006
|
_ref.iconClassName;
|
|
977
|
-
var props = _objectWithoutProperties(_ref, _excluded$
|
|
1007
|
+
var props = _objectWithoutProperties(_ref, _excluded$7);
|
|
978
1008
|
var intl = reactIntl.useIntl();
|
|
979
1009
|
return /*#__PURE__*/React.createElement(IconButton$1, Object.assign({
|
|
980
1010
|
className: classNames([_defineProperty({}, className, className !== null)]),
|
|
@@ -1015,7 +1045,7 @@ MenuButton.propTypes = propTypes$k;
|
|
|
1015
1045
|
MenuButton.defaultProps = defaultProps$k;
|
|
1016
1046
|
var MenuButton$1 = MenuButton;
|
|
1017
1047
|
|
|
1018
|
-
var _excluded$
|
|
1048
|
+
var _excluded$6 = ["className"];
|
|
1019
1049
|
var propTypes$j = {
|
|
1020
1050
|
className: PropTypes.string
|
|
1021
1051
|
};
|
|
@@ -1024,7 +1054,7 @@ var defaultProps$j = {
|
|
|
1024
1054
|
};
|
|
1025
1055
|
var ShareButton = function ShareButton(_ref) {
|
|
1026
1056
|
var className = _ref.className,
|
|
1027
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
1057
|
+
props = _objectWithoutProperties(_ref, _excluded$6);
|
|
1028
1058
|
var intl = reactIntl.useIntl();
|
|
1029
1059
|
return /*#__PURE__*/React.createElement(IconButton$1, Object.assign({
|
|
1030
1060
|
className: classNames([_defineProperty({}, className, className !== null)]),
|
|
@@ -1164,7 +1194,7 @@ ViewerMenuContainer.propTypes = propTypes$h;
|
|
|
1164
1194
|
ViewerMenuContainer.defaultProps = defaultProps$h;
|
|
1165
1195
|
var MenuContainer = ViewerMenuContainer;
|
|
1166
1196
|
|
|
1167
|
-
var styles$c = {"button":"micromag-viewer-menus-menu-dot-button","progress":"micromag-viewer-menus-menu-dot-progress","container":"micromag-viewer-menus-menu-dot-container","vertical":"micromag-viewer-menus-menu-dot-vertical","dot":"micromag-viewer-menus-menu-dot-dot","subDot":"micromag-viewer-menus-menu-dot-subDot","dots":"micromag-viewer-menus-menu-dot-dots","outlineBounce":"micromag-viewer-menus-menu-dot-outlineBounce"};
|
|
1197
|
+
var styles$c = {"button":"micromag-viewer-menus-menu-dot-button","progress":"micromag-viewer-menus-menu-dot-progress","container":"micromag-viewer-menus-menu-dot-container","vertical":"micromag-viewer-menus-menu-dot-vertical","dot":"micromag-viewer-menus-menu-dot-dot","focus-visible":"micromag-viewer-menus-menu-dot-focus-visible","subDot":"micromag-viewer-menus-menu-dot-subDot","dots":"micromag-viewer-menus-menu-dot-dots","outlineBounce":"micromag-viewer-menus-menu-dot-outlineBounce"};
|
|
1168
1198
|
|
|
1169
1199
|
var propTypes$g = {
|
|
1170
1200
|
current: PropTypes.bool,
|
|
@@ -1258,7 +1288,7 @@ var MenuDot = ViewerMenuDot;
|
|
|
1258
1288
|
|
|
1259
1289
|
var styles$b = {"container":"micromag-viewer-menus-menu-dots-container","closeButton":"micromag-viewer-menus-menu-dots-closeButton","focus-visible":"micromag-viewer-menus-menu-dots-focus-visible","items":"micromag-viewer-menus-menu-dots-items","item":"micromag-viewer-menus-menu-dots-item","buttons":"micromag-viewer-menus-menu-dots-buttons","vertical":"micromag-viewer-menus-menu-dots-vertical"};
|
|
1260
1290
|
|
|
1261
|
-
var _excluded$
|
|
1291
|
+
var _excluded$5 = ["direction", "items", "onClickDot", "onClickScreensMenu", "colors", "closeable", "buttons", "withItemClick", "withoutScreensMenu", "onClose", "className"];
|
|
1262
1292
|
var propTypes$f = {
|
|
1263
1293
|
direction: PropTypes.oneOf(['horizontal', 'vertical']),
|
|
1264
1294
|
items: core.PropTypes.menuItems,
|
|
@@ -1300,7 +1330,7 @@ var ViewerMenuDots = function ViewerMenuDots(_ref) {
|
|
|
1300
1330
|
withoutScreensMenu = _ref.withoutScreensMenu,
|
|
1301
1331
|
onClose = _ref.onClose,
|
|
1302
1332
|
className = _ref.className,
|
|
1303
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
1333
|
+
props = _objectWithoutProperties(_ref, _excluded$5);
|
|
1304
1334
|
var _ref2 = colors || {},
|
|
1305
1335
|
_ref2$primary = _ref2.primary,
|
|
1306
1336
|
primary = _ref2$primary === void 0 ? 'rgba(255, 255, 255, 1)' : _ref2$primary;
|
|
@@ -1419,7 +1449,7 @@ StackIcon.propTypes = propTypes$e;
|
|
|
1419
1449
|
StackIcon.defaultProps = defaultProps$e;
|
|
1420
1450
|
var StackIcon$1 = StackIcon;
|
|
1421
1451
|
|
|
1422
|
-
var styles$a = {"button":"micromag-viewer-menus-menu-screen-button","container":"micromag-viewer-menus-menu-screen-container","focus-visible":"micromag-viewer-menus-menu-screen-focus-visible","isCurrent":"micromag-viewer-menus-menu-screen-isCurrent","
|
|
1452
|
+
var styles$a = {"button":"micromag-viewer-menus-menu-screen-button","container":"micromag-viewer-menus-menu-screen-container","focus-visible":"micromag-viewer-menus-menu-screen-focus-visible","isCurrent":"micromag-viewer-menus-menu-screen-isCurrent","inner":"micromag-viewer-menus-menu-screen-inner","subScreenBadge":"micromag-viewer-menus-menu-screen-subScreenBadge","subScreenCount":"micromag-viewer-menus-menu-screen-subScreenCount","subScreenIcon":"micromag-viewer-menus-menu-screen-subScreenIcon","screen":"micromag-viewer-menus-menu-screen-screen","pulse":"micromag-viewer-menus-menu-screen-pulse"};
|
|
1423
1453
|
|
|
1424
1454
|
var propTypes$d = {
|
|
1425
1455
|
className: PropTypes.string,
|
|
@@ -1515,7 +1545,7 @@ var MenuScreen = ViewerMenuScreen;
|
|
|
1515
1545
|
|
|
1516
1546
|
var styles$9 = {"scroll":"micromag-viewer-menus-menu-preview-scroll","container":"micromag-viewer-menus-menu-preview-container","disabled":"micromag-viewer-menus-menu-preview-disabled","screenButton":"micromag-viewer-menus-menu-preview-screenButton","content":"micromag-viewer-menus-menu-preview-content","buttons":"micromag-viewer-menus-menu-preview-buttons","organisation":"micromag-viewer-menus-menu-preview-organisation","icon":"micromag-viewer-menus-menu-preview-icon","titleContainer":"micromag-viewer-menus-menu-preview-titleContainer","headerContainer":"micromag-viewer-menus-menu-preview-headerContainer","badge":"micromag-viewer-menus-menu-preview-badge","title":"micromag-viewer-menus-menu-preview-title","nav":"micromag-viewer-menus-menu-preview-nav","items":"micromag-viewer-menus-menu-preview-items","item":"micromag-viewer-menus-menu-preview-item","inner":"micromag-viewer-menus-menu-preview-inner","frame":"micromag-viewer-menus-menu-preview-frame","screen":"micromag-viewer-menus-menu-preview-screen","intro":"micromag-viewer-menus-menu-preview-intro"};
|
|
1517
1547
|
|
|
1518
|
-
var _excluded$
|
|
1548
|
+
var _excluded$4 = ["textAlign"];
|
|
1519
1549
|
var propTypes$c = {
|
|
1520
1550
|
viewerTheme: core.PropTypes.viewerTheme,
|
|
1521
1551
|
header: PropTypes.node,
|
|
@@ -1597,7 +1627,7 @@ var ViewerMenuPreview = function ViewerMenuPreview(_ref) {
|
|
|
1597
1627
|
// eslint-disable-next-line no-unused-vars
|
|
1598
1628
|
var _ref6 = titleStyles || {};
|
|
1599
1629
|
_ref6.textAlign;
|
|
1600
|
-
var otherTitleStyles = _objectWithoutProperties(_ref6, _excluded$
|
|
1630
|
+
var otherTitleStyles = _objectWithoutProperties(_ref6, _excluded$4);
|
|
1601
1631
|
var finalTitleStyles = titleStyles !== null ? utils.getStyleFromText(otherTitleStyles) : null;
|
|
1602
1632
|
// const { url: brandLogoUrl = null } = brandLogo || {};
|
|
1603
1633
|
var _useState = React.useState([]),
|
|
@@ -1874,7 +1904,7 @@ ViewerMenuShare.propTypes = propTypes$a;
|
|
|
1874
1904
|
ViewerMenuShare.defaultProps = defaultProps$a;
|
|
1875
1905
|
var MenuShare = ViewerMenuShare;
|
|
1876
1906
|
|
|
1877
|
-
var styles$6 = {"container":"micromag-viewer-container","screenContainer":"micromag-viewer-screenContainer","screensFrame":"micromag-viewer-screensFrame","menuShare":"micromag-viewer-menuShare","menuPreview":"micromag-viewer-menuPreview","menuContainer":"micromag-viewer-menuContainer","focus-visible":"micromag-viewer-focus-visible","landscape":"micromag-viewer-landscape","hideMenu":"micromag-viewer-hideMenu","menuNavContainer":"micromag-viewer-menuNavContainer","menuTopContainer":"micromag-viewer-menuTopContainer","dots":"micromag-viewer-dots","disableMenu":"micromag-viewer-disableMenu","content":"micromag-viewer-content","withoutGestures":"micromag-viewer-withoutGestures","fadeMenu":"micromag-viewer-fadeMenu","withShadow":"micromag-viewer-withShadow","isOpened":"micromag-viewer-isOpened","menuItem":"micromag-viewer-menuItem","menuButton":"micromag-viewer-menuButton","slidingButton":"micromag-viewer-slidingButton","screensMenuButtonToggled":"micromag-viewer-screensMenuButtonToggled","navButton":"micromag-viewer-navButton","previous":"micromag-viewer-previous","next":"micromag-viewer-next","screen":"micromag-viewer-screen","current":"micromag-viewer-current","playbackControls":"micromag-viewer-playbackControls","arrowHint":"micromag-viewer-arrowHint","webView":"micromag-viewer-webView","shareIncentiveContainer":"micromag-viewer-shareIncentiveContainer","shareIncentive":"micromag-viewer-shareIncentive","shareIncentiveVisible":"micromag-viewer-shareIncentiveVisible"};
|
|
1907
|
+
var styles$6 = {"container":"micromag-viewer-container","screenContainer":"micromag-viewer-screenContainer","screensFrame":"micromag-viewer-screensFrame","menuShare":"micromag-viewer-menuShare","menuPreview":"micromag-viewer-menuPreview","menuContainer":"micromag-viewer-menuContainer","focus-visible":"micromag-viewer-focus-visible","landscape":"micromag-viewer-landscape","hideMenu":"micromag-viewer-hideMenu","menuNavContainer":"micromag-viewer-menuNavContainer","menuTopContainer":"micromag-viewer-menuTopContainer","dots":"micromag-viewer-dots","disableMenu":"micromag-viewer-disableMenu","content":"micromag-viewer-content","withoutGestures":"micromag-viewer-withoutGestures","ariaAnnouncement":"micromag-viewer-ariaAnnouncement","accessibilityLinks":"micromag-viewer-accessibilityLinks","accessibilityButton":"micromag-viewer-accessibilityButton","disabled":"micromag-viewer-disabled","tooltip":"micromag-viewer-tooltip","fadeMenu":"micromag-viewer-fadeMenu","withShadow":"micromag-viewer-withShadow","isOpened":"micromag-viewer-isOpened","menuItem":"micromag-viewer-menuItem","menuButton":"micromag-viewer-menuButton","slidingButton":"micromag-viewer-slidingButton","screensMenuButtonToggled":"micromag-viewer-screensMenuButtonToggled","navButton":"micromag-viewer-navButton","previous":"micromag-viewer-previous","next":"micromag-viewer-next","screen":"micromag-viewer-screen","current":"micromag-viewer-current","playbackControls":"micromag-viewer-playbackControls","arrowHint":"micromag-viewer-arrowHint","webView":"micromag-viewer-webView","shareIncentiveContainer":"micromag-viewer-shareIncentiveContainer","shareIncentive":"micromag-viewer-shareIncentive","shareIncentiveVisible":"micromag-viewer-shareIncentiveVisible"};
|
|
1878
1908
|
|
|
1879
1909
|
var propTypes$9 = {
|
|
1880
1910
|
story: core.PropTypes.story.isRequired,
|
|
@@ -2123,8 +2153,11 @@ var ViewerMenu = function ViewerMenu(_ref) {
|
|
|
2123
2153
|
progress: shareOpened ? 1 : 0,
|
|
2124
2154
|
computeProgress: shareOpened ? computeShareProgressClose : computeShareProgress,
|
|
2125
2155
|
springParams: springParams,
|
|
2126
|
-
|
|
2127
|
-
axis: 'y'
|
|
2156
|
+
dragOptions: {
|
|
2157
|
+
axis: 'y',
|
|
2158
|
+
pointer: {
|
|
2159
|
+
keys: false
|
|
2160
|
+
}
|
|
2128
2161
|
}
|
|
2129
2162
|
}),
|
|
2130
2163
|
bindShareDrag = _useDragProgress.bind,
|
|
@@ -2167,7 +2200,10 @@ var ViewerMenu = function ViewerMenu(_ref) {
|
|
|
2167
2200
|
computeProgress: menuOpened ? computeMenuProgressClose : computeMenuProgress,
|
|
2168
2201
|
springParams: springParams,
|
|
2169
2202
|
drapOptions: {
|
|
2170
|
-
axis: 'y'
|
|
2203
|
+
axis: 'y',
|
|
2204
|
+
pointer: {
|
|
2205
|
+
keys: false
|
|
2206
|
+
}
|
|
2171
2207
|
}
|
|
2172
2208
|
}),
|
|
2173
2209
|
bindMenuDrag = _useDragProgress2.bind,
|
|
@@ -2220,14 +2256,18 @@ var ViewerMenu = function ViewerMenu(_ref) {
|
|
|
2220
2256
|
iconPosition: "left",
|
|
2221
2257
|
focusable: !shareOpened
|
|
2222
2258
|
}),
|
|
2223
|
-
toggledButton: /*#__PURE__*/React.createElement(
|
|
2259
|
+
toggledButton: /*#__PURE__*/React.createElement(FocusLock, {
|
|
2260
|
+
group: "share",
|
|
2261
|
+
disabled: !shareOpened,
|
|
2262
|
+
returnFocus: true
|
|
2263
|
+
}, /*#__PURE__*/React.createElement(CloseMenuButton$1, {
|
|
2224
2264
|
className: styles$6.menuButton,
|
|
2225
2265
|
onClick: onCloseShare,
|
|
2226
2266
|
theme: menuTheme,
|
|
2227
2267
|
iconPosition: "left",
|
|
2228
2268
|
focusable: shareOpened,
|
|
2229
2269
|
single: true
|
|
2230
|
-
}),
|
|
2270
|
+
})),
|
|
2231
2271
|
progressSpring: shareOpenedProgress
|
|
2232
2272
|
}) : null, afterShareMenuButton) : null, !withoutScreensMenu || beforeScreensMenuButton !== null ? /*#__PURE__*/React.createElement("div", Object.assign({
|
|
2233
2273
|
className: styles$6.menuItem
|
|
@@ -2240,13 +2280,17 @@ var ViewerMenu = function ViewerMenu(_ref) {
|
|
|
2240
2280
|
theme: menuTheme,
|
|
2241
2281
|
focusable: !menuOpened
|
|
2242
2282
|
}),
|
|
2243
|
-
toggledButton: /*#__PURE__*/React.createElement(
|
|
2283
|
+
toggledButton: /*#__PURE__*/React.createElement(FocusLock, {
|
|
2284
|
+
group: "screens",
|
|
2285
|
+
disabled: !menuOpened,
|
|
2286
|
+
returnFocus: true
|
|
2287
|
+
}, /*#__PURE__*/React.createElement(CloseMenuButton$1, {
|
|
2244
2288
|
className: styles$6.menuButton,
|
|
2245
2289
|
onClick: onCloseMenu,
|
|
2246
2290
|
theme: menuTheme,
|
|
2247
2291
|
iconPosition: "right",
|
|
2248
2292
|
focusable: menuOpened
|
|
2249
|
-
}),
|
|
2293
|
+
})),
|
|
2250
2294
|
progressSpring: menuOpenedProgress,
|
|
2251
2295
|
toggledButtonClassName: styles$6.screensMenuButtonToggled
|
|
2252
2296
|
}) : null) : null), /*#__PURE__*/React.createElement(MenuDots, Object.assign({}, menuTheme, {
|
|
@@ -2265,7 +2309,11 @@ var ViewerMenu = function ViewerMenu(_ref) {
|
|
|
2265
2309
|
className: styles$6.menuContainer,
|
|
2266
2310
|
progressSpring: shareOpenedProgress,
|
|
2267
2311
|
theme: viewerTheme
|
|
2268
|
-
}, draggingShare || shareOpened ? /*#__PURE__*/React.createElement(
|
|
2312
|
+
}, draggingShare || shareOpened ? /*#__PURE__*/React.createElement(FocusLock, {
|
|
2313
|
+
group: "share",
|
|
2314
|
+
disabled: !shareOpened,
|
|
2315
|
+
returnFocus: true
|
|
2316
|
+
}, /*#__PURE__*/React.createElement(MenuShare, {
|
|
2269
2317
|
viewerTheme: viewerTheme,
|
|
2270
2318
|
className: styles$6.menuShare,
|
|
2271
2319
|
title: title,
|
|
@@ -2278,11 +2326,15 @@ var ViewerMenu = function ViewerMenu(_ref) {
|
|
|
2278
2326
|
shareUrl: shareUrl,
|
|
2279
2327
|
onShare: onShare,
|
|
2280
2328
|
onClose: onCloseShare
|
|
2281
|
-
}) : null), /*#__PURE__*/React.createElement(MenuContainer, {
|
|
2329
|
+
})) : null), /*#__PURE__*/React.createElement(MenuContainer, {
|
|
2282
2330
|
className: styles$6.menuContainer,
|
|
2283
2331
|
progressSpring: menuOpenedProgress,
|
|
2284
2332
|
theme: viewerTheme
|
|
2285
|
-
}, menuMounted ? /*#__PURE__*/React.createElement(
|
|
2333
|
+
}, menuMounted ? /*#__PURE__*/React.createElement(FocusLock, {
|
|
2334
|
+
group: "screens",
|
|
2335
|
+
disabled: !menuOpened,
|
|
2336
|
+
returnFocus: true
|
|
2337
|
+
}, /*#__PURE__*/React.createElement(MenuPreview, {
|
|
2286
2338
|
viewerTheme: viewerTheme,
|
|
2287
2339
|
header: previewHeader,
|
|
2288
2340
|
footer: previewFooter,
|
|
@@ -2301,7 +2353,7 @@ var ViewerMenu = function ViewerMenu(_ref) {
|
|
|
2301
2353
|
toggleFullscreen: toggleFullscreen,
|
|
2302
2354
|
fullscreenActive: fullscreenActive,
|
|
2303
2355
|
fullscreenEnabled: fullscreenEnabled
|
|
2304
|
-
}) : null));
|
|
2356
|
+
})) : null));
|
|
2305
2357
|
};
|
|
2306
2358
|
ViewerMenu.propTypes = propTypes$9;
|
|
2307
2359
|
ViewerMenu.defaultProps = defaultProps$9;
|
|
@@ -2390,8 +2442,9 @@ function ViewerScreen(_ref) {
|
|
|
2390
2442
|
ViewerScreen.propTypes = propTypes$8;
|
|
2391
2443
|
ViewerScreen.defaultProps = defaultProps$8;
|
|
2392
2444
|
|
|
2393
|
-
var styles$4 = {"arrow":"micromag-viewer-buttons-navigation-button-arrow","next":"micromag-viewer-buttons-navigation-button-next","previous":"micromag-viewer-buttons-navigation-button-previous"};
|
|
2445
|
+
var styles$4 = {"container":"micromag-viewer-buttons-navigation-button-container","arrow":"micromag-viewer-buttons-navigation-button-arrow","next":"micromag-viewer-buttons-navigation-button-next","previous":"micromag-viewer-buttons-navigation-button-previous"};
|
|
2394
2446
|
|
|
2447
|
+
var _excluded$3 = ["direction", "onClick", "className"];
|
|
2395
2448
|
var propTypes$7 = {
|
|
2396
2449
|
direction: PropTypes.oneOf(['previous', 'next']),
|
|
2397
2450
|
onClick: PropTypes.func,
|
|
@@ -2405,8 +2458,9 @@ var defaultProps$7 = {
|
|
|
2405
2458
|
var NavigationButton = function NavigationButton(_ref) {
|
|
2406
2459
|
var direction = _ref.direction,
|
|
2407
2460
|
_onClick = _ref.onClick,
|
|
2408
|
-
className = _ref.className
|
|
2409
|
-
|
|
2461
|
+
className = _ref.className,
|
|
2462
|
+
props = _objectWithoutProperties(_ref, _excluded$3);
|
|
2463
|
+
return /*#__PURE__*/React.createElement(IconButton$1, Object.assign({
|
|
2410
2464
|
className: classNames([styles$4.container, styles$4[direction], _defineProperty({}, className, className !== null)]),
|
|
2411
2465
|
onClick: function onClick(e) {
|
|
2412
2466
|
e.stopPropagation();
|
|
@@ -2422,23 +2476,8 @@ var NavigationButton = function NavigationButton(_ref) {
|
|
|
2422
2476
|
fill: "currentColor"
|
|
2423
2477
|
}, /*#__PURE__*/React.createElement("polygon", {
|
|
2424
2478
|
points: "9.62 4.62 5 0 0.38 4.62 1.44 5.68 4.25 2.87 4.25 14.39 5.75 14.39 5.75 2.87 8.56 5.68 9.62 4.62"
|
|
2425
|
-
})),
|
|
2426
|
-
label: /*#__PURE__*/React.createElement("span", {
|
|
2427
|
-
className: "sr-only"
|
|
2428
|
-
}, direction === 'previous' ? /*#__PURE__*/React.createElement(reactIntl.FormattedMessage, {
|
|
2429
|
-
id: "zYH/31",
|
|
2430
|
-
defaultMessage: [{
|
|
2431
|
-
"type": 0,
|
|
2432
|
-
"value": "Go to previous screen"
|
|
2433
|
-
}]
|
|
2434
|
-
}) : /*#__PURE__*/React.createElement(reactIntl.FormattedMessage, {
|
|
2435
|
-
id: "v9bqYj",
|
|
2436
|
-
defaultMessage: [{
|
|
2437
|
-
"type": 0,
|
|
2438
|
-
"value": "Go to next screen"
|
|
2439
|
-
}]
|
|
2440
2479
|
}))
|
|
2441
|
-
});
|
|
2480
|
+
}, props));
|
|
2442
2481
|
};
|
|
2443
2482
|
NavigationButton.propTypes = propTypes$7;
|
|
2444
2483
|
NavigationButton.defaultProps = defaultProps$7;
|
|
@@ -2466,7 +2505,7 @@ ArrowHint.propTypes = propTypes$6;
|
|
|
2466
2505
|
ArrowHint.defaultProps = defaultProps$6;
|
|
2467
2506
|
var ArrowHint$1 = ArrowHint;
|
|
2468
2507
|
|
|
2469
|
-
var styles$2 = {"track":"micromag-viewer-partials-seek-bar-track","progress":"micromag-viewer-partials-seek-bar-progress","inner":"micromag-viewer-partials-seek-bar-inner","progressBarContainer":"micromag-viewer-partials-seek-bar-progressBarContainer","progressBar":"micromag-viewer-partials-seek-bar-progressBar","playHead":"micromag-viewer-partials-seek-bar-playHead","withSeekHead":"micromag-viewer-partials-seek-bar-withSeekHead","scrubbedTime":"micromag-viewer-partials-seek-bar-scrubbedTime","showTimestamp":"micromag-viewer-partials-seek-bar-showTimestamp"};
|
|
2508
|
+
var styles$2 = {"track":"micromag-viewer-partials-seek-bar-track","progress":"micromag-viewer-partials-seek-bar-progress","inner":"micromag-viewer-partials-seek-bar-inner","progressBarContainer":"micromag-viewer-partials-seek-bar-progressBarContainer","progressBar":"micromag-viewer-partials-seek-bar-progressBar","playHead":"micromag-viewer-partials-seek-bar-playHead","withSeekHead":"micromag-viewer-partials-seek-bar-withSeekHead","scrubbedTime":"micromag-viewer-partials-seek-bar-scrubbedTime","showTimestamp":"micromag-viewer-partials-seek-bar-showTimestamp","focus-visible":"micromag-viewer-partials-seek-bar-focus-visible"};
|
|
2470
2509
|
|
|
2471
2510
|
var stopDragEventsPropagation = {
|
|
2472
2511
|
onTouchMove: function onTouchMove(e) {
|
|
@@ -2563,10 +2602,15 @@ var SeekBar = function SeekBar(_ref3) {
|
|
|
2563
2602
|
_useState2 = _slicedToArray(_useState, 2),
|
|
2564
2603
|
showTimestamp = _useState2[0],
|
|
2565
2604
|
setShowTimestamp = _useState2[1];
|
|
2566
|
-
var
|
|
2605
|
+
var startProgressRef = React.useRef(progress);
|
|
2606
|
+
var onDrag = React.useCallback(
|
|
2607
|
+
// eslint-disable-next-line no-unused-vars
|
|
2608
|
+
function (_ref5) {
|
|
2567
2609
|
var _ref5$xy = _slicedToArray(_ref5.xy, 1),
|
|
2568
|
-
|
|
2569
|
-
|
|
2610
|
+
xOffset = _ref5$xy[0],
|
|
2611
|
+
_ref5$movement = _slicedToArray(_ref5.movement, 1);
|
|
2612
|
+
_ref5$movement[0];
|
|
2613
|
+
var elapsedTime = _ref5.elapsedTime,
|
|
2570
2614
|
active = _ref5.active,
|
|
2571
2615
|
tap = _ref5.tap,
|
|
2572
2616
|
currentTarget = _ref5.currentTarget;
|
|
@@ -2578,21 +2622,28 @@ var SeekBar = function SeekBar(_ref3) {
|
|
|
2578
2622
|
return;
|
|
2579
2623
|
}
|
|
2580
2624
|
var _currentTarget$getBou = currentTarget.getBoundingClientRect(),
|
|
2581
|
-
_currentTarget$getBou2 = _currentTarget$getBou.
|
|
2582
|
-
|
|
2583
|
-
_currentTarget$getBou3 = _currentTarget$getBou.
|
|
2584
|
-
|
|
2585
|
-
var newProgress =
|
|
2625
|
+
_currentTarget$getBou2 = _currentTarget$getBou.width,
|
|
2626
|
+
elWidth = _currentTarget$getBou2 === void 0 ? 0 : _currentTarget$getBou2,
|
|
2627
|
+
_currentTarget$getBou3 = _currentTarget$getBou.x,
|
|
2628
|
+
xGap = _currentTarget$getBou3 === void 0 ? null : _currentTarget$getBou3;
|
|
2629
|
+
var newProgress = null;
|
|
2630
|
+
if (tap) {
|
|
2631
|
+
newProgress = Math.max(0, Math.min(1, (xOffset - xGap) / elWidth));
|
|
2632
|
+
} else {
|
|
2633
|
+
// startProgressRef.current + xMovement
|
|
2634
|
+
newProgress = Math.max(0, Math.min(1, (xOffset - xGap) / elWidth));
|
|
2635
|
+
}
|
|
2586
2636
|
if (onSeek !== null) {
|
|
2587
2637
|
onSeek(newProgress, tap);
|
|
2588
2638
|
}
|
|
2589
2639
|
}, [onSeek, onClick, collapsed]);
|
|
2590
2640
|
var onDragStart = React.useCallback(function () {
|
|
2641
|
+
startProgressRef.current = progress;
|
|
2591
2642
|
setShowTimestamp(true);
|
|
2592
2643
|
if (onSeekStart !== null) {
|
|
2593
2644
|
onSeekStart();
|
|
2594
2645
|
}
|
|
2595
|
-
}, [onSeekStart, setShowTimestamp]);
|
|
2646
|
+
}, [progress, onSeekStart, setShowTimestamp]);
|
|
2596
2647
|
var onDragEnd = React.useCallback(function () {
|
|
2597
2648
|
if (onSeekEnd !== null) {
|
|
2598
2649
|
setShowTimestamp(false);
|
|
@@ -2639,6 +2690,27 @@ var SeekBar = function SeekBar(_ref3) {
|
|
|
2639
2690
|
}
|
|
2640
2691
|
})), /*#__PURE__*/React.createElement("button", Object.assign({}, bind(), {
|
|
2641
2692
|
type: "button",
|
|
2693
|
+
role: "slider",
|
|
2694
|
+
"aria-valuemin": 0,
|
|
2695
|
+
"aria-valuemax": 100,
|
|
2696
|
+
"aria-valuenow": progress,
|
|
2697
|
+
"aria-valuetext": intl.formatMessage({
|
|
2698
|
+
id: "C1VUEY",
|
|
2699
|
+
defaultMessage: [{
|
|
2700
|
+
"type": 1,
|
|
2701
|
+
"value": "current"
|
|
2702
|
+
}, {
|
|
2703
|
+
"type": 0,
|
|
2704
|
+
"value": " of "
|
|
2705
|
+
}, {
|
|
2706
|
+
"type": 1,
|
|
2707
|
+
"value": "duration"
|
|
2708
|
+
}]
|
|
2709
|
+
}, {
|
|
2710
|
+
current: getFormattedTimestamp(currentTime, duration < SHOW_MILLISECONDS_THRESHOLD),
|
|
2711
|
+
duration: getFormattedTimestamp(duration, duration < SHOW_MILLISECONDS_THRESHOLD)
|
|
2712
|
+
}),
|
|
2713
|
+
"data-draggable": true,
|
|
2642
2714
|
className: styles$2.track,
|
|
2643
2715
|
title: intl.formatMessage({
|
|
2644
2716
|
id: "G1Gyjn",
|
|
@@ -2648,10 +2720,10 @@ var SeekBar = function SeekBar(_ref3) {
|
|
|
2648
2720
|
}]
|
|
2649
2721
|
}),
|
|
2650
2722
|
"aria-label": intl.formatMessage({
|
|
2651
|
-
id: "
|
|
2723
|
+
id: "2prwZ7",
|
|
2652
2724
|
defaultMessage: [{
|
|
2653
2725
|
"type": 0,
|
|
2654
|
-
"value": "
|
|
2726
|
+
"value": "Progress slider"
|
|
2655
2727
|
}]
|
|
2656
2728
|
}),
|
|
2657
2729
|
tabIndex: focusable ? '0' : '-1'
|
|
@@ -2661,7 +2733,7 @@ SeekBar.propTypes = propTypes$5;
|
|
|
2661
2733
|
SeekBar.defaultProps = defaultProps$5;
|
|
2662
2734
|
var SeekBar$1 = SeekBar;
|
|
2663
2735
|
|
|
2664
|
-
var styles$1 = {"suggest":"micromag-viewer-partials-playback-controls-suggest","playPauseButton":"micromag-viewer-partials-playback-controls-playPauseButton","muteButton":"micromag-viewer-partials-playback-controls-muteButton","container":"micromag-viewer-partials-playback-controls-container","icon":"micromag-viewer-partials-playback-controls-icon","offset":"micromag-viewer-partials-playback-controls-offset","spinner":"micromag-viewer-partials-playback-controls-spinner","withPlayPause":"micromag-viewer-partials-playback-controls-withPlayPause","withSuggestPlay":"micromag-viewer-partials-playback-controls-withSuggestPlay","isCollapsed":"micromag-viewer-partials-playback-controls-isCollapsed","loading":"micromag-viewer-partials-playback-controls-loading","hidden":"micromag-viewer-partials-playback-controls-hidden","notPlaying":"micromag-viewer-partials-playback-controls-notPlaying","isMuted":"micromag-viewer-partials-playback-controls-isMuted","withMute":"micromag-viewer-partials-playback-controls-withMute","withSeekBar":"micromag-viewer-partials-playback-controls-withSeekBar","seekBar":"micromag-viewer-partials-playback-controls-seekBar","withSeekBarOnly":"micromag-viewer-partials-playback-controls-withSeekBarOnly"};
|
|
2736
|
+
var styles$1 = {"suggest":"micromag-viewer-partials-playback-controls-suggest","playPauseButton":"micromag-viewer-partials-playback-controls-playPauseButton","muteButton":"micromag-viewer-partials-playback-controls-muteButton","container":"micromag-viewer-partials-playback-controls-container","icon":"micromag-viewer-partials-playback-controls-icon","offset":"micromag-viewer-partials-playback-controls-offset","spinner":"micromag-viewer-partials-playback-controls-spinner","withPlayPause":"micromag-viewer-partials-playback-controls-withPlayPause","withSuggestPlay":"micromag-viewer-partials-playback-controls-withSuggestPlay","isCollapsed":"micromag-viewer-partials-playback-controls-isCollapsed","loading":"micromag-viewer-partials-playback-controls-loading","hidden":"micromag-viewer-partials-playback-controls-hidden","focus-visible":"micromag-viewer-partials-playback-controls-focus-visible","notPlaying":"micromag-viewer-partials-playback-controls-notPlaying","isMuted":"micromag-viewer-partials-playback-controls-isMuted","withMute":"micromag-viewer-partials-playback-controls-withMute","withSeekBar":"micromag-viewer-partials-playback-controls-withSeekBar","seekBar":"micromag-viewer-partials-playback-controls-seekBar","withSeekBarOnly":"micromag-viewer-partials-playback-controls-withSeekBarOnly"};
|
|
2665
2737
|
|
|
2666
2738
|
var propTypes$4 = {
|
|
2667
2739
|
defaultColor: PropTypes.shape({
|
|
@@ -2729,6 +2801,9 @@ function PlaybackControls(_ref) {
|
|
|
2729
2801
|
buffering = _useMediaState.buffering,
|
|
2730
2802
|
playing = _useMediaState.playing,
|
|
2731
2803
|
muted = _useMediaState.muted;
|
|
2804
|
+
|
|
2805
|
+
// console.log(controlsVisible);
|
|
2806
|
+
|
|
2732
2807
|
React.useEffect(function () {
|
|
2733
2808
|
var id = null;
|
|
2734
2809
|
setShowLoading(false);
|
|
@@ -2795,7 +2870,9 @@ function PlaybackControls(_ref) {
|
|
|
2795
2870
|
setPlaying(false);
|
|
2796
2871
|
}
|
|
2797
2872
|
}, [playing, setWasPlaying, setPlaying]);
|
|
2798
|
-
var onSeek = React.useCallback(
|
|
2873
|
+
var onSeek = React.useCallback(
|
|
2874
|
+
// eslint-disable-next-line no-unused-vars
|
|
2875
|
+
function (progress) {
|
|
2799
2876
|
if (mediaElement !== null) {
|
|
2800
2877
|
mediaElement.currentTime = progress * mediaElement.duration;
|
|
2801
2878
|
}
|
|
@@ -2825,21 +2902,8 @@ function PlaybackControls(_ref) {
|
|
|
2825
2902
|
}) : /*#__PURE__*/React.createElement(components.PlayIcon, {
|
|
2826
2903
|
className: styles$1.icon
|
|
2827
2904
|
});
|
|
2828
|
-
var playLabel = playing ? intl.formatMessage({
|
|
2829
|
-
id: "mTqcmA",
|
|
2830
|
-
defaultMessage: [{
|
|
2831
|
-
"type": 0,
|
|
2832
|
-
"value": "Pause"
|
|
2833
|
-
}]
|
|
2834
|
-
}) : intl.formatMessage({
|
|
2835
|
-
id: "ahSpiH",
|
|
2836
|
-
defaultMessage: [{
|
|
2837
|
-
"type": 0,
|
|
2838
|
-
"value": "Play"
|
|
2839
|
-
}]
|
|
2840
|
-
});
|
|
2841
2905
|
return /*#__PURE__*/React.createElement("div", {
|
|
2842
|
-
className: classNames([styles$1.container, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, className, className !== null), styles$1.withPlayPause, controls && (!seekBarOnly || !playing)), styles$1.withSuggestPlay, controlsSuggestPlay), styles$1.withMute, hasMedia || controls), styles$1.withSeekBar, controls), styles$1.withSeekBarOnly, seekBarOnly), styles$1.isCollapsed, isCollapsed), styles$1.isMuted, muted), collapsedClassName, collapsedClassName !== null && isCollapsed)])
|
|
2906
|
+
className: classNames([styles$1.container, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, className, className !== null), styles$1.withPlayPause, controlsVisible && controls && (!seekBarOnly || !playing)), styles$1.withSuggestPlay, controlsSuggestPlay), styles$1.withMute, hasMedia || controls), styles$1.withSeekBar, controls), styles$1.withSeekBarOnly, seekBarOnly), styles$1.isCollapsed, isCollapsed), styles$1.isMuted, muted), collapsedClassName, collapsedClassName !== null && isCollapsed)])
|
|
2843
2907
|
}, controlsSuggestPlay && !finalShowLoading ? /*#__PURE__*/React.createElement(components.Button, {
|
|
2844
2908
|
className: classNames([styles$1.suggest]),
|
|
2845
2909
|
style: {
|
|
@@ -2850,32 +2914,40 @@ function PlaybackControls(_ref) {
|
|
|
2850
2914
|
icon: /*#__PURE__*/React.createElement(components.PlayIcon, {
|
|
2851
2915
|
className: classNames([styles$1.icon, styles$1.offset])
|
|
2852
2916
|
}),
|
|
2917
|
+
"aria-pressed": !playing,
|
|
2853
2918
|
"aria-label": intl.formatMessage({
|
|
2854
|
-
id: "
|
|
2919
|
+
id: "mTqcmA",
|
|
2855
2920
|
defaultMessage: [{
|
|
2856
2921
|
"type": 0,
|
|
2857
|
-
"value": "
|
|
2922
|
+
"value": "Pause"
|
|
2858
2923
|
}]
|
|
2859
2924
|
}),
|
|
2860
2925
|
withoutBootstrapStyles: true
|
|
2861
2926
|
}) : null, /*#__PURE__*/React.createElement(components.Button, {
|
|
2862
|
-
className: classNames([styles$1.playPauseButton, _defineProperty(_defineProperty({}, styles$1.hidden, controlsSuggestPlay && !controls), styles$1.loading, finalShowLoading)]),
|
|
2927
|
+
className: classNames([styles$1.playPauseButton, _defineProperty(_defineProperty({}, styles$1.hidden, !controlsVisible || controlsSuggestPlay && !controls), styles$1.loading, finalShowLoading)]),
|
|
2863
2928
|
style: {
|
|
2864
2929
|
color: color
|
|
2865
2930
|
},
|
|
2866
2931
|
onClick: playing ? onPause : onPlay,
|
|
2867
|
-
focusable: controlsVisible,
|
|
2932
|
+
focusable: controls && controlsVisible && (!seekBarOnly || !playing),
|
|
2868
2933
|
disabled: finalShowLoading,
|
|
2869
2934
|
icon: finalShowLoading ? /*#__PURE__*/React.createElement(components.Spinner, {
|
|
2870
2935
|
className: classNames([styles$1.spinner, styles$1.offset])
|
|
2871
2936
|
}) : playIcon,
|
|
2937
|
+
"aria-pressed": !playing,
|
|
2872
2938
|
"aria-label": finalShowLoading ? intl.formatMessage({
|
|
2873
2939
|
id: "YyYrXp",
|
|
2874
2940
|
defaultMessage: [{
|
|
2875
2941
|
"type": 0,
|
|
2876
2942
|
"value": "Loading"
|
|
2877
2943
|
}]
|
|
2878
|
-
}) :
|
|
2944
|
+
}) : intl.formatMessage({
|
|
2945
|
+
id: "mTqcmA",
|
|
2946
|
+
defaultMessage: [{
|
|
2947
|
+
"type": 0,
|
|
2948
|
+
"value": "Pause"
|
|
2949
|
+
}]
|
|
2950
|
+
}),
|
|
2879
2951
|
withoutBootstrapStyles: true
|
|
2880
2952
|
}), /*#__PURE__*/React.createElement(SeekBar$1, {
|
|
2881
2953
|
className: styles$1.seekBar,
|
|
@@ -2885,7 +2957,7 @@ function PlaybackControls(_ref) {
|
|
|
2885
2957
|
onSeek: onSeek,
|
|
2886
2958
|
onSeekStart: onSeekStart,
|
|
2887
2959
|
onSeekEnd: onSeekEnd,
|
|
2888
|
-
focusable:
|
|
2960
|
+
focusable: controls && controlsVisible && !seekBarOnly,
|
|
2889
2961
|
collapsed: isCollapsed,
|
|
2890
2962
|
withSeekHead: !isCollapsed && !seekBarOnly,
|
|
2891
2963
|
backgroundColor: color,
|
|
@@ -2902,18 +2974,13 @@ function PlaybackControls(_ref) {
|
|
|
2902
2974
|
}) : /*#__PURE__*/React.createElement(components.MuteIcon, {
|
|
2903
2975
|
className: styles$1.icon
|
|
2904
2976
|
}),
|
|
2905
|
-
"aria-
|
|
2977
|
+
"aria-pressed": !muted,
|
|
2978
|
+
"aria-label": intl.formatMessage({
|
|
2906
2979
|
id: "RK/QEY",
|
|
2907
2980
|
defaultMessage: [{
|
|
2908
2981
|
"type": 0,
|
|
2909
2982
|
"value": "Unmute"
|
|
2910
2983
|
}]
|
|
2911
|
-
}) : intl.formatMessage({
|
|
2912
|
-
id: "vzg8Es",
|
|
2913
|
-
defaultMessage: [{
|
|
2914
|
-
"type": 0,
|
|
2915
|
-
"value": "Mute"
|
|
2916
|
-
}]
|
|
2917
2984
|
}),
|
|
2918
2985
|
withoutBootstrapStyles: true
|
|
2919
2986
|
}));
|
|
@@ -2921,19 +2988,22 @@ function PlaybackControls(_ref) {
|
|
|
2921
2988
|
PlaybackControls.propTypes = propTypes$4;
|
|
2922
2989
|
PlaybackControls.defaultProps = defaultProps$4;
|
|
2923
2990
|
|
|
2924
|
-
var styles = {"container":"micromag-viewer-partials-web-view-container","opened":"micromag-viewer-partials-web-view-opened"};
|
|
2991
|
+
var styles = {"container":"micromag-viewer-partials-web-view-container","focusLock":"micromag-viewer-partials-web-view-focusLock","opened":"micromag-viewer-partials-web-view-opened"};
|
|
2925
2992
|
|
|
2926
2993
|
var _excluded$2 = ["opened", "close", "open", "update", "url"];
|
|
2927
2994
|
var propTypes$3 = {
|
|
2995
|
+
onChange: PropTypes.func,
|
|
2928
2996
|
className: PropTypes.string,
|
|
2929
2997
|
style: PropTypes.object
|
|
2930
2998
|
};
|
|
2931
2999
|
var defaultProps$3 = {
|
|
3000
|
+
onChange: null,
|
|
2932
3001
|
className: null,
|
|
2933
3002
|
style: null
|
|
2934
3003
|
};
|
|
2935
3004
|
function WebViewContainer(_ref) {
|
|
2936
|
-
var
|
|
3005
|
+
var onChange = _ref.onChange,
|
|
3006
|
+
className = _ref.className,
|
|
2937
3007
|
style = _ref.style;
|
|
2938
3008
|
var _useViewerWebView = contexts.useViewerWebView(),
|
|
2939
3009
|
opened = _useViewerWebView.opened,
|
|
@@ -2948,13 +3018,15 @@ function WebViewContainer(_ref) {
|
|
|
2948
3018
|
enableInteraction = _useViewerInteraction.enableInteraction;
|
|
2949
3019
|
var _usePlaybackContext = contexts.usePlaybackContext(),
|
|
2950
3020
|
playing = _usePlaybackContext.playing,
|
|
2951
|
-
setPlaying = _usePlaybackContext.setPlaying
|
|
3021
|
+
setPlaying = _usePlaybackContext.setPlaying,
|
|
3022
|
+
hideControls = _usePlaybackContext.hideControls,
|
|
3023
|
+
showControls = _usePlaybackContext.showControls;
|
|
2952
3024
|
var wasPlayingRef = React.useRef(playing);
|
|
2953
3025
|
var _useState = React.useState(url),
|
|
2954
3026
|
_useState2 = _slicedToArray(_useState, 2),
|
|
2955
3027
|
currentUrl = _useState2[0],
|
|
2956
3028
|
setCurrentUrl = _useState2[1];
|
|
2957
|
-
var
|
|
3029
|
+
var ref = React.useRef(null);
|
|
2958
3030
|
|
|
2959
3031
|
// Handle current webview url
|
|
2960
3032
|
React.useEffect(function () {
|
|
@@ -2966,35 +3038,47 @@ function WebViewContainer(_ref) {
|
|
|
2966
3038
|
if (url === null) {
|
|
2967
3039
|
setCurrentUrl(null);
|
|
2968
3040
|
}
|
|
2969
|
-
|
|
3041
|
+
if (onChange !== null) {
|
|
3042
|
+
onChange(opened);
|
|
3043
|
+
}
|
|
3044
|
+
}, [url, setCurrentUrl, onChange]);
|
|
2970
3045
|
|
|
2971
3046
|
// Disable interaction and pause playback
|
|
2972
3047
|
React.useEffect(function () {
|
|
2973
3048
|
if (opened) {
|
|
2974
3049
|
disableInteraction();
|
|
3050
|
+
hideControls();
|
|
2975
3051
|
wasPlayingRef.current = playing;
|
|
2976
3052
|
if (playing) {
|
|
2977
3053
|
setPlaying(false);
|
|
2978
3054
|
}
|
|
2979
|
-
iframeRef.current.focus();
|
|
2980
3055
|
} else {
|
|
2981
3056
|
enableInteraction();
|
|
3057
|
+
showControls();
|
|
2982
3058
|
if (wasPlayingRef.current && !playing) {
|
|
2983
3059
|
wasPlayingRef.current = false;
|
|
2984
3060
|
setPlaying(true);
|
|
2985
3061
|
}
|
|
2986
3062
|
}
|
|
2987
3063
|
}, [opened]);
|
|
3064
|
+
var keyboardShortcuts = React.useMemo(function () {
|
|
3065
|
+
return {
|
|
3066
|
+
escape: function escape() {
|
|
3067
|
+
close();
|
|
3068
|
+
}
|
|
3069
|
+
};
|
|
3070
|
+
}, [close]);
|
|
3071
|
+
useKeyboardShortcuts(keyboardShortcuts);
|
|
2988
3072
|
return /*#__PURE__*/React.createElement("div", {
|
|
2989
3073
|
className: classNames([styles.container, _defineProperty(_defineProperty({}, styles.opened, opened), className, className !== null)]),
|
|
2990
3074
|
style: style,
|
|
2991
|
-
onTransitionEnd: onTransitionEnd
|
|
3075
|
+
onTransitionEnd: onTransitionEnd,
|
|
3076
|
+
ref: ref
|
|
2992
3077
|
}, /*#__PURE__*/React.createElement(WebView, Object.assign({
|
|
2993
3078
|
url: url || currentUrl
|
|
2994
3079
|
}, webViewProps, {
|
|
2995
3080
|
closeable: opened,
|
|
2996
3081
|
focusable: opened,
|
|
2997
|
-
iframeRef: iframeRef,
|
|
2998
3082
|
className: styles.webView,
|
|
2999
3083
|
onClose: close
|
|
3000
3084
|
})));
|
|
@@ -3157,6 +3241,7 @@ var Viewer = function Viewer(_ref) {
|
|
|
3157
3241
|
screensMedias = _ref.screensMedias,
|
|
3158
3242
|
screenSizeOptions = _ref.screenSizeOptions,
|
|
3159
3243
|
className = _ref.className;
|
|
3244
|
+
var intl = reactIntl.useIntl();
|
|
3160
3245
|
/**
|
|
3161
3246
|
* Screen Data + Processing
|
|
3162
3247
|
*/
|
|
@@ -3208,13 +3293,20 @@ var Viewer = function Viewer(_ref) {
|
|
|
3208
3293
|
* Screen Layout
|
|
3209
3294
|
*/
|
|
3210
3295
|
var _ref5 = viewerTheme || {},
|
|
3211
|
-
textStyles = _ref5.textStyles
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3296
|
+
textStyles = _ref5.textStyles,
|
|
3297
|
+
colors = _ref5.colors;
|
|
3298
|
+
var _ref6 = colors || {},
|
|
3299
|
+
_ref6$primary = _ref6.primary,
|
|
3300
|
+
primaryColor = _ref6$primary === void 0 ? null : _ref6$primary,
|
|
3301
|
+
_ref6$focus = _ref6.focus,
|
|
3302
|
+
focusColor = _ref6$focus === void 0 ? null : _ref6$focus;
|
|
3303
|
+
var finalFocusColor = utils.getColorAsString(focusColor || primaryColor);
|
|
3304
|
+
var _ref7 = textStyles || {},
|
|
3305
|
+
_ref7$title = _ref7.title,
|
|
3306
|
+
themeTextStyle = _ref7$title === void 0 ? null : _ref7$title;
|
|
3307
|
+
var _ref8 = themeTextStyle || {},
|
|
3308
|
+
_ref8$fontFamily = _ref8.fontFamily,
|
|
3309
|
+
themeFont = _ref8$fontFamily === void 0 ? null : _ref8$fontFamily;
|
|
3218
3310
|
|
|
3219
3311
|
// Fonts
|
|
3220
3312
|
var finalFonts = React.useMemo(function () {
|
|
@@ -3231,8 +3323,9 @@ var Viewer = function Viewer(_ref) {
|
|
|
3231
3323
|
var isEditor = renderContext === 'edit';
|
|
3232
3324
|
var withoutScreensTransforms = isStatic || isCapture;
|
|
3233
3325
|
var _usePlaybackContext = contexts.usePlaybackContext(),
|
|
3234
|
-
playing = _usePlaybackContext.playing
|
|
3235
|
-
_usePlaybackContext
|
|
3326
|
+
playing = _usePlaybackContext.playing;
|
|
3327
|
+
_usePlaybackContext.setControls;
|
|
3328
|
+
var _usePlaybackContext$c = _usePlaybackContext.controls,
|
|
3236
3329
|
playbackControls = _usePlaybackContext$c === void 0 ? false : _usePlaybackContext$c,
|
|
3237
3330
|
_usePlaybackContext$c2 = _usePlaybackContext.controlsVisible,
|
|
3238
3331
|
playbackcontrolsVisible = _usePlaybackContext$c2 === void 0 ? false : _usePlaybackContext$c2,
|
|
@@ -3253,15 +3346,15 @@ var Viewer = function Viewer(_ref) {
|
|
|
3253
3346
|
viewerHeight = _useScreenSizeFromEle.fullHeight,
|
|
3254
3347
|
screenSize = _useScreenSizeFromEle.screenSize,
|
|
3255
3348
|
screenScale = _useScreenSizeFromEle.scale;
|
|
3256
|
-
var
|
|
3257
|
-
|
|
3258
|
-
screenWidth =
|
|
3259
|
-
|
|
3260
|
-
screenHeight =
|
|
3261
|
-
|
|
3262
|
-
landscape =
|
|
3263
|
-
|
|
3264
|
-
menuOverScreen =
|
|
3349
|
+
var _ref9 = screenSize || {},
|
|
3350
|
+
_ref9$width = _ref9.width,
|
|
3351
|
+
screenWidth = _ref9$width === void 0 ? null : _ref9$width,
|
|
3352
|
+
_ref9$height = _ref9.height,
|
|
3353
|
+
screenHeight = _ref9$height === void 0 ? null : _ref9$height,
|
|
3354
|
+
_ref9$landscape = _ref9.landscape,
|
|
3355
|
+
landscape = _ref9$landscape === void 0 ? false : _ref9$landscape,
|
|
3356
|
+
_ref9$menuOverScreen = _ref9.menuOverScreen,
|
|
3357
|
+
menuOverScreen = _ref9$menuOverScreen === void 0 ? false : _ref9$menuOverScreen;
|
|
3265
3358
|
var screenContainerWidth = screenScale !== null ? screenWidth * screenScale : screenWidth;
|
|
3266
3359
|
var screenContainerHeight = screenScale !== null ? screenHeight * screenScale : screenHeight;
|
|
3267
3360
|
var hasSize = screenWidth > 0 && screenHeight > 0;
|
|
@@ -3281,6 +3374,16 @@ var Viewer = function Viewer(_ref) {
|
|
|
3281
3374
|
}
|
|
3282
3375
|
}, [ready, landscape, menuOverScreen, onViewModeChange]);
|
|
3283
3376
|
|
|
3377
|
+
// CSS variable
|
|
3378
|
+
React.useEffect(function () {
|
|
3379
|
+
if (containerRef.current === null) {
|
|
3380
|
+
return;
|
|
3381
|
+
}
|
|
3382
|
+
if (finalFocusColor !== null) {
|
|
3383
|
+
containerRef.current.style.setProperty('--micromag-focus-color', finalFocusColor);
|
|
3384
|
+
}
|
|
3385
|
+
}, [finalFocusColor]);
|
|
3386
|
+
|
|
3284
3387
|
/**
|
|
3285
3388
|
* Screen Transitions
|
|
3286
3389
|
*/
|
|
@@ -3300,11 +3403,11 @@ var Viewer = function Viewer(_ref) {
|
|
|
3300
3403
|
onScreenChange(screens[index], index);
|
|
3301
3404
|
}
|
|
3302
3405
|
}, [screenIndex, screens, onScreenChange]);
|
|
3303
|
-
var onScreenNavigate = React.useCallback(function (
|
|
3304
|
-
var index =
|
|
3305
|
-
newIndex =
|
|
3306
|
-
end =
|
|
3307
|
-
direction =
|
|
3406
|
+
var onScreenNavigate = React.useCallback(function (_ref10) {
|
|
3407
|
+
var index = _ref10.index,
|
|
3408
|
+
newIndex = _ref10.newIndex,
|
|
3409
|
+
end = _ref10.end,
|
|
3410
|
+
direction = _ref10.direction;
|
|
3308
3411
|
if (end && onEnd !== null) {
|
|
3309
3412
|
onEnd();
|
|
3310
3413
|
}
|
|
@@ -3352,13 +3455,13 @@ var Viewer = function Viewer(_ref) {
|
|
|
3352
3455
|
currentScreenInteractionEnabled = _useScreenInteraction.currentScreenInteractionEnabled,
|
|
3353
3456
|
enableInteraction = _useScreenInteraction.enableInteraction,
|
|
3354
3457
|
disableInteraction = _useScreenInteraction.disableInteraction;
|
|
3355
|
-
var onTap = React.useCallback(function (
|
|
3356
|
-
var currentTarget =
|
|
3357
|
-
event =
|
|
3358
|
-
target =
|
|
3359
|
-
|
|
3360
|
-
x =
|
|
3361
|
-
y =
|
|
3458
|
+
var onTap = React.useCallback(function (_ref11) {
|
|
3459
|
+
var currentTarget = _ref11.currentTarget,
|
|
3460
|
+
event = _ref11.event,
|
|
3461
|
+
target = _ref11.target,
|
|
3462
|
+
_ref11$xy = _slicedToArray(_ref11.xy, 2),
|
|
3463
|
+
x = _ref11$xy[0],
|
|
3464
|
+
y = _ref11$xy[1];
|
|
3362
3465
|
if (event) {
|
|
3363
3466
|
event.stopPropagation();
|
|
3364
3467
|
}
|
|
@@ -3371,12 +3474,12 @@ var Viewer = function Viewer(_ref) {
|
|
|
3371
3474
|
y: y
|
|
3372
3475
|
});
|
|
3373
3476
|
}, [interactWithScreen, screenIndex]);
|
|
3374
|
-
var computeScreenProgress = React.useCallback(function (
|
|
3375
|
-
var active =
|
|
3376
|
-
|
|
3377
|
-
mx =
|
|
3378
|
-
|
|
3379
|
-
vx =
|
|
3477
|
+
var computeScreenProgress = React.useCallback(function (_ref12) {
|
|
3478
|
+
var active = _ref12.active,
|
|
3479
|
+
_ref12$movement = _slicedToArray(_ref12.movement, 1),
|
|
3480
|
+
mx = _ref12$movement[0],
|
|
3481
|
+
_ref12$velocity = _slicedToArray(_ref12.velocity, 1),
|
|
3482
|
+
vx = _ref12$velocity[0];
|
|
3380
3483
|
var p = mx / screenContainerWidth; // drag "ratio": how much of the screen width has been swiped?
|
|
3381
3484
|
var forwards = mx < 0; // true if swiping to left (to navigate forwards)
|
|
3382
3485
|
var newIndex = !forwards ? screenIndex - 1 : screenIndex + 1; // which item index are we moving towards?
|
|
@@ -3389,8 +3492,8 @@ var Viewer = function Viewer(_ref) {
|
|
|
3389
3492
|
}
|
|
3390
3493
|
return screenIndex - progress;
|
|
3391
3494
|
}, [screenContainerWidth, screenIndex]);
|
|
3392
|
-
var onScreenProgress = React.useCallback(function (progress,
|
|
3393
|
-
var active =
|
|
3495
|
+
var onScreenProgress = React.useCallback(function (progress, _ref13) {
|
|
3496
|
+
var active = _ref13.active;
|
|
3394
3497
|
var delta = Math.abs(progress - screenIndex);
|
|
3395
3498
|
var reachedBounds = progress < 0 || progress >= screensCount; // have we reached the end of the stack?
|
|
3396
3499
|
if (!active && delta === 1 && !reachedBounds) {
|
|
@@ -3427,9 +3530,12 @@ var Viewer = function Viewer(_ref) {
|
|
|
3427
3530
|
onProgress: onScreenProgress,
|
|
3428
3531
|
onTap: onTap,
|
|
3429
3532
|
springParams: springParams,
|
|
3430
|
-
|
|
3533
|
+
dragOptions: {
|
|
3431
3534
|
filterTaps: true,
|
|
3432
|
-
axis: 'x'
|
|
3535
|
+
axis: 'x',
|
|
3536
|
+
pointer: {
|
|
3537
|
+
keys: false
|
|
3538
|
+
}
|
|
3433
3539
|
}
|
|
3434
3540
|
}),
|
|
3435
3541
|
isDragging = _useDragProgress.dragging,
|
|
@@ -3486,11 +3592,11 @@ var Viewer = function Viewer(_ref) {
|
|
|
3486
3592
|
menuDotsContainerRef = _useDimensionObserver3.ref,
|
|
3487
3593
|
_useDimensionObserver4 = _useDimensionObserver3.height,
|
|
3488
3594
|
menuDotsContainerHeight = _useDimensionObserver4 === void 0 ? 0 : _useDimensionObserver4;
|
|
3489
|
-
var onClickScreen = React.useCallback(function (
|
|
3490
|
-
var itemScreenId =
|
|
3595
|
+
var onClickScreen = React.useCallback(function (_ref14) {
|
|
3596
|
+
var itemScreenId = _ref14.screenId;
|
|
3491
3597
|
onInteractionPrivate();
|
|
3492
|
-
var index = screens.findIndex(function (
|
|
3493
|
-
var id =
|
|
3598
|
+
var index = screens.findIndex(function (_ref15) {
|
|
3599
|
+
var id = _ref15.id;
|
|
3494
3600
|
return id === itemScreenId;
|
|
3495
3601
|
});
|
|
3496
3602
|
changeIndex(index);
|
|
@@ -3513,19 +3619,43 @@ var Viewer = function Viewer(_ref) {
|
|
|
3513
3619
|
return toggleFullscreen();
|
|
3514
3620
|
},
|
|
3515
3621
|
arrowleft: function arrowleft() {
|
|
3516
|
-
|
|
3622
|
+
if (!checkDraggable(document.activeElement)) {
|
|
3623
|
+
gotoPreviousScreen();
|
|
3624
|
+
}
|
|
3517
3625
|
},
|
|
3518
3626
|
arrowright: function arrowright() {
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
return gotoNextScreen();
|
|
3627
|
+
if (!checkDraggable(document.activeElement)) {
|
|
3628
|
+
gotoNextScreen();
|
|
3629
|
+
}
|
|
3523
3630
|
}
|
|
3631
|
+
// ' ': () => gotoNextScreen(),
|
|
3524
3632
|
};
|
|
3525
3633
|
}, [gotoPreviousScreen, gotoNextScreen]);
|
|
3526
3634
|
useKeyboardShortcuts(keyboardShortcuts, {
|
|
3527
3635
|
disabled: renderContext !== 'view'
|
|
3528
3636
|
});
|
|
3637
|
+
|
|
3638
|
+
// const onClickSkipToContent = useCallback(() => {
|
|
3639
|
+
// const contentElement = document.getElementById('content') || null;
|
|
3640
|
+
// if (contentElement !== null) {
|
|
3641
|
+
// contentElement.focus();
|
|
3642
|
+
// }
|
|
3643
|
+
// }, []);
|
|
3644
|
+
|
|
3645
|
+
var onClickSkipToPlaybackControls = React.useCallback(function () {
|
|
3646
|
+
var controlsElement = document.getElementById('controls');
|
|
3647
|
+
if (controlsElement) {
|
|
3648
|
+
var buttons = controlsElement.querySelectorAll('button[tabindex]');
|
|
3649
|
+
var firstFocusableButton = Array.from(buttons).find(function (button) {
|
|
3650
|
+
return button.tabIndex >= 0;
|
|
3651
|
+
});
|
|
3652
|
+
if (firstFocusableButton) {
|
|
3653
|
+
firstFocusableButton.focus({
|
|
3654
|
+
preventScroll: true
|
|
3655
|
+
});
|
|
3656
|
+
}
|
|
3657
|
+
}
|
|
3658
|
+
}, []);
|
|
3529
3659
|
var _useState5 = React.useState(null),
|
|
3530
3660
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
3531
3661
|
currentShareIncentive = _useState6[0],
|
|
@@ -3534,26 +3664,26 @@ var Viewer = function Viewer(_ref) {
|
|
|
3534
3664
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
3535
3665
|
shareIncentiveVisible = _useState8[0],
|
|
3536
3666
|
setShareIncentiveVisible = _useState8[1];
|
|
3537
|
-
var
|
|
3538
|
-
|
|
3539
|
-
header =
|
|
3540
|
-
var
|
|
3541
|
-
|
|
3542
|
-
shareIncentive =
|
|
3543
|
-
var
|
|
3544
|
-
|
|
3545
|
-
hasShareIncentive =
|
|
3546
|
-
_ref17$label = _ref17.label,
|
|
3547
|
-
shareIncentiveLabel = _ref17$label === void 0 ? null : _ref17$label;
|
|
3548
|
-
var _ref18 = currentShareIncentive || {},
|
|
3667
|
+
var _ref16 = currentScreen || {},
|
|
3668
|
+
_ref16$header = _ref16.header,
|
|
3669
|
+
header = _ref16$header === void 0 ? null : _ref16$header;
|
|
3670
|
+
var _ref17 = header || {},
|
|
3671
|
+
_ref17$shareIncentive = _ref17.shareIncentive,
|
|
3672
|
+
shareIncentive = _ref17$shareIncentive === void 0 ? null : _ref17$shareIncentive;
|
|
3673
|
+
var _ref18 = shareIncentive || {},
|
|
3674
|
+
_ref18$active = _ref18.active,
|
|
3675
|
+
hasShareIncentive = _ref18$active === void 0 ? false : _ref18$active,
|
|
3549
3676
|
_ref18$label = _ref18.label,
|
|
3550
|
-
|
|
3551
|
-
var _ref19 =
|
|
3552
|
-
_ref19$
|
|
3553
|
-
|
|
3554
|
-
var _ref20 =
|
|
3677
|
+
shareIncentiveLabel = _ref18$label === void 0 ? null : _ref18$label;
|
|
3678
|
+
var _ref19 = currentShareIncentive || {},
|
|
3679
|
+
_ref19$label = _ref19.label,
|
|
3680
|
+
currentShareIncentiveLabel = _ref19$label === void 0 ? null : _ref19$label;
|
|
3681
|
+
var _ref20 = shareIncentiveLabel || {},
|
|
3555
3682
|
_ref20$body = _ref20.body,
|
|
3556
|
-
|
|
3683
|
+
incentiveLabel = _ref20$body === void 0 ? null : _ref20$body;
|
|
3684
|
+
var _ref21 = currentShareIncentiveLabel || {},
|
|
3685
|
+
_ref21$body = _ref21.body,
|
|
3686
|
+
currentIncentiveLabel = _ref21$body === void 0 ? null : _ref21$body;
|
|
3557
3687
|
React.useEffect(function () {
|
|
3558
3688
|
setShareIncentiveVisible(true);
|
|
3559
3689
|
if (hasShareIncentive && shareIncentiveLabel !== currentShareIncentiveLabel) {
|
|
@@ -3622,7 +3752,62 @@ var Viewer = function Viewer(_ref) {
|
|
|
3622
3752
|
}), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, styles$6.landscape, landscape), styles$6.withoutGestures, withoutGestures), styles$6.hideMenu, !menuVisible), styles$6.disableMenu, navigationDisabled), styles$6.fadeMenu, playing && playbackControls && !playbackcontrolsVisible), styles$6.ready, ready || withoutScreensTransforms), styles$6.hasInteracted, hasInteracted), styles$6.isDragging, isDragging), className, className)]),
|
|
3623
3753
|
ref: containerRef,
|
|
3624
3754
|
onContextMenu: onContextMenu
|
|
3625
|
-
},
|
|
3755
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
3756
|
+
className: styles$6.ariaAnnouncement,
|
|
3757
|
+
id: "announce",
|
|
3758
|
+
"aria-live": "polite"
|
|
3759
|
+
}, /*#__PURE__*/React.createElement(reactIntl.FormattedMessage, {
|
|
3760
|
+
id: "AIr8rM",
|
|
3761
|
+
defaultMessage: [{
|
|
3762
|
+
"type": 0,
|
|
3763
|
+
"value": "Screen "
|
|
3764
|
+
}, {
|
|
3765
|
+
"type": 1,
|
|
3766
|
+
"value": "current"
|
|
3767
|
+
}, {
|
|
3768
|
+
"type": 0,
|
|
3769
|
+
"value": " of "
|
|
3770
|
+
}, {
|
|
3771
|
+
"type": 1,
|
|
3772
|
+
"value": "length"
|
|
3773
|
+
}],
|
|
3774
|
+
values: {
|
|
3775
|
+
current: screenIndex + 1,
|
|
3776
|
+
length: screens.length
|
|
3777
|
+
}
|
|
3778
|
+
})), /*#__PURE__*/React.createElement("nav", {
|
|
3779
|
+
"aria-label": intl.formatMessage({
|
|
3780
|
+
id: "gfZs4J",
|
|
3781
|
+
defaultMessage: [{
|
|
3782
|
+
"type": 0,
|
|
3783
|
+
"value": "Skip Links"
|
|
3784
|
+
}]
|
|
3785
|
+
}),
|
|
3786
|
+
className: styles$6.accessibilityLinks
|
|
3787
|
+
}, /*#__PURE__*/React.createElement(Button$1, {
|
|
3788
|
+
onClick: onClickSkipToPlaybackControls,
|
|
3789
|
+
"aria-disabled": withoutPlaybackControls || !playbackcontrolsVisible,
|
|
3790
|
+
"aria-describedby": "disabledReason",
|
|
3791
|
+
className: classNames([styles$6.accessibilityButton, _defineProperty({}, styles$6.disabled, withoutPlaybackControls || !playbackcontrolsVisible)])
|
|
3792
|
+
}, /*#__PURE__*/React.createElement(reactIntl.FormattedMessage, {
|
|
3793
|
+
id: "CnVj9r",
|
|
3794
|
+
defaultMessage: [{
|
|
3795
|
+
"type": 0,
|
|
3796
|
+
"value": "Skip to controls"
|
|
3797
|
+
}]
|
|
3798
|
+
})), withoutPlaybackControls || !playbackcontrolsVisible ? /*#__PURE__*/React.createElement("div", {
|
|
3799
|
+
role: "tooltip",
|
|
3800
|
+
className: styles$6.tooltipBox,
|
|
3801
|
+
id: "disabledReason"
|
|
3802
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
3803
|
+
className: styles$6.tooltip
|
|
3804
|
+
}, /*#__PURE__*/React.createElement(reactIntl.FormattedMessage, {
|
|
3805
|
+
id: "YXhRxW",
|
|
3806
|
+
defaultMessage: [{
|
|
3807
|
+
"type": 0,
|
|
3808
|
+
"value": "No controls available"
|
|
3809
|
+
}]
|
|
3810
|
+
}))) : null), !withoutMenu ? /*#__PURE__*/React.createElement(ViewerMenu$1, {
|
|
3626
3811
|
story: parsedStory,
|
|
3627
3812
|
currentScreenIndex: screenIndex,
|
|
3628
3813
|
withShadow: menuOverScreen && !withoutMenuShadow,
|
|
@@ -3652,7 +3837,14 @@ var Viewer = function Viewer(_ref) {
|
|
|
3652
3837
|
}, dragContentBind()), !withoutNavigationArrow && !withNeighborScreens && !navigationDisabled && screenIndex > 0 && screens.length > 1 ? /*#__PURE__*/React.createElement(NavigationButton$1, {
|
|
3653
3838
|
direction: "previous",
|
|
3654
3839
|
className: classNames([styles$6.navButton, styles$6.previous]),
|
|
3655
|
-
onClick: gotoPreviousScreen
|
|
3840
|
+
onClick: gotoPreviousScreen,
|
|
3841
|
+
ariaLabel: intl.formatMessage({
|
|
3842
|
+
id: "zYH/31",
|
|
3843
|
+
defaultMessage: [{
|
|
3844
|
+
"type": 0,
|
|
3845
|
+
"value": "Go to previous screen"
|
|
3846
|
+
}]
|
|
3847
|
+
})
|
|
3656
3848
|
}) : null, /*#__PURE__*/React.createElement("div", {
|
|
3657
3849
|
className: styles$6.screensFrame,
|
|
3658
3850
|
style: {
|
|
@@ -3666,7 +3858,10 @@ var Viewer = function Viewer(_ref) {
|
|
|
3666
3858
|
var screenStyles = getScreenStylesByIndex(i, progressSpring);
|
|
3667
3859
|
return /*#__PURE__*/React.createElement(web.animated.div, {
|
|
3668
3860
|
key: "screen-viewer-".concat(screen.id || '', "-").concat(i + 1),
|
|
3861
|
+
id: current ? 'content' : null,
|
|
3862
|
+
"aria-hidden": !current,
|
|
3669
3863
|
style: screenStyles,
|
|
3864
|
+
tabIndex: current ? 0 : -1,
|
|
3670
3865
|
className: classNames([styles$6.screenContainer, _defineProperty({}, styles$6.current, current)])
|
|
3671
3866
|
}, screen !== null ? /*#__PURE__*/React.createElement(ViewerScreen, {
|
|
3672
3867
|
className: styles$6.screen,
|
|
@@ -3687,9 +3882,17 @@ var Viewer = function Viewer(_ref) {
|
|
|
3687
3882
|
})), !withoutNavigationArrow && !withNeighborScreens && !navigationDisabled && screenIndex < screens.length - 1 ? /*#__PURE__*/React.createElement(NavigationButton$1, {
|
|
3688
3883
|
direction: "next",
|
|
3689
3884
|
className: classNames([styles$6.navButton, styles$6.next]),
|
|
3690
|
-
onClick: gotoNextScreen
|
|
3885
|
+
onClick: gotoNextScreen,
|
|
3886
|
+
ariaLabel: intl.formatMessage({
|
|
3887
|
+
id: "v9bqYj",
|
|
3888
|
+
defaultMessage: [{
|
|
3889
|
+
"type": 0,
|
|
3890
|
+
"value": "Go to next screen"
|
|
3891
|
+
}]
|
|
3892
|
+
})
|
|
3691
3893
|
}) : null, !withoutPlaybackControls ? /*#__PURE__*/React.createElement("div", {
|
|
3692
3894
|
className: styles$6.playbackControls,
|
|
3895
|
+
id: "controls",
|
|
3693
3896
|
ref: playbackControlsContainerRef
|
|
3694
3897
|
}, /*#__PURE__*/React.createElement(PlaybackControls, {
|
|
3695
3898
|
className: styles$6.controls
|