@alfalab/core-components-gallery 7.2.3 → 7.3.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/Component.js +51 -7
- package/Component.js.map +1 -1
- package/components/bottom-button/index.css +5 -5
- package/components/bottom-button/index.module.css.js +1 -1
- package/components/buttons/index.css +5 -5
- package/components/buttons/index.d.ts +3 -1
- package/components/buttons/index.js +49 -12
- package/components/buttons/index.js.map +1 -1
- package/components/buttons/index.module.css.js +1 -1
- package/components/header/Component.js +1 -0
- package/components/header/Component.js.map +1 -1
- package/components/header/index.css +3 -2
- package/components/header/index.module.css.js +1 -1
- package/components/header/index.module.css.js.map +1 -1
- package/components/header-info-block/Component.js +2 -1
- package/components/header-info-block/Component.js.map +1 -1
- package/components/header-info-block/index.css +4 -4
- package/components/header-info-block/index.module.css.js +1 -1
- package/components/header-mobile/index.css +6 -6
- package/components/header-mobile/index.module.css.js +1 -1
- package/components/image-preview/Component.js +2 -1
- package/components/image-preview/Component.js.map +1 -1
- package/components/image-preview/index.css +20 -20
- package/components/image-preview/index.module.css.js +1 -1
- package/components/image-preview/index.module.css.js.map +1 -1
- package/components/image-viewer/hooks.js +3 -2
- package/components/image-viewer/hooks.js.map +1 -1
- package/components/image-viewer/index.css +30 -31
- package/components/image-viewer/index.module.css.js +1 -1
- package/components/image-viewer/index.module.css.js.map +1 -1
- package/components/image-viewer/single.js +1 -0
- package/components/image-viewer/single.js.map +1 -1
- package/components/image-viewer/slide.js +3 -2
- package/components/image-viewer/slide.js.map +1 -1
- package/components/image-viewer/video/index.css +22 -10
- package/components/image-viewer/video/index.js +50 -15
- package/components/image-viewer/video/index.js.map +1 -1
- package/components/image-viewer/video/index.module.css.js +1 -1
- package/components/image-viewer/video/index.module.css.js.map +1 -1
- package/components/info-bar/Component.js +1 -0
- package/components/info-bar/Component.js.map +1 -1
- package/components/info-bar/index.css +3 -3
- package/components/info-bar/index.module.css.js +1 -1
- package/components/navigation-bar/Component.js +56 -26
- package/components/navigation-bar/Component.js.map +1 -1
- package/components/navigation-bar/index.css +21 -11
- package/components/navigation-bar/index.module.css.js +1 -1
- package/components/navigation-bar/index.module.css.js.map +1 -1
- package/components/subtitles/index.css +3 -3
- package/components/subtitles/index.module.css.js +1 -1
- package/constants.d.ts +1 -1
- package/constants.js +1 -1
- package/constants.js.map +1 -1
- package/cssm/Component.js +51 -7
- package/cssm/Component.js.map +1 -1
- package/cssm/components/buttons/index.d.ts +3 -1
- package/cssm/components/buttons/index.js +54 -17
- package/cssm/components/buttons/index.js.map +1 -1
- package/cssm/components/header/Component.js +1 -0
- package/cssm/components/header/Component.js.map +1 -1
- package/cssm/components/header/index.module.css +2 -1
- package/cssm/components/header-info-block/Component.js +2 -1
- package/cssm/components/header-info-block/Component.js.map +1 -1
- package/cssm/components/image-preview/Component.js +2 -1
- package/cssm/components/image-preview/Component.js.map +1 -1
- package/cssm/components/image-preview/index.module.css +3 -3
- package/cssm/components/image-viewer/hooks.js +3 -2
- package/cssm/components/image-viewer/hooks.js.map +1 -1
- package/cssm/components/image-viewer/index.module.css +2 -3
- package/cssm/components/image-viewer/single.js +1 -0
- package/cssm/components/image-viewer/single.js.map +1 -1
- package/cssm/components/image-viewer/slide.js +3 -2
- package/cssm/components/image-viewer/slide.js.map +1 -1
- package/cssm/components/image-viewer/video/index.js +50 -15
- package/cssm/components/image-viewer/video/index.js.map +1 -1
- package/cssm/components/image-viewer/video/index.module.css +15 -3
- package/cssm/components/info-bar/Component.js +1 -0
- package/cssm/components/info-bar/Component.js.map +1 -1
- package/cssm/components/navigation-bar/Component.js +56 -26
- package/cssm/components/navigation-bar/Component.js.map +1 -1
- package/cssm/components/navigation-bar/index.module.css +13 -3
- package/cssm/constants.d.ts +1 -1
- package/cssm/constants.js +1 -1
- package/cssm/constants.js.map +1 -1
- package/cssm/hooks/use-custom-subtitles.js +57 -11
- package/cssm/hooks/use-custom-subtitles.js.map +1 -1
- package/cssm/index.js +1 -0
- package/cssm/index.js.map +1 -1
- package/cssm/types.d.ts +4 -2
- package/cssm/utils/index.d.ts +1 -0
- package/cssm/utils/index.js +2 -0
- package/cssm/utils/index.js.map +1 -1
- package/cssm/utils/modern-download.d.ts +6 -0
- package/cssm/utils/modern-download.js +113 -0
- package/cssm/utils/modern-download.js.map +1 -0
- package/esm/Component.js +51 -7
- package/esm/Component.js.map +1 -1
- package/esm/components/bottom-button/index.css +5 -5
- package/esm/components/bottom-button/index.module.css.js +1 -1
- package/esm/components/buttons/index.css +5 -5
- package/esm/components/buttons/index.d.ts +3 -1
- package/esm/components/buttons/index.js +50 -13
- package/esm/components/buttons/index.js.map +1 -1
- package/esm/components/buttons/index.module.css.js +1 -1
- package/esm/components/header/Component.js +1 -0
- package/esm/components/header/Component.js.map +1 -1
- package/esm/components/header/index.css +3 -2
- package/esm/components/header/index.module.css.js +1 -1
- package/esm/components/header/index.module.css.js.map +1 -1
- package/esm/components/header-info-block/Component.js +2 -1
- package/esm/components/header-info-block/Component.js.map +1 -1
- package/esm/components/header-info-block/index.css +4 -4
- package/esm/components/header-info-block/index.module.css.js +1 -1
- package/esm/components/header-mobile/index.css +6 -6
- package/esm/components/header-mobile/index.module.css.js +1 -1
- package/esm/components/image-preview/Component.js +2 -1
- package/esm/components/image-preview/Component.js.map +1 -1
- package/esm/components/image-preview/index.css +20 -20
- package/esm/components/image-preview/index.module.css.js +1 -1
- package/esm/components/image-preview/index.module.css.js.map +1 -1
- package/esm/components/image-viewer/hooks.js +3 -2
- package/esm/components/image-viewer/hooks.js.map +1 -1
- package/esm/components/image-viewer/index.css +30 -31
- package/esm/components/image-viewer/index.module.css.js +1 -1
- package/esm/components/image-viewer/index.module.css.js.map +1 -1
- package/esm/components/image-viewer/single.js +1 -0
- package/esm/components/image-viewer/single.js.map +1 -1
- package/esm/components/image-viewer/slide.js +3 -2
- package/esm/components/image-viewer/slide.js.map +1 -1
- package/esm/components/image-viewer/video/index.css +22 -10
- package/esm/components/image-viewer/video/index.js +51 -16
- package/esm/components/image-viewer/video/index.js.map +1 -1
- package/esm/components/image-viewer/video/index.module.css.js +1 -1
- package/esm/components/image-viewer/video/index.module.css.js.map +1 -1
- package/esm/components/info-bar/Component.js +1 -0
- package/esm/components/info-bar/Component.js.map +1 -1
- package/esm/components/info-bar/index.css +3 -3
- package/esm/components/info-bar/index.module.css.js +1 -1
- package/esm/components/navigation-bar/Component.js +56 -25
- package/esm/components/navigation-bar/Component.js.map +1 -1
- package/esm/components/navigation-bar/index.css +21 -11
- package/esm/components/navigation-bar/index.module.css.js +1 -1
- package/esm/components/navigation-bar/index.module.css.js.map +1 -1
- package/esm/components/subtitles/index.css +3 -3
- package/esm/components/subtitles/index.module.css.js +1 -1
- package/esm/constants.d.ts +1 -1
- package/esm/constants.js +1 -1
- package/esm/constants.js.map +1 -1
- package/esm/hooks/use-custom-subtitles.js +57 -11
- package/esm/hooks/use-custom-subtitles.js.map +1 -1
- package/esm/index.css +9 -9
- package/esm/index.js +1 -0
- package/esm/index.js.map +1 -1
- package/esm/index.module.css.js +1 -1
- package/esm/types.d.ts +4 -2
- package/esm/utils/index.d.ts +1 -0
- package/esm/utils/index.js +1 -0
- package/esm/utils/index.js.map +1 -1
- package/esm/utils/modern-download.d.ts +6 -0
- package/esm/utils/modern-download.js +109 -0
- package/esm/utils/modern-download.js.map +1 -0
- package/hooks/use-custom-subtitles.js +57 -11
- package/hooks/use-custom-subtitles.js.map +1 -1
- package/index.css +9 -9
- package/index.js +1 -0
- package/index.js.map +1 -1
- package/index.module.css.js +1 -1
- package/modern/Component.js +50 -7
- package/modern/Component.js.map +1 -1
- package/modern/components/bottom-button/index.css +5 -5
- package/modern/components/bottom-button/index.module.css.js +1 -1
- package/modern/components/buttons/index.css +5 -5
- package/modern/components/buttons/index.d.ts +3 -1
- package/modern/components/buttons/index.js +51 -12
- package/modern/components/buttons/index.js.map +1 -1
- package/modern/components/buttons/index.module.css.js +1 -1
- package/modern/components/header/index.css +3 -2
- package/modern/components/header/index.module.css.js +1 -1
- package/modern/components/header/index.module.css.js.map +1 -1
- package/modern/components/header-info-block/Component.js +1 -1
- package/modern/components/header-info-block/Component.js.map +1 -1
- package/modern/components/header-info-block/index.css +4 -4
- package/modern/components/header-info-block/index.module.css.js +1 -1
- package/modern/components/header-mobile/index.css +6 -6
- package/modern/components/header-mobile/index.module.css.js +1 -1
- package/modern/components/image-preview/Component.js +1 -1
- package/modern/components/image-preview/Component.js.map +1 -1
- package/modern/components/image-preview/index.css +20 -20
- package/modern/components/image-preview/index.module.css.js +1 -1
- package/modern/components/image-preview/index.module.css.js.map +1 -1
- package/modern/components/image-viewer/hooks.js +3 -2
- package/modern/components/image-viewer/hooks.js.map +1 -1
- package/modern/components/image-viewer/index.css +30 -31
- package/modern/components/image-viewer/index.module.css.js +1 -1
- package/modern/components/image-viewer/index.module.css.js.map +1 -1
- package/modern/components/image-viewer/slide.js +2 -2
- package/modern/components/image-viewer/slide.js.map +1 -1
- package/modern/components/image-viewer/video/index.css +22 -10
- package/modern/components/image-viewer/video/index.js +47 -12
- package/modern/components/image-viewer/video/index.js.map +1 -1
- package/modern/components/image-viewer/video/index.module.css.js +1 -1
- package/modern/components/image-viewer/video/index.module.css.js.map +1 -1
- package/modern/components/info-bar/index.css +3 -3
- package/modern/components/info-bar/index.module.css.js +1 -1
- package/modern/components/navigation-bar/Component.js +55 -25
- package/modern/components/navigation-bar/Component.js.map +1 -1
- package/modern/components/navigation-bar/index.css +21 -11
- package/modern/components/navigation-bar/index.module.css.js +1 -1
- package/modern/components/navigation-bar/index.module.css.js.map +1 -1
- package/modern/components/subtitles/index.css +3 -3
- package/modern/components/subtitles/index.module.css.js +1 -1
- package/modern/constants.d.ts +1 -1
- package/modern/constants.js +1 -1
- package/modern/constants.js.map +1 -1
- package/modern/hooks/use-custom-subtitles.js +56 -9
- package/modern/hooks/use-custom-subtitles.js.map +1 -1
- package/modern/index.css +9 -9
- package/modern/index.module.css.js +1 -1
- package/modern/types.d.ts +4 -2
- package/modern/utils/index.d.ts +1 -0
- package/modern/utils/index.js +1 -0
- package/modern/utils/index.js.map +1 -1
- package/modern/utils/modern-download.d.ts +6 -0
- package/modern/utils/modern-download.js +76 -0
- package/modern/utils/modern-download.js.map +1 -0
- package/moderncssm/Component.js +50 -7
- package/moderncssm/Component.js.map +1 -1
- package/moderncssm/components/buttons/index.d.ts +3 -1
- package/moderncssm/components/buttons/index.js +51 -12
- package/moderncssm/components/buttons/index.js.map +1 -1
- package/moderncssm/components/header/index.module.css +1 -1
- package/moderncssm/components/header-info-block/Component.js +1 -1
- package/moderncssm/components/header-info-block/Component.js.map +1 -1
- package/moderncssm/components/image-preview/Component.js +1 -1
- package/moderncssm/components/image-preview/Component.js.map +1 -1
- package/moderncssm/components/image-preview/index.module.css +2 -2
- package/moderncssm/components/image-viewer/hooks.js +3 -2
- package/moderncssm/components/image-viewer/hooks.js.map +1 -1
- package/moderncssm/components/image-viewer/index.module.css +2 -2
- package/moderncssm/components/image-viewer/slide.js +2 -2
- package/moderncssm/components/image-viewer/slide.js.map +1 -1
- package/moderncssm/components/image-viewer/video/index.js +47 -12
- package/moderncssm/components/image-viewer/video/index.js.map +1 -1
- package/moderncssm/components/image-viewer/video/index.module.css +16 -3
- package/moderncssm/components/navigation-bar/Component.js +55 -25
- package/moderncssm/components/navigation-bar/Component.js.map +1 -1
- package/moderncssm/components/navigation-bar/index.module.css +14 -2
- package/moderncssm/constants.d.ts +1 -1
- package/moderncssm/constants.js +1 -1
- package/moderncssm/constants.js.map +1 -1
- package/moderncssm/hooks/use-custom-subtitles.js +56 -9
- package/moderncssm/hooks/use-custom-subtitles.js.map +1 -1
- package/moderncssm/types.d.ts +4 -2
- package/moderncssm/utils/index.d.ts +1 -0
- package/moderncssm/utils/index.js +1 -0
- package/moderncssm/utils/index.js.map +1 -1
- package/moderncssm/utils/modern-download.d.ts +6 -0
- package/moderncssm/utils/modern-download.js +76 -0
- package/moderncssm/utils/modern-download.js.map +1 -0
- package/package.json +2 -2
- package/src/Component.tsx +63 -6
- package/src/components/buttons/index.tsx +157 -62
- package/src/components/header/index.module.css +1 -1
- package/src/components/header-info-block/Component.tsx +2 -2
- package/src/components/image-preview/Component.tsx +1 -1
- package/src/components/image-preview/index.module.css +2 -2
- package/src/components/image-viewer/hooks.ts +3 -2
- package/src/components/image-viewer/index.module.css +2 -2
- package/src/components/image-viewer/slide.tsx +2 -1
- package/src/components/image-viewer/video/index.module.css +16 -3
- package/src/components/image-viewer/video/index.tsx +62 -13
- package/src/components/navigation-bar/Component.tsx +68 -27
- package/src/components/navigation-bar/index.module.css +12 -2
- package/src/constants.ts +1 -1
- package/src/hooks/use-custom-subtitles.ts +72 -12
- package/src/types.ts +4 -2
- package/src/utils/index.ts +1 -0
- package/src/utils/modern-download.ts +107 -0
- package/types.d.ts +4 -2
- package/utils/index.d.ts +1 -0
- package/utils/index.js +2 -0
- package/utils/index.js.map +1 -1
- package/utils/modern-download.d.ts +6 -0
- package/utils/modern-download.js +113 -0
- package/utils/modern-download.js.map +1 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
:root {
|
|
2
2
|
--color-static-neutral-0-inverted: #262629;
|
|
3
3
|
}
|
|
4
|
-
.
|
|
4
|
+
.gallery__headerMobile_2zyga {
|
|
5
5
|
position: relative;
|
|
6
6
|
height: 72px;
|
|
7
7
|
z-index: 3;
|
|
@@ -10,21 +10,21 @@
|
|
|
10
10
|
justify-content: space-between;
|
|
11
11
|
align-items: center;
|
|
12
12
|
}
|
|
13
|
-
.
|
|
13
|
+
.gallery__headerMobile_2zyga.gallery__video_2zyga {
|
|
14
14
|
position: absolute;
|
|
15
15
|
width: 100%;
|
|
16
16
|
background-color: var(--color-static-neutral-0-inverted);
|
|
17
17
|
transition: transform 0.3s ease-in-out;
|
|
18
18
|
}
|
|
19
|
-
.
|
|
19
|
+
.gallery__hide_2zyga {
|
|
20
20
|
transform: translateY(-96px);
|
|
21
21
|
}
|
|
22
|
-
.
|
|
23
|
-
.
|
|
22
|
+
.gallery__leftButton_2zyga,
|
|
23
|
+
.gallery__rightButtons_2zyga {
|
|
24
24
|
display: flex;
|
|
25
25
|
align-items: center;
|
|
26
26
|
}
|
|
27
|
-
.
|
|
27
|
+
.gallery__description_2zyga {
|
|
28
28
|
position: absolute;
|
|
29
29
|
left: 50%;
|
|
30
30
|
transform: translateX(-50%);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import './index.css';
|
|
2
2
|
|
|
3
|
-
var styles = {"headerMobile":"
|
|
3
|
+
var styles = {"headerMobile":"gallery__headerMobile_2zyga","video":"gallery__video_2zyga","hide":"gallery__hide_2zyga","rightButtons":"gallery__rightButtons_2zyga","description":"gallery__description_2zyga"};
|
|
4
4
|
|
|
5
5
|
export { styles as default };
|
|
6
6
|
//# sourceMappingURL=index.module.css.js.map
|
|
@@ -4,6 +4,7 @@ import { useFocus } from '@alfalab/hooks';
|
|
|
4
4
|
import { PREVIEW_VIDEO_MULTIPLIER, PREVIEW_HEIGHT_MOBILE, PREVIEW_HEIGHT_DESKTOP, PREVIEW_WIDTH_MOBILE, PREVIEW_WIDTH_DESKTOP } from '../../constants.js';
|
|
5
5
|
import { GalleryContext } from '../../context.js';
|
|
6
6
|
import { isVideo, getImageAlt } from '../../utils/utils.js';
|
|
7
|
+
import 'tslib';
|
|
7
8
|
import { NoImagePaths } from './paths.js';
|
|
8
9
|
import styles from './index.module.css.js';
|
|
9
10
|
|
|
@@ -71,7 +72,7 @@ var ImagePreview = function (_a) {
|
|
|
71
72
|
}
|
|
72
73
|
if (isVideo(image.src)) {
|
|
73
74
|
return (React.createElement("div", { className: cn(styles.preview, styles.image, (_c = {},
|
|
74
|
-
_c[styles.loading] = !meta,
|
|
75
|
+
_c[styles.loading] = !(meta === null || meta === void 0 ? void 0 : meta.loaded),
|
|
75
76
|
_c[styles.mobile] = isMobile,
|
|
76
77
|
_c)) },
|
|
77
78
|
React.createElement("canvas", { className: cn(styles.canvasPreview, (_d = {}, _d[styles.mobile] = isMobile, _d)), "data-testid": 'canvas', width: previewWidth, height: previewHeight, ref: canvasRef })));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Component.js","sources":["../../../src/components/image-preview/Component.tsx"],"sourcesContent":["import React, {\n type FC,\n type KeyboardEventHandler,\n type MouseEventHandler,\n useContext,\n useEffect,\n useRef,\n} from 'react';\nimport cn from 'classnames';\n\nimport { useFocus } from '@alfalab/hooks';\n\nimport {\n PREVIEW_HEIGHT_DESKTOP,\n PREVIEW_HEIGHT_MOBILE,\n PREVIEW_VIDEO_MULTIPLIER,\n PREVIEW_WIDTH_DESKTOP,\n PREVIEW_WIDTH_MOBILE,\n} from '../../constants';\nimport { GalleryContext } from '../../context';\nimport { type GalleryImage } from '../../types';\nimport { getImageAlt, isVideo } from '../../utils';\n\nimport { NoImagePaths } from './paths';\n\nimport styles from './index.module.css';\n\ntype Props = {\n image: GalleryImage;\n index: number;\n active?: boolean;\n onSelect: (index: number) => void;\n className: string;\n};\n\nexport const ImagePreview: FC<Props> = ({ image, active = false, index, onSelect, className }) => {\n const { imagesMeta, view } = useContext(GalleryContext);\n\n const isMobile = view === 'mobile';\n\n const previewWidth = isMobile ? PREVIEW_WIDTH_MOBILE : PREVIEW_WIDTH_DESKTOP;\n const previewHeight = isMobile ? PREVIEW_HEIGHT_MOBILE : PREVIEW_HEIGHT_DESKTOP;\n\n const ref = useRef<HTMLDivElement>(null);\n const canvasRef = useRef<HTMLCanvasElement>(null);\n\n useEffect(() => {\n const canvas = canvasRef.current;\n const video = imagesMeta[index]?.player?.current;\n const context = canvas?.getContext('2d');\n const drawPreview = () => {\n if (video) {\n context?.drawImage(\n video,\n 0,\n 0,\n video.videoWidth / PREVIEW_VIDEO_MULTIPLIER,\n video.videoHeight / PREVIEW_VIDEO_MULTIPLIER,\n );\n }\n };\n\n drawPreview();\n\n if (isVideo(image.src)) {\n video?.addEventListener('canplay', drawPreview);\n }\n\n return () => {\n if (isVideo(image.src)) {\n video?.removeEventListener('canplay', drawPreview);\n }\n };\n }, [image.src, imagesMeta, index]);\n\n const handleClick = () => {\n onSelect(index);\n };\n\n const handleKeyDown: KeyboardEventHandler = (event) => {\n if (event.key === 'Enter') {\n onSelect(index);\n }\n };\n\n const handleDragStart: MouseEventHandler<HTMLDivElement> = (e) => {\n e.preventDefault();\n };\n\n const [focused] = useFocus(ref, 'keyboard');\n\n const meta = imagesMeta[index];\n\n const isBroken = Boolean(meta?.broken);\n\n const renderPreview = () => {\n if (isBroken) {\n return (\n <div\n className={cn(\n styles.preview,\n { [styles.mobile]: isMobile, [styles.active]: active },\n styles.brokenImageWrapper,\n )}\n >\n <div className={cn(styles.brokenIcon)}>\n <svg\n xmlns='http://www.w3.org/2000/svg'\n width={previewWidth}\n height={previewHeight}\n viewBox={`${isMobile ? -6 : 0} ${\n isMobile ? -12 : 0\n } ${previewWidth} ${previewHeight}`}\n fill='none'\n >\n <rect fill='none' />\n <path\n fillRule='evenodd'\n clipRule='evenodd'\n d={isMobile ? NoImagePaths.mobileImage : NoImagePaths.baseImage}\n fill='#89898A'\n />\n <path\n d={\n isMobile\n ? NoImagePaths.mobileTriangle\n : NoImagePaths.triangleImage\n }\n fill='#89898A'\n />\n </svg>\n </div>\n </div>\n );\n }\n\n if (image.previewSrc) {\n return (\n <div\n className={cn(styles.preview, styles.image, {\n [styles.loading]: !meta,\n [styles.mobile]: isMobile,\n })}\n >\n <img src={image.previewSrc} alt={getImageAlt(image, index)} />\n </div>\n );\n }\n\n if (isVideo(image.src)) {\n return (\n <div\n className={cn(styles.preview, styles.image, {\n [styles.loading]: !meta,\n [styles.mobile]: isMobile,\n })}\n >\n <canvas\n className={cn(styles.canvasPreview, { [styles.mobile]: isMobile })}\n data-testid='canvas'\n width={previewWidth}\n height={previewHeight}\n ref={canvasRef}\n />\n </div>\n );\n }\n\n return (\n <div\n className={cn(styles.preview, styles.image, {\n [styles.loading]: !meta,\n [styles.mobile]: isMobile,\n })}\n >\n <img src={image.src} alt={getImageAlt(image, index)} />\n </div>\n );\n };\n\n return (\n <div\n className={cn(\n styles.component,\n {\n [styles.active]: active,\n [styles.focused]: focused,\n [styles.mobile]: isMobile,\n },\n className,\n )}\n onClick={handleClick}\n role='button'\n onKeyDown={handleKeyDown}\n onMouseDown={handleDragStart}\n tabIndex={0}\n ref={ref}\n aria-label={`Перейти к ${index + 1} элементу`}\n >\n {renderPreview()}\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AAmCO,IAAM,YAAY,GAAc,UAAC,EAAqD,EAAA;;AAAnD,IAAA,IAAA,KAAK,WAAA,EAAE,EAAA,GAAA,EAAA,CAAA,MAAc,EAAd,MAAM,mBAAG,KAAK,GAAA,EAAA,EAAE,KAAK,WAAA,EAAE,QAAQ,GAAA,EAAA,CAAA,QAAA,EAAE,SAAS,GAAA,EAAA,CAAA,SAAA;IACjF,IAAA,EAAA,GAAuB,UAAU,CAAC,cAAc,CAAC,EAA/C,UAAU,GAAA,EAAA,CAAA,UAAA,EAAE,IAAI,GAAA,EAAA,CAAA,IAA+B;AAEvD,IAAA,IAAM,QAAQ,GAAG,IAAI,KAAK,QAAQ;IAElC,IAAM,YAAY,GAAG,QAAQ,GAAG,oBAAoB,GAAG,qBAAqB;IAC5E,IAAM,aAAa,GAAG,QAAQ,GAAG,qBAAqB,GAAG,sBAAsB;AAE/E,IAAA,IAAM,GAAG,GAAG,MAAM,CAAiB,IAAI,CAAC;AACxC,IAAA,IAAM,SAAS,GAAG,MAAM,CAAoB,IAAI,CAAC;AAEjD,IAAA,SAAS,CAAC,YAAA;;AACN,QAAA,IAAM,MAAM,GAAG,SAAS,CAAC,OAAO;AAChC,QAAA,IAAM,KAAK,GAAG,CAAA,EAAA,GAAA,CAAA,EAAA,GAAA,UAAU,CAAC,KAAK,CAAC,MAAE,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,MAAA,GAAA,EAAA,CAAA,MAAM,MAAE,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,MAAA,GAAA,EAAA,CAAA,OAAO;AAChD,Q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.js","sources":["../../../src/components/image-preview/Component.tsx"],"sourcesContent":["import React, {\n type FC,\n type KeyboardEventHandler,\n type MouseEventHandler,\n useContext,\n useEffect,\n useRef,\n} from 'react';\nimport cn from 'classnames';\n\nimport { useFocus } from '@alfalab/hooks';\n\nimport {\n PREVIEW_HEIGHT_DESKTOP,\n PREVIEW_HEIGHT_MOBILE,\n PREVIEW_VIDEO_MULTIPLIER,\n PREVIEW_WIDTH_DESKTOP,\n PREVIEW_WIDTH_MOBILE,\n} from '../../constants';\nimport { GalleryContext } from '../../context';\nimport { type GalleryImage } from '../../types';\nimport { getImageAlt, isVideo } from '../../utils';\n\nimport { NoImagePaths } from './paths';\n\nimport styles from './index.module.css';\n\ntype Props = {\n image: GalleryImage;\n index: number;\n active?: boolean;\n onSelect: (index: number) => void;\n className: string;\n};\n\nexport const ImagePreview: FC<Props> = ({ image, active = false, index, onSelect, className }) => {\n const { imagesMeta, view } = useContext(GalleryContext);\n\n const isMobile = view === 'mobile';\n\n const previewWidth = isMobile ? PREVIEW_WIDTH_MOBILE : PREVIEW_WIDTH_DESKTOP;\n const previewHeight = isMobile ? PREVIEW_HEIGHT_MOBILE : PREVIEW_HEIGHT_DESKTOP;\n\n const ref = useRef<HTMLDivElement>(null);\n const canvasRef = useRef<HTMLCanvasElement>(null);\n\n useEffect(() => {\n const canvas = canvasRef.current;\n const video = imagesMeta[index]?.player?.current;\n const context = canvas?.getContext('2d');\n const drawPreview = () => {\n if (video) {\n context?.drawImage(\n video,\n 0,\n 0,\n video.videoWidth / PREVIEW_VIDEO_MULTIPLIER,\n video.videoHeight / PREVIEW_VIDEO_MULTIPLIER,\n );\n }\n };\n\n drawPreview();\n\n if (isVideo(image.src)) {\n video?.addEventListener('canplay', drawPreview);\n }\n\n return () => {\n if (isVideo(image.src)) {\n video?.removeEventListener('canplay', drawPreview);\n }\n };\n }, [image.src, imagesMeta, index]);\n\n const handleClick = () => {\n onSelect(index);\n };\n\n const handleKeyDown: KeyboardEventHandler = (event) => {\n if (event.key === 'Enter') {\n onSelect(index);\n }\n };\n\n const handleDragStart: MouseEventHandler<HTMLDivElement> = (e) => {\n e.preventDefault();\n };\n\n const [focused] = useFocus(ref, 'keyboard');\n\n const meta = imagesMeta[index];\n\n const isBroken = Boolean(meta?.broken);\n\n const renderPreview = () => {\n if (isBroken) {\n return (\n <div\n className={cn(\n styles.preview,\n { [styles.mobile]: isMobile, [styles.active]: active },\n styles.brokenImageWrapper,\n )}\n >\n <div className={cn(styles.brokenIcon)}>\n <svg\n xmlns='http://www.w3.org/2000/svg'\n width={previewWidth}\n height={previewHeight}\n viewBox={`${isMobile ? -6 : 0} ${\n isMobile ? -12 : 0\n } ${previewWidth} ${previewHeight}`}\n fill='none'\n >\n <rect fill='none' />\n <path\n fillRule='evenodd'\n clipRule='evenodd'\n d={isMobile ? NoImagePaths.mobileImage : NoImagePaths.baseImage}\n fill='#89898A'\n />\n <path\n d={\n isMobile\n ? NoImagePaths.mobileTriangle\n : NoImagePaths.triangleImage\n }\n fill='#89898A'\n />\n </svg>\n </div>\n </div>\n );\n }\n\n if (image.previewSrc) {\n return (\n <div\n className={cn(styles.preview, styles.image, {\n [styles.loading]: !meta,\n [styles.mobile]: isMobile,\n })}\n >\n <img src={image.previewSrc} alt={getImageAlt(image, index)} />\n </div>\n );\n }\n\n if (isVideo(image.src)) {\n return (\n <div\n className={cn(styles.preview, styles.image, {\n [styles.loading]: !meta?.loaded,\n [styles.mobile]: isMobile,\n })}\n >\n <canvas\n className={cn(styles.canvasPreview, { [styles.mobile]: isMobile })}\n data-testid='canvas'\n width={previewWidth}\n height={previewHeight}\n ref={canvasRef}\n />\n </div>\n );\n }\n\n return (\n <div\n className={cn(styles.preview, styles.image, {\n [styles.loading]: !meta,\n [styles.mobile]: isMobile,\n })}\n >\n <img src={image.src} alt={getImageAlt(image, index)} />\n </div>\n );\n };\n\n return (\n <div\n className={cn(\n styles.component,\n {\n [styles.active]: active,\n [styles.focused]: focused,\n [styles.mobile]: isMobile,\n },\n className,\n )}\n onClick={handleClick}\n role='button'\n onKeyDown={handleKeyDown}\n onMouseDown={handleDragStart}\n tabIndex={0}\n ref={ref}\n aria-label={`Перейти к ${index + 1} элементу`}\n >\n {renderPreview()}\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;AAmCO,IAAM,YAAY,GAAc,UAAC,EAAqD,EAAA;;AAAnD,IAAA,IAAA,KAAK,WAAA,EAAE,EAAA,GAAA,EAAA,CAAA,MAAc,EAAd,MAAM,mBAAG,KAAK,GAAA,EAAA,EAAE,KAAK,WAAA,EAAE,QAAQ,GAAA,EAAA,CAAA,QAAA,EAAE,SAAS,GAAA,EAAA,CAAA,SAAA;IACjF,IAAA,EAAA,GAAuB,UAAU,CAAC,cAAc,CAAC,EAA/C,UAAU,GAAA,EAAA,CAAA,UAAA,EAAE,IAAI,GAAA,EAAA,CAAA,IAA+B;AAEvD,IAAA,IAAM,QAAQ,GAAG,IAAI,KAAK,QAAQ;IAElC,IAAM,YAAY,GAAG,QAAQ,GAAG,oBAAoB,GAAG,qBAAqB;IAC5E,IAAM,aAAa,GAAG,QAAQ,GAAG,qBAAqB,GAAG,sBAAsB;AAE/E,IAAA,IAAM,GAAG,GAAG,MAAM,CAAiB,IAAI,CAAC;AACxC,IAAA,IAAM,SAAS,GAAG,MAAM,CAAoB,IAAI,CAAC;AAEjD,IAAA,SAAS,CAAC,YAAA;;AACN,QAAA,IAAM,MAAM,GAAG,SAAS,CAAC,OAAO;AAChC,QAAA,IAAM,KAAK,GAAG,CAAA,EAAA,GAAA,CAAA,EAAA,GAAA,UAAU,CAAC,KAAK,CAAC,MAAE,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,MAAA,GAAA,EAAA,CAAA,MAAM,MAAE,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,MAAA,GAAA,EAAA,CAAA,OAAO;AAChD,QAAA,IAAM,OAAO,GAAG,MAAM,KAAA,IAAA,IAAN,MAAM,KAAA,MAAA,GAAA,MAAA,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@
|
|
|
1
1
|
:root {
|
|
2
2
|
--color-light-status-info: #2288fa;
|
|
3
3
|
--color-static-neutral-100-inverted: #1c1c1e;
|
|
4
|
-
--color-static-neutral-
|
|
4
|
+
--color-static-neutral-translucent-100-inverted: rgba(214, 214, 229, 0.07);
|
|
5
5
|
}
|
|
6
6
|
:root {
|
|
7
7
|
--border-radius-8: 8px;
|
|
@@ -10,23 +10,23 @@
|
|
|
10
10
|
:root {
|
|
11
11
|
--focus-color: var(--color-light-status-info);
|
|
12
12
|
}
|
|
13
|
-
.
|
|
13
|
+
.gallery__component_1p08d {
|
|
14
14
|
display: flex;
|
|
15
15
|
z-index: 3;
|
|
16
16
|
overflow: hidden;
|
|
17
17
|
transition: border 0.15s ease-in-out;
|
|
18
18
|
outline: none;
|
|
19
19
|
}
|
|
20
|
-
.
|
|
20
|
+
.gallery__component_1p08d .gallery__image_1p08d {
|
|
21
21
|
opacity: 0.3;
|
|
22
22
|
}
|
|
23
|
-
.
|
|
23
|
+
.gallery__component_1p08d.gallery__mobile_1p08d {
|
|
24
24
|
padding: 0;
|
|
25
25
|
}
|
|
26
|
-
.
|
|
26
|
+
.gallery__active_1p08d > .gallery__image_1p08d {
|
|
27
27
|
opacity: 1;
|
|
28
28
|
}
|
|
29
|
-
.
|
|
29
|
+
.gallery__preview_1p08d {
|
|
30
30
|
width: 56px;
|
|
31
31
|
height: 56px;
|
|
32
32
|
flex-shrink: 0;
|
|
@@ -36,15 +36,15 @@
|
|
|
36
36
|
-moz-user-select: none;
|
|
37
37
|
user-select: none;
|
|
38
38
|
}
|
|
39
|
-
.
|
|
39
|
+
.gallery__preview_1p08d.gallery__mobile_1p08d {
|
|
40
40
|
width: 46px;
|
|
41
41
|
height: 46px;
|
|
42
42
|
border-radius: var(--border-radius-8);
|
|
43
43
|
}
|
|
44
|
-
.
|
|
44
|
+
.gallery__image_1p08d {
|
|
45
45
|
transition: opacity 0.15s ease-in-out;
|
|
46
46
|
}
|
|
47
|
-
.
|
|
47
|
+
.gallery__image_1p08d > img {
|
|
48
48
|
display: block;
|
|
49
49
|
width: 100%;
|
|
50
50
|
height: 100%;
|
|
@@ -54,36 +54,36 @@
|
|
|
54
54
|
overflow: clip;
|
|
55
55
|
overflow-clip-margin: border-box;
|
|
56
56
|
}
|
|
57
|
-
.
|
|
57
|
+
.gallery__image_1p08d:hover {
|
|
58
58
|
opacity: 0.7;
|
|
59
59
|
}
|
|
60
|
-
.
|
|
60
|
+
.gallery__loading_1p08d {
|
|
61
61
|
background-color: var(--color-static-neutral-100-inverted);
|
|
62
62
|
}
|
|
63
|
-
.
|
|
64
|
-
background-color: var(--color-static-neutral-
|
|
63
|
+
.gallery__loading_1p08d .gallery__active_1p08d {
|
|
64
|
+
background-color: var(--color-static-neutral-translucent-100-inverted);
|
|
65
65
|
}
|
|
66
|
-
.
|
|
66
|
+
.gallery__brokenImageWrapper_1p08d {
|
|
67
67
|
display: flex;
|
|
68
68
|
justify-content: center;
|
|
69
69
|
align-items: center;
|
|
70
|
-
background-color: var(--color-static-neutral-
|
|
70
|
+
background-color: var(--color-static-neutral-translucent-100-inverted);
|
|
71
71
|
opacity: 0.3;
|
|
72
72
|
}
|
|
73
|
-
.
|
|
73
|
+
.gallery__brokenImageWrapper_1p08d.gallery__active_1p08d {
|
|
74
74
|
opacity: 1;
|
|
75
75
|
}
|
|
76
|
-
.
|
|
76
|
+
.gallery__brokenIcon_1p08d {
|
|
77
77
|
width: 40px;
|
|
78
78
|
height: 40px;
|
|
79
79
|
}
|
|
80
|
-
.
|
|
80
|
+
.gallery__focused_1p08d {
|
|
81
81
|
outline: 2px solid var(--focus-color);
|
|
82
82
|
outline-offset: 2px;
|
|
83
83
|
}
|
|
84
|
-
.
|
|
84
|
+
.gallery__canvasPreview_1p08d {
|
|
85
85
|
border-radius: var(--border-radius-12);
|
|
86
86
|
}
|
|
87
|
-
.
|
|
87
|
+
.gallery__canvasPreview_1p08d.gallery__mobile_1p08d {
|
|
88
88
|
border-radius: var(--border-radius-8);
|
|
89
89
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import './index.css';
|
|
2
2
|
|
|
3
|
-
var styles = {"component":"
|
|
3
|
+
var styles = {"component":"gallery__component_1p08d","image":"gallery__image_1p08d","mobile":"gallery__mobile_1p08d","active":"gallery__active_1p08d","preview":"gallery__preview_1p08d","loading":"gallery__loading_1p08d","brokenImageWrapper":"gallery__brokenImageWrapper_1p08d","brokenIcon":"gallery__brokenIcon_1p08d","focused":"gallery__focused_1p08d","canvasPreview":"gallery__canvasPreview_1p08d"};
|
|
4
4
|
|
|
5
5
|
export { styles as default };
|
|
6
6
|
//# sourceMappingURL=index.module.css.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.module.css.js","sources":["../../src/components/image-preview/index.module.css"],"sourcesContent":["@import '@alfalab/core-components-vars/src/index.css';\n\n.component {\n display: flex;\n z-index: 3;\n overflow: hidden;\n transition: border 0.15s ease-in-out;\n outline: none;\n\n & .image {\n opacity: 0.3;\n }\n\n &.mobile {\n padding: 0;\n }\n}\n\n.active {\n & > .image {\n opacity: 1;\n }\n}\n\n.preview {\n width: 56px;\n height: 56px;\n flex-shrink: 0;\n border-radius: var(--border-radius-12);\n cursor: pointer;\n user-select: none;\n\n &.mobile {\n width: 46px;\n height: 46px;\n border-radius: var(--border-radius-8);\n }\n}\n\n.image {\n transition: opacity 0.15s ease-in-out;\n\n & > img {\n display: block;\n width: 100%;\n height: 100%;\n border-radius: inherit;\n object-fit: cover;\n overflow: clip;\n overflow-clip-margin: border-box;\n }\n\n &:hover {\n opacity: 0.7;\n }\n}\n\n.loading {\n background-color: var(--color-static-neutral-100-inverted);\n\n & .active {\n background-color: var(--color-static-neutral-
|
|
1
|
+
{"version":3,"file":"index.module.css.js","sources":["../../src/components/image-preview/index.module.css"],"sourcesContent":["@import '@alfalab/core-components-vars/src/index.css';\n\n.component {\n display: flex;\n z-index: 3;\n overflow: hidden;\n transition: border 0.15s ease-in-out;\n outline: none;\n\n & .image {\n opacity: 0.3;\n }\n\n &.mobile {\n padding: 0;\n }\n}\n\n.active {\n & > .image {\n opacity: 1;\n }\n}\n\n.preview {\n width: 56px;\n height: 56px;\n flex-shrink: 0;\n border-radius: var(--border-radius-12);\n cursor: pointer;\n user-select: none;\n\n &.mobile {\n width: 46px;\n height: 46px;\n border-radius: var(--border-radius-8);\n }\n}\n\n.image {\n transition: opacity 0.15s ease-in-out;\n\n & > img {\n display: block;\n width: 100%;\n height: 100%;\n border-radius: inherit;\n object-fit: cover;\n overflow: clip;\n overflow-clip-margin: border-box;\n }\n\n &:hover {\n opacity: 0.7;\n }\n}\n\n.loading {\n background-color: var(--color-static-neutral-100-inverted);\n\n & .active {\n background-color: var(--color-static-neutral-translucent-100-inverted);\n }\n}\n\n.brokenImageWrapper {\n display: flex;\n justify-content: center;\n align-items: center;\n background-color: var(--color-static-neutral-translucent-100-inverted);\n opacity: 0.3;\n\n &.active {\n opacity: 1;\n }\n}\n\n.brokenIcon {\n width: 40px;\n height: 40px;\n}\n\n.focused {\n @mixin focus-outline;\n}\n\n.canvasPreview {\n border-radius: var(--border-radius-12);\n\n &.mobile {\n border-radius: var(--border-radius-8);\n }\n}\n"],"names":[],"mappings":";;AAEgB,aAAe,CAAC,WAAW,CAAC,0BAA0B,CAAC,OAAO,CAAC,sBAAsB,CAAC,QAAQ,CAAC,uBAAuB,CAAC,QAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,wBAAwB,CAAC,SAAS,CAAC,wBAAwB,CAAC,oBAAoB,CAAC,mCAAmC,CAAC,YAAY,CAAC,2BAA2B,CAAC,SAAS,CAAC,wBAAwB,CAAC,eAAe,CAAC,8BAA8B,CAAC;;;;"}
|
|
@@ -22,8 +22,9 @@ var useHandleImageViewer = function () {
|
|
|
22
22
|
var isArrow = ((_a = leftArrowRef.current) === null || _a === void 0 ? void 0 : _a.contains(eventTarget)) ||
|
|
23
23
|
((_b = rightArrowRef.current) === null || _b === void 0 ? void 0 : _b.contains(eventTarget));
|
|
24
24
|
var isPlaceholder = Boolean(eventTarget.closest(".".concat(styles.placeholder)));
|
|
25
|
-
var
|
|
26
|
-
|
|
25
|
+
var isContentArea = Boolean(eventTarget.closest('[data-content-area]'));
|
|
26
|
+
// Закрываем галерею только при клике вне элементов контента и только на desktop
|
|
27
|
+
if (!isPlaceholder && !isArrow && !isContentArea && !isMobile) {
|
|
27
28
|
onClose();
|
|
28
29
|
}
|
|
29
30
|
}, [isMobile, onClose]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.js","sources":["../../../src/components/image-viewer/hooks.ts"],"sourcesContent":["import {\n type MouseEventHandler,\n type SyntheticEvent,\n useCallback,\n useContext,\n useEffect,\n useRef,\n} from 'react';\nimport elementClosest from 'element-closest';\n\nimport { GalleryContext } from '../../context';\n\nimport styles from './index.module.css';\n\nexport const useHandleImageViewer = () => {\n const { view, onClose, setImageMeta } = useContext(GalleryContext);\n\n const leftArrowRef = useRef<HTMLDivElement>(null);\n const rightArrowRef = useRef<HTMLDivElement>(null);\n\n const isMobile = view === 'mobile';\n\n const handleLoad = (event: SyntheticEvent<HTMLImageElement>, index: number) => {\n const target = event.currentTarget;\n\n const { naturalWidth, naturalHeight } = target;\n\n setImageMeta({ width: naturalWidth, height: naturalHeight }, index);\n };\n\n const handleLoadError = (index: number) => {\n setImageMeta({ width: 0, height: 0, broken: true }, index);\n };\n\n const handleWrapperClick = useCallback<MouseEventHandler>(\n (event) => {\n const eventTarget = event.target as HTMLElement;\n\n const isArrow =\n leftArrowRef.current?.contains(eventTarget) ||\n rightArrowRef.current?.contains(eventTarget);\n\n const isPlaceholder = Boolean(eventTarget.closest(`.${styles.placeholder}`));\n\n const
|
|
1
|
+
{"version":3,"file":"hooks.js","sources":["../../../src/components/image-viewer/hooks.ts"],"sourcesContent":["import {\n type MouseEventHandler,\n type SyntheticEvent,\n useCallback,\n useContext,\n useEffect,\n useRef,\n} from 'react';\nimport elementClosest from 'element-closest';\n\nimport { GalleryContext } from '../../context';\n\nimport styles from './index.module.css';\n\nexport const useHandleImageViewer = () => {\n const { view, onClose, setImageMeta } = useContext(GalleryContext);\n\n const leftArrowRef = useRef<HTMLDivElement>(null);\n const rightArrowRef = useRef<HTMLDivElement>(null);\n\n const isMobile = view === 'mobile';\n\n const handleLoad = (event: SyntheticEvent<HTMLImageElement>, index: number) => {\n const target = event.currentTarget;\n\n const { naturalWidth, naturalHeight } = target;\n\n setImageMeta({ width: naturalWidth, height: naturalHeight }, index);\n };\n\n const handleLoadError = (index: number) => {\n setImageMeta({ width: 0, height: 0, broken: true }, index);\n };\n\n const handleWrapperClick = useCallback<MouseEventHandler>(\n (event) => {\n const eventTarget = event.target as HTMLElement;\n\n const isArrow =\n leftArrowRef.current?.contains(eventTarget) ||\n rightArrowRef.current?.contains(eventTarget);\n\n const isPlaceholder = Boolean(eventTarget.closest(`.${styles.placeholder}`));\n\n const isContentArea = Boolean(eventTarget.closest('[data-content-area]'));\n\n // Закрываем галерею только при клике вне элементов контента и только на desktop\n if (!isPlaceholder && !isArrow && !isContentArea && !isMobile) {\n onClose();\n }\n },\n [isMobile, onClose],\n );\n\n useEffect(() => {\n elementClosest(window);\n }, []);\n\n return {\n handleLoad,\n handleLoadError,\n handleWrapperClick,\n isMobile,\n leftArrowRef,\n rightArrowRef,\n };\n};\n"],"names":[],"mappings":";;;;;AAca,IAAA,oBAAoB,GAAG,YAAA;AAC1B,IAAA,IAAA,EAAkC,GAAA,UAAU,CAAC,cAAc,CAAC,EAA1D,IAAI,GAAA,EAAA,CAAA,IAAA,EAAE,OAAO,GAAA,EAAA,CAAA,OAAA,EAAE,YAAY,kBAA+B;AAElE,IAAA,IAAM,YAAY,GAAG,MAAM,CAAiB,IAAI,CAAC;AACjD,IAAA,IAAM,aAAa,GAAG,MAAM,CAAiB,IAAI,CAAC;AAElD,IAAA,IAAM,QAAQ,GAAG,IAAI,KAAK,QAAQ;AAElC,IAAA,IAAM,UAAU,GAAG,UAAC,KA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AED,IAAA,SAAS,CAAC,YAAA;QACN,cAAc,CAAC,MAAM,CAAC;KACzB,EAAE,EAAE,CAAC;IAEN,OAAO;AACH,QAAA,UAAU,EAAA,UAAA;AACV,QAAA,eAAe,EAAA,eAAA;AACf,QAAA,kBAAkB,EAAA,kBAAA;AAClB,QAAA,QAAQ,EAAA,QAAA;AACR,QAAA,YAAY,EAAA,YAAA;AACZ,QAAA,aAAa,EAAA,aAAA;KAChB;AACL;;;;"}
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
--color-static-neutral-0-inverted: #262629;
|
|
4
4
|
--color-static-neutral-0-inverted-hover: #2f2f32;
|
|
5
5
|
--color-static-neutral-0-inverted-press: #353539;
|
|
6
|
-
--color-static-neutral-300-inverted: #29292c;
|
|
7
6
|
--color-static-neutral-translucent-100-inverted: rgba(214, 214, 229, 0.07);
|
|
8
7
|
--color-static-neutral-translucent-1300-inverted: rgba(255, 255, 255, 0.94);
|
|
9
8
|
}
|
|
@@ -20,7 +19,7 @@
|
|
|
20
19
|
:root {
|
|
21
20
|
--focus-color: var(--color-light-status-info);
|
|
22
21
|
}
|
|
23
|
-
.
|
|
22
|
+
.gallery__component_15cn9 {
|
|
24
23
|
display: flex;
|
|
25
24
|
flex-grow: 1;
|
|
26
25
|
justify-content: center;
|
|
@@ -88,7 +87,7 @@
|
|
|
88
87
|
z-index: -1000;
|
|
89
88
|
}
|
|
90
89
|
|
|
91
|
-
.
|
|
90
|
+
.gallery__swiperFrame_15cn9 {
|
|
92
91
|
display: flex;
|
|
93
92
|
flex: 1 1 0;
|
|
94
93
|
min-width: 0;
|
|
@@ -100,17 +99,17 @@
|
|
|
100
99
|
box-sizing: border-box;
|
|
101
100
|
}
|
|
102
101
|
|
|
103
|
-
.
|
|
102
|
+
.gallery__swiperFrame_15cn9.gallery__mobile_15cn9 {
|
|
104
103
|
max-height: calc(100vh - 210px);
|
|
105
104
|
max-height: calc(100dvh - 210px);
|
|
106
105
|
}
|
|
107
106
|
|
|
108
|
-
.
|
|
107
|
+
.gallery__swiperFrame_15cn9.gallery__mobileVideo_15cn9 {
|
|
109
108
|
max-height: 100vh;
|
|
110
109
|
max-height: 100dvh;
|
|
111
110
|
}
|
|
112
111
|
|
|
113
|
-
.
|
|
112
|
+
.gallery__fullScreenFrame_15cn9 {
|
|
114
113
|
display: flex;
|
|
115
114
|
align-items: center;
|
|
116
115
|
justify-content: center;
|
|
@@ -123,7 +122,7 @@
|
|
|
123
122
|
overflow: hidden;
|
|
124
123
|
}
|
|
125
124
|
|
|
126
|
-
.
|
|
125
|
+
.gallery__hiddenFrame_15cn9 {
|
|
127
126
|
flex: 0 0 0;
|
|
128
127
|
width: 0;
|
|
129
128
|
height: 0;
|
|
@@ -131,16 +130,16 @@
|
|
|
131
130
|
overflow: hidden;
|
|
132
131
|
}
|
|
133
132
|
|
|
134
|
-
.
|
|
133
|
+
.gallery__swiper_15cn9 {
|
|
135
134
|
width: 100%;
|
|
136
135
|
height: 100%;
|
|
137
136
|
}
|
|
138
137
|
|
|
139
|
-
.
|
|
138
|
+
.gallery__hidden_15cn9 {
|
|
140
139
|
display: none;
|
|
141
140
|
}
|
|
142
141
|
|
|
143
|
-
.
|
|
142
|
+
.gallery__singleSlideContainer_15cn9 {
|
|
144
143
|
display: flex;
|
|
145
144
|
width: 100%;
|
|
146
145
|
height: 100%;
|
|
@@ -148,22 +147,22 @@
|
|
|
148
147
|
|
|
149
148
|
max-height: calc(100vh - 80px);
|
|
150
149
|
max-height: calc(100dvh - 80px);
|
|
151
|
-
padding: var(--gap-32);
|
|
150
|
+
padding: var(--gap-0) var(--gap-32) var(--gap-32);
|
|
152
151
|
box-sizing: border-box;
|
|
153
152
|
}
|
|
154
153
|
|
|
155
|
-
.
|
|
154
|
+
.gallery__singleSlideContainer_15cn9.gallery__mobile_15cn9 {
|
|
156
155
|
max-height: calc(100vh - 174px);
|
|
157
156
|
max-height: calc(100dvh - 174px);
|
|
158
157
|
padding: 0;
|
|
159
158
|
}
|
|
160
159
|
|
|
161
|
-
.
|
|
160
|
+
.gallery__singleSlideContainer_15cn9.gallery__mobileVideo_15cn9 {
|
|
162
161
|
max-height: 100vh;
|
|
163
162
|
max-height: 100dvh;
|
|
164
163
|
}
|
|
165
164
|
|
|
166
|
-
.
|
|
165
|
+
.gallery__slide_15cn9 {
|
|
167
166
|
position: relative;
|
|
168
167
|
display: flex;
|
|
169
168
|
justify-content: center;
|
|
@@ -172,17 +171,17 @@
|
|
|
172
171
|
height: 100%;
|
|
173
172
|
}
|
|
174
173
|
|
|
175
|
-
.
|
|
174
|
+
.gallery__slideLoading_15cn9 {
|
|
176
175
|
background-color: var(--color-static-neutral-translucent-100-inverted);
|
|
177
176
|
border-radius: var(--border-radius-8);
|
|
178
177
|
}
|
|
179
178
|
|
|
180
|
-
.
|
|
179
|
+
.gallery__spinner_15cn9 {
|
|
181
180
|
position: absolute;
|
|
182
181
|
color: var(--color-static-neutral-translucent-1300-inverted);
|
|
183
182
|
}
|
|
184
183
|
|
|
185
|
-
.
|
|
184
|
+
.gallery__image_15cn9 {
|
|
186
185
|
width: auto;
|
|
187
186
|
height: auto;
|
|
188
187
|
max-width: 100%;
|
|
@@ -195,11 +194,11 @@
|
|
|
195
194
|
border-radius: var(--border-radius-8);
|
|
196
195
|
}
|
|
197
196
|
|
|
198
|
-
.
|
|
197
|
+
.gallery__image_15cn9.gallery__mobile_15cn9 {
|
|
199
198
|
border-radius: var(--border-radius-0);
|
|
200
199
|
}
|
|
201
200
|
|
|
202
|
-
.
|
|
201
|
+
.gallery__smallImage_15cn9 {
|
|
203
202
|
position: relative;
|
|
204
203
|
width: auto;
|
|
205
204
|
height: auto;
|
|
@@ -212,17 +211,17 @@
|
|
|
212
211
|
user-select: none;
|
|
213
212
|
}
|
|
214
213
|
|
|
215
|
-
.
|
|
214
|
+
.gallery__verticalImageFit_15cn9 {
|
|
216
215
|
width: auto;
|
|
217
216
|
height: 100%;
|
|
218
217
|
}
|
|
219
218
|
|
|
220
|
-
.
|
|
219
|
+
.gallery__horizontalImageFit_15cn9 {
|
|
221
220
|
width: 100%;
|
|
222
221
|
height: auto;
|
|
223
222
|
}
|
|
224
223
|
|
|
225
|
-
.
|
|
224
|
+
.gallery__fullScreenMedia_15cn9 {
|
|
226
225
|
width: 100%;
|
|
227
226
|
height: 100%;
|
|
228
227
|
max-width: 100%;
|
|
@@ -232,7 +231,7 @@
|
|
|
232
231
|
border-radius: var(--border-radius-0);
|
|
233
232
|
}
|
|
234
233
|
|
|
235
|
-
.
|
|
234
|
+
.gallery__arrow_15cn9 {
|
|
236
235
|
display: flex;
|
|
237
236
|
flex-direction: column;
|
|
238
237
|
justify-content: center;
|
|
@@ -246,30 +245,30 @@
|
|
|
246
245
|
outline: none;
|
|
247
246
|
}
|
|
248
247
|
|
|
249
|
-
.
|
|
248
|
+
.gallery__arrow_15cn9:hover {
|
|
250
249
|
background-color: var(--color-static-neutral-0-inverted-hover);
|
|
251
250
|
}
|
|
252
251
|
|
|
253
|
-
.
|
|
252
|
+
.gallery__arrow_15cn9:active {
|
|
254
253
|
background-color: var(--color-static-neutral-0-inverted-press);
|
|
255
254
|
}
|
|
256
255
|
|
|
257
|
-
.
|
|
256
|
+
.gallery__focused_15cn9 {
|
|
258
257
|
outline: 2px solid var(--focus-color);
|
|
259
258
|
outline-offset: 2px;
|
|
260
259
|
}
|
|
261
260
|
|
|
262
|
-
.
|
|
261
|
+
.gallery__placeholder_15cn9 {
|
|
263
262
|
display: flex;
|
|
264
263
|
justify-content: center;
|
|
265
264
|
align-items: center;
|
|
266
265
|
width: 100%;
|
|
267
266
|
height: 100%;
|
|
268
267
|
border-radius: var(--border-radius-8);
|
|
269
|
-
background-color: var(--color-static-neutral-
|
|
268
|
+
background-color: var(--color-static-neutral-translucent-100-inverted);
|
|
270
269
|
}
|
|
271
270
|
|
|
272
|
-
.
|
|
271
|
+
.gallery__brokenImgWrapper_15cn9 {
|
|
273
272
|
position: relative;
|
|
274
273
|
display: flex;
|
|
275
274
|
flex-direction: column;
|
|
@@ -278,13 +277,13 @@
|
|
|
278
277
|
text-align: center;
|
|
279
278
|
}
|
|
280
279
|
|
|
281
|
-
.
|
|
280
|
+
.gallery__brokenImgIcon_15cn9 {
|
|
282
281
|
width: 80px;
|
|
283
282
|
height: 80px;
|
|
284
283
|
margin-bottom: var(--gap-4);
|
|
285
284
|
}
|
|
286
285
|
|
|
287
|
-
.
|
|
286
|
+
.gallery__fullScreenVideo_15cn9 {
|
|
288
287
|
width: 100%;
|
|
289
288
|
height: 100%;
|
|
290
289
|
max-height: none;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import './index.css';
|
|
2
2
|
|
|
3
|
-
var styles = {"component":"
|
|
3
|
+
var styles = {"component":"gallery__component_15cn9","swiperFrame":"gallery__swiperFrame_15cn9","mobile":"gallery__mobile_15cn9","mobileVideo":"gallery__mobileVideo_15cn9","fullScreenFrame":"gallery__fullScreenFrame_15cn9","hiddenFrame":"gallery__hiddenFrame_15cn9","swiper":"gallery__swiper_15cn9","hidden":"gallery__hidden_15cn9","singleSlideContainer":"gallery__singleSlideContainer_15cn9","slide":"gallery__slide_15cn9","slideLoading":"gallery__slideLoading_15cn9","spinner":"gallery__spinner_15cn9","image":"gallery__image_15cn9","smallImage":"gallery__smallImage_15cn9","verticalImageFit":"gallery__verticalImageFit_15cn9","horizontalImageFit":"gallery__horizontalImageFit_15cn9","fullScreenMedia":"gallery__fullScreenMedia_15cn9","arrow":"gallery__arrow_15cn9","focused":"gallery__focused_15cn9","placeholder":"gallery__placeholder_15cn9","brokenImgWrapper":"gallery__brokenImgWrapper_15cn9","brokenImgIcon":"gallery__brokenImgIcon_15cn9","fullScreenVideo":"gallery__fullScreenVideo_15cn9"};
|
|
4
4
|
|
|
5
5
|
export { styles as default };
|
|
6
6
|
//# sourceMappingURL=index.module.css.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.module.css.js","sources":["../../src/components/image-viewer/index.module.css"],"sourcesContent":["@import '@alfalab/core-components-vars/src/index.css';\n\n.component {\n display: flex;\n flex-grow: 1;\n justify-content: center;\n min-height: 0;\n background-color: var(--color-static-neutral-0-inverted);\n\n /* swiper/swiper.css; */\n :global(.swiper) {\n margin-left: auto;\n margin-right: auto;\n position: relative;\n overflow: hidden;\n list-style: none;\n padding: 0;\n z-index: 1;\n display: block;\n }\n :global(.swiper-wrapper) {\n position: relative;\n width: 100%;\n height: 100%;\n z-index: 1;\n display: flex;\n transition-property: transform;\n transition-timing-function: var(--swiper-wrapper-transition-timing-function, initial);\n box-sizing: content-box;\n }\n :global(.swiper-android) :global(.swiper-slide),\n :global(.swiper-ios) :global(.swiper-slide),\n :global(.swiper-wrapper) {\n transform: translate3d(0, 0, 0);\n }\n :global(.swiper-horizontal) {\n touch-action: pan-y;\n }\n :global(.swiper-slide) {\n flex-shrink: 0;\n width: 100%;\n height: 100%;\n position: relative;\n transition-property: transform;\n display: block;\n }\n :global(.swiper-slide-invisible-blank) {\n visibility: hidden;\n }\n :global(.swiper-autoheight),\n :global(.swiper-autoheight) :global(.swiper-slide) {\n height: auto;\n }\n :global(.swiper-autoheight) :global(.swiper-wrapper) {\n align-items: flex-start;\n transition-property: transform, height;\n }\n :global(.swiper-backface-hidden) :global(.swiper-slide) {\n transform: translateZ(0);\n backface-visibility: hidden;\n }\n\n /* swiper/modules/a11y.css */\n :global(.swiper) :global(.swiper-notification) {\n position: absolute;\n left: 0;\n top: 0;\n pointer-events: none;\n opacity: 0;\n z-index: -1000;\n }\n\n .swiperFrame {\n display: flex;\n flex: 1 1 0;\n min-width: 0;\n height: 100%;\n min-height: 0;\n\n /* 168px - высота хэдера и футера */\n max-height: calc(100vh - 168px);\n max-height: calc(100dvh - 168px);\n padding: var(--gap-32) var(--gap-16);\n box-sizing: border-box;\n\n &.mobile {\n max-height: calc(100vh - 210px);\n max-height: calc(100dvh - 210px);\n }\n\n &.mobileVideo {\n max-height: 100vh;\n max-height: 100dvh;\n }\n }\n\n .fullScreenFrame {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 100%;\n height: 100%;\n max-height: none;\n min-height: 0;\n padding: var(--gap-0);\n box-sizing: border-box;\n overflow: hidden;\n }\n\n .hiddenFrame {\n flex: 0 0 0;\n width: 0;\n height: 0;\n padding: var(--gap-0);\n overflow: hidden;\n }\n\n .swiper {\n width: 100%;\n height: 100%;\n }\n\n .hidden {\n display: none;\n }\n\n .singleSlideContainer {\n display: flex;\n width: 100%;\n height: 100%;\n min-height: 0;\n\n max-height: calc(100vh - 80px);\n max-height: calc(100dvh - 80px);\n padding: var(--gap-32);\n box-sizing: border-box;\n\n &.mobile {\n max-height: calc(100vh - 174px);\n max-height: calc(100dvh - 174px);\n padding: 0;\n }\n\n &.mobileVideo {\n max-height: 100vh;\n max-height: 100dvh;\n }\n }\n\n .slide {\n position: relative;\n display: flex;\n justify-content: center;\n align-items: center;\n width: 100%;\n height: 100%;\n }\n\n .slideLoading {\n background-color: var(--color-static-neutral-translucent-100-inverted);\n border-radius: var(--border-radius-8);\n }\n\n .spinner {\n position: absolute;\n color: var(--color-static-neutral-translucent-1300-inverted);\n }\n\n .image {\n width: auto;\n height: auto;\n max-width: 100%;\n max-height: 100%;\n object-fit: contain;\n user-select: none;\n border-radius: var(--border-radius-8);\n\n &.mobile {\n border-radius: var(--border-radius-0);\n }\n }\n\n .smallImage {\n position: relative;\n width: auto;\n height: auto;\n max-width: 100%;\n max-height: 100%;\n object-fit: contain;\n user-select: none;\n }\n\n .verticalImageFit {\n width: auto;\n height: 100%;\n }\n\n .horizontalImageFit {\n width: 100%;\n height: auto;\n }\n\n .fullScreenMedia {\n width: 100%;\n height: 100%;\n max-width: 100%;\n max-height: 100%;\n object-fit: contain;\n border-radius: var(--border-radius-0);\n }\n\n .arrow {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n flex-shrink: 0;\n width: 96px;\n height: 100%;\n cursor: pointer;\n color: var(--color-static-neutral-translucent-1300-inverted);\n transition: background-color 0.15s ease-in-out;\n outline: none;\n\n &:hover {\n background-color: var(--color-static-neutral-0-inverted-hover);\n }\n\n &:active {\n background-color: var(--color-static-neutral-0-inverted-press);\n }\n }\n\n .focused {\n @mixin focus-outline;\n }\n\n .placeholder {\n display: flex;\n justify-content: center;\n align-items: center;\n width: 100%;\n height: 100%;\n border-radius: var(--border-radius-8);\n background-color: var(--color-static-neutral-
|
|
1
|
+
{"version":3,"file":"index.module.css.js","sources":["../../src/components/image-viewer/index.module.css"],"sourcesContent":["@import '@alfalab/core-components-vars/src/index.css';\n\n.component {\n display: flex;\n flex-grow: 1;\n justify-content: center;\n min-height: 0;\n background-color: var(--color-static-neutral-0-inverted);\n\n /* swiper/swiper.css; */\n :global(.swiper) {\n margin-left: auto;\n margin-right: auto;\n position: relative;\n overflow: hidden;\n list-style: none;\n padding: 0;\n z-index: 1;\n display: block;\n }\n :global(.swiper-wrapper) {\n position: relative;\n width: 100%;\n height: 100%;\n z-index: 1;\n display: flex;\n transition-property: transform;\n transition-timing-function: var(--swiper-wrapper-transition-timing-function, initial);\n box-sizing: content-box;\n }\n :global(.swiper-android) :global(.swiper-slide),\n :global(.swiper-ios) :global(.swiper-slide),\n :global(.swiper-wrapper) {\n transform: translate3d(0, 0, 0);\n }\n :global(.swiper-horizontal) {\n touch-action: pan-y;\n }\n :global(.swiper-slide) {\n flex-shrink: 0;\n width: 100%;\n height: 100%;\n position: relative;\n transition-property: transform;\n display: block;\n }\n :global(.swiper-slide-invisible-blank) {\n visibility: hidden;\n }\n :global(.swiper-autoheight),\n :global(.swiper-autoheight) :global(.swiper-slide) {\n height: auto;\n }\n :global(.swiper-autoheight) :global(.swiper-wrapper) {\n align-items: flex-start;\n transition-property: transform, height;\n }\n :global(.swiper-backface-hidden) :global(.swiper-slide) {\n transform: translateZ(0);\n backface-visibility: hidden;\n }\n\n /* swiper/modules/a11y.css */\n :global(.swiper) :global(.swiper-notification) {\n position: absolute;\n left: 0;\n top: 0;\n pointer-events: none;\n opacity: 0;\n z-index: -1000;\n }\n\n .swiperFrame {\n display: flex;\n flex: 1 1 0;\n min-width: 0;\n height: 100%;\n min-height: 0;\n\n /* 168px - высота хэдера и футера */\n max-height: calc(100vh - 168px);\n max-height: calc(100dvh - 168px);\n padding: var(--gap-32) var(--gap-16);\n box-sizing: border-box;\n\n &.mobile {\n max-height: calc(100vh - 210px);\n max-height: calc(100dvh - 210px);\n }\n\n &.mobileVideo {\n max-height: 100vh;\n max-height: 100dvh;\n }\n }\n\n .fullScreenFrame {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 100%;\n height: 100%;\n max-height: none;\n min-height: 0;\n padding: var(--gap-0);\n box-sizing: border-box;\n overflow: hidden;\n }\n\n .hiddenFrame {\n flex: 0 0 0;\n width: 0;\n height: 0;\n padding: var(--gap-0);\n overflow: hidden;\n }\n\n .swiper {\n width: 100%;\n height: 100%;\n }\n\n .hidden {\n display: none;\n }\n\n .singleSlideContainer {\n display: flex;\n width: 100%;\n height: 100%;\n min-height: 0;\n\n max-height: calc(100vh - 80px);\n max-height: calc(100dvh - 80px);\n padding: var(--gap-0) var(--gap-32) var(--gap-32);\n box-sizing: border-box;\n\n &.mobile {\n max-height: calc(100vh - 174px);\n max-height: calc(100dvh - 174px);\n padding: 0;\n }\n\n &.mobileVideo {\n max-height: 100vh;\n max-height: 100dvh;\n }\n }\n\n .slide {\n position: relative;\n display: flex;\n justify-content: center;\n align-items: center;\n width: 100%;\n height: 100%;\n }\n\n .slideLoading {\n background-color: var(--color-static-neutral-translucent-100-inverted);\n border-radius: var(--border-radius-8);\n }\n\n .spinner {\n position: absolute;\n color: var(--color-static-neutral-translucent-1300-inverted);\n }\n\n .image {\n width: auto;\n height: auto;\n max-width: 100%;\n max-height: 100%;\n object-fit: contain;\n user-select: none;\n border-radius: var(--border-radius-8);\n\n &.mobile {\n border-radius: var(--border-radius-0);\n }\n }\n\n .smallImage {\n position: relative;\n width: auto;\n height: auto;\n max-width: 100%;\n max-height: 100%;\n object-fit: contain;\n user-select: none;\n }\n\n .verticalImageFit {\n width: auto;\n height: 100%;\n }\n\n .horizontalImageFit {\n width: 100%;\n height: auto;\n }\n\n .fullScreenMedia {\n width: 100%;\n height: 100%;\n max-width: 100%;\n max-height: 100%;\n object-fit: contain;\n border-radius: var(--border-radius-0);\n }\n\n .arrow {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n flex-shrink: 0;\n width: 96px;\n height: 100%;\n cursor: pointer;\n color: var(--color-static-neutral-translucent-1300-inverted);\n transition: background-color 0.15s ease-in-out;\n outline: none;\n\n &:hover {\n background-color: var(--color-static-neutral-0-inverted-hover);\n }\n\n &:active {\n background-color: var(--color-static-neutral-0-inverted-press);\n }\n }\n\n .focused {\n @mixin focus-outline;\n }\n\n .placeholder {\n display: flex;\n justify-content: center;\n align-items: center;\n width: 100%;\n height: 100%;\n border-radius: var(--border-radius-8);\n background-color: var(--color-static-neutral-translucent-100-inverted);\n }\n\n .brokenImgWrapper {\n position: relative;\n display: flex;\n flex-direction: column;\n align-items: center;\n width: 150px;\n text-align: center;\n }\n\n .brokenImgIcon {\n width: 80px;\n height: 80px;\n margin-bottom: var(--gap-4);\n }\n\n .fullScreenVideo {\n width: 100%;\n height: 100%;\n max-height: none;\n }\n}\n"],"names":[],"mappings":";;AAEgB,aAAe,CAAC,WAAW,CAAC,0BAA0B,CAAC,aAAa,CAAC,4BAA4B,CAAC,QAAQ,CAAC,uBAAuB,CAAC,aAAa,CAAC,4BAA4B,CAAC,iBAAiB,CAAC,gCAAgC,CAAC,aAAa,CAAC,4BAA4B,CAAC,QAAQ,CAAC,uBAAuB,CAAC,QAAQ,CAAC,uBAAuB,CAAC,sBAAsB,CAAC,qCAAqC,CAAC,OAAO,CAAC,sBAAsB,CAAC,cAAc,CAAC,6BAA6B,CAAC,SAAS,CAAC,wBAAwB,CAAC,OAAO,CAAC,sBAAsB,CAAC,YAAY,CAAC,2BAA2B,CAAC,kBAAkB,CAAC,iCAAiC,CAAC,oBAAoB,CAAC,mCAAmC,CAAC,iBAAiB,CAAC,gCAAgC,CAAC,OAAO,CAAC,sBAAsB,CAAC,SAAS,CAAC,wBAAwB,CAAC,aAAa,CAAC,4BAA4B,CAAC,kBAAkB,CAAC,iCAAiC,CAAC,eAAe,CAAC,8BAA8B,CAAC,iBAAiB,CAAC,gCAAgC,CAAC;;;;"}
|
|
@@ -2,6 +2,7 @@ import React, { useContext, useRef } from 'react';
|
|
|
2
2
|
import cn from 'classnames';
|
|
3
3
|
import { GalleryContext } from '../../context.js';
|
|
4
4
|
import { isVideo } from '../../utils/utils.js';
|
|
5
|
+
import 'tslib';
|
|
5
6
|
import { useHandleImageViewer } from './hooks.js';
|
|
6
7
|
import { Slide } from './slide.js';
|
|
7
8
|
import styles from './index.module.css.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"single.js","sources":["../../../src/components/image-viewer/single.tsx"],"sourcesContent":["import React, { type FC, useContext, useRef } from 'react';\nimport cn from 'classnames';\n\nimport { GalleryContext } from '../../context';\nimport { isVideo } from '../../utils';\n\nimport { useHandleImageViewer } from './hooks';\nimport { Slide } from './slide';\n\nimport styles from './index.module.css';\n\nexport const Single: FC = () => {\n const { fullScreen, currentSlideIndex, getCurrentImage, getCurrentImageMeta } =\n useContext(GalleryContext);\n\n const { handleWrapperClick, isMobile } = useHandleImageViewer();\n\n const wrapperRef = useRef<HTMLDivElement>(null);\n\n const currentImage = getCurrentImage();\n const currentImageMeta = getCurrentImageMeta();\n\n if (!currentImage) return null;\n\n const imageWidth = currentImageMeta?.width || 1;\n const imageHeight = currentImageMeta?.height || 1;\n\n const imageAspectRatio = imageWidth / imageHeight;\n\n const wrapperRect = wrapperRef.current?.getBoundingClientRect();\n\n const wrapperAspectRatio = (wrapperRect?.width || 1) / (wrapperRect?.height || 1);\n\n return (\n /* eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions */\n <div className={styles.component} onClick={handleWrapperClick}>\n {fullScreen && !isVideo(currentImage?.src) ? (\n <div className={styles.fullScreenFrame}>\n <Slide\n isActive={true}\n containerAspectRatio={wrapperAspectRatio}\n image={currentImage}\n containerHeight={wrapperRect?.height || 0}\n meta={currentImageMeta}\n index={currentSlideIndex}\n imageAspectRatio={imageAspectRatio}\n slideVisible={false}\n fullScreen={true}\n />\n </div>\n ) : (\n <div\n className={cn(styles.singleSlideContainer, {\n [styles.mobile]: isMobile,\n [styles.mobileVideo]: isMobile && isVideo(currentImage?.src),\n })}\n ref={wrapperRef}\n >\n <Slide\n isActive={true}\n containerAspectRatio={wrapperAspectRatio}\n image={currentImage}\n containerHeight={wrapperRect?.height || 0}\n meta={currentImageMeta}\n index={currentSlideIndex}\n imageAspectRatio={imageAspectRatio}\n slideVisible={true}\n />\n </div>\n )}\n </div>\n );\n};\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"single.js","sources":["../../../src/components/image-viewer/single.tsx"],"sourcesContent":["import React, { type FC, useContext, useRef } from 'react';\nimport cn from 'classnames';\n\nimport { GalleryContext } from '../../context';\nimport { isVideo } from '../../utils';\n\nimport { useHandleImageViewer } from './hooks';\nimport { Slide } from './slide';\n\nimport styles from './index.module.css';\n\nexport const Single: FC = () => {\n const { fullScreen, currentSlideIndex, getCurrentImage, getCurrentImageMeta } =\n useContext(GalleryContext);\n\n const { handleWrapperClick, isMobile } = useHandleImageViewer();\n\n const wrapperRef = useRef<HTMLDivElement>(null);\n\n const currentImage = getCurrentImage();\n const currentImageMeta = getCurrentImageMeta();\n\n if (!currentImage) return null;\n\n const imageWidth = currentImageMeta?.width || 1;\n const imageHeight = currentImageMeta?.height || 1;\n\n const imageAspectRatio = imageWidth / imageHeight;\n\n const wrapperRect = wrapperRef.current?.getBoundingClientRect();\n\n const wrapperAspectRatio = (wrapperRect?.width || 1) / (wrapperRect?.height || 1);\n\n return (\n /* eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions */\n <div className={styles.component} onClick={handleWrapperClick}>\n {fullScreen && !isVideo(currentImage?.src) ? (\n <div className={styles.fullScreenFrame}>\n <Slide\n isActive={true}\n containerAspectRatio={wrapperAspectRatio}\n image={currentImage}\n containerHeight={wrapperRect?.height || 0}\n meta={currentImageMeta}\n index={currentSlideIndex}\n imageAspectRatio={imageAspectRatio}\n slideVisible={false}\n fullScreen={true}\n />\n </div>\n ) : (\n <div\n className={cn(styles.singleSlideContainer, {\n [styles.mobile]: isMobile,\n [styles.mobileVideo]: isMobile && isVideo(currentImage?.src),\n })}\n ref={wrapperRef}\n >\n <Slide\n isActive={true}\n containerAspectRatio={wrapperAspectRatio}\n image={currentImage}\n containerHeight={wrapperRect?.height || 0}\n meta={currentImageMeta}\n index={currentSlideIndex}\n imageAspectRatio={imageAspectRatio}\n slideVisible={true}\n />\n </div>\n )}\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AAWa,IAAA,MAAM,GAAO,YAAA;;;AAChB,IAAA,IAAA,KACF,UAAU,CAAC,cAAc,CAAC,EADtB,UAAU,GAAA,EAAA,CAAA,UAAA,EAAE,iBAAiB,uBAAA,EAAE,eAAe,qBAAA,EAAE,mBAAmB,yBAC7C;IAExB,IAAA,EAAA,GAAmC,oBAAoB,EAAE,EAAvD,kBAAkB,GAAA,EAAA,CAAA,kBAAA,EAAE,QAAQ,GAAA,EAAA,CAAA,QAA2B;AAE/D,IAAA,IAAM,UAAU,GAAG,MAAM,CAAiB,IAAI,CAAC;AAE/C,IAAA,IAAM,YAAY,GAAG,eAAe,EAAE;AACtC,IAAA,IAAM,gBAAgB,GAAG,mBAAmB,EAAE;AAE9C,IAAA,IAAI,CAAC,YAAY;AAAE,QAAA,OAAO,IAAI;AAE9B,IAAA,IAAM,UAAU,GAAG,CAAA,gBAAgB,KAAhB,IAAA,IAAA,gBAAgB,KAAhB,MAAA,GAAA,MAAA,GAAA,gBAAgB,CAAE,KAAK,KAAI,CAAC;AAC/C,IAAA,IAAM,WAAW,GAAG,CAAA,gBAAgB,KAAhB,IAAA,IAAA,gBAA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A,aAAA,CAAA,KAAA,EAAA,EACI,SAAS,EAAE,EAAE,CAAC,MAAM,CAAC,oBAAoB,GAAA,EAAA,GAAA,EAAA;AACrC,YAAA,EAAA,CAAC,MAAM,CAAC,MAAM,CAAA,GAAG,QAAQ;AACzB,YAAA,EAAA,CAAC,MAAM,CAAC,WAAW,CAAA,GAAG,QAAQ,IAAI,OAAO,CAAC,YAAY,aAAZ,YAAY,KAAA,MAAA,GAAA,MAAA,GAAZ,YAAY,CAAE,GAAG,CAAC;gBAC9D,EACF,GAAG,EAAE,UAAU,EAAA;QAEf,KAAC,CAAA,aAAA,CAAA,KAAK,IACF,QAAQ,EAAE,IAAI,EACd,oBAAoB,EAAE,kBAAkB,EACxC,KAAK,EAAE,YAAY,EACnB,eAAe,EAAE,CAAA,WAAW,KAAA,IAAA,IAAX,WAAW,KAAA,MAAA,GAAA,MAAA,GAAX,WAAW,CAAE,MAAM,KAAI,CAAC,EACzC,IAAI,EAAE,gBAAgB,EACtB,KAAK,EAAE,iBAAiB,EACxB,gBAAgB,EAAE,gBAAgB,EAClC,YAAY,EAAE,IAAI,GACpB,CACA,CACT,CACC;AAEd;;;;"}
|
|
@@ -5,6 +5,7 @@ import { TypographyText } from '@alfalab/core-components-typography/esm';
|
|
|
5
5
|
import { GalleryContext } from '../../context.js';
|
|
6
6
|
import { isSmallImage, isVideo, getImageAlt } from '../../utils/utils.js';
|
|
7
7
|
import { TestIds } from '../../utils/constants.js';
|
|
8
|
+
import 'tslib';
|
|
8
9
|
import { useHandleImageViewer } from './hooks.js';
|
|
9
10
|
import { NoImagePaths } from './paths.js';
|
|
10
11
|
import { Video } from './video/index.js';
|
|
@@ -22,7 +23,7 @@ var SlideInner = function (_a) {
|
|
|
22
23
|
React.createElement(TypographyText, { view: 'primary-small', color: 'static-secondary-light' },
|
|
23
24
|
"\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C ",
|
|
24
25
|
isVideoView ? 'видео' : 'изображение'))) : (children);
|
|
25
|
-
return (React.createElement("div", { className: cn(styles.slide, (_b = {}, _b[styles.slideLoading] = loading, _b)) },
|
|
26
|
+
return (React.createElement("div", { className: cn(styles.slide, (_b = {}, _b[styles.slideLoading] = loading && !isVideoView, _b)) },
|
|
26
27
|
broken ? React.createElement("div", { className: styles.placeholder }, content) : content,
|
|
27
28
|
React.createElement(Spinner, { className: styles.spinner, preset: 48, visible: loading })));
|
|
28
29
|
};
|
|
@@ -53,7 +54,7 @@ var Slide = function (_a) {
|
|
|
53
54
|
_c[styles.fullScreenMedia] = fullScreen,
|
|
54
55
|
_c[styles.verticalImageFit] = verticalImageFit,
|
|
55
56
|
_c[styles.horizontalImageFit] = horizontalImageFit,
|
|
56
|
-
_c)), onLoad: function (event) { return handleLoad(event, index); }, onError: function () { return handleLoadError(index); }, style: imageStyle, "data-test-id": slideVisible ? TestIds.ACTIVE_IMAGE : undefined })));
|
|
57
|
+
_c)), onLoad: function (event) { return handleLoad(event, index); }, onError: function () { return handleLoadError(index); }, style: imageStyle, "data-content-area": 'true', "data-test-id": slideVisible ? TestIds.ACTIVE_IMAGE : undefined })));
|
|
57
58
|
};
|
|
58
59
|
|
|
59
60
|
export { Slide };
|