@alfalab/core-components-gallery 5.1.4 → 5.1.5
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/Component.js +13 -9
- package/components/header/Component.js +12 -8
- package/components/header/buttons.js +12 -8
- package/components/header/index.css +3 -3
- package/components/header/index.js +1 -1
- package/components/header-info-block/Component.js +10 -6
- package/components/header-info-block/index.css +5 -5
- package/components/image-preview/Component.js +12 -7
- package/components/image-preview/index.css +12 -12
- package/components/image-viewer/component.js +21 -14
- package/components/image-viewer/index.css +19 -19
- package/components/image-viewer/index.js +2 -2
- package/components/image-viewer/slide.js +1 -1
- package/components/index.js +2 -2
- package/components/navigation-bar/Component.js +7 -3
- package/components/navigation-bar/index.css +6 -6
- package/cssm/Component.js +11 -6
- package/cssm/components/header/Component.js +11 -6
- package/cssm/components/header/buttons.js +11 -7
- package/cssm/components/header-info-block/Component.js +10 -5
- package/cssm/components/image-preview/Component.js +14 -8
- package/cssm/components/image-viewer/component.js +23 -15
- package/cssm/components/image-viewer/slide.js +20 -14
- package/cssm/components/navigation-bar/Component.js +7 -2
- package/esm/Component.js +3 -3
- package/esm/components/header/Component.js +2 -2
- package/esm/components/header/buttons.js +1 -1
- package/esm/components/header/index.css +3 -3
- package/esm/components/header/index.js +1 -1
- package/esm/components/header-info-block/Component.js +1 -1
- package/esm/components/header-info-block/index.css +5 -5
- package/esm/components/image-preview/Component.js +1 -1
- package/esm/components/image-preview/index.css +12 -12
- package/esm/components/image-viewer/component.js +2 -2
- package/esm/components/image-viewer/index.css +19 -19
- package/esm/components/image-viewer/index.js +2 -2
- package/esm/components/image-viewer/slide.js +1 -1
- package/esm/components/index.js +2 -2
- package/esm/components/navigation-bar/Component.js +1 -1
- package/esm/components/navigation-bar/index.css +6 -6
- package/esm/index.css +3 -3
- package/esm/index.js +2 -2
- package/esm/{slide-a9813a06.d.ts → slide-8e346f19.d.ts} +0 -0
- package/esm/{slide-a9813a06.js → slide-8e346f19.js} +1 -1
- package/esm/{tslib.es6-fdf2c3e5.d.ts → tslib.es6-fa71e962.d.ts} +0 -0
- package/esm/{tslib.es6-fdf2c3e5.js → tslib.es6-fa71e962.js} +0 -0
- package/index.css +3 -3
- package/index.js +2 -2
- package/modern/Component.js +2 -2
- package/modern/components/header/Component.js +1 -1
- package/modern/components/header/index.css +3 -3
- package/modern/components/header-info-block/Component.js +1 -1
- package/modern/components/header-info-block/index.css +5 -5
- package/modern/components/image-preview/Component.js +1 -1
- package/modern/components/image-preview/index.css +12 -12
- package/modern/components/image-viewer/component.js +1 -1
- package/modern/components/image-viewer/index.css +19 -19
- package/modern/components/image-viewer/index.js +1 -1
- package/modern/components/image-viewer/slide.js +1 -1
- package/modern/components/index.js +1 -1
- package/modern/components/navigation-bar/Component.js +1 -1
- package/modern/components/navigation-bar/index.css +6 -6
- package/modern/index.css +3 -3
- package/modern/index.js +1 -1
- package/modern/{slide-4304ec1c.d.ts → slide-87fc2658.d.ts} +0 -0
- package/modern/{slide-4304ec1c.js → slide-87fc2658.js} +1 -1
- package/package.json +5 -5
- package/{slide-e83fee6e.d.ts → slide-c0784b7a.d.ts} +0 -0
- package/slide-c0784b7a.js +49 -0
- package/{tslib.es6-bf76bf4c.d.ts → tslib.es6-9a318bd4.d.ts} +0 -0
- package/{tslib.es6-bf76bf4c.js → tslib.es6-9a318bd4.js} +0 -0
- package/slide-e83fee6e.js +0 -44
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: 1rqwo */
|
|
2
2
|
:root {
|
|
3
3
|
--color-light-bg-tertiary-inverted: #3c4c5d;
|
|
4
4
|
}
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
--gap-3xs: 2px;
|
|
15
15
|
--gap-xl: 24px;
|
|
16
16
|
}
|
|
17
|
-
.
|
|
17
|
+
.gallery__component_1f1tu {
|
|
18
18
|
display: flex;
|
|
19
19
|
flex-wrap: nowrap;
|
|
20
20
|
align-content: center;
|
|
@@ -27,16 +27,16 @@
|
|
|
27
27
|
background-color: var(--color-light-bg-tertiary-inverted);
|
|
28
28
|
scrollbar-width: none
|
|
29
29
|
}
|
|
30
|
-
.
|
|
30
|
+
.gallery__component_1f1tu::-webkit-scrollbar {
|
|
31
31
|
display: none;
|
|
32
32
|
}
|
|
33
|
-
.
|
|
33
|
+
.gallery__preview_1f1tu {
|
|
34
34
|
flex-shrink: 0;
|
|
35
35
|
margin: 0 var(--gap-3xs)
|
|
36
36
|
}
|
|
37
|
-
.
|
|
37
|
+
.gallery__preview_1f1tu:first-child {
|
|
38
38
|
margin-left: auto;
|
|
39
39
|
}
|
|
40
|
-
.
|
|
40
|
+
.gallery__preview_1f1tu:last-child {
|
|
41
41
|
margin-right: auto;
|
|
42
42
|
}
|
package/cssm/Component.js
CHANGED
|
@@ -38,6 +38,11 @@ require('./components/image-viewer/paths.js');
|
|
|
38
38
|
require('./components/image-viewer/index.module.css');
|
|
39
39
|
require('swiper/swiper.min.css');
|
|
40
40
|
|
|
41
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
42
|
+
|
|
43
|
+
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
44
|
+
var styles__default = /*#__PURE__*/_interopDefaultCompat(styles);
|
|
45
|
+
|
|
41
46
|
var Backdrop = function () { return null; };
|
|
42
47
|
var Gallery = function (_a) {
|
|
43
48
|
var open = _a.open, images = _a.images, _b = _a.initialSlide, initialSlide = _b === void 0 ? 0 : _b, _c = _a.loop, loop = _c === void 0 ? true : _c, onClose = _a.onClose;
|
|
@@ -127,12 +132,12 @@ var Gallery = function (_a) {
|
|
|
127
132
|
getCurrentImage: function () { return images[currentSlideIndex]; },
|
|
128
133
|
getCurrentImageMeta: function () { return imagesMeta[currentSlideIndex]; },
|
|
129
134
|
};
|
|
130
|
-
return (
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
showNavigationBar &&
|
|
135
|
+
return (React__default.default.createElement(context.GalleryContext.Provider, { value: galleryContext },
|
|
136
|
+
React__default.default.createElement(coreComponentsBaseModal.BaseModal, { open: open, className: styles__default.default.modal, onEscapeKeyDown: handleEscapeKeyDown, Backdrop: Backdrop },
|
|
137
|
+
React__default.default.createElement("div", { className: styles__default.default.container },
|
|
138
|
+
React__default.default.createElement(components_header_Component.Header, null),
|
|
139
|
+
React__default.default.createElement(components_imageViewer_component.ImageViewer, null),
|
|
140
|
+
showNavigationBar && React__default.default.createElement(components_navigationBar_Component.NavigationBar, null)))));
|
|
136
141
|
};
|
|
137
142
|
|
|
138
143
|
exports.Gallery = Gallery;
|
|
@@ -18,6 +18,11 @@ require('@alfalab/icons-glyph/ArrowsOutwardMIcon');
|
|
|
18
18
|
require('@alfalab/icons-glyph/CrossMIcon');
|
|
19
19
|
require('@alfalab/icons-glyph/PointerDownMIcon');
|
|
20
20
|
|
|
21
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
22
|
+
|
|
23
|
+
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
24
|
+
var styles__default = /*#__PURE__*/_interopDefaultCompat(styles);
|
|
25
|
+
|
|
21
26
|
var Header = function () {
|
|
22
27
|
var _a;
|
|
23
28
|
var _b = React.useContext(context.GalleryContext), currentSlideIndex = _b.currentSlideIndex, singleSlide = _b.singleSlide, images = _b.images, fullScreen = _b.fullScreen, getCurrentImageMeta = _b.getCurrentImageMeta, getCurrentImage = _b.getCurrentImage, setFullScreen = _b.setFullScreen, onClose = _b.onClose;
|
|
@@ -43,14 +48,14 @@ var Header = function () {
|
|
|
43
48
|
var showFullScreenButton = !utils_utils.isSmallImage(meta) && !(meta === null || meta === void 0 ? void 0 : meta.broken);
|
|
44
49
|
var showDownloadButton = !(meta === null || meta === void 0 ? void 0 : meta.broken) && canDownload;
|
|
45
50
|
var renderToggleFullScreenButton = function () {
|
|
46
|
-
return fullScreen ? (
|
|
51
|
+
return fullScreen ? (React__default.default.createElement(components_header_buttons.ExitFullscreen, { onClick: closeFullScreen, buttonRef: toggleFullScreenButton, dataTestId: utils_constants.TestIds.EXIT_FULLSCREEN_BUTTON })) : (React__default.default.createElement(components_header_buttons.Fullscreen, { onClick: openFullScreen, buttonRef: toggleFullScreenButton, dataTestId: utils_constants.TestIds.FULLSCREEN_BUTTON }));
|
|
47
52
|
};
|
|
48
|
-
return (
|
|
49
|
-
|
|
50
|
-
|
|
53
|
+
return (React__default.default.createElement("div", { className: styles__default.default.header },
|
|
54
|
+
React__default.default.createElement(components_headerInfoBlock_Component.HeaderInfoBlock, { filename: filename, description: description }),
|
|
55
|
+
React__default.default.createElement("div", { className: styles__default.default.buttons },
|
|
51
56
|
showFullScreenButton && renderToggleFullScreenButton(),
|
|
52
|
-
showDownloadButton && (
|
|
53
|
-
|
|
57
|
+
showDownloadButton && (React__default.default.createElement(components_header_buttons.Download, { href: currentImage === null || currentImage === void 0 ? void 0 : currentImage.src, download: currentImage === null || currentImage === void 0 ? void 0 : currentImage.name, dataTestId: utils_constants.TestIds.DOWNLOAD_BUTTON })),
|
|
58
|
+
React__default.default.createElement(components_header_buttons.Exit, { onClick: onClose, dataTestId: utils_constants.TestIds.CLOSE_BUTTON }))));
|
|
54
59
|
};
|
|
55
60
|
|
|
56
61
|
exports.Header = Header;
|
|
@@ -9,19 +9,23 @@ var ArrowsOutwardMIcon = require('@alfalab/icons-glyph/ArrowsOutwardMIcon');
|
|
|
9
9
|
var CrossMIcon = require('@alfalab/icons-glyph/CrossMIcon');
|
|
10
10
|
var PointerDownMIcon = require('@alfalab/icons-glyph/PointerDownMIcon');
|
|
11
11
|
|
|
12
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
13
|
+
|
|
14
|
+
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
15
|
+
|
|
12
16
|
var Fullscreen = function (_a) {
|
|
13
17
|
var buttonRef = _a.buttonRef, restProps = tslib_es6.__rest(_a, ["buttonRef"]);
|
|
14
|
-
return (
|
|
15
|
-
|
|
18
|
+
return (React__default.default.createElement(coreComponentsTooltip.Tooltip, { trigger: 'hover', position: 'bottom', content: '\u041E\u0442\u043A\u0440\u044B\u0442\u044C \u0432 \u043F\u043E\u043B\u043D\u043E\u044D\u043A\u0440\u0430\u043D\u043D\u043E\u043C \u0440\u0435\u0436\u0438\u043C\u0435', fallbackPlacements: ['bottom-end'] },
|
|
19
|
+
React__default.default.createElement(coreComponentsIconButton.IconButton, tslib_es6.__assign({}, restProps, { ref: buttonRef, icon: ArrowsOutwardMIcon.ArrowsOutwardMIcon, colors: 'inverted', "aria-label": '\u041E\u0442\u043A\u0440\u044B\u0442\u044C \u0432 \u043F\u043E\u043B\u043D\u043E\u044D\u043A\u0440\u0430\u043D\u043D\u043E\u043C \u0440\u0435\u0436\u0438\u043C\u0435' }))));
|
|
16
20
|
};
|
|
17
21
|
var ExitFullscreen = function (_a) {
|
|
18
22
|
var buttonRef = _a.buttonRef, restProps = tslib_es6.__rest(_a, ["buttonRef"]);
|
|
19
|
-
return (
|
|
20
|
-
|
|
23
|
+
return (React__default.default.createElement(coreComponentsTooltip.Tooltip, { trigger: 'hover', position: 'bottom', content: '\u0412\u044B\u0439\u0442\u0438 \u0438\u0437 \u043F\u043E\u043B\u043D\u043E\u044D\u043A\u0440\u0430\u043D\u043D\u043E\u0433\u043E \u0440\u0435\u0436\u0438\u043C\u0430', fallbackPlacements: ['bottom-end'] },
|
|
24
|
+
React__default.default.createElement(coreComponentsIconButton.IconButton, tslib_es6.__assign({}, restProps, { ref: buttonRef, icon: ArrowsInwardMIcon.ArrowsInwardMIcon, colors: 'inverted', "aria-label": '\u0412\u044B\u0439\u0442\u0438 \u0438\u0437 \u043F\u043E\u043B\u043D\u043E\u044D\u043A\u0440\u0430\u043D\u043D\u043E\u0433\u043E \u0440\u0435\u0436\u0438\u043C\u0430' }))));
|
|
21
25
|
};
|
|
22
|
-
var Download = function (props) { return (
|
|
23
|
-
|
|
24
|
-
var Exit = function (props) { return (
|
|
26
|
+
var Download = function (props) { return (React__default.default.createElement(coreComponentsTooltip.Tooltip, { trigger: 'hover', position: 'bottom', content: '\u0421\u043A\u0430\u0447\u0430\u0442\u044C', fallbackPlacements: ['bottom-end'] },
|
|
27
|
+
React__default.default.createElement(coreComponentsIconButton.IconButton, tslib_es6.__assign({}, props, { icon: PointerDownMIcon.PointerDownMIcon, colors: 'inverted', "aria-label": '\u0421\u043A\u0430\u0447\u0430\u0442\u044C' })))); };
|
|
28
|
+
var Exit = function (props) { return (React__default.default.createElement(coreComponentsIconButton.IconButton, tslib_es6.__assign({}, props, { icon: CrossMIcon.CrossMIcon, colors: 'inverted', "aria-label": '\u0417\u0430\u043A\u0440\u044B\u0442\u044C' }))); };
|
|
25
29
|
|
|
26
30
|
exports.Download = Download;
|
|
27
31
|
exports.Exit = Exit;
|
|
@@ -5,14 +5,19 @@ var coreComponentsTypography = require('@alfalab/core-components-typography/cssm
|
|
|
5
5
|
var utils_splitFilename = require('../../utils/split-filename.js');
|
|
6
6
|
var styles = require('./index.module.css');
|
|
7
7
|
|
|
8
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
9
|
+
|
|
10
|
+
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
11
|
+
var styles__default = /*#__PURE__*/_interopDefaultCompat(styles);
|
|
12
|
+
|
|
8
13
|
var HeaderInfoBlock = function (_a) {
|
|
9
14
|
var filename = _a.filename, description = _a.description;
|
|
10
15
|
var _b = utils_splitFilename.splitFilename(filename), head = _b[0], tail = _b[1];
|
|
11
|
-
return (
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
description ? (
|
|
16
|
+
return (React__default.default.createElement("div", { className: styles__default.default.info },
|
|
17
|
+
React__default.default.createElement("div", { className: styles__default.default.filenameContainer },
|
|
18
|
+
React__default.default.createElement(coreComponentsTypography.Typography.Title, { tag: 'h1', className: styles__default.default.filenameHead, view: 'xsmall', font: 'system', color: 'primary-inverted' }, head),
|
|
19
|
+
React__default.default.createElement(coreComponentsTypography.Typography.Title, { tag: 'h1', view: 'xsmall', font: 'system', color: 'primary-inverted' }, tail)),
|
|
20
|
+
description ? (React__default.default.createElement(coreComponentsTypography.Typography.Text, { className: styles__default.default.description, tag: 'div', view: 'primary-medium', color: 'secondary-inverted' }, description)) : null));
|
|
16
21
|
};
|
|
17
22
|
|
|
18
23
|
exports.HeaderInfoBlock = HeaderInfoBlock;
|
|
@@ -7,6 +7,12 @@ var context = require('../../context.js');
|
|
|
7
7
|
var components_imagePreview_paths = require('./paths.js');
|
|
8
8
|
var styles = require('./index.module.css');
|
|
9
9
|
|
|
10
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
11
|
+
|
|
12
|
+
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
13
|
+
var cn__default = /*#__PURE__*/_interopDefaultCompat(cn);
|
|
14
|
+
var styles__default = /*#__PURE__*/_interopDefaultCompat(styles);
|
|
15
|
+
|
|
10
16
|
var ImagePreview = function (_a) {
|
|
11
17
|
var _b, _c;
|
|
12
18
|
var image = _a.image, _d = _a.active, active = _d === void 0 ? false : _d, index = _a.index, onSelect = _a.onSelect, className = _a.className;
|
|
@@ -23,14 +29,14 @@ var ImagePreview = function (_a) {
|
|
|
23
29
|
var focused = hooks.useFocus(ref, 'keyboard')[0];
|
|
24
30
|
var meta = imagesMeta[index];
|
|
25
31
|
var isBroken = Boolean(meta === null || meta === void 0 ? void 0 : meta.broken);
|
|
26
|
-
return (
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
_c[
|
|
33
|
-
_c[
|
|
32
|
+
return (React__default.default.createElement("div", { className: cn__default.default(styles__default.default.component, (_b = {}, _b[styles__default.default.active] = active, _b[styles__default.default.focused] = focused, _b), className), onClick: handleClick, role: 'button', onKeyDown: handleKeyDown, tabIndex: 0, ref: ref, "aria-label": "\u041F\u0435\u0440\u0435\u0439\u0442\u0438 \u043A \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044E ".concat(index + 1) }, isBroken ? (React__default.default.createElement("div", { className: cn__default.default(styles__default.default.preview, styles__default.default.brokenImageWrapper) },
|
|
33
|
+
React__default.default.createElement("div", { className: styles__default.default.brokenIcon },
|
|
34
|
+
React__default.default.createElement("svg", { xmlns: 'http://www.w3.org/2000/svg', width: '40', height: '40', viewBox: '0 0 40 40', fill: 'none' },
|
|
35
|
+
React__default.default.createElement("rect", { width: '40', height: '40', fill: 'none' }),
|
|
36
|
+
React__default.default.createElement("path", { fillRule: 'evenodd', clipRule: 'evenodd', d: components_imagePreview_paths.NoImagePaths.baseImage, fill: '#DBDEE1' }),
|
|
37
|
+
React__default.default.createElement("path", { d: components_imagePreview_paths.NoImagePaths.triangleImage, fill: '#DBDEE1' }))))) : (React__default.default.createElement("div", { className: cn__default.default(styles__default.default.preview, styles__default.default.image, (_c = {},
|
|
38
|
+
_c[styles__default.default.broken] = isBroken,
|
|
39
|
+
_c[styles__default.default.loading] = !meta,
|
|
34
40
|
_c)), style: { backgroundImage: "url(".concat(image.src, ")") } }))));
|
|
35
41
|
};
|
|
36
42
|
|
|
@@ -18,7 +18,15 @@ var styles = require('./index.module.css');
|
|
|
18
18
|
require('@alfalab/core-components-typography/cssm');
|
|
19
19
|
require('./paths.js');
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
22
|
+
|
|
23
|
+
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
24
|
+
var cn__default = /*#__PURE__*/_interopDefaultCompat(cn);
|
|
25
|
+
var elementClosest__default = /*#__PURE__*/_interopDefaultCompat(elementClosest);
|
|
26
|
+
var SwiperCore__default = /*#__PURE__*/_interopDefaultCompat(SwiperCore);
|
|
27
|
+
var styles__default = /*#__PURE__*/_interopDefaultCompat(styles);
|
|
28
|
+
|
|
29
|
+
SwiperCore__default.default.use([SwiperCore.EffectFade, SwiperCore.A11y, SwiperCore.Controller]);
|
|
22
30
|
var ImageViewer = function () {
|
|
23
31
|
var _a, _b, _c;
|
|
24
32
|
var _d = React.useContext(context.GalleryContext), singleSlide = _d.singleSlide, images = _d.images, imagesMeta = _d.imagesMeta, fullScreen = _d.fullScreen, currentSlideIndex = _d.currentSlideIndex, initialSlide = _d.initialSlide, onClose = _d.onClose, getCurrentImage = _d.getCurrentImage, setImageMeta = _d.setImageMeta, setCurrentSlideIndex = _d.setCurrentSlideIndex, getSwiper = _d.getSwiper, setSwiper = _d.setSwiper, slidePrev = _d.slidePrev, slideNext = _d.slideNext;
|
|
@@ -60,14 +68,14 @@ var ImageViewer = function () {
|
|
|
60
68
|
var eventTarget = event.target;
|
|
61
69
|
var isArrow = ((_a = leftArrowRef.current) === null || _a === void 0 ? void 0 : _a.contains(eventTarget)) ||
|
|
62
70
|
((_b = rightArrowRef.current) === null || _b === void 0 ? void 0 : _b.contains(eventTarget));
|
|
63
|
-
var isPlaceholder = Boolean(eventTarget.closest(".".concat(
|
|
71
|
+
var isPlaceholder = Boolean(eventTarget.closest(".".concat(styles__default.default.placeholder)));
|
|
64
72
|
var isImg = eventTarget.tagName === 'IMG';
|
|
65
73
|
if (!isImg && !isPlaceholder && !isArrow) {
|
|
66
74
|
onClose();
|
|
67
75
|
}
|
|
68
76
|
}, [onClose]);
|
|
69
77
|
React.useEffect(function () {
|
|
70
|
-
|
|
78
|
+
elementClosest__default.default(window);
|
|
71
79
|
}, []);
|
|
72
80
|
var swiperProps = React.useMemo(function () {
|
|
73
81
|
var _a;
|
|
@@ -77,7 +85,7 @@ var ImageViewer = function () {
|
|
|
77
85
|
fadeEffect: {
|
|
78
86
|
crossFade: true,
|
|
79
87
|
},
|
|
80
|
-
className:
|
|
88
|
+
className: cn__default.default(styles__default.default.swiper, (_a = {}, _a[styles__default.default.hidden] = fullScreen, _a)),
|
|
81
89
|
controller: { control: swiper },
|
|
82
90
|
a11y: {
|
|
83
91
|
slideRole: 'img',
|
|
@@ -95,30 +103,30 @@ var ImageViewer = function () {
|
|
|
95
103
|
var currentImage = getCurrentImage();
|
|
96
104
|
return (
|
|
97
105
|
/* eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions */
|
|
98
|
-
|
|
99
|
-
showControls && (
|
|
100
|
-
_b[
|
|
106
|
+
React__default.default.createElement("div", { className: cn__default.default(styles__default.default.component, (_a = {}, _a[styles__default.default.singleSlide] = singleSlide, _a)), onClick: handleWrapperClick },
|
|
107
|
+
showControls && (React__default.default.createElement("div", { className: cn__default.default(styles__default.default.arrow, (_b = {},
|
|
108
|
+
_b[styles__default.default.focused] = leftArrowFocused,
|
|
101
109
|
_b)), onClick: handlePrevClick, role: 'button', onKeyDown: handleArrowLeftKeyDown, tabIndex: 0, ref: leftArrowRef, "aria-label": '\u041F\u0440\u0435\u0434\u044B\u0434\u0443\u0449\u0435\u0435 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435', "data-test-id": utils_constants.TestIds.PREV_SLIDE_BUTTON },
|
|
102
|
-
|
|
103
|
-
fullScreen && (
|
|
104
|
-
|
|
110
|
+
React__default.default.createElement(ChevronBackHeavyMIcon.ChevronBackHeavyMIcon, null))),
|
|
111
|
+
fullScreen && (React__default.default.createElement("img", { src: currentImage === null || currentImage === void 0 ? void 0 : currentImage.src, alt: currentImage ? utils_utils.getImageAlt(currentImage, currentSlideIndex) : '', className: styles__default.default.fullScreenImage })),
|
|
112
|
+
React__default.default.createElement(react.Swiper, tslib_es6.__assign({}, swiperProps), images.map(function (image, index) {
|
|
105
113
|
var meta = imagesMeta[index];
|
|
106
114
|
var imageWidth = (meta === null || meta === void 0 ? void 0 : meta.width) || 1;
|
|
107
115
|
var imageHeight = (meta === null || meta === void 0 ? void 0 : meta.height) || 1;
|
|
108
116
|
var imageAspectRatio = imageWidth / imageHeight;
|
|
109
117
|
var slideVisible = index === currentSlideIndex;
|
|
110
|
-
return (
|
|
118
|
+
return (React__default.default.createElement(react.SwiperSlide, { key: utils_utils.getImageKey(image, index), style: {
|
|
111
119
|
pointerEvents: slideVisible ? 'auto' : 'none',
|
|
112
120
|
transitionProperty: 'opacity',
|
|
113
121
|
} }, function (_a) {
|
|
114
122
|
var isActive = _a.isActive;
|
|
115
|
-
return (
|
|
123
|
+
return (React__default.default.createElement(components_imageViewer_slide.Slide, { isActive: isActive, swiperAspectRatio: swiperAspectRatio, image: image, swiperHeight: swiperHeight, meta: meta, index: index, imageAspectRatio: imageAspectRatio, slideVisible: slideVisible, handleLoad: handleLoad, handleLoadError: handleLoadError }));
|
|
116
124
|
}));
|
|
117
125
|
})),
|
|
118
|
-
showControls && (
|
|
119
|
-
_c[
|
|
126
|
+
showControls && (React__default.default.createElement("div", { className: cn__default.default(styles__default.default.arrow, (_c = {},
|
|
127
|
+
_c[styles__default.default.focused] = rightArrowFocused,
|
|
120
128
|
_c)), onClick: handleNextClick, role: 'button', onKeyDown: handleArrowRightKeyDown, tabIndex: 0, ref: rightArrowRef, "aria-label": '\u0421\u043B\u0435\u0434\u0443\u044E\u0449\u0435\u0435 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435', "data-test-id": utils_constants.TestIds.NEXT_SLIDE_BUTTON },
|
|
121
|
-
|
|
129
|
+
React__default.default.createElement(ChevronForwardHeavyMIcon.ChevronForwardHeavyMIcon, null)))));
|
|
122
130
|
};
|
|
123
131
|
|
|
124
132
|
exports.ImageViewer = ImageViewer;
|
|
@@ -8,17 +8,23 @@ var utils_constants = require('../../utils/constants.js');
|
|
|
8
8
|
var components_imageViewer_paths = require('./paths.js');
|
|
9
9
|
var styles = require('./index.module.css');
|
|
10
10
|
|
|
11
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
12
|
+
|
|
13
|
+
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
14
|
+
var cn__default = /*#__PURE__*/_interopDefaultCompat(cn);
|
|
15
|
+
var styles__default = /*#__PURE__*/_interopDefaultCompat(styles);
|
|
16
|
+
|
|
11
17
|
var SlideInner = function (_a) {
|
|
12
18
|
var _b;
|
|
13
19
|
var children = _a.children, broken = _a.broken, loading = _a.loading, withPlaceholder = _a.withPlaceholder;
|
|
14
|
-
var content = broken ? (
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return (
|
|
20
|
+
var content = broken ? (React__default.default.createElement("div", { className: styles__default.default.brokenImgWrapper },
|
|
21
|
+
React__default.default.createElement("div", { className: styles__default.default.brokenImgIcon },
|
|
22
|
+
React__default.default.createElement("svg", { xmlns: 'http://www.w3.org/2000/svg', width: '80', height: '80', viewBox: '0 0 80 80', fill: 'none' },
|
|
23
|
+
React__default.default.createElement("rect", { width: '80', height: '80', fill: 'none' }),
|
|
24
|
+
React__default.default.createElement("path", { fillRule: 'evenodd', clipRule: 'evenodd', d: components_imageViewer_paths.NoImagePaths.baseImage, fill: '#DBDEE1' }),
|
|
25
|
+
React__default.default.createElement("path", { d: components_imageViewer_paths.NoImagePaths.triangleImage, fill: '#DBDEE1' }))),
|
|
26
|
+
React__default.default.createElement(coreComponentsTypography.Typography.Text, { view: 'primary-small', color: 'secondary' }, "\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435"))) : (children);
|
|
27
|
+
return (React__default.default.createElement("div", { className: cn__default.default(styles__default.default.slide, (_b = {}, _b[styles__default.default.slideLoading] = loading, _b)) }, withPlaceholder ? React__default.default.createElement("div", { className: styles__default.default.placeholder }, content) : content));
|
|
22
28
|
};
|
|
23
29
|
var Slide = function (_a) {
|
|
24
30
|
var _b;
|
|
@@ -27,12 +33,12 @@ var Slide = function (_a) {
|
|
|
27
33
|
var small = utils_utils.isSmallImage(meta);
|
|
28
34
|
var verticalImageFit = !small && swiperAspectRatio > imageAspectRatio;
|
|
29
35
|
var horizontalImageFit = !small && swiperAspectRatio <= imageAspectRatio;
|
|
30
|
-
return (
|
|
31
|
-
|
|
32
|
-
_b[
|
|
33
|
-
_b[
|
|
34
|
-
_b[
|
|
35
|
-
_b[
|
|
36
|
+
return (React__default.default.createElement(SlideInner, { active: isActive, broken: broken, loading: !meta, withPlaceholder: small || broken },
|
|
37
|
+
React__default.default.createElement("img", { src: image.src, alt: utils_utils.getImageAlt(image, index), className: cn__default.default((_b = {},
|
|
38
|
+
_b[styles__default.default.smallImage] = small,
|
|
39
|
+
_b[styles__default.default.image] = !small,
|
|
40
|
+
_b[styles__default.default.verticalImageFit] = verticalImageFit,
|
|
41
|
+
_b[styles__default.default.horizontalImageFit] = horizontalImageFit,
|
|
36
42
|
_b)), onLoad: function (event) { return handleLoad(event, index); }, onError: function () { return handleLoadError(index); }, style: {
|
|
37
43
|
maxHeight: "".concat(swiperHeight, "px"),
|
|
38
44
|
}, "data-test-id": slideVisible ? utils_constants.TestIds.ACTIVE_IMAGE : undefined })));
|
|
@@ -11,6 +11,11 @@ require('@alfalab/hooks');
|
|
|
11
11
|
require('../image-preview/paths.js');
|
|
12
12
|
require('../image-preview/index.module.css');
|
|
13
13
|
|
|
14
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
15
|
+
|
|
16
|
+
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
17
|
+
var styles__default = /*#__PURE__*/_interopDefaultCompat(styles);
|
|
18
|
+
|
|
14
19
|
var MIN_SCROLL_STEP = 24;
|
|
15
20
|
var NavigationBar = function () {
|
|
16
21
|
var containerRef = React.useRef(null);
|
|
@@ -58,9 +63,9 @@ var NavigationBar = function () {
|
|
|
58
63
|
}, [currentSlideIndex, handlePreviewPosition, scroll]);
|
|
59
64
|
return (
|
|
60
65
|
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
61
|
-
|
|
66
|
+
React__default.default.createElement("div", { className: styles__default.default.component, ref: containerRef, onKeyDown: handleKeyDown, "data-test-id": utils_constants.TestIds.NAVIGATION_BAR }, images.map(function (image, index) {
|
|
62
67
|
var active = index === currentSlideIndex;
|
|
63
|
-
return (
|
|
68
|
+
return (React__default.default.createElement(components_imagePreview_Component.ImagePreview, { key: utils_utils.getImageKey(image, index), image: image, active: active, index: index, onSelect: handlePreviewSelect, className: styles__default.default.preview }));
|
|
64
69
|
})));
|
|
65
70
|
};
|
|
66
71
|
|
package/esm/Component.js
CHANGED
|
@@ -14,7 +14,7 @@ import './components/header-info-block/Component.js';
|
|
|
14
14
|
import '@alfalab/core-components-typography/esm';
|
|
15
15
|
import './utils/split-filename.js';
|
|
16
16
|
import './components/header/buttons.js';
|
|
17
|
-
import './tslib.es6-
|
|
17
|
+
import './tslib.es6-fa71e962.js';
|
|
18
18
|
import '@alfalab/core-components-icon-button/esm';
|
|
19
19
|
import '@alfalab/core-components-tooltip/esm';
|
|
20
20
|
import '@alfalab/icons-glyph/ArrowsInwardMIcon';
|
|
@@ -26,11 +26,11 @@ import 'swiper';
|
|
|
26
26
|
import 'swiper/react';
|
|
27
27
|
import '@alfalab/icons-glyph/ChevronBackHeavyMIcon';
|
|
28
28
|
import '@alfalab/icons-glyph/ChevronForwardHeavyMIcon';
|
|
29
|
-
import './slide-
|
|
29
|
+
import './slide-8e346f19.js';
|
|
30
30
|
import './components/image-viewer/paths.js';
|
|
31
31
|
import 'swiper/swiper.min.css';
|
|
32
32
|
|
|
33
|
-
var styles = {"container":"
|
|
33
|
+
var styles = {"container":"gallery__container_1slnl","modal":"gallery__modal_1slnl"};
|
|
34
34
|
require('./index.css')
|
|
35
35
|
|
|
36
36
|
var Backdrop = function () { return null; };
|
|
@@ -6,7 +6,7 @@ import { HeaderInfoBlock } from '../header-info-block/Component.js';
|
|
|
6
6
|
import { Download, Exit, ExitFullscreen, Fullscreen } from './buttons.js';
|
|
7
7
|
import '@alfalab/core-components-typography/esm';
|
|
8
8
|
import '../../utils/split-filename.js';
|
|
9
|
-
import '../../tslib.es6-
|
|
9
|
+
import '../../tslib.es6-fa71e962.js';
|
|
10
10
|
import '@alfalab/core-components-icon-button/esm';
|
|
11
11
|
import '@alfalab/core-components-tooltip/esm';
|
|
12
12
|
import '@alfalab/icons-glyph/ArrowsInwardMIcon';
|
|
@@ -14,7 +14,7 @@ import '@alfalab/icons-glyph/ArrowsOutwardMIcon';
|
|
|
14
14
|
import '@alfalab/icons-glyph/CrossMIcon';
|
|
15
15
|
import '@alfalab/icons-glyph/PointerDownMIcon';
|
|
16
16
|
|
|
17
|
-
var styles = {"header":"
|
|
17
|
+
var styles = {"header":"gallery__header_1msjd","buttons":"gallery__buttons_1msjd"};
|
|
18
18
|
require('./index.css')
|
|
19
19
|
|
|
20
20
|
var Header = function () {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as __rest, _ as __assign } from '../../tslib.es6-
|
|
1
|
+
import { a as __rest, _ as __assign } from '../../tslib.es6-fa71e962.js';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { IconButton } from '@alfalab/core-components-icon-button/esm';
|
|
4
4
|
import { Tooltip } from '@alfalab/core-components-tooltip/esm';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: 1vqds */
|
|
2
2
|
:root {
|
|
3
3
|
--color-light-bg-tertiary-inverted: #3c4c5d;
|
|
4
4
|
}
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
--gap-xl: 24px;
|
|
16
16
|
--gap-2xl: 32px;
|
|
17
17
|
}
|
|
18
|
-
.
|
|
18
|
+
.gallery__header_1msjd {
|
|
19
19
|
display: flex;
|
|
20
20
|
justify-content: space-between;
|
|
21
21
|
flex-shrink: 0;
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
background-color: var(--color-light-bg-tertiary-inverted);
|
|
25
25
|
box-sizing: border-box;
|
|
26
26
|
}
|
|
27
|
-
.
|
|
27
|
+
.gallery__buttons_1msjd {
|
|
28
28
|
display: flex;
|
|
29
29
|
padding-left: var(--gap-2xl);
|
|
30
30
|
}
|
|
@@ -7,7 +7,7 @@ import '../header-info-block/Component.js';
|
|
|
7
7
|
import '@alfalab/core-components-typography/esm';
|
|
8
8
|
import '../../utils/split-filename.js';
|
|
9
9
|
import './buttons.js';
|
|
10
|
-
import '../../tslib.es6-
|
|
10
|
+
import '../../tslib.es6-fa71e962.js';
|
|
11
11
|
import '@alfalab/core-components-icon-button/esm';
|
|
12
12
|
import '@alfalab/core-components-tooltip/esm';
|
|
13
13
|
import '@alfalab/icons-glyph/ArrowsInwardMIcon';
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { Typography } from '@alfalab/core-components-typography/esm';
|
|
3
3
|
import { splitFilename } from '../../utils/split-filename.js';
|
|
4
4
|
|
|
5
|
-
var styles = {"info":"
|
|
5
|
+
var styles = {"info":"gallery__info_lntwg","filenameHead":"gallery__filenameHead_lntwg","filenameContainer":"gallery__filenameContainer_lntwg","description":"gallery__description_lntwg"};
|
|
6
6
|
require('./index.css')
|
|
7
7
|
|
|
8
8
|
var HeaderInfoBlock = function (_a) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: hcon2 */
|
|
2
2
|
:root {
|
|
3
3
|
|
|
4
4
|
/* Hard */
|
|
@@ -10,24 +10,24 @@
|
|
|
10
10
|
:root {
|
|
11
11
|
--gap-2xs: 4px;
|
|
12
12
|
}
|
|
13
|
-
.
|
|
13
|
+
.gallery__info_lntwg {
|
|
14
14
|
height: 100%;
|
|
15
15
|
display: flex;
|
|
16
16
|
flex-direction: column;
|
|
17
17
|
justify-content: center;
|
|
18
18
|
overflow: hidden;
|
|
19
19
|
}
|
|
20
|
-
.
|
|
20
|
+
.gallery__filenameHead_lntwg {
|
|
21
21
|
display: inline;
|
|
22
22
|
text-overflow: ellipsis;
|
|
23
23
|
overflow: hidden;
|
|
24
24
|
white-space: nowrap;
|
|
25
25
|
}
|
|
26
|
-
.
|
|
26
|
+
.gallery__filenameContainer_lntwg {
|
|
27
27
|
overflow: hidden;
|
|
28
28
|
display: inline-flex;
|
|
29
29
|
}
|
|
30
|
-
.
|
|
30
|
+
.gallery__description_lntwg {
|
|
31
31
|
display: inline;
|
|
32
32
|
text-overflow: ellipsis;
|
|
33
33
|
overflow: hidden;
|
|
@@ -4,7 +4,7 @@ import { useFocus } from '@alfalab/hooks';
|
|
|
4
4
|
import { GalleryContext } from '../../context.js';
|
|
5
5
|
import { NoImagePaths } from './paths.js';
|
|
6
6
|
|
|
7
|
-
var styles = {"component":"
|
|
7
|
+
var styles = {"component":"gallery__component_1120r","active":"gallery__active_1120r","image":"gallery__image_1120r","preview":"gallery__preview_1120r","loading":"gallery__loading_1120r","brokenImageWrapper":"gallery__brokenImageWrapper_1120r","brokenIcon":"gallery__brokenIcon_1120r","focused":"gallery__focused_1120r"};
|
|
8
8
|
require('./index.css')
|
|
9
9
|
|
|
10
10
|
var ImagePreview = function (_a) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: yw881 */
|
|
2
2
|
:root {
|
|
3
3
|
--color-light-bg-primary: #fff;
|
|
4
4
|
--color-light-border-key-inverted: #fff;
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
:root {
|
|
23
23
|
--focus-color: var(--color-light-border-link);
|
|
24
24
|
}
|
|
25
|
-
.
|
|
25
|
+
.gallery__component_1120r {
|
|
26
26
|
display: flex;
|
|
27
27
|
padding: var(--gap-2xs);
|
|
28
28
|
border: 2px solid rgba(0, 0, 0, 0);
|
|
@@ -31,13 +31,13 @@
|
|
|
31
31
|
transition: border 0.15s ease-in-out;
|
|
32
32
|
outline: none;
|
|
33
33
|
}
|
|
34
|
-
.
|
|
34
|
+
.gallery__active_1120r {
|
|
35
35
|
border-color: var(--color-light-border-key-inverted)
|
|
36
36
|
}
|
|
37
|
-
.
|
|
37
|
+
.gallery__active_1120r > .gallery__image_1120r {
|
|
38
38
|
opacity: 0.7;
|
|
39
39
|
}
|
|
40
|
-
.
|
|
40
|
+
.gallery__preview_1120r {
|
|
41
41
|
width: 56px;
|
|
42
42
|
height: 56px;
|
|
43
43
|
flex-shrink: 0;
|
|
@@ -46,34 +46,34 @@
|
|
|
46
46
|
-webkit-user-select: none;
|
|
47
47
|
user-select: none;
|
|
48
48
|
}
|
|
49
|
-
.
|
|
49
|
+
.gallery__image_1120r {
|
|
50
50
|
background-color: var(--color-light-bg-primary);
|
|
51
51
|
background-size: cover;
|
|
52
52
|
background-repeat: no-repeat;
|
|
53
53
|
background-position: center;
|
|
54
54
|
transition: opacity 0.15s ease-in-out
|
|
55
55
|
}
|
|
56
|
-
.
|
|
56
|
+
.gallery__image_1120r:hover {
|
|
57
57
|
opacity: 0.7;
|
|
58
58
|
}
|
|
59
|
-
.
|
|
59
|
+
.gallery__loading_1120r {
|
|
60
60
|
/* TODO: цвета нет в палитре */
|
|
61
61
|
background-color: #e9eaeb;
|
|
62
62
|
}
|
|
63
|
-
.
|
|
63
|
+
.gallery__brokenImageWrapper_1120r {
|
|
64
64
|
display: flex;
|
|
65
65
|
justify-content: center;
|
|
66
66
|
align-items: center;
|
|
67
67
|
background-color: var(--color-light-bg-primary)
|
|
68
68
|
}
|
|
69
|
-
.
|
|
69
|
+
.gallery__brokenImageWrapper_1120r:hover {
|
|
70
70
|
opacity: 0.7;
|
|
71
71
|
}
|
|
72
|
-
.
|
|
72
|
+
.gallery__brokenIcon_1120r {
|
|
73
73
|
width: 40px;
|
|
74
74
|
height: 40px;
|
|
75
75
|
}
|
|
76
|
-
.
|
|
76
|
+
.gallery__focused_1120r {
|
|
77
77
|
outline: 2px solid var(--focus-color);
|
|
78
78
|
outline-offset: 2px;
|
|
79
79
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as __assign } from '../../tslib.es6-
|
|
1
|
+
import { _ as __assign } from '../../tslib.es6-fa71e962.js';
|
|
2
2
|
import React, { useContext, useRef, useCallback, useEffect, useMemo } from 'react';
|
|
3
3
|
import cn from 'classnames';
|
|
4
4
|
import elementClosest from 'element-closest';
|
|
@@ -10,7 +10,7 @@ import { ChevronForwardHeavyMIcon } from '@alfalab/icons-glyph/ChevronForwardHea
|
|
|
10
10
|
import { GalleryContext } from '../../context.js';
|
|
11
11
|
import { getImageAlt, getImageKey } from '../../utils/utils.js';
|
|
12
12
|
import { TestIds } from '../../utils/constants.js';
|
|
13
|
-
import { s as styles, S as Slide } from '../../slide-
|
|
13
|
+
import { s as styles, S as Slide } from '../../slide-8e346f19.js';
|
|
14
14
|
import 'swiper/swiper.min.css';
|
|
15
15
|
import '@alfalab/core-components-typography/esm';
|
|
16
16
|
import './paths.js';
|