@prom-ui/core 1.7.1 → 1.8.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.
- package/Avatar/package.json +1 -1
- package/Backdrop/cjs/index.development.js +7 -2
- package/Backdrop/cjs/index.development.v2.js +7 -2
- package/Backdrop/cjs/index.production.js +1 -1
- package/Backdrop/cjs/index.production.v2.js +1 -1
- package/Backdrop/index.d.ts +2 -0
- package/Backdrop/package.json +1 -1
- package/Body/package.json +1 -1
- package/BodyContext/package.json +1 -1
- package/BodyProvider/package.json +1 -1
- package/BodyScrollLock/cjs/index.development.js +87 -0
- package/BodyScrollLock/cjs/index.development.v2.js +87 -0
- package/BodyScrollLock/cjs/index.production.js +1 -0
- package/BodyScrollLock/cjs/index.production.v2.js +1 -0
- package/BodyScrollLock/cjs/style.development.css +1 -0
- package/BodyScrollLock/cjs/style.development.v2.css +1 -0
- package/BodyScrollLock/cjs/style.production.css +1 -0
- package/BodyScrollLock/cjs/style.production.v2.css +1 -0
- package/BodyScrollLock/index.d.ts +5 -0
- package/BodyScrollLock/index.js +7 -0
- package/BodyScrollLock/index.v2.js +7 -0
- package/BodyScrollLock/package.json +9 -0
- package/BodyScrollLock/utils.d.ts +1 -0
- package/Box/package.json +1 -1
- package/Button/package.json +1 -1
- package/ButtonPageUp/package.json +1 -1
- package/Checkbox/package.json +1 -1
- package/Flex/package.json +1 -1
- package/Grid/package.json +1 -1
- package/Icon/package.json +1 -1
- package/Image/package.json +1 -1
- package/ImageEmoji/package.json +1 -1
- package/Input/package.json +1 -1
- package/InputField/package.json +1 -1
- package/KeyPress/package.json +1 -1
- package/Line/package.json +1 -1
- package/Link/package.json +1 -1
- package/List/package.json +1 -1
- package/Media/package.json +1 -1
- package/OutsideClick/package.json +1 -1
- package/Overlay/cjs/index.development.js +11 -43
- package/Overlay/cjs/index.development.v2.js +11 -43
- package/Overlay/cjs/index.production.js +1 -1
- package/Overlay/cjs/index.production.v2.js +1 -1
- package/Overlay/index.d.ts +2 -4
- package/Overlay/package.json +1 -2
- package/PhotoGallery/cjs/index.development.js +7 -50
- package/PhotoGallery/cjs/index.development.v2.js +7 -50
- package/PhotoGallery/cjs/index.production.js +1 -1
- package/PhotoGallery/cjs/index.production.v2.js +1 -1
- package/PhotoGallery/package.json +1 -2
- package/Picture/package.json +1 -1
- package/Portal/package.json +1 -1
- package/QRCode/package.json +1 -1
- package/Rating/package.json +1 -1
- package/RatingSelect/package.json +1 -1
- package/SafeQuery/package.json +1 -1
- package/Scroll/package.json +1 -1
- package/ScrollControls/package.json +1 -1
- package/SimpleSlider/package.json +1 -1
- package/Skeleton/package.json +1 -1
- package/Spinner/package.json +1 -1
- package/Text/package.json +1 -1
- package/TextEmoji/package.json +1 -1
- package/Tooltip/package.json +1 -1
- package/Tumbler/package.json +1 -1
- package/package.json +2 -3
- package/useBodyTTag/package.json +1 -1
- package/useBrowserLayoutEffect/cjs/index.development.js +12 -0
- package/useBrowserLayoutEffect/cjs/index.development.v2.js +12 -0
- package/useBrowserLayoutEffect/cjs/index.production.js +1 -0
- package/useBrowserLayoutEffect/cjs/index.production.v2.js +1 -0
- package/useBrowserLayoutEffect/index.d.ts +5 -0
- package/useBrowserLayoutEffect/index.js +7 -0
- package/useBrowserLayoutEffect/index.v2.js +7 -0
- package/useBrowserLayoutEffect/package.json +9 -0
- package/useDebounce/package.json +1 -1
- package/useForwardRef/package.json +1 -1
- package/useId/package.json +1 -1
- package/useIsMounted/package.json +1 -1
- package/useKeyPress/package.json +1 -1
- package/useMedia/package.json +1 -1
- package/useOutsideClick/package.json +1 -1
- package/usePortal/package.json +1 -1
- package/useScrollPosition/package.json +1 -1
- package/Overlay/components/TouchScrollable.d.ts +0 -8
- package/PhotoGallery/components/TouchScrollable.d.ts +0 -9
|
@@ -3,21 +3,17 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var React = require('react');
|
|
6
|
-
var ScrollLock = require('react-scrolllock');
|
|
7
6
|
var reactTransitionGroup = require('react-transition-group');
|
|
8
7
|
var Backdrop = require('@prom-ui/core/Backdrop');
|
|
9
8
|
var KeyPress = require('@prom-ui/core/KeyPress');
|
|
10
9
|
var Portal = require('@prom-ui/core/Portal');
|
|
11
10
|
var ScrollControls = require('@prom-ui/core/ScrollControls');
|
|
12
|
-
var utils = require('react-scrolllock/dist/utils');
|
|
13
11
|
var Icon = require('@prom-ui/core/Icon');
|
|
14
12
|
var Play = require('@prom-ui/icons/Play');
|
|
15
13
|
var Button = require('@prom-ui/core/Button');
|
|
16
14
|
var useBodyTTag = require('@prom-ui/core/useBodyTTag');
|
|
17
15
|
var Close = require('@prom-ui/icons/Close');
|
|
18
16
|
|
|
19
|
-
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
20
|
-
|
|
21
17
|
function _interopNamespaceCompat(e) {
|
|
22
18
|
if (e && typeof e === 'object' && 'default' in e) return e;
|
|
23
19
|
var n = Object.create(null);
|
|
@@ -37,7 +33,6 @@ function _interopNamespaceCompat(e) {
|
|
|
37
33
|
}
|
|
38
34
|
|
|
39
35
|
var React__namespace = /*#__PURE__*/_interopNamespaceCompat(React);
|
|
40
|
-
var ScrollLock__default = /*#__PURE__*/_interopDefaultCompat(ScrollLock);
|
|
41
36
|
|
|
42
37
|
function _iterableToArrayLimit(arr, i) {
|
|
43
38
|
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
|
|
@@ -99,39 +94,6 @@ function _nonIterableRest() {
|
|
|
99
94
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
100
95
|
}
|
|
101
96
|
|
|
102
|
-
// FORK FROM https://github.com/jossmac/react-scrolllock/blob/master/src/TouchScrollable.js
|
|
103
|
-
|
|
104
|
-
function allowTouchMove(e) {
|
|
105
|
-
var target = e.currentTarget;
|
|
106
|
-
if (target.scrollHeight > target.clientHeight || target.scrollWidth > target.clientWidth) {
|
|
107
|
-
e.stopPropagation();
|
|
108
|
-
return true;
|
|
109
|
-
}
|
|
110
|
-
e.preventDefault();
|
|
111
|
-
return false;
|
|
112
|
-
}
|
|
113
|
-
var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
|
|
114
|
-
|
|
115
|
-
/* @ts-ignore */
|
|
116
|
-
var canUseEventListeners = canUseDOM && !!(window.addEventListener || window.attachEvent);
|
|
117
|
-
var TouchScrollable = function TouchScrollable(_ref) {
|
|
118
|
-
var _ref$isActive = _ref.isActive,
|
|
119
|
-
isActive = _ref$isActive === void 0 ? false : _ref$isActive,
|
|
120
|
-
scrollRef = _ref.scrollRef,
|
|
121
|
-
children = _ref.children;
|
|
122
|
-
React__namespace.useEffect(function () {
|
|
123
|
-
if (!isActive || !canUseEventListeners || !(scrollRef !== null && scrollRef !== void 0 && scrollRef.current)) return;
|
|
124
|
-
scrollRef.current.addEventListener('touchstart', utils.preventInertiaScroll, utils.listenerOptions);
|
|
125
|
-
scrollRef.current.addEventListener('touchmove', allowTouchMove, utils.listenerOptions);
|
|
126
|
-
return function () {
|
|
127
|
-
if (!isActive || !canUseEventListeners || !(scrollRef !== null && scrollRef !== void 0 && scrollRef.current)) return;
|
|
128
|
-
scrollRef.current.removeEventListener('touchstart', utils.preventInertiaScroll, utils.listenerOptions);
|
|
129
|
-
scrollRef.current.removeEventListener('touchmove', allowTouchMove, utils.listenerOptions);
|
|
130
|
-
};
|
|
131
|
-
});
|
|
132
|
-
return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, children);
|
|
133
|
-
};
|
|
134
|
-
|
|
135
97
|
var reqMap = new Map();
|
|
136
98
|
var scrollInToViewElement = function scrollInToViewElement(target, parent) {
|
|
137
99
|
var isAnimate = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
@@ -1108,10 +1070,7 @@ var MainPhotos = /*#__PURE__*/React__namespace.forwardRef(function (_ref, ref) {
|
|
|
1108
1070
|
showOnHover: true,
|
|
1109
1071
|
hideOnDisabled: true
|
|
1110
1072
|
}, function (scrollRef) {
|
|
1111
|
-
return /*#__PURE__*/React__namespace.createElement(
|
|
1112
|
-
scrollRef: scrollRef,
|
|
1113
|
-
isActive: true
|
|
1114
|
-
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
1073
|
+
return /*#__PURE__*/React__namespace.createElement("div", {
|
|
1115
1074
|
ref: scrollRef,
|
|
1116
1075
|
className: css.mainPhoto,
|
|
1117
1076
|
onScroll: onScroll
|
|
@@ -1133,7 +1092,7 @@ var MainPhotos = /*#__PURE__*/React__namespace.forwardRef(function (_ref, ref) {
|
|
|
1133
1092
|
src: previewSrc,
|
|
1134
1093
|
videoSrc: videoSrc
|
|
1135
1094
|
}));
|
|
1136
|
-
}))
|
|
1095
|
+
}));
|
|
1137
1096
|
});
|
|
1138
1097
|
});
|
|
1139
1098
|
|
|
@@ -1158,10 +1117,7 @@ var PreviewPhotos = /*#__PURE__*/React__namespace.forwardRef(function (_ref, ref
|
|
|
1158
1117
|
var _onClick = function onClick(index) {
|
|
1159
1118
|
onChange(index);
|
|
1160
1119
|
};
|
|
1161
|
-
return /*#__PURE__*/React__namespace.createElement(
|
|
1162
|
-
scrollRef: localScrollRef,
|
|
1163
|
-
isActive: true
|
|
1164
|
-
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
1120
|
+
return /*#__PURE__*/React__namespace.createElement("div", {
|
|
1165
1121
|
ref: localScrollRef,
|
|
1166
1122
|
className: css.preview
|
|
1167
1123
|
}, items.map(function (_ref2, index) {
|
|
@@ -1201,7 +1157,7 @@ var PreviewPhotos = /*#__PURE__*/React__namespace.forwardRef(function (_ref, ref
|
|
|
1201
1157
|
className: css.videoPlayLabelIcon,
|
|
1202
1158
|
"icon-as": Play.SvgPlay
|
|
1203
1159
|
}))));
|
|
1204
|
-
}))
|
|
1160
|
+
}));
|
|
1205
1161
|
});
|
|
1206
1162
|
|
|
1207
1163
|
var _templateObject;
|
|
@@ -1325,7 +1281,8 @@ var PhotoGallery = function PhotoGallery(_ref) {
|
|
|
1325
1281
|
return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement(Backdrop.Backdrop, {
|
|
1326
1282
|
isOpen: isOpen,
|
|
1327
1283
|
onClick: onCloseHandle,
|
|
1328
|
-
zIndex: zIndex
|
|
1284
|
+
zIndex: zIndex,
|
|
1285
|
+
isBodyScrollLock: true
|
|
1329
1286
|
}), /*#__PURE__*/React__namespace.createElement(reactTransitionGroup.CSSTransition, {
|
|
1330
1287
|
"in": isOpen,
|
|
1331
1288
|
timeout: 240,
|
|
@@ -1341,7 +1298,7 @@ var PhotoGallery = function PhotoGallery(_ref) {
|
|
|
1341
1298
|
style: {
|
|
1342
1299
|
zIndex: zIndex
|
|
1343
1300
|
}
|
|
1344
|
-
}, /*#__PURE__*/React__namespace.createElement(
|
|
1301
|
+
}, /*#__PURE__*/React__namespace.createElement(KeyPress.KeyPress, {
|
|
1345
1302
|
code: "Escape",
|
|
1346
1303
|
onKeyUp: onCloseHandle
|
|
1347
1304
|
}), /*#__PURE__*/React__namespace.createElement(KeyPress.KeyPress, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react"),e=require("react-scrolllock"),n=require("react-transition-group"),i=require("@prom-ui/core/Backdrop"),o=require("@prom-ui/core/KeyPress"),r=require("@prom-ui/core/Portal"),a=require("@prom-ui/core/ScrollControls"),s=require("react-scrolllock/dist/utils"),l=require("@prom-ui/core/Icon"),c=require("@prom-ui/icons/Play"),u=require("@prom-ui/core/Button"),h=require("@prom-ui/core/useBodyTTag"),d=require("@prom-ui/icons/Close");function f(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}function m(t){if(t&&"object"==typeof t&&"default"in t)return t;var e=Object.create(null);return t&&Object.keys(t).forEach((function(n){if("default"!==n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}})),e.default=t,Object.freeze(e)}var p=m(t),g=f(e);function v(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var i,o,r,a,s=[],l=!0,c=!1;try{if(r=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;l=!1}else for(;!(l=(i=r.call(n)).done)&&(s.push(i.value),s.length!==e);l=!0);}catch(u){c=!0,o=u}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return y(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return y(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n<e;n++)i[n]=t[n];return i}function b(t){var e=t.currentTarget;return e.scrollHeight>e.clientHeight||e.scrollWidth>e.clientWidth?(t.stopPropagation(),!0):(t.preventDefault(),!1)}var E,w=!("undefined"==typeof window||!window.document||!window.document.createElement)&&!(!window.addEventListener&&!window.attachEvent),x=function(t){var e=t.isActive,n=void 0!==e&&e,i=t.scrollRef,o=t.children;return p.useEffect((function(){if(n&&w&&null!=i&&i.current)return i.current.addEventListener("touchstart",s.preventInertiaScroll,s.listenerOptions),i.current.addEventListener("touchmove",b,s.listenerOptions),function(){n&&w&&null!=i&&i.current&&(i.current.removeEventListener("touchstart",s.preventInertiaScroll,s.listenerOptions),i.current.removeEventListener("touchmove",b,s.listenerOptions))}})),p.createElement(p.Fragment,null,o)},O=new Map,z=function(t,e){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];O.has(e)&&(cancelAnimationFrame(O.get(e)),O.delete(e));var i=requestAnimationFrame((function(){var i=e.getBoundingClientRect(),o=t.getBoundingClientRect(),r=o.top+e.scrollTop-i.top-i.height/2+o.height/2,a=o.left+e.scrollLeft-i.left-i.width/2+o.width/2;a<0&&(a=0),r<0&&(r=0),e.scrollTo({behavior:n?"smooth":"instant",top:r,left:a})}));O.set(e,i)},I=function(t){var e=/^.*(?:(?:youtu\.be\/|v\/|vi\/|u\/\w\/|embed\/|shorts\/)|(?:(?:watch)?\?v(?:i)?=|\&v(?:i)?=))([^#\&\?]*).*/.exec(t);return e&&e[1]},T=function(t){var e=I(t);return"https://img.youtube.com/vi/".concat(e,"/0.jpg")},_=function(){var t=function(t,e){this.el=t,this.zoomFactor=1,this.lastScale=1,this.offset={x:0,y:0},this.initialOffset={x:0,y:0},this.options=Object.assign({},this.defaults,e),this.setupMarkup(),this.bindEvents(),this.update(),this.isImageLoaded(this.el)&&(this.updateAspectRatio(),this.setupOffsets()),this.enable()},e=function(t,e){return t+e};t.prototype={defaults:{tapZoomFactor:2,zoomOutFactor:1.3,animationDuration:300,maxZoom:4,minZoom:.5,draggableUnzoomed:!0,lockDragAxis:!1,setOffsetsOnce:!1,use2d:!0,useMouseWheel:!1,verticalPadding:0,horizontalPadding:0,onZoomStart:null,onZoomEnd:null,onZoomUpdate:null,onDragStart:null,onDragEnd:null,onDragUpdate:null,onDoubleTap:null,onMouseWheel:null},handleDragStart:function(t){"function"==typeof this.options.onDragStart&&this.options.onDragStart(this,t),this.stopAnimation(),this.lastDragPosition=!1,this.hasInteraction=!0,this.handleDrag(t)},handleDrag:function(t){var e="touchmove"===t.type?this.getTouches(t)[0]:this.getPointer(t);this.drag(e,this.lastDragPosition),this.offset=this.sanitizeOffset(this.offset),this.lastDragPosition=e},handleDragEnd:function(){"function"==typeof this.options.onDragEnd&&this.options.onDragEnd(this,event),this.end()},handleZoomStart:function(t){"function"==typeof this.options.onZoomStart&&this.options.onZoomStart(this,t),this.stopAnimation(),this.lastScale=1,this.nthZoom=0,this.lastZoomCenter=!1,this.hasInteraction=!0},handleZoom:function(t,e){var n=this.getTouchCenter(this.getTouches(t)),i=e/this.lastScale;this.lastScale=e,this.nthZoom+=1,this.nthZoom>3&&(this.scale(i,n),this.drag(n,this.lastZoomCenter)),this.lastZoomCenter=n},handleZoomEnd:function(){"function"==typeof this.options.onZoomEnd&&this.options.onZoomEnd(this,event),this.end()},handleDoubleTap:function(t){var e=this.getTouches(t)[0],n=this.zoomFactor>1?1:this.options.tapZoomFactor,i=this.zoomFactor,o=function(t){this.scaleTo(i+t*(n-i),e)}.bind(this);this.hasInteraction||(this.isDoubleTap=!0,i>n&&(e=this.getCurrentZoomCenter()),this.animate(this.options.animationDuration,o,this.swing),"function"==typeof this.options.onDoubleTap&&this.options.onDoubleTap(this,t))},handleMouseWheel:function(t){var e=this.getPointer(t),n=Math.min(Math.max(this.options.minZoom,this.lastScale+-.01*t.deltaY),this.options.maxZoom),i=n/this.lastScale;this.scale(i,e),this.lastScale=n,this.update(),"function"==typeof this.options.onMouseWheel&&this.options.onMouseWheel(this,t)},computeInitialOffset:function(){this.initialOffset={x:-Math.abs(this.el.offsetWidth*this.getInitialZoomFactor()-this.container.offsetWidth)/2,y:-Math.abs(this.el.offsetHeight*this.getInitialZoomFactor()-this.container.offsetHeight)/2}},resetOffset:function(){this.offset.x=this.initialOffset.x,this.offset.y=this.initialOffset.y},isImageLoaded:function(t){return"IMG"===t.nodeName?t.complete&&0!==t.naturalHeight:Array.from(t.querySelectorAll("img")).every(this.isImageLoaded)},setupOffsets:function(){this.options.setOffsetsOnce&&this._isOffsetsSet||(this._isOffsetsSet=!0,this.computeInitialOffset(),this.resetOffset())},sanitizeOffset:function(t){var e=this.el.offsetWidth*this.getInitialZoomFactor()*this.zoomFactor,n=this.el.offsetHeight*this.getInitialZoomFactor()*this.zoomFactor,i=e-this.getContainerX()+this.options.horizontalPadding,o=n-this.getContainerY()+this.options.verticalPadding,r=Math.max(i,0),a=Math.max(o,0),s=Math.min(i,0)-this.options.horizontalPadding,l=Math.min(o,0)-this.options.verticalPadding;return{x:Math.min(Math.max(t.x,s),r),y:Math.min(Math.max(t.y,l),a)}},scaleTo:function(t,e){this.scale(t/this.zoomFactor,e)},scale:function(t,e){t=this.scaleZoomFactor(t),this.addOffset({x:(t-1)*(e.x+this.offset.x),y:(t-1)*(e.y+this.offset.y)}),"function"==typeof this.options.onZoomUpdate&&this.options.onZoomUpdate(this,event)},scaleZoomFactor:function(t){var e=this.zoomFactor;return this.zoomFactor*=t,this.zoomFactor=Math.min(this.options.maxZoom,Math.max(this.zoomFactor,this.options.minZoom)),this.zoomFactor/e},canDrag:function(){return this.options.draggableUnzoomed||!((t=this.zoomFactor)>(e=1)-.01&&t<e+.01);var t,e},drag:function(t,e){e&&(this.options.lockDragAxis?Math.abs(t.x-e.x)>Math.abs(t.y-e.y)?this.addOffset({x:-(t.x-e.x),y:0}):this.addOffset({y:-(t.y-e.y),x:0}):this.addOffset({y:-(t.y-e.y),x:-(t.x-e.x)}),"function"==typeof this.options.onDragUpdate&&this.options.onDragUpdate(this,event))},getTouchCenter:function(t){return this.getVectorAvg(t)},getVectorAvg:function(t){return{x:t.map((function(t){return t.x})).reduce(e)/t.length,y:t.map((function(t){return t.y})).reduce(e)/t.length}},addOffset:function(t){this.offset={x:this.offset.x+t.x,y:this.offset.y+t.y}},sanitize:function(){this.zoomFactor<this.options.zoomOutFactor?this.zoomOutAnimation():this.isInsaneOffset(this.offset)&&this.sanitizeOffsetAnimation()},isInsaneOffset:function(t){var e=this.sanitizeOffset(t);return e.x!==t.x||e.y!==t.y},sanitizeOffsetAnimation:function(){var t=this.sanitizeOffset(this.offset),e=this.offset.x,n=this.offset.y,i=function(i){this.offset.x=e+i*(t.x-e),this.offset.y=n+i*(t.y-n),this.update()}.bind(this);this.animate(this.options.animationDuration,i,this.swing)},zoomOutAnimation:function(){if(1!==this.zoomFactor){var t=this.zoomFactor,e=this.getCurrentZoomCenter(),n=function(n){this.scaleTo(t+n*(1-t),e)}.bind(this);this.animate(this.options.animationDuration,n,this.swing)}},updateAspectRatio:function(){this.unsetContainerY(),this.setContainerY(this.container.parentElement.offsetHeight)},getInitialZoomFactor:function(){var t=this.container.offsetWidth/this.el.offsetWidth,e=this.container.offsetHeight/this.el.offsetHeight;return Math.min(t,e)},getAspectRatio:function(){return this.el.offsetWidth/this.el.offsetHeight},getCurrentZoomCenter:function(){var t=this.offset.x-this.initialOffset.x,e=-1*this.offset.x-t/(1/this.zoomFactor-1),n=this.offset.y-this.initialOffset.y;return{x:e,y:-1*this.offset.y-n/(1/this.zoomFactor-1)}},getTouches:function(t){var e=this.container.getBoundingClientRect(),n=document.documentElement.scrollTop||document.body.scrollTop,i=document.documentElement.scrollLeft||document.body.scrollLeft,o=e.top+n,r=e.left+i;return Array.prototype.slice.call(t.touches).map((function(t){return{x:t.pageX-r,y:t.pageY-o}}))},getPointer:function(t){var e=this.container.getBoundingClientRect(),n=document.documentElement.scrollTop||document.body.scrollTop,i=document.documentElement.scrollLeft||document.body.scrollLeft,o=e.top+n,r=e.left+i;return{x:t.pageX-r,y:t.pageY-o}},animate:function(t,e,n,i){var o=(new Date).getTime(),r=function(){if(this.inAnimation){var a=(new Date).getTime()-o,s=a/t;a>=t?(e(1),i&&i(),this.update(),this.stopAnimation(),this.update()):(n&&(s=n(s)),e(s),this.update(),requestAnimationFrame(r))}}.bind(this);this.inAnimation=!0,requestAnimationFrame(r)},stopAnimation:function(){this.inAnimation=!1},swing:function(t){return-Math.cos(t*Math.PI)/2+.5},getContainerX:function(){return this.container.offsetWidth},getContainerY:function(){return this.container.offsetHeight},setContainerY:function(t){return this.container.style.height=t+"px"},unsetContainerY:function(){this.container.style.height=null},setupMarkup:function(){var t,e;this.container=(t='<div class="pinch-zoom-container" style="height: 100%;"></div>',(e=document.implementation.createHTMLDocument("")).body.innerHTML=t,Array.from(e.body.children)[0]),this.el.parentNode.insertBefore(this.container,this.el),this.container.appendChild(this.el),this.container.style.overflow="hidden",this.container.style.position="relative",this.el.style.webkitTransformOrigin="0% 0%",this.el.style.mozTransformOrigin="0% 0%",this.el.style.msTransformOrigin="0% 0%",this.el.style.oTransformOrigin="0% 0%",this.el.style.transformOrigin="0% 0%",this.el.style.position="absolute",this.el.style.backfaceVisibility="hidden",this.el.style.willChange="transform"},end:function(){this.hasInteraction=!1,this.sanitize(),this.update()},bindEvents:function(){var t=this;n(this.container,this),this.resizeHandler=this.update.bind(this),window.addEventListener("resize",this.resizeHandler),Array.from(this.el.querySelectorAll("img")).forEach((function(e){e.addEventListener("load",t.update.bind(t))})),"IMG"===this.el.nodeName&&this.el.addEventListener("load",this.update.bind(this))},update:function(t){t&&"resize"===t.type&&(this.updateAspectRatio(),this.setupOffsets()),t&&"load"===t.type&&(this.updateAspectRatio(),this.setupOffsets()),this.updatePlanned||(this.updatePlanned=!0,window.setTimeout(function(){this.updatePlanned=!1;var t=this.getInitialZoomFactor()*this.zoomFactor,e=-this.offset.x/t,n=-this.offset.y/t,i="scale3d("+t+", "+t+",1) translate3d("+e+"px,"+n+"px,0px)",o="scale("+t+", "+t+") translate("+e+"px,"+n+"px)",r=function(){this.clone&&(this.clone.parentNode.removeChild(this.clone),delete this.clone)}.bind(this);!this.options.use2d||this.hasInteraction||this.inAnimation?(this.is3d=!0,r(),this.el.style.webkitTransform=i,this.el.style.mozTransform=o,this.el.style.msTransform=o,this.el.style.oTransform=o,this.el.style.transform=i):(this.is3d&&(this.clone=this.el.cloneNode(!0),this.clone.style.pointerEvents="none",this.container.appendChild(this.clone),window.setTimeout(r,200)),this.el.style.webkitTransform=o,this.el.style.mozTransform=o,this.el.style.msTransform=o,this.el.style.oTransform=o,this.el.style.transform=o,this.is3d=!1)}.bind(this),0))},enable:function(){this.enabled=!0},disable:function(){this.enabled=!1},destroy:function(){window.removeEventListener("resize",this.resizeHandler),this.container&&(this.container.remove(),this.container=null)},reset:function(){this.zoomOutAnimation()}};var n=function(t,e){var n=null,i=0,o=null,r=null,a=function(t,i){if(n!==t){if(n&&!t)switch(n){case"zoom":e.handleZoomEnd(i);break;case"drag":e.handleDragEnd(i)}switch(t){case"zoom":e.handleZoomStart(i);break;case"drag":e.handleDragStart(i)}}n=t},s=function(t){2===i?a("zoom"):1===i&&e.canDrag()?a("drag",t):a(null,t)},l=function(t){return Array.from(t).map((function(t){return{x:t.pageX,y:t.pageY}}))},c=function(t,e){var n,i;return n=t.x-e.x,i=t.y-e.y,Math.sqrt(n*n+i*i)},u=function(t){t.stopPropagation(),t.preventDefault()},h=!0;t.addEventListener("touchstart",(function(t){e.enabled&&(h=!0,i=t.touches.length,function(t){var r=(new Date).getTime();if(i>1&&(o=null),r-o<300)switch(u(t),e.handleDoubleTap(t),n){case"zoom":e.handleZoomEnd(t);break;case"drag":e.handleDragEnd(t)}else e.isDoubleTap=!1;1===i&&(o=r)}(t))}),{passive:!1}),t.addEventListener("touchmove",(function(t){if(e.enabled&&!e.isDoubleTap){if(h)s(t),n&&u(t),r=l(t.touches);else{switch(n){case"zoom":2==r.length&&2==t.touches.length&&e.handleZoom(t,function(t,e){var n=c(t[0],t[1]);return c(e[0],e[1])/n}(r,l(t.touches)));break;case"drag":e.handleDrag(t)}n&&(u(t),e.update())}h=!1}}),{passive:!1}),t.addEventListener("touchend",(function(t){e.enabled&&(i=t.touches.length,s(t))})),e.options.useMouseWheel&&(t.addEventListener("mousewheel",(function(t){e.enabled&&(u(t),e.handleMouseWheel(t))})),t.addEventListener("mousedown",(function(t){e.enabled&&(h=!0,i=1)}),{passive:!0}),t.addEventListener("mousemove",(function(t){e.enabled&&(h?(s(t),n&&u(t)):("drag"===n&&e.handleDrag(t),n&&(u(t),e.update())),h=!1)}),{passive:!1}),t.addEventListener("mouseup",(function(t){e.enabled&&(i=0,s(t))}),{passive:!0}))};return t}(),A={scrolling:"BeLzR",root:"nJWgH",layout:"BDoOb",layoutHeader:"iNVA1",layoutContent:"C-jWr",layoutSection:"_3FXm5",layoutAside:"ABw2b",header:"meCSL",headerTitle:"NpSWI",headerClose:"-B9Zg",mainPhotoScrollControls:"ckcap",mainPhoto:"-r4WP BeLzR",mainPhotoItem:"Q7wDI",mainPhotoImage:"NrcBT",mainPhotoIframe:"kObZY",preview:"_86-3f BeLzR",previewItem:"gnB8m",previewButton:"L4PR-",previewImage:"_8dsDI",videoPlayLabel:"_2kU58",videoPlayLabelIcon:"WR7T8",enter:"sM8Qu",exit:"veHZr",enterActive:"VP4oy",exitActive:"AMPJ3"},C=p.forwardRef((function(t,e){var n=t.src,i=t.videoSrc,o=p.useRef(null),r=p.useRef(null),a=p.useRef(null),s=!!i,l=function(){var t,e;null===(t=r.current)||void 0===t||t.reset(),null===(e=o.current)||void 0===e||null===(e=e.contentWindow)||void 0===e||e.postMessage('{"event":"command","func":"pauseVideo","args":""}',"*")};return p.useEffect((function(){return requestAnimationFrame((function(){a.current&&!s&&(r.current=new _(a.current,{draggableUnzoomed:!1,animationDuration:200,setOffsetsOnce:!1}))})),function(){var t;null===(t=r.current)||void 0===t||t.destroy()}}),[i]),p.useImperativeHandle(e,(function(){return{reset:l}}),[]),s?p.createElement("iframe",{ref:o,className:A.mainPhotoIframe,src:i,width:"100%",height:"100%",allowFullScreen:!0,title:"",loading:"lazy","data-qaid":"photo_gallery_main_video","data-testid":"photo_gallery_main_video"}):p.createElement("img",{ref:a,className:A.mainPhotoImage,src:n,width:"100%",height:"100%",alt:"",decoding:"async",loading:"lazy","data-qaid":"photo_gallery_main_image","data-testid":"photo_gallery_main_image"})})),D=p.forwardRef((function(t,e){var n=t.items,i=t.onChange,o=p.useRef([]),r=p.useRef(0),s=p.useRef(null),l=function(){o.current.forEach((function(t){null==t||t.reset()}))},c=function(t){var e,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=null===(e=s.current)||void 0===e?void 0:e.children[t];l(),i&&z(i,s.current,n)};p.useImperativeHandle(e,(function(){return{scrollToIndex:c}}),[]);var u=function(){if(s.current){var t=function(t,e){var n=t.scrollLeft/t.scrollWidth*e;return Math.round(n)}(s.current,n.length);r.current!==t&&(r.current=t,i(t),l())}};return p.createElement(a.ScrollControls,{ref:s,className:A.mainPhotoScrollControls,showOnHover:!0,hideOnDisabled:!0},(function(t){return p.createElement(x,{scrollRef:t,isActive:!0},p.createElement("div",{ref:t,className:A.mainPhoto,onScroll:u},n.map((function(t,e){var n,i=t.type,r=t.src,a="video"===i,s=a?T(r):r,l=a?(n=I(r),"https://youtube.com/embed/".concat(n,"?enablejsapi=1&rel=0")):void 0;return p.createElement("div",{key:e,className:A.mainPhotoItem,"data-qaid":"photo_gallery_main_item","data-testid":"photo_gallery_main_item"},p.createElement(C,{ref:function(t){return o.current[e]=t},src:s,videoSrc:l}))}))))}))})),P=p.forwardRef((function(t,e){var n=t.items,i=t.selectedIndex,o=t.onChange,r=p.useRef(null),a=function(t){var e,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=null===(e=r.current)||void 0===e?void 0:e.children[t];i&&z(i,r.current,n)};p.useImperativeHandle(e,(function(){return{scrollToIndex:a}}),[]);return p.createElement(x,{scrollRef:r,isActive:!0},p.createElement("div",{ref:r,className:A.preview},n.map((function(t,e){var n=t.type,r=t.src,a="video"===n,s=a?T(r):r;return p.createElement("div",{key:e,className:A.previewItem,"data-qaid":"photo_gallery_preview_item","data-testid":"photo_gallery_preview_item"},p.createElement("button",{className:A.previewButton,type:"button",onClick:function(){return function(t){o(t)}(e)},disabled:i===e,"data-qaid":"photo_gallery_preview_button","data-testid":"photo_gallery_preview_button"},p.createElement("img",{className:A.previewImage,src:s,width:58,height:58,alt:"",decoding:"async",loading:"lazy","data-qaid":"photo_gallery_preview_image","data-testid":"photo_gallery_preview_image"}),a&&p.createElement("div",{className:A.videoPlayLabel,"data-qaid":"photo_gallery_preview_play","data-testid":"photo_gallery_preview_play"},p.createElement(l.Icon,{className:A.videoPlayLabelIcon,"icon-as":c.SvgPlay}))))}))))})),S=function(t){var e,n,i=t.title,o=t.onClose,r=t.selectedIndex,a=t.itemsLength,s=r+1,c=(0,h.useBodyTTag().t)(E||(e=["Фото "," из ",""],n||(n=e.slice(0)),E=Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))),s,a);return p.createElement("div",{className:A.header},p.createElement("div",{className:A.headerTitle,"data-qaid":"photo_gallery_title","data-testid":"photo_gallery_title"},i||c),p.createElement("div",{className:A.headerClose},p.createElement(u.Button,{"button-padding":"xxs","button-theme":"black-inherit",type:"button",onClick:o,"data-qaid":"photo_gallery_close_button","data-testid":"photo_gallery_close_button"},p.createElement(l.Icon,{"icon-as":d.SvgClose,style:{width:24,height:24}}))))};exports.PhotoGallery=function(t){var e=t.isOpen,a=t.title,s=t.visibleIndex,l=void 0===s?0:s,c=t.items,u=t.zIndex,h=void 0===u?5e3:u,d=t.onClose,f=t.onChange,m=p.useRef(!0),y=p.useRef(null),b=p.useRef(null),E=v(p.useState(l),2),w=E[0],x=E[1];p.useEffect((function(){e&&"function"==typeof f&&f(w)}),[w]),p.useEffect((function(){var t,n;e&&(x(l),null===(t=b.current)||void 0===t||t.scrollToIndex(l,!1),null===(n=y.current)||void 0===n||n.scrollToIndex(l,!1))}),[e]),p.useEffect((function(){var t;if(!e)return function(){};var n=null,i=function(){n&&clearTimeout(n)},o=function(){i(),n=setTimeout((function(){var t,e;null===(t=b.current)||void 0===t||t.scrollToIndex(w,!1),null===(e=y.current)||void 0===e||e.scrollToIndex(w,!1)}),100)};return window.addEventListener("resize",o),null===(t=window)||void 0===t||null===(t=t.matchMedia("(orientation: portrait)"))||void 0===t||t.addEventListener("change",o),function(){var t;i(),window.removeEventListener("resize",o),null===(t=window)||void 0===t||null===(t=t.matchMedia("(orientation: portrait)"))||void 0===t||t.removeEventListener("change",o)}}),[e,w]);var O=function(t){var e,n;m.current=!1,x(t),null===(e=b.current)||void 0===e||e.scrollToIndex(t),null===(n=y.current)||void 0===n||n.scrollToIndex(t)},z=function(){d(w)};return p.createElement(p.Fragment,null,p.createElement(i.Backdrop,{isOpen:e,onClick:z,zIndex:h}),p.createElement(n.CSSTransition,{in:e,timeout:240,classNames:A,unmountOnExit:!0},p.createElement(r.Portal,null,p.createElement("div",{className:A.root,"data-qaid":"photo_gallery","data-testid":"photo_gallery",style:{zIndex:h}},p.createElement(g.default,null),p.createElement(o.KeyPress,{code:"Escape",onKeyUp:z}),p.createElement(o.KeyPress,{code:"ArrowLeft",onKeyUp:function(){0!==w&&O(w-1)}}),p.createElement(o.KeyPress,{code:"ArrowRight",onKeyUp:function(){w!==c.length-1&&O(w+1)}}),p.createElement("div",{className:A.layout},p.createElement("header",{className:A.layoutHeader},p.createElement(S,{title:a,selectedIndex:w,itemsLength:c.length,onClose:z})),p.createElement("div",{className:A.layoutContent},p.createElement("section",{className:A.layoutSection},p.createElement(D,{ref:y,items:c,onChange:function(t){var e;m.current&&(x(t),null===(e=b.current)||void 0===e||e.scrollToIndex(t));m.current||w!==t||(m.current=!0)}})),c.length>1&&p.createElement("aside",{className:A.layoutAside},p.createElement(P,{ref:b,items:c,selectedIndex:w,onChange:O}))))))))},require("./style.production.css");
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react"),e=require("react-transition-group"),n=require("@prom-ui/core/Backdrop"),i=require("@prom-ui/core/KeyPress"),o=require("@prom-ui/core/Portal"),a=require("@prom-ui/core/ScrollControls"),s=require("@prom-ui/core/Icon"),r=require("@prom-ui/icons/Play"),l=require("@prom-ui/core/Button"),c=require("@prom-ui/core/useBodyTTag"),h=require("@prom-ui/icons/Close");function u(t){if(t&&"object"==typeof t&&"default"in t)return t;var e=Object.create(null);return t&&Object.keys(t).forEach((function(n){if("default"!==n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}})),e.default=t,Object.freeze(e)}var d=u(t);function f(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var i,o,a,s,r=[],l=!0,c=!1;try{if(a=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;l=!1}else for(;!(l=(i=a.call(n)).done)&&(r.push(i.value),r.length!==e);l=!0);}catch(h){c=!0,o=h}finally{try{if(!l&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(c)throw o}}return r}}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return m(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return m(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n<e;n++)i[n]=t[n];return i}var p,g=new Map,v=function(t,e){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];g.has(e)&&(cancelAnimationFrame(g.get(e)),g.delete(e));var i=requestAnimationFrame((function(){var i=e.getBoundingClientRect(),o=t.getBoundingClientRect(),a=o.top+e.scrollTop-i.top-i.height/2+o.height/2,s=o.left+e.scrollLeft-i.left-i.width/2+o.width/2;s<0&&(s=0),a<0&&(a=0),e.scrollTo({behavior:n?"smooth":"instant",top:a,left:s})}));g.set(e,i)},y=function(t){var e=/^.*(?:(?:youtu\.be\/|v\/|vi\/|u\/\w\/|embed\/|shorts\/)|(?:(?:watch)?\?v(?:i)?=|\&v(?:i)?=))([^#\&\?]*).*/.exec(t);return e&&e[1]},b=function(t){var e=y(t);return"https://img.youtube.com/vi/".concat(e,"/0.jpg")},x=function(){var t=function(t,e){this.el=t,this.zoomFactor=1,this.lastScale=1,this.offset={x:0,y:0},this.initialOffset={x:0,y:0},this.options=Object.assign({},this.defaults,e),this.setupMarkup(),this.bindEvents(),this.update(),this.isImageLoaded(this.el)&&(this.updateAspectRatio(),this.setupOffsets()),this.enable()},e=function(t,e){return t+e};t.prototype={defaults:{tapZoomFactor:2,zoomOutFactor:1.3,animationDuration:300,maxZoom:4,minZoom:.5,draggableUnzoomed:!0,lockDragAxis:!1,setOffsetsOnce:!1,use2d:!0,useMouseWheel:!1,verticalPadding:0,horizontalPadding:0,onZoomStart:null,onZoomEnd:null,onZoomUpdate:null,onDragStart:null,onDragEnd:null,onDragUpdate:null,onDoubleTap:null,onMouseWheel:null},handleDragStart:function(t){"function"==typeof this.options.onDragStart&&this.options.onDragStart(this,t),this.stopAnimation(),this.lastDragPosition=!1,this.hasInteraction=!0,this.handleDrag(t)},handleDrag:function(t){var e="touchmove"===t.type?this.getTouches(t)[0]:this.getPointer(t);this.drag(e,this.lastDragPosition),this.offset=this.sanitizeOffset(this.offset),this.lastDragPosition=e},handleDragEnd:function(){"function"==typeof this.options.onDragEnd&&this.options.onDragEnd(this,event),this.end()},handleZoomStart:function(t){"function"==typeof this.options.onZoomStart&&this.options.onZoomStart(this,t),this.stopAnimation(),this.lastScale=1,this.nthZoom=0,this.lastZoomCenter=!1,this.hasInteraction=!0},handleZoom:function(t,e){var n=this.getTouchCenter(this.getTouches(t)),i=e/this.lastScale;this.lastScale=e,this.nthZoom+=1,this.nthZoom>3&&(this.scale(i,n),this.drag(n,this.lastZoomCenter)),this.lastZoomCenter=n},handleZoomEnd:function(){"function"==typeof this.options.onZoomEnd&&this.options.onZoomEnd(this,event),this.end()},handleDoubleTap:function(t){var e=this.getTouches(t)[0],n=this.zoomFactor>1?1:this.options.tapZoomFactor,i=this.zoomFactor,o=function(t){this.scaleTo(i+t*(n-i),e)}.bind(this);this.hasInteraction||(this.isDoubleTap=!0,i>n&&(e=this.getCurrentZoomCenter()),this.animate(this.options.animationDuration,o,this.swing),"function"==typeof this.options.onDoubleTap&&this.options.onDoubleTap(this,t))},handleMouseWheel:function(t){var e=this.getPointer(t),n=Math.min(Math.max(this.options.minZoom,this.lastScale+-.01*t.deltaY),this.options.maxZoom),i=n/this.lastScale;this.scale(i,e),this.lastScale=n,this.update(),"function"==typeof this.options.onMouseWheel&&this.options.onMouseWheel(this,t)},computeInitialOffset:function(){this.initialOffset={x:-Math.abs(this.el.offsetWidth*this.getInitialZoomFactor()-this.container.offsetWidth)/2,y:-Math.abs(this.el.offsetHeight*this.getInitialZoomFactor()-this.container.offsetHeight)/2}},resetOffset:function(){this.offset.x=this.initialOffset.x,this.offset.y=this.initialOffset.y},isImageLoaded:function(t){return"IMG"===t.nodeName?t.complete&&0!==t.naturalHeight:Array.from(t.querySelectorAll("img")).every(this.isImageLoaded)},setupOffsets:function(){this.options.setOffsetsOnce&&this._isOffsetsSet||(this._isOffsetsSet=!0,this.computeInitialOffset(),this.resetOffset())},sanitizeOffset:function(t){var e=this.el.offsetWidth*this.getInitialZoomFactor()*this.zoomFactor,n=this.el.offsetHeight*this.getInitialZoomFactor()*this.zoomFactor,i=e-this.getContainerX()+this.options.horizontalPadding,o=n-this.getContainerY()+this.options.verticalPadding,a=Math.max(i,0),s=Math.max(o,0),r=Math.min(i,0)-this.options.horizontalPadding,l=Math.min(o,0)-this.options.verticalPadding;return{x:Math.min(Math.max(t.x,r),a),y:Math.min(Math.max(t.y,l),s)}},scaleTo:function(t,e){this.scale(t/this.zoomFactor,e)},scale:function(t,e){t=this.scaleZoomFactor(t),this.addOffset({x:(t-1)*(e.x+this.offset.x),y:(t-1)*(e.y+this.offset.y)}),"function"==typeof this.options.onZoomUpdate&&this.options.onZoomUpdate(this,event)},scaleZoomFactor:function(t){var e=this.zoomFactor;return this.zoomFactor*=t,this.zoomFactor=Math.min(this.options.maxZoom,Math.max(this.zoomFactor,this.options.minZoom)),this.zoomFactor/e},canDrag:function(){return this.options.draggableUnzoomed||!((t=this.zoomFactor)>(e=1)-.01&&t<e+.01);var t,e},drag:function(t,e){e&&(this.options.lockDragAxis?Math.abs(t.x-e.x)>Math.abs(t.y-e.y)?this.addOffset({x:-(t.x-e.x),y:0}):this.addOffset({y:-(t.y-e.y),x:0}):this.addOffset({y:-(t.y-e.y),x:-(t.x-e.x)}),"function"==typeof this.options.onDragUpdate&&this.options.onDragUpdate(this,event))},getTouchCenter:function(t){return this.getVectorAvg(t)},getVectorAvg:function(t){return{x:t.map((function(t){return t.x})).reduce(e)/t.length,y:t.map((function(t){return t.y})).reduce(e)/t.length}},addOffset:function(t){this.offset={x:this.offset.x+t.x,y:this.offset.y+t.y}},sanitize:function(){this.zoomFactor<this.options.zoomOutFactor?this.zoomOutAnimation():this.isInsaneOffset(this.offset)&&this.sanitizeOffsetAnimation()},isInsaneOffset:function(t){var e=this.sanitizeOffset(t);return e.x!==t.x||e.y!==t.y},sanitizeOffsetAnimation:function(){var t=this.sanitizeOffset(this.offset),e=this.offset.x,n=this.offset.y,i=function(i){this.offset.x=e+i*(t.x-e),this.offset.y=n+i*(t.y-n),this.update()}.bind(this);this.animate(this.options.animationDuration,i,this.swing)},zoomOutAnimation:function(){if(1!==this.zoomFactor){var t=this.zoomFactor,e=this.getCurrentZoomCenter(),n=function(n){this.scaleTo(t+n*(1-t),e)}.bind(this);this.animate(this.options.animationDuration,n,this.swing)}},updateAspectRatio:function(){this.unsetContainerY(),this.setContainerY(this.container.parentElement.offsetHeight)},getInitialZoomFactor:function(){var t=this.container.offsetWidth/this.el.offsetWidth,e=this.container.offsetHeight/this.el.offsetHeight;return Math.min(t,e)},getAspectRatio:function(){return this.el.offsetWidth/this.el.offsetHeight},getCurrentZoomCenter:function(){var t=this.offset.x-this.initialOffset.x,e=-1*this.offset.x-t/(1/this.zoomFactor-1),n=this.offset.y-this.initialOffset.y;return{x:e,y:-1*this.offset.y-n/(1/this.zoomFactor-1)}},getTouches:function(t){var e=this.container.getBoundingClientRect(),n=document.documentElement.scrollTop||document.body.scrollTop,i=document.documentElement.scrollLeft||document.body.scrollLeft,o=e.top+n,a=e.left+i;return Array.prototype.slice.call(t.touches).map((function(t){return{x:t.pageX-a,y:t.pageY-o}}))},getPointer:function(t){var e=this.container.getBoundingClientRect(),n=document.documentElement.scrollTop||document.body.scrollTop,i=document.documentElement.scrollLeft||document.body.scrollLeft,o=e.top+n,a=e.left+i;return{x:t.pageX-a,y:t.pageY-o}},animate:function(t,e,n,i){var o=(new Date).getTime(),a=function(){if(this.inAnimation){var s=(new Date).getTime()-o,r=s/t;s>=t?(e(1),i&&i(),this.update(),this.stopAnimation(),this.update()):(n&&(r=n(r)),e(r),this.update(),requestAnimationFrame(a))}}.bind(this);this.inAnimation=!0,requestAnimationFrame(a)},stopAnimation:function(){this.inAnimation=!1},swing:function(t){return-Math.cos(t*Math.PI)/2+.5},getContainerX:function(){return this.container.offsetWidth},getContainerY:function(){return this.container.offsetHeight},setContainerY:function(t){return this.container.style.height=t+"px"},unsetContainerY:function(){this.container.style.height=null},setupMarkup:function(){var t,e;this.container=(t='<div class="pinch-zoom-container" style="height: 100%;"></div>',(e=document.implementation.createHTMLDocument("")).body.innerHTML=t,Array.from(e.body.children)[0]),this.el.parentNode.insertBefore(this.container,this.el),this.container.appendChild(this.el),this.container.style.overflow="hidden",this.container.style.position="relative",this.el.style.webkitTransformOrigin="0% 0%",this.el.style.mozTransformOrigin="0% 0%",this.el.style.msTransformOrigin="0% 0%",this.el.style.oTransformOrigin="0% 0%",this.el.style.transformOrigin="0% 0%",this.el.style.position="absolute",this.el.style.backfaceVisibility="hidden",this.el.style.willChange="transform"},end:function(){this.hasInteraction=!1,this.sanitize(),this.update()},bindEvents:function(){var t=this;n(this.container,this),this.resizeHandler=this.update.bind(this),window.addEventListener("resize",this.resizeHandler),Array.from(this.el.querySelectorAll("img")).forEach((function(e){e.addEventListener("load",t.update.bind(t))})),"IMG"===this.el.nodeName&&this.el.addEventListener("load",this.update.bind(this))},update:function(t){t&&"resize"===t.type&&(this.updateAspectRatio(),this.setupOffsets()),t&&"load"===t.type&&(this.updateAspectRatio(),this.setupOffsets()),this.updatePlanned||(this.updatePlanned=!0,window.setTimeout(function(){this.updatePlanned=!1;var t=this.getInitialZoomFactor()*this.zoomFactor,e=-this.offset.x/t,n=-this.offset.y/t,i="scale3d("+t+", "+t+",1) translate3d("+e+"px,"+n+"px,0px)",o="scale("+t+", "+t+") translate("+e+"px,"+n+"px)",a=function(){this.clone&&(this.clone.parentNode.removeChild(this.clone),delete this.clone)}.bind(this);!this.options.use2d||this.hasInteraction||this.inAnimation?(this.is3d=!0,a(),this.el.style.webkitTransform=i,this.el.style.mozTransform=o,this.el.style.msTransform=o,this.el.style.oTransform=o,this.el.style.transform=i):(this.is3d&&(this.clone=this.el.cloneNode(!0),this.clone.style.pointerEvents="none",this.container.appendChild(this.clone),window.setTimeout(a,200)),this.el.style.webkitTransform=o,this.el.style.mozTransform=o,this.el.style.msTransform=o,this.el.style.oTransform=o,this.el.style.transform=o,this.is3d=!1)}.bind(this),0))},enable:function(){this.enabled=!0},disable:function(){this.enabled=!1},destroy:function(){window.removeEventListener("resize",this.resizeHandler),this.container&&(this.container.remove(),this.container=null)},reset:function(){this.zoomOutAnimation()}};var n=function(t,e){var n=null,i=0,o=null,a=null,s=function(t,i){if(n!==t){if(n&&!t)switch(n){case"zoom":e.handleZoomEnd(i);break;case"drag":e.handleDragEnd(i)}switch(t){case"zoom":e.handleZoomStart(i);break;case"drag":e.handleDragStart(i)}}n=t},r=function(t){2===i?s("zoom"):1===i&&e.canDrag()?s("drag",t):s(null,t)},l=function(t){return Array.from(t).map((function(t){return{x:t.pageX,y:t.pageY}}))},c=function(t,e){var n,i;return n=t.x-e.x,i=t.y-e.y,Math.sqrt(n*n+i*i)},h=function(t){t.stopPropagation(),t.preventDefault()},u=!0;t.addEventListener("touchstart",(function(t){e.enabled&&(u=!0,i=t.touches.length,function(t){var a=(new Date).getTime();if(i>1&&(o=null),a-o<300)switch(h(t),e.handleDoubleTap(t),n){case"zoom":e.handleZoomEnd(t);break;case"drag":e.handleDragEnd(t)}else e.isDoubleTap=!1;1===i&&(o=a)}(t))}),{passive:!1}),t.addEventListener("touchmove",(function(t){if(e.enabled&&!e.isDoubleTap){if(u)r(t),n&&h(t),a=l(t.touches);else{switch(n){case"zoom":2==a.length&&2==t.touches.length&&e.handleZoom(t,function(t,e){var n=c(t[0],t[1]);return c(e[0],e[1])/n}(a,l(t.touches)));break;case"drag":e.handleDrag(t)}n&&(h(t),e.update())}u=!1}}),{passive:!1}),t.addEventListener("touchend",(function(t){e.enabled&&(i=t.touches.length,r(t))})),e.options.useMouseWheel&&(t.addEventListener("mousewheel",(function(t){e.enabled&&(h(t),e.handleMouseWheel(t))})),t.addEventListener("mousedown",(function(t){e.enabled&&(u=!0,i=1)}),{passive:!0}),t.addEventListener("mousemove",(function(t){e.enabled&&(u?(r(t),n&&h(t)):("drag"===n&&e.handleDrag(t),n&&(h(t),e.update())),u=!1)}),{passive:!1}),t.addEventListener("mouseup",(function(t){e.enabled&&(i=0,r(t))}),{passive:!0}))};return t}(),E={scrolling:"BeLzR",root:"nJWgH",layout:"BDoOb",layoutHeader:"iNVA1",layoutContent:"C-jWr",layoutSection:"_3FXm5",layoutAside:"ABw2b",header:"meCSL",headerTitle:"NpSWI",headerClose:"-B9Zg",mainPhotoScrollControls:"ckcap",mainPhoto:"-r4WP BeLzR",mainPhotoItem:"Q7wDI",mainPhotoImage:"NrcBT",mainPhotoIframe:"kObZY",preview:"_86-3f BeLzR",previewItem:"gnB8m",previewButton:"L4PR-",previewImage:"_8dsDI",videoPlayLabel:"_2kU58",videoPlayLabelIcon:"WR7T8",enter:"sM8Qu",exit:"veHZr",enterActive:"VP4oy",exitActive:"AMPJ3"},w=d.forwardRef((function(t,e){var n=t.src,i=t.videoSrc,o=d.useRef(null),a=d.useRef(null),s=d.useRef(null),r=!!i,l=function(){var t,e;null===(t=a.current)||void 0===t||t.reset(),null===(e=o.current)||void 0===e||null===(e=e.contentWindow)||void 0===e||e.postMessage('{"event":"command","func":"pauseVideo","args":""}',"*")};return d.useEffect((function(){return requestAnimationFrame((function(){s.current&&!r&&(a.current=new x(s.current,{draggableUnzoomed:!1,animationDuration:200,setOffsetsOnce:!1}))})),function(){var t;null===(t=a.current)||void 0===t||t.destroy()}}),[i]),d.useImperativeHandle(e,(function(){return{reset:l}}),[]),r?d.createElement("iframe",{ref:o,className:E.mainPhotoIframe,src:i,width:"100%",height:"100%",allowFullScreen:!0,title:"",loading:"lazy","data-qaid":"photo_gallery_main_video","data-testid":"photo_gallery_main_video"}):d.createElement("img",{ref:s,className:E.mainPhotoImage,src:n,width:"100%",height:"100%",alt:"",decoding:"async",loading:"lazy","data-qaid":"photo_gallery_main_image","data-testid":"photo_gallery_main_image"})})),O=d.forwardRef((function(t,e){var n=t.items,i=t.onChange,o=d.useRef([]),s=d.useRef(0),r=d.useRef(null),l=function(){o.current.forEach((function(t){null==t||t.reset()}))},c=function(t){var e,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=null===(e=r.current)||void 0===e?void 0:e.children[t];l(),i&&v(i,r.current,n)};d.useImperativeHandle(e,(function(){return{scrollToIndex:c}}),[]);var h=function(){if(r.current){var t=function(t,e){var n=t.scrollLeft/t.scrollWidth*e;return Math.round(n)}(r.current,n.length);s.current!==t&&(s.current=t,i(t),l())}};return d.createElement(a.ScrollControls,{ref:r,className:E.mainPhotoScrollControls,showOnHover:!0,hideOnDisabled:!0},(function(t){return d.createElement("div",{ref:t,className:E.mainPhoto,onScroll:h},n.map((function(t,e){var n,i=t.type,a=t.src,s="video"===i,r=s?b(a):a,l=s?(n=y(a),"https://youtube.com/embed/".concat(n,"?enablejsapi=1&rel=0")):void 0;return d.createElement("div",{key:e,className:E.mainPhotoItem,"data-qaid":"photo_gallery_main_item","data-testid":"photo_gallery_main_item"},d.createElement(w,{ref:function(t){return o.current[e]=t},src:r,videoSrc:l}))})))}))})),z=d.forwardRef((function(t,e){var n=t.items,i=t.selectedIndex,o=t.onChange,a=d.useRef(null),l=function(t){var e,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=null===(e=a.current)||void 0===e?void 0:e.children[t];i&&v(i,a.current,n)};d.useImperativeHandle(e,(function(){return{scrollToIndex:l}}),[]);return d.createElement("div",{ref:a,className:E.preview},n.map((function(t,e){var n=t.type,a=t.src,l="video"===n,c=l?b(a):a;return d.createElement("div",{key:e,className:E.previewItem,"data-qaid":"photo_gallery_preview_item","data-testid":"photo_gallery_preview_item"},d.createElement("button",{className:E.previewButton,type:"button",onClick:function(){return function(t){o(t)}(e)},disabled:i===e,"data-qaid":"photo_gallery_preview_button","data-testid":"photo_gallery_preview_button"},d.createElement("img",{className:E.previewImage,src:c,width:58,height:58,alt:"",decoding:"async",loading:"lazy","data-qaid":"photo_gallery_preview_image","data-testid":"photo_gallery_preview_image"}),l&&d.createElement("div",{className:E.videoPlayLabel,"data-qaid":"photo_gallery_preview_play","data-testid":"photo_gallery_preview_play"},d.createElement(s.Icon,{className:E.videoPlayLabelIcon,"icon-as":r.SvgPlay}))))})))})),T=function(t){var e,n,i=t.title,o=t.onClose,a=t.selectedIndex,r=t.itemsLength,u=a+1,f=(0,c.useBodyTTag().t)(p||(e=["Фото "," из ",""],n||(n=e.slice(0)),p=Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))),u,r);return d.createElement("div",{className:E.header},d.createElement("div",{className:E.headerTitle,"data-qaid":"photo_gallery_title","data-testid":"photo_gallery_title"},i||f),d.createElement("div",{className:E.headerClose},d.createElement(l.Button,{"button-padding":"xxs","button-theme":"black-inherit",type:"button",onClick:o,"data-qaid":"photo_gallery_close_button","data-testid":"photo_gallery_close_button"},d.createElement(s.Icon,{"icon-as":h.SvgClose,style:{width:24,height:24}}))))};exports.PhotoGallery=function(t){var a=t.isOpen,s=t.title,r=t.visibleIndex,l=void 0===r?0:r,c=t.items,h=t.zIndex,u=void 0===h?5e3:h,m=t.onClose,p=t.onChange,g=d.useRef(!0),v=d.useRef(null),y=d.useRef(null),b=f(d.useState(l),2),x=b[0],w=b[1];d.useEffect((function(){a&&"function"==typeof p&&p(x)}),[x]),d.useEffect((function(){var t,e;a&&(w(l),null===(t=y.current)||void 0===t||t.scrollToIndex(l,!1),null===(e=v.current)||void 0===e||e.scrollToIndex(l,!1))}),[a]),d.useEffect((function(){var t;if(!a)return function(){};var e=null,n=function(){e&&clearTimeout(e)},i=function(){n(),e=setTimeout((function(){var t,e;null===(t=y.current)||void 0===t||t.scrollToIndex(x,!1),null===(e=v.current)||void 0===e||e.scrollToIndex(x,!1)}),100)};return window.addEventListener("resize",i),null===(t=window)||void 0===t||null===(t=t.matchMedia("(orientation: portrait)"))||void 0===t||t.addEventListener("change",i),function(){var t;n(),window.removeEventListener("resize",i),null===(t=window)||void 0===t||null===(t=t.matchMedia("(orientation: portrait)"))||void 0===t||t.removeEventListener("change",i)}}),[a,x]);var I=function(t){var e,n;g.current=!1,w(t),null===(e=y.current)||void 0===e||e.scrollToIndex(t),null===(n=v.current)||void 0===n||n.scrollToIndex(t)},_=function(){m(x)};return d.createElement(d.Fragment,null,d.createElement(n.Backdrop,{isOpen:a,onClick:_,zIndex:u,isBodyScrollLock:!0}),d.createElement(e.CSSTransition,{in:a,timeout:240,classNames:E,unmountOnExit:!0},d.createElement(o.Portal,null,d.createElement("div",{className:E.root,"data-qaid":"photo_gallery","data-testid":"photo_gallery",style:{zIndex:u}},d.createElement(i.KeyPress,{code:"Escape",onKeyUp:_}),d.createElement(i.KeyPress,{code:"ArrowLeft",onKeyUp:function(){0!==x&&I(x-1)}}),d.createElement(i.KeyPress,{code:"ArrowRight",onKeyUp:function(){x!==c.length-1&&I(x+1)}}),d.createElement("div",{className:E.layout},d.createElement("header",{className:E.layoutHeader},d.createElement(T,{title:s,selectedIndex:x,itemsLength:c.length,onClose:_})),d.createElement("div",{className:E.layoutContent},d.createElement("section",{className:E.layoutSection},d.createElement(O,{ref:v,items:c,onChange:function(t){var e;g.current&&(w(t),null===(e=y.current)||void 0===e||e.scrollToIndex(t));g.current||x!==t||(g.current=!0)}})),c.length>1&&d.createElement("aside",{className:E.layoutAside},d.createElement(z,{ref:y,items:c,selectedIndex:x,onChange:I}))))))))},require("./style.production.css");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react"),e=require("react-scrolllock"),n=require("react-transition-group"),i=require("@prom-ui/core/Backdrop"),o=require("@prom-ui/core/KeyPress"),a=require("@prom-ui/core/Portal"),r=require("@prom-ui/core/ScrollControls"),s=require("react-scrolllock/dist/utils"),l=require("@prom-ui/core/Icon"),c=require("@prom-ui/icons/Play"),u=require("@prom-ui/core/Button"),h=require("@prom-ui/core/useBodyTTag"),d=require("@prom-ui/icons/Close");function f(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}function m(t){if(t&&"object"==typeof t&&"default"in t)return t;var e=Object.create(null);return t&&Object.keys(t).forEach((function(n){if("default"!==n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}})),e.default=t,Object.freeze(e)}var p=m(t),g=f(e);function v(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var i,o,a,r,s=[],l=!0,c=!1;try{if(a=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;l=!1}else for(;!(l=(i=a.call(n)).done)&&(s.push(i.value),s.length!==e);l=!0);}catch(u){c=!0,o=u}finally{try{if(!l&&null!=n.return&&(r=n.return(),Object(r)!==r))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return y(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return y(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n<e;n++)i[n]=t[n];return i}function b(t){var e=t.currentTarget;return e.scrollHeight>e.clientHeight||e.scrollWidth>e.clientWidth?(t.stopPropagation(),!0):(t.preventDefault(),!1)}var E,x=!("undefined"==typeof window||!window.document||!window.document.createElement)&&!(!window.addEventListener&&!window.attachEvent),w=function(t){var e=t.isActive,n=void 0!==e&&e,i=t.scrollRef,o=t.children;return p.useEffect((function(){if(n&&x&&null!=i&&i.current)return i.current.addEventListener("touchstart",s.preventInertiaScroll,s.listenerOptions),i.current.addEventListener("touchmove",b,s.listenerOptions),function(){n&&x&&null!=i&&i.current&&(i.current.removeEventListener("touchstart",s.preventInertiaScroll,s.listenerOptions),i.current.removeEventListener("touchmove",b,s.listenerOptions))}})),p.createElement(p.Fragment,null,o)},O=new Map,z=function(t,e){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];O.has(e)&&(cancelAnimationFrame(O.get(e)),O.delete(e));var i=requestAnimationFrame((function(){var i=e.getBoundingClientRect(),o=t.getBoundingClientRect(),a=o.top+e.scrollTop-i.top-i.height/2+o.height/2,r=o.left+e.scrollLeft-i.left-i.width/2+o.width/2;r<0&&(r=0),a<0&&(a=0),e.scrollTo({behavior:n?"smooth":"instant",top:a,left:r})}));O.set(e,i)},T=function(t){var e=/^.*(?:(?:youtu\.be\/|v\/|vi\/|u\/\w\/|embed\/|shorts\/)|(?:(?:watch)?\?v(?:i)?=|\&v(?:i)?=))([^#\&\?]*).*/.exec(t);return e&&e[1]},I=function(t){var e=T(t);return"https://img.youtube.com/vi/".concat(e,"/0.jpg")},_=function(){var t=function(t,e){this.el=t,this.zoomFactor=1,this.lastScale=1,this.offset={x:0,y:0},this.initialOffset={x:0,y:0},this.options=Object.assign({},this.defaults,e),this.setupMarkup(),this.bindEvents(),this.update(),this.isImageLoaded(this.el)&&(this.updateAspectRatio(),this.setupOffsets()),this.enable()},e=function(t,e){return t+e};t.prototype={defaults:{tapZoomFactor:2,zoomOutFactor:1.3,animationDuration:300,maxZoom:4,minZoom:.5,draggableUnzoomed:!0,lockDragAxis:!1,setOffsetsOnce:!1,use2d:!0,useMouseWheel:!1,verticalPadding:0,horizontalPadding:0,onZoomStart:null,onZoomEnd:null,onZoomUpdate:null,onDragStart:null,onDragEnd:null,onDragUpdate:null,onDoubleTap:null,onMouseWheel:null},handleDragStart:function(t){"function"==typeof this.options.onDragStart&&this.options.onDragStart(this,t),this.stopAnimation(),this.lastDragPosition=!1,this.hasInteraction=!0,this.handleDrag(t)},handleDrag:function(t){var e="touchmove"===t.type?this.getTouches(t)[0]:this.getPointer(t);this.drag(e,this.lastDragPosition),this.offset=this.sanitizeOffset(this.offset),this.lastDragPosition=e},handleDragEnd:function(){"function"==typeof this.options.onDragEnd&&this.options.onDragEnd(this,event),this.end()},handleZoomStart:function(t){"function"==typeof this.options.onZoomStart&&this.options.onZoomStart(this,t),this.stopAnimation(),this.lastScale=1,this.nthZoom=0,this.lastZoomCenter=!1,this.hasInteraction=!0},handleZoom:function(t,e){var n=this.getTouchCenter(this.getTouches(t)),i=e/this.lastScale;this.lastScale=e,this.nthZoom+=1,this.nthZoom>3&&(this.scale(i,n),this.drag(n,this.lastZoomCenter)),this.lastZoomCenter=n},handleZoomEnd:function(){"function"==typeof this.options.onZoomEnd&&this.options.onZoomEnd(this,event),this.end()},handleDoubleTap:function(t){var e=this.getTouches(t)[0],n=this.zoomFactor>1?1:this.options.tapZoomFactor,i=this.zoomFactor,o=function(t){this.scaleTo(i+t*(n-i),e)}.bind(this);this.hasInteraction||(this.isDoubleTap=!0,i>n&&(e=this.getCurrentZoomCenter()),this.animate(this.options.animationDuration,o,this.swing),"function"==typeof this.options.onDoubleTap&&this.options.onDoubleTap(this,t))},handleMouseWheel:function(t){var e=this.getPointer(t),n=Math.min(Math.max(this.options.minZoom,this.lastScale+-.01*t.deltaY),this.options.maxZoom),i=n/this.lastScale;this.scale(i,e),this.lastScale=n,this.update(),"function"==typeof this.options.onMouseWheel&&this.options.onMouseWheel(this,t)},computeInitialOffset:function(){this.initialOffset={x:-Math.abs(this.el.offsetWidth*this.getInitialZoomFactor()-this.container.offsetWidth)/2,y:-Math.abs(this.el.offsetHeight*this.getInitialZoomFactor()-this.container.offsetHeight)/2}},resetOffset:function(){this.offset.x=this.initialOffset.x,this.offset.y=this.initialOffset.y},isImageLoaded:function(t){return"IMG"===t.nodeName?t.complete&&0!==t.naturalHeight:Array.from(t.querySelectorAll("img")).every(this.isImageLoaded)},setupOffsets:function(){this.options.setOffsetsOnce&&this._isOffsetsSet||(this._isOffsetsSet=!0,this.computeInitialOffset(),this.resetOffset())},sanitizeOffset:function(t){var e=this.el.offsetWidth*this.getInitialZoomFactor()*this.zoomFactor,n=this.el.offsetHeight*this.getInitialZoomFactor()*this.zoomFactor,i=e-this.getContainerX()+this.options.horizontalPadding,o=n-this.getContainerY()+this.options.verticalPadding,a=Math.max(i,0),r=Math.max(o,0),s=Math.min(i,0)-this.options.horizontalPadding,l=Math.min(o,0)-this.options.verticalPadding;return{x:Math.min(Math.max(t.x,s),a),y:Math.min(Math.max(t.y,l),r)}},scaleTo:function(t,e){this.scale(t/this.zoomFactor,e)},scale:function(t,e){t=this.scaleZoomFactor(t),this.addOffset({x:(t-1)*(e.x+this.offset.x),y:(t-1)*(e.y+this.offset.y)}),"function"==typeof this.options.onZoomUpdate&&this.options.onZoomUpdate(this,event)},scaleZoomFactor:function(t){var e=this.zoomFactor;return this.zoomFactor*=t,this.zoomFactor=Math.min(this.options.maxZoom,Math.max(this.zoomFactor,this.options.minZoom)),this.zoomFactor/e},canDrag:function(){return this.options.draggableUnzoomed||!((t=this.zoomFactor)>(e=1)-.01&&t<e+.01);var t,e},drag:function(t,e){e&&(this.options.lockDragAxis?Math.abs(t.x-e.x)>Math.abs(t.y-e.y)?this.addOffset({x:-(t.x-e.x),y:0}):this.addOffset({y:-(t.y-e.y),x:0}):this.addOffset({y:-(t.y-e.y),x:-(t.x-e.x)}),"function"==typeof this.options.onDragUpdate&&this.options.onDragUpdate(this,event))},getTouchCenter:function(t){return this.getVectorAvg(t)},getVectorAvg:function(t){return{x:t.map((function(t){return t.x})).reduce(e)/t.length,y:t.map((function(t){return t.y})).reduce(e)/t.length}},addOffset:function(t){this.offset={x:this.offset.x+t.x,y:this.offset.y+t.y}},sanitize:function(){this.zoomFactor<this.options.zoomOutFactor?this.zoomOutAnimation():this.isInsaneOffset(this.offset)&&this.sanitizeOffsetAnimation()},isInsaneOffset:function(t){var e=this.sanitizeOffset(t);return e.x!==t.x||e.y!==t.y},sanitizeOffsetAnimation:function(){var t=this.sanitizeOffset(this.offset),e=this.offset.x,n=this.offset.y,i=function(i){this.offset.x=e+i*(t.x-e),this.offset.y=n+i*(t.y-n),this.update()}.bind(this);this.animate(this.options.animationDuration,i,this.swing)},zoomOutAnimation:function(){if(1!==this.zoomFactor){var t=this.zoomFactor,e=this.getCurrentZoomCenter(),n=function(n){this.scaleTo(t+n*(1-t),e)}.bind(this);this.animate(this.options.animationDuration,n,this.swing)}},updateAspectRatio:function(){this.unsetContainerY(),this.setContainerY(this.container.parentElement.offsetHeight)},getInitialZoomFactor:function(){var t=this.container.offsetWidth/this.el.offsetWidth,e=this.container.offsetHeight/this.el.offsetHeight;return Math.min(t,e)},getAspectRatio:function(){return this.el.offsetWidth/this.el.offsetHeight},getCurrentZoomCenter:function(){var t=this.offset.x-this.initialOffset.x,e=-1*this.offset.x-t/(1/this.zoomFactor-1),n=this.offset.y-this.initialOffset.y;return{x:e,y:-1*this.offset.y-n/(1/this.zoomFactor-1)}},getTouches:function(t){var e=this.container.getBoundingClientRect(),n=document.documentElement.scrollTop||document.body.scrollTop,i=document.documentElement.scrollLeft||document.body.scrollLeft,o=e.top+n,a=e.left+i;return Array.prototype.slice.call(t.touches).map((function(t){return{x:t.pageX-a,y:t.pageY-o}}))},getPointer:function(t){var e=this.container.getBoundingClientRect(),n=document.documentElement.scrollTop||document.body.scrollTop,i=document.documentElement.scrollLeft||document.body.scrollLeft,o=e.top+n,a=e.left+i;return{x:t.pageX-a,y:t.pageY-o}},animate:function(t,e,n,i){var o=(new Date).getTime(),a=function(){if(this.inAnimation){var r=(new Date).getTime()-o,s=r/t;r>=t?(e(1),i&&i(),this.update(),this.stopAnimation(),this.update()):(n&&(s=n(s)),e(s),this.update(),requestAnimationFrame(a))}}.bind(this);this.inAnimation=!0,requestAnimationFrame(a)},stopAnimation:function(){this.inAnimation=!1},swing:function(t){return-Math.cos(t*Math.PI)/2+.5},getContainerX:function(){return this.container.offsetWidth},getContainerY:function(){return this.container.offsetHeight},setContainerY:function(t){return this.container.style.height=t+"px"},unsetContainerY:function(){this.container.style.height=null},setupMarkup:function(){var t,e;this.container=(t='<div class="pinch-zoom-container" style="height: 100%;"></div>',(e=document.implementation.createHTMLDocument("")).body.innerHTML=t,Array.from(e.body.children)[0]),this.el.parentNode.insertBefore(this.container,this.el),this.container.appendChild(this.el),this.container.style.overflow="hidden",this.container.style.position="relative",this.el.style.webkitTransformOrigin="0% 0%",this.el.style.mozTransformOrigin="0% 0%",this.el.style.msTransformOrigin="0% 0%",this.el.style.oTransformOrigin="0% 0%",this.el.style.transformOrigin="0% 0%",this.el.style.position="absolute",this.el.style.backfaceVisibility="hidden",this.el.style.willChange="transform"},end:function(){this.hasInteraction=!1,this.sanitize(),this.update()},bindEvents:function(){var t=this;n(this.container,this),this.resizeHandler=this.update.bind(this),window.addEventListener("resize",this.resizeHandler),Array.from(this.el.querySelectorAll("img")).forEach((function(e){e.addEventListener("load",t.update.bind(t))})),"IMG"===this.el.nodeName&&this.el.addEventListener("load",this.update.bind(this))},update:function(t){t&&"resize"===t.type&&(this.updateAspectRatio(),this.setupOffsets()),t&&"load"===t.type&&(this.updateAspectRatio(),this.setupOffsets()),this.updatePlanned||(this.updatePlanned=!0,window.setTimeout(function(){this.updatePlanned=!1;var t=this.getInitialZoomFactor()*this.zoomFactor,e=-this.offset.x/t,n=-this.offset.y/t,i="scale3d("+t+", "+t+",1) translate3d("+e+"px,"+n+"px,0px)",o="scale("+t+", "+t+") translate("+e+"px,"+n+"px)",a=function(){this.clone&&(this.clone.parentNode.removeChild(this.clone),delete this.clone)}.bind(this);!this.options.use2d||this.hasInteraction||this.inAnimation?(this.is3d=!0,a(),this.el.style.webkitTransform=i,this.el.style.mozTransform=o,this.el.style.msTransform=o,this.el.style.oTransform=o,this.el.style.transform=i):(this.is3d&&(this.clone=this.el.cloneNode(!0),this.clone.style.pointerEvents="none",this.container.appendChild(this.clone),window.setTimeout(a,200)),this.el.style.webkitTransform=o,this.el.style.mozTransform=o,this.el.style.msTransform=o,this.el.style.oTransform=o,this.el.style.transform=o,this.is3d=!1)}.bind(this),0))},enable:function(){this.enabled=!0},disable:function(){this.enabled=!1},destroy:function(){window.removeEventListener("resize",this.resizeHandler),this.container&&(this.container.remove(),this.container=null)},reset:function(){this.zoomOutAnimation()}};var n=function(t,e){var n=null,i=0,o=null,a=null,r=function(t,i){if(n!==t){if(n&&!t)switch(n){case"zoom":e.handleZoomEnd(i);break;case"drag":e.handleDragEnd(i)}switch(t){case"zoom":e.handleZoomStart(i);break;case"drag":e.handleDragStart(i)}}n=t},s=function(t){2===i?r("zoom"):1===i&&e.canDrag()?r("drag",t):r(null,t)},l=function(t){return Array.from(t).map((function(t){return{x:t.pageX,y:t.pageY}}))},c=function(t,e){var n,i;return n=t.x-e.x,i=t.y-e.y,Math.sqrt(n*n+i*i)},u=function(t){t.stopPropagation(),t.preventDefault()},h=!0;t.addEventListener("touchstart",(function(t){e.enabled&&(h=!0,i=t.touches.length,function(t){var a=(new Date).getTime();if(i>1&&(o=null),a-o<300)switch(u(t),e.handleDoubleTap(t),n){case"zoom":e.handleZoomEnd(t);break;case"drag":e.handleDragEnd(t)}else e.isDoubleTap=!1;1===i&&(o=a)}(t))}),{passive:!1}),t.addEventListener("touchmove",(function(t){if(e.enabled&&!e.isDoubleTap){if(h)s(t),n&&u(t),a=l(t.touches);else{switch(n){case"zoom":2==a.length&&2==t.touches.length&&e.handleZoom(t,function(t,e){var n=c(t[0],t[1]);return c(e[0],e[1])/n}(a,l(t.touches)));break;case"drag":e.handleDrag(t)}n&&(u(t),e.update())}h=!1}}),{passive:!1}),t.addEventListener("touchend",(function(t){e.enabled&&(i=t.touches.length,s(t))})),e.options.useMouseWheel&&(t.addEventListener("mousewheel",(function(t){e.enabled&&(u(t),e.handleMouseWheel(t))})),t.addEventListener("mousedown",(function(t){e.enabled&&(h=!0,i=1)}),{passive:!0}),t.addEventListener("mousemove",(function(t){e.enabled&&(h?(s(t),n&&u(t)):("drag"===n&&e.handleDrag(t),n&&(u(t),e.update())),h=!1)}),{passive:!1}),t.addEventListener("mouseup",(function(t){e.enabled&&(i=0,s(t))}),{passive:!0}))};return t}(),C={scrolling:"q1DKc",root:"KiBKq",layout:"JBDok",layoutHeader:"tVG4b",layoutContent:"O43ff",layoutSection:"CvZb6",layoutAside:"fdKgJ",header:"xfAad",headerTitle:"QiOEy",headerClose:"qdl3x",mainPhotoScrollControls:"PeY3Y",mainPhoto:"QIMHy q1DKc",mainPhotoItem:"aZCyk",mainPhotoImage:"_2aEr5",mainPhotoIframe:"kThdT",preview:"F-k0z q1DKc",previewItem:"jf683",previewButton:"VAXOP",previewImage:"Mx2Y-",videoPlayLabel:"jQiDN",videoPlayLabelIcon:"wSdjd",enter:"Lnosr",exit:"NW-xY",enterActive:"LrirU",exitActive:"L6st-"},A=p.forwardRef((function(t,e){var n=t.src,i=t.videoSrc,o=p.useRef(null),a=p.useRef(null),r=p.useRef(null),s=!!i,l=function(){var t,e;null===(t=a.current)||void 0===t||t.reset(),null===(e=o.current)||void 0===e||null===(e=e.contentWindow)||void 0===e||e.postMessage('{"event":"command","func":"pauseVideo","args":""}',"*")};return p.useEffect((function(){return requestAnimationFrame((function(){r.current&&!s&&(a.current=new _(r.current,{draggableUnzoomed:!1,animationDuration:200,setOffsetsOnce:!1}))})),function(){var t;null===(t=a.current)||void 0===t||t.destroy()}}),[i]),p.useImperativeHandle(e,(function(){return{reset:l}}),[]),s?p.createElement("iframe",{ref:o,className:C.mainPhotoIframe,src:i,width:"100%",height:"100%",allowFullScreen:!0,title:"",loading:"lazy","data-qaid":"photo_gallery_main_video","data-testid":"photo_gallery_main_video"}):p.createElement("img",{ref:r,className:C.mainPhotoImage,src:n,width:"100%",height:"100%",alt:"",decoding:"async",loading:"lazy","data-qaid":"photo_gallery_main_image","data-testid":"photo_gallery_main_image"})})),D=p.forwardRef((function(t,e){var n=t.items,i=t.onChange,o=p.useRef([]),a=p.useRef(0),s=p.useRef(null),l=function(){o.current.forEach((function(t){null==t||t.reset()}))},c=function(t){var e,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=null===(e=s.current)||void 0===e?void 0:e.children[t];l(),i&&z(i,s.current,n)};p.useImperativeHandle(e,(function(){return{scrollToIndex:c}}),[]);var u=function(){if(s.current){var t=function(t,e){var n=t.scrollLeft/t.scrollWidth*e;return Math.round(n)}(s.current,n.length);a.current!==t&&(a.current=t,i(t),l())}};return p.createElement(r.ScrollControls,{ref:s,className:C.mainPhotoScrollControls,showOnHover:!0,hideOnDisabled:!0},(function(t){return p.createElement(w,{scrollRef:t,isActive:!0},p.createElement("div",{ref:t,className:C.mainPhoto,onScroll:u},n.map((function(t,e){var n,i=t.type,a=t.src,r="video"===i,s=r?I(a):a,l=r?(n=T(a),"https://youtube.com/embed/".concat(n,"?enablejsapi=1&rel=0")):void 0;return p.createElement("div",{key:e,className:C.mainPhotoItem,"data-qaid":"photo_gallery_main_item","data-testid":"photo_gallery_main_item"},p.createElement(A,{ref:function(t){return o.current[e]=t},src:s,videoSrc:l}))}))))}))})),P=p.forwardRef((function(t,e){var n=t.items,i=t.selectedIndex,o=t.onChange,a=p.useRef(null),r=function(t){var e,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=null===(e=a.current)||void 0===e?void 0:e.children[t];i&&z(i,a.current,n)};p.useImperativeHandle(e,(function(){return{scrollToIndex:r}}),[]);return p.createElement(w,{scrollRef:a,isActive:!0},p.createElement("div",{ref:a,className:C.preview},n.map((function(t,e){var n=t.type,a=t.src,r="video"===n,s=r?I(a):a;return p.createElement("div",{key:e,className:C.previewItem,"data-qaid":"photo_gallery_preview_item","data-testid":"photo_gallery_preview_item"},p.createElement("button",{className:C.previewButton,type:"button",onClick:function(){return function(t){o(t)}(e)},disabled:i===e,"data-qaid":"photo_gallery_preview_button","data-testid":"photo_gallery_preview_button"},p.createElement("img",{className:C.previewImage,src:s,width:58,height:58,alt:"",decoding:"async",loading:"lazy","data-qaid":"photo_gallery_preview_image","data-testid":"photo_gallery_preview_image"}),r&&p.createElement("div",{className:C.videoPlayLabel,"data-qaid":"photo_gallery_preview_play","data-testid":"photo_gallery_preview_play"},p.createElement(l.Icon,{className:C.videoPlayLabelIcon,"icon-as":c.SvgPlay}))))}))))})),S=function(t){var e,n,i=t.title,o=t.onClose,a=t.selectedIndex,r=t.itemsLength,s=a+1,c=(0,h.useBodyTTag().t)(E||(e=["Фото "," из ",""],n||(n=e.slice(0)),E=Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))),s,r);return p.createElement("div",{className:C.header},p.createElement("div",{className:C.headerTitle,"data-qaid":"photo_gallery_title","data-testid":"photo_gallery_title"},i||c),p.createElement("div",{className:C.headerClose},p.createElement(u.Button,{"button-padding":"xxs","button-theme":"black-inherit",type:"button",onClick:o,"data-qaid":"photo_gallery_close_button","data-testid":"photo_gallery_close_button"},p.createElement(l.Icon,{"icon-as":d.SvgClose,style:{width:24,height:24}}))))};exports.PhotoGallery=function(t){var e=t.isOpen,r=t.title,s=t.visibleIndex,l=void 0===s?0:s,c=t.items,u=t.zIndex,h=void 0===u?5e3:u,d=t.onClose,f=t.onChange,m=p.useRef(!0),y=p.useRef(null),b=p.useRef(null),E=v(p.useState(l),2),x=E[0],w=E[1];p.useEffect((function(){e&&"function"==typeof f&&f(x)}),[x]),p.useEffect((function(){var t,n;e&&(w(l),null===(t=b.current)||void 0===t||t.scrollToIndex(l,!1),null===(n=y.current)||void 0===n||n.scrollToIndex(l,!1))}),[e]),p.useEffect((function(){var t;if(!e)return function(){};var n=null,i=function(){n&&clearTimeout(n)},o=function(){i(),n=setTimeout((function(){var t,e;null===(t=b.current)||void 0===t||t.scrollToIndex(x,!1),null===(e=y.current)||void 0===e||e.scrollToIndex(x,!1)}),100)};return window.addEventListener("resize",o),null===(t=window)||void 0===t||null===(t=t.matchMedia("(orientation: portrait)"))||void 0===t||t.addEventListener("change",o),function(){var t;i(),window.removeEventListener("resize",o),null===(t=window)||void 0===t||null===(t=t.matchMedia("(orientation: portrait)"))||void 0===t||t.removeEventListener("change",o)}}),[e,x]);var O=function(t){var e,n;m.current=!1,w(t),null===(e=b.current)||void 0===e||e.scrollToIndex(t),null===(n=y.current)||void 0===n||n.scrollToIndex(t)},z=function(){d(x)};return p.createElement(p.Fragment,null,p.createElement(i.Backdrop,{isOpen:e,onClick:z,zIndex:h}),p.createElement(n.CSSTransition,{in:e,timeout:240,classNames:C,unmountOnExit:!0},p.createElement(a.Portal,null,p.createElement("div",{className:C.root,"data-qaid":"photo_gallery","data-testid":"photo_gallery",style:{zIndex:h}},p.createElement(g.default,null),p.createElement(o.KeyPress,{code:"Escape",onKeyUp:z}),p.createElement(o.KeyPress,{code:"ArrowLeft",onKeyUp:function(){0!==x&&O(x-1)}}),p.createElement(o.KeyPress,{code:"ArrowRight",onKeyUp:function(){x!==c.length-1&&O(x+1)}}),p.createElement("div",{className:C.layout},p.createElement("header",{className:C.layoutHeader},p.createElement(S,{title:r,selectedIndex:x,itemsLength:c.length,onClose:z})),p.createElement("div",{className:C.layoutContent},p.createElement("section",{className:C.layoutSection},p.createElement(D,{ref:y,items:c,onChange:function(t){var e;m.current&&(w(t),null===(e=b.current)||void 0===e||e.scrollToIndex(t));m.current||x!==t||(m.current=!0)}})),c.length>1&&p.createElement("aside",{className:C.layoutAside},p.createElement(P,{ref:b,items:c,selectedIndex:x,onChange:O}))))))))},require("./style.production.v2.css");
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react"),e=require("react-transition-group"),n=require("@prom-ui/core/Backdrop"),i=require("@prom-ui/core/KeyPress"),o=require("@prom-ui/core/Portal"),a=require("@prom-ui/core/ScrollControls"),s=require("@prom-ui/core/Icon"),r=require("@prom-ui/icons/Play"),l=require("@prom-ui/core/Button"),c=require("@prom-ui/core/useBodyTTag"),h=require("@prom-ui/icons/Close");function u(t){if(t&&"object"==typeof t&&"default"in t)return t;var e=Object.create(null);return t&&Object.keys(t).forEach((function(n){if("default"!==n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}})),e.default=t,Object.freeze(e)}var d=u(t);function f(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var i,o,a,s,r=[],l=!0,c=!1;try{if(a=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;l=!1}else for(;!(l=(i=a.call(n)).done)&&(r.push(i.value),r.length!==e);l=!0);}catch(h){c=!0,o=h}finally{try{if(!l&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(c)throw o}}return r}}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return m(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return m(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n<e;n++)i[n]=t[n];return i}var p,g=new Map,v=function(t,e){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];g.has(e)&&(cancelAnimationFrame(g.get(e)),g.delete(e));var i=requestAnimationFrame((function(){var i=e.getBoundingClientRect(),o=t.getBoundingClientRect(),a=o.top+e.scrollTop-i.top-i.height/2+o.height/2,s=o.left+e.scrollLeft-i.left-i.width/2+o.width/2;s<0&&(s=0),a<0&&(a=0),e.scrollTo({behavior:n?"smooth":"instant",top:a,left:s})}));g.set(e,i)},y=function(t){var e=/^.*(?:(?:youtu\.be\/|v\/|vi\/|u\/\w\/|embed\/|shorts\/)|(?:(?:watch)?\?v(?:i)?=|\&v(?:i)?=))([^#\&\?]*).*/.exec(t);return e&&e[1]},b=function(t){var e=y(t);return"https://img.youtube.com/vi/".concat(e,"/0.jpg")},x=function(){var t=function(t,e){this.el=t,this.zoomFactor=1,this.lastScale=1,this.offset={x:0,y:0},this.initialOffset={x:0,y:0},this.options=Object.assign({},this.defaults,e),this.setupMarkup(),this.bindEvents(),this.update(),this.isImageLoaded(this.el)&&(this.updateAspectRatio(),this.setupOffsets()),this.enable()},e=function(t,e){return t+e};t.prototype={defaults:{tapZoomFactor:2,zoomOutFactor:1.3,animationDuration:300,maxZoom:4,minZoom:.5,draggableUnzoomed:!0,lockDragAxis:!1,setOffsetsOnce:!1,use2d:!0,useMouseWheel:!1,verticalPadding:0,horizontalPadding:0,onZoomStart:null,onZoomEnd:null,onZoomUpdate:null,onDragStart:null,onDragEnd:null,onDragUpdate:null,onDoubleTap:null,onMouseWheel:null},handleDragStart:function(t){"function"==typeof this.options.onDragStart&&this.options.onDragStart(this,t),this.stopAnimation(),this.lastDragPosition=!1,this.hasInteraction=!0,this.handleDrag(t)},handleDrag:function(t){var e="touchmove"===t.type?this.getTouches(t)[0]:this.getPointer(t);this.drag(e,this.lastDragPosition),this.offset=this.sanitizeOffset(this.offset),this.lastDragPosition=e},handleDragEnd:function(){"function"==typeof this.options.onDragEnd&&this.options.onDragEnd(this,event),this.end()},handleZoomStart:function(t){"function"==typeof this.options.onZoomStart&&this.options.onZoomStart(this,t),this.stopAnimation(),this.lastScale=1,this.nthZoom=0,this.lastZoomCenter=!1,this.hasInteraction=!0},handleZoom:function(t,e){var n=this.getTouchCenter(this.getTouches(t)),i=e/this.lastScale;this.lastScale=e,this.nthZoom+=1,this.nthZoom>3&&(this.scale(i,n),this.drag(n,this.lastZoomCenter)),this.lastZoomCenter=n},handleZoomEnd:function(){"function"==typeof this.options.onZoomEnd&&this.options.onZoomEnd(this,event),this.end()},handleDoubleTap:function(t){var e=this.getTouches(t)[0],n=this.zoomFactor>1?1:this.options.tapZoomFactor,i=this.zoomFactor,o=function(t){this.scaleTo(i+t*(n-i),e)}.bind(this);this.hasInteraction||(this.isDoubleTap=!0,i>n&&(e=this.getCurrentZoomCenter()),this.animate(this.options.animationDuration,o,this.swing),"function"==typeof this.options.onDoubleTap&&this.options.onDoubleTap(this,t))},handleMouseWheel:function(t){var e=this.getPointer(t),n=Math.min(Math.max(this.options.minZoom,this.lastScale+-.01*t.deltaY),this.options.maxZoom),i=n/this.lastScale;this.scale(i,e),this.lastScale=n,this.update(),"function"==typeof this.options.onMouseWheel&&this.options.onMouseWheel(this,t)},computeInitialOffset:function(){this.initialOffset={x:-Math.abs(this.el.offsetWidth*this.getInitialZoomFactor()-this.container.offsetWidth)/2,y:-Math.abs(this.el.offsetHeight*this.getInitialZoomFactor()-this.container.offsetHeight)/2}},resetOffset:function(){this.offset.x=this.initialOffset.x,this.offset.y=this.initialOffset.y},isImageLoaded:function(t){return"IMG"===t.nodeName?t.complete&&0!==t.naturalHeight:Array.from(t.querySelectorAll("img")).every(this.isImageLoaded)},setupOffsets:function(){this.options.setOffsetsOnce&&this._isOffsetsSet||(this._isOffsetsSet=!0,this.computeInitialOffset(),this.resetOffset())},sanitizeOffset:function(t){var e=this.el.offsetWidth*this.getInitialZoomFactor()*this.zoomFactor,n=this.el.offsetHeight*this.getInitialZoomFactor()*this.zoomFactor,i=e-this.getContainerX()+this.options.horizontalPadding,o=n-this.getContainerY()+this.options.verticalPadding,a=Math.max(i,0),s=Math.max(o,0),r=Math.min(i,0)-this.options.horizontalPadding,l=Math.min(o,0)-this.options.verticalPadding;return{x:Math.min(Math.max(t.x,r),a),y:Math.min(Math.max(t.y,l),s)}},scaleTo:function(t,e){this.scale(t/this.zoomFactor,e)},scale:function(t,e){t=this.scaleZoomFactor(t),this.addOffset({x:(t-1)*(e.x+this.offset.x),y:(t-1)*(e.y+this.offset.y)}),"function"==typeof this.options.onZoomUpdate&&this.options.onZoomUpdate(this,event)},scaleZoomFactor:function(t){var e=this.zoomFactor;return this.zoomFactor*=t,this.zoomFactor=Math.min(this.options.maxZoom,Math.max(this.zoomFactor,this.options.minZoom)),this.zoomFactor/e},canDrag:function(){return this.options.draggableUnzoomed||!((t=this.zoomFactor)>(e=1)-.01&&t<e+.01);var t,e},drag:function(t,e){e&&(this.options.lockDragAxis?Math.abs(t.x-e.x)>Math.abs(t.y-e.y)?this.addOffset({x:-(t.x-e.x),y:0}):this.addOffset({y:-(t.y-e.y),x:0}):this.addOffset({y:-(t.y-e.y),x:-(t.x-e.x)}),"function"==typeof this.options.onDragUpdate&&this.options.onDragUpdate(this,event))},getTouchCenter:function(t){return this.getVectorAvg(t)},getVectorAvg:function(t){return{x:t.map((function(t){return t.x})).reduce(e)/t.length,y:t.map((function(t){return t.y})).reduce(e)/t.length}},addOffset:function(t){this.offset={x:this.offset.x+t.x,y:this.offset.y+t.y}},sanitize:function(){this.zoomFactor<this.options.zoomOutFactor?this.zoomOutAnimation():this.isInsaneOffset(this.offset)&&this.sanitizeOffsetAnimation()},isInsaneOffset:function(t){var e=this.sanitizeOffset(t);return e.x!==t.x||e.y!==t.y},sanitizeOffsetAnimation:function(){var t=this.sanitizeOffset(this.offset),e=this.offset.x,n=this.offset.y,i=function(i){this.offset.x=e+i*(t.x-e),this.offset.y=n+i*(t.y-n),this.update()}.bind(this);this.animate(this.options.animationDuration,i,this.swing)},zoomOutAnimation:function(){if(1!==this.zoomFactor){var t=this.zoomFactor,e=this.getCurrentZoomCenter(),n=function(n){this.scaleTo(t+n*(1-t),e)}.bind(this);this.animate(this.options.animationDuration,n,this.swing)}},updateAspectRatio:function(){this.unsetContainerY(),this.setContainerY(this.container.parentElement.offsetHeight)},getInitialZoomFactor:function(){var t=this.container.offsetWidth/this.el.offsetWidth,e=this.container.offsetHeight/this.el.offsetHeight;return Math.min(t,e)},getAspectRatio:function(){return this.el.offsetWidth/this.el.offsetHeight},getCurrentZoomCenter:function(){var t=this.offset.x-this.initialOffset.x,e=-1*this.offset.x-t/(1/this.zoomFactor-1),n=this.offset.y-this.initialOffset.y;return{x:e,y:-1*this.offset.y-n/(1/this.zoomFactor-1)}},getTouches:function(t){var e=this.container.getBoundingClientRect(),n=document.documentElement.scrollTop||document.body.scrollTop,i=document.documentElement.scrollLeft||document.body.scrollLeft,o=e.top+n,a=e.left+i;return Array.prototype.slice.call(t.touches).map((function(t){return{x:t.pageX-a,y:t.pageY-o}}))},getPointer:function(t){var e=this.container.getBoundingClientRect(),n=document.documentElement.scrollTop||document.body.scrollTop,i=document.documentElement.scrollLeft||document.body.scrollLeft,o=e.top+n,a=e.left+i;return{x:t.pageX-a,y:t.pageY-o}},animate:function(t,e,n,i){var o=(new Date).getTime(),a=function(){if(this.inAnimation){var s=(new Date).getTime()-o,r=s/t;s>=t?(e(1),i&&i(),this.update(),this.stopAnimation(),this.update()):(n&&(r=n(r)),e(r),this.update(),requestAnimationFrame(a))}}.bind(this);this.inAnimation=!0,requestAnimationFrame(a)},stopAnimation:function(){this.inAnimation=!1},swing:function(t){return-Math.cos(t*Math.PI)/2+.5},getContainerX:function(){return this.container.offsetWidth},getContainerY:function(){return this.container.offsetHeight},setContainerY:function(t){return this.container.style.height=t+"px"},unsetContainerY:function(){this.container.style.height=null},setupMarkup:function(){var t,e;this.container=(t='<div class="pinch-zoom-container" style="height: 100%;"></div>',(e=document.implementation.createHTMLDocument("")).body.innerHTML=t,Array.from(e.body.children)[0]),this.el.parentNode.insertBefore(this.container,this.el),this.container.appendChild(this.el),this.container.style.overflow="hidden",this.container.style.position="relative",this.el.style.webkitTransformOrigin="0% 0%",this.el.style.mozTransformOrigin="0% 0%",this.el.style.msTransformOrigin="0% 0%",this.el.style.oTransformOrigin="0% 0%",this.el.style.transformOrigin="0% 0%",this.el.style.position="absolute",this.el.style.backfaceVisibility="hidden",this.el.style.willChange="transform"},end:function(){this.hasInteraction=!1,this.sanitize(),this.update()},bindEvents:function(){var t=this;n(this.container,this),this.resizeHandler=this.update.bind(this),window.addEventListener("resize",this.resizeHandler),Array.from(this.el.querySelectorAll("img")).forEach((function(e){e.addEventListener("load",t.update.bind(t))})),"IMG"===this.el.nodeName&&this.el.addEventListener("load",this.update.bind(this))},update:function(t){t&&"resize"===t.type&&(this.updateAspectRatio(),this.setupOffsets()),t&&"load"===t.type&&(this.updateAspectRatio(),this.setupOffsets()),this.updatePlanned||(this.updatePlanned=!0,window.setTimeout(function(){this.updatePlanned=!1;var t=this.getInitialZoomFactor()*this.zoomFactor,e=-this.offset.x/t,n=-this.offset.y/t,i="scale3d("+t+", "+t+",1) translate3d("+e+"px,"+n+"px,0px)",o="scale("+t+", "+t+") translate("+e+"px,"+n+"px)",a=function(){this.clone&&(this.clone.parentNode.removeChild(this.clone),delete this.clone)}.bind(this);!this.options.use2d||this.hasInteraction||this.inAnimation?(this.is3d=!0,a(),this.el.style.webkitTransform=i,this.el.style.mozTransform=o,this.el.style.msTransform=o,this.el.style.oTransform=o,this.el.style.transform=i):(this.is3d&&(this.clone=this.el.cloneNode(!0),this.clone.style.pointerEvents="none",this.container.appendChild(this.clone),window.setTimeout(a,200)),this.el.style.webkitTransform=o,this.el.style.mozTransform=o,this.el.style.msTransform=o,this.el.style.oTransform=o,this.el.style.transform=o,this.is3d=!1)}.bind(this),0))},enable:function(){this.enabled=!0},disable:function(){this.enabled=!1},destroy:function(){window.removeEventListener("resize",this.resizeHandler),this.container&&(this.container.remove(),this.container=null)},reset:function(){this.zoomOutAnimation()}};var n=function(t,e){var n=null,i=0,o=null,a=null,s=function(t,i){if(n!==t){if(n&&!t)switch(n){case"zoom":e.handleZoomEnd(i);break;case"drag":e.handleDragEnd(i)}switch(t){case"zoom":e.handleZoomStart(i);break;case"drag":e.handleDragStart(i)}}n=t},r=function(t){2===i?s("zoom"):1===i&&e.canDrag()?s("drag",t):s(null,t)},l=function(t){return Array.from(t).map((function(t){return{x:t.pageX,y:t.pageY}}))},c=function(t,e){var n,i;return n=t.x-e.x,i=t.y-e.y,Math.sqrt(n*n+i*i)},h=function(t){t.stopPropagation(),t.preventDefault()},u=!0;t.addEventListener("touchstart",(function(t){e.enabled&&(u=!0,i=t.touches.length,function(t){var a=(new Date).getTime();if(i>1&&(o=null),a-o<300)switch(h(t),e.handleDoubleTap(t),n){case"zoom":e.handleZoomEnd(t);break;case"drag":e.handleDragEnd(t)}else e.isDoubleTap=!1;1===i&&(o=a)}(t))}),{passive:!1}),t.addEventListener("touchmove",(function(t){if(e.enabled&&!e.isDoubleTap){if(u)r(t),n&&h(t),a=l(t.touches);else{switch(n){case"zoom":2==a.length&&2==t.touches.length&&e.handleZoom(t,function(t,e){var n=c(t[0],t[1]);return c(e[0],e[1])/n}(a,l(t.touches)));break;case"drag":e.handleDrag(t)}n&&(h(t),e.update())}u=!1}}),{passive:!1}),t.addEventListener("touchend",(function(t){e.enabled&&(i=t.touches.length,r(t))})),e.options.useMouseWheel&&(t.addEventListener("mousewheel",(function(t){e.enabled&&(h(t),e.handleMouseWheel(t))})),t.addEventListener("mousedown",(function(t){e.enabled&&(u=!0,i=1)}),{passive:!0}),t.addEventListener("mousemove",(function(t){e.enabled&&(u?(r(t),n&&h(t)):("drag"===n&&e.handleDrag(t),n&&(h(t),e.update())),u=!1)}),{passive:!1}),t.addEventListener("mouseup",(function(t){e.enabled&&(i=0,r(t))}),{passive:!0}))};return t}(),E={scrolling:"q1DKc",root:"KiBKq",layout:"JBDok",layoutHeader:"tVG4b",layoutContent:"O43ff",layoutSection:"CvZb6",layoutAside:"fdKgJ",header:"xfAad",headerTitle:"QiOEy",headerClose:"qdl3x",mainPhotoScrollControls:"PeY3Y",mainPhoto:"QIMHy q1DKc",mainPhotoItem:"aZCyk",mainPhotoImage:"_2aEr5",mainPhotoIframe:"kThdT",preview:"F-k0z q1DKc",previewItem:"jf683",previewButton:"VAXOP",previewImage:"Mx2Y-",videoPlayLabel:"jQiDN",videoPlayLabelIcon:"wSdjd",enter:"Lnosr",exit:"NW-xY",enterActive:"LrirU",exitActive:"L6st-"},w=d.forwardRef((function(t,e){var n=t.src,i=t.videoSrc,o=d.useRef(null),a=d.useRef(null),s=d.useRef(null),r=!!i,l=function(){var t,e;null===(t=a.current)||void 0===t||t.reset(),null===(e=o.current)||void 0===e||null===(e=e.contentWindow)||void 0===e||e.postMessage('{"event":"command","func":"pauseVideo","args":""}',"*")};return d.useEffect((function(){return requestAnimationFrame((function(){s.current&&!r&&(a.current=new x(s.current,{draggableUnzoomed:!1,animationDuration:200,setOffsetsOnce:!1}))})),function(){var t;null===(t=a.current)||void 0===t||t.destroy()}}),[i]),d.useImperativeHandle(e,(function(){return{reset:l}}),[]),r?d.createElement("iframe",{ref:o,className:E.mainPhotoIframe,src:i,width:"100%",height:"100%",allowFullScreen:!0,title:"",loading:"lazy","data-qaid":"photo_gallery_main_video","data-testid":"photo_gallery_main_video"}):d.createElement("img",{ref:s,className:E.mainPhotoImage,src:n,width:"100%",height:"100%",alt:"",decoding:"async",loading:"lazy","data-qaid":"photo_gallery_main_image","data-testid":"photo_gallery_main_image"})})),O=d.forwardRef((function(t,e){var n=t.items,i=t.onChange,o=d.useRef([]),s=d.useRef(0),r=d.useRef(null),l=function(){o.current.forEach((function(t){null==t||t.reset()}))},c=function(t){var e,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=null===(e=r.current)||void 0===e?void 0:e.children[t];l(),i&&v(i,r.current,n)};d.useImperativeHandle(e,(function(){return{scrollToIndex:c}}),[]);var h=function(){if(r.current){var t=function(t,e){var n=t.scrollLeft/t.scrollWidth*e;return Math.round(n)}(r.current,n.length);s.current!==t&&(s.current=t,i(t),l())}};return d.createElement(a.ScrollControls,{ref:r,className:E.mainPhotoScrollControls,showOnHover:!0,hideOnDisabled:!0},(function(t){return d.createElement("div",{ref:t,className:E.mainPhoto,onScroll:h},n.map((function(t,e){var n,i=t.type,a=t.src,s="video"===i,r=s?b(a):a,l=s?(n=y(a),"https://youtube.com/embed/".concat(n,"?enablejsapi=1&rel=0")):void 0;return d.createElement("div",{key:e,className:E.mainPhotoItem,"data-qaid":"photo_gallery_main_item","data-testid":"photo_gallery_main_item"},d.createElement(w,{ref:function(t){return o.current[e]=t},src:r,videoSrc:l}))})))}))})),z=d.forwardRef((function(t,e){var n=t.items,i=t.selectedIndex,o=t.onChange,a=d.useRef(null),l=function(t){var e,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=null===(e=a.current)||void 0===e?void 0:e.children[t];i&&v(i,a.current,n)};d.useImperativeHandle(e,(function(){return{scrollToIndex:l}}),[]);return d.createElement("div",{ref:a,className:E.preview},n.map((function(t,e){var n=t.type,a=t.src,l="video"===n,c=l?b(a):a;return d.createElement("div",{key:e,className:E.previewItem,"data-qaid":"photo_gallery_preview_item","data-testid":"photo_gallery_preview_item"},d.createElement("button",{className:E.previewButton,type:"button",onClick:function(){return function(t){o(t)}(e)},disabled:i===e,"data-qaid":"photo_gallery_preview_button","data-testid":"photo_gallery_preview_button"},d.createElement("img",{className:E.previewImage,src:c,width:58,height:58,alt:"",decoding:"async",loading:"lazy","data-qaid":"photo_gallery_preview_image","data-testid":"photo_gallery_preview_image"}),l&&d.createElement("div",{className:E.videoPlayLabel,"data-qaid":"photo_gallery_preview_play","data-testid":"photo_gallery_preview_play"},d.createElement(s.Icon,{className:E.videoPlayLabelIcon,"icon-as":r.SvgPlay}))))})))})),T=function(t){var e,n,i=t.title,o=t.onClose,a=t.selectedIndex,r=t.itemsLength,u=a+1,f=(0,c.useBodyTTag().t)(p||(e=["Фото "," из ",""],n||(n=e.slice(0)),p=Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))),u,r);return d.createElement("div",{className:E.header},d.createElement("div",{className:E.headerTitle,"data-qaid":"photo_gallery_title","data-testid":"photo_gallery_title"},i||f),d.createElement("div",{className:E.headerClose},d.createElement(l.Button,{"button-padding":"xxs","button-theme":"black-inherit",type:"button",onClick:o,"data-qaid":"photo_gallery_close_button","data-testid":"photo_gallery_close_button"},d.createElement(s.Icon,{"icon-as":h.SvgClose,style:{width:24,height:24}}))))};exports.PhotoGallery=function(t){var a=t.isOpen,s=t.title,r=t.visibleIndex,l=void 0===r?0:r,c=t.items,h=t.zIndex,u=void 0===h?5e3:h,m=t.onClose,p=t.onChange,g=d.useRef(!0),v=d.useRef(null),y=d.useRef(null),b=f(d.useState(l),2),x=b[0],w=b[1];d.useEffect((function(){a&&"function"==typeof p&&p(x)}),[x]),d.useEffect((function(){var t,e;a&&(w(l),null===(t=y.current)||void 0===t||t.scrollToIndex(l,!1),null===(e=v.current)||void 0===e||e.scrollToIndex(l,!1))}),[a]),d.useEffect((function(){var t;if(!a)return function(){};var e=null,n=function(){e&&clearTimeout(e)},i=function(){n(),e=setTimeout((function(){var t,e;null===(t=y.current)||void 0===t||t.scrollToIndex(x,!1),null===(e=v.current)||void 0===e||e.scrollToIndex(x,!1)}),100)};return window.addEventListener("resize",i),null===(t=window)||void 0===t||null===(t=t.matchMedia("(orientation: portrait)"))||void 0===t||t.addEventListener("change",i),function(){var t;n(),window.removeEventListener("resize",i),null===(t=window)||void 0===t||null===(t=t.matchMedia("(orientation: portrait)"))||void 0===t||t.removeEventListener("change",i)}}),[a,x]);var I=function(t){var e,n;g.current=!1,w(t),null===(e=y.current)||void 0===e||e.scrollToIndex(t),null===(n=v.current)||void 0===n||n.scrollToIndex(t)},_=function(){m(x)};return d.createElement(d.Fragment,null,d.createElement(n.Backdrop,{isOpen:a,onClick:_,zIndex:u,isBodyScrollLock:!0}),d.createElement(e.CSSTransition,{in:a,timeout:240,classNames:E,unmountOnExit:!0},d.createElement(o.Portal,null,d.createElement("div",{className:E.root,"data-qaid":"photo_gallery","data-testid":"photo_gallery",style:{zIndex:u}},d.createElement(i.KeyPress,{code:"Escape",onKeyUp:_}),d.createElement(i.KeyPress,{code:"ArrowLeft",onKeyUp:function(){0!==x&&I(x-1)}}),d.createElement(i.KeyPress,{code:"ArrowRight",onKeyUp:function(){x!==c.length-1&&I(x+1)}}),d.createElement("div",{className:E.layout},d.createElement("header",{className:E.layoutHeader},d.createElement(T,{title:s,selectedIndex:x,itemsLength:c.length,onClose:_})),d.createElement("div",{className:E.layoutContent},d.createElement("section",{className:E.layoutSection},d.createElement(O,{ref:v,items:c,onChange:function(t){var e;g.current&&(w(t),null===(e=y.current)||void 0===e||e.scrollToIndex(t));g.current||x!==t||(g.current=!0)}})),c.length>1&&d.createElement("aside",{className:E.layoutAside},d.createElement(z,{ref:y,items:c,selectedIndex:x,onChange:I}))))))))},require("./style.production.v2.css");
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prom-ui/core/PhotoGallery",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"types": "index.d.ts",
|
|
6
6
|
"sideEffects": [
|
|
7
7
|
"*.css"
|
|
8
8
|
],
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"react-scrolllock": "^5.0.1",
|
|
11
10
|
"react-transition-group": "^4.4.2"
|
|
12
11
|
}
|
|
13
12
|
}
|
package/Picture/package.json
CHANGED
package/Portal/package.json
CHANGED
package/QRCode/package.json
CHANGED
package/Rating/package.json
CHANGED
package/SafeQuery/package.json
CHANGED
package/Scroll/package.json
CHANGED
package/Skeleton/package.json
CHANGED
package/Spinner/package.json
CHANGED
package/Text/package.json
CHANGED
package/TextEmoji/package.json
CHANGED
package/Tooltip/package.json
CHANGED
package/Tumbler/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prom-ui/core",
|
|
3
3
|
"author": "e.marchenko",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.8.0",
|
|
5
5
|
"description": "core ui blocks",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"ts-types": "tsc --project tsconfig.build.json --declaration --emitDeclarationOnly",
|
|
@@ -56,7 +56,6 @@
|
|
|
56
56
|
"react-easy-swipe": "^0.0.22",
|
|
57
57
|
"react-popper-tooltip": "^4.4.2",
|
|
58
58
|
"react-responsive": "^9.0.2",
|
|
59
|
-
"react-scrolllock": "^5.0.1",
|
|
60
59
|
"react-transition-group": "^4.4.2",
|
|
61
60
|
"ts-debounce": "^4.0.0",
|
|
62
61
|
"ttag": "^1.7.24"
|
|
@@ -72,5 +71,5 @@
|
|
|
72
71
|
"optional": true
|
|
73
72
|
}
|
|
74
73
|
},
|
|
75
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "f14b07090bb160c72db095b77e23182c6ec2a53b"
|
|
76
75
|
}
|
package/useBodyTTag/package.json
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var react = require('react');
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Хук `useBrowserLayoutEffect` устраняет ошибку рендера на сервере.
|
|
9
|
+
*/
|
|
10
|
+
var useBrowserLayoutEffect = typeof window !== 'undefined' ? react.useLayoutEffect : react.useEffect;
|
|
11
|
+
|
|
12
|
+
exports.useBrowserLayoutEffect = useBrowserLayoutEffect;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var react = require('react');
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Хук `useBrowserLayoutEffect` устраняет ошибку рендера на сервере.
|
|
9
|
+
*/
|
|
10
|
+
var useBrowserLayoutEffect = typeof window !== 'undefined' ? react.useLayoutEffect : react.useEffect;
|
|
11
|
+
|
|
12
|
+
exports.useBrowserLayoutEffect = useBrowserLayoutEffect;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t="undefined"!=typeof window?e.useLayoutEffect:e.useEffect;exports.useBrowserLayoutEffect=t;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t="undefined"!=typeof window?e.useLayoutEffect:e.useEffect;exports.useBrowserLayoutEffect=t;
|