@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
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;"}
|
package/index.module.css.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
require('./index.css');
|
|
4
4
|
|
|
5
|
-
var styles = {"container":"
|
|
5
|
+
var styles = {"container":"gallery__container_1kzqo","mobile":"gallery__mobile_1kzqo","modal":"gallery__modal_1kzqo","navigationVideo":"gallery__navigationVideo_1kzqo","hide":"gallery__hide_1kzqo","hideInfo":"gallery__hideInfo_1kzqo","bottomButton":"gallery__bottomButton_1kzqo"};
|
|
6
6
|
|
|
7
7
|
module.exports = styles;
|
|
8
8
|
//# sourceMappingURL=index.module.css.js.map
|
package/modern/Component.js
CHANGED
|
@@ -33,6 +33,7 @@ const Gallery = ({ open, images, slideIndex, initialSlide = 0, loop = true, onCl
|
|
|
33
33
|
const [mutedVideo, setMutedVideo] = useState(DEFAULT_MUTED_VIDEO);
|
|
34
34
|
const [playingVideo, setPlayingVideo] = useState(DEFAULT_PLAYING_VIDEO);
|
|
35
35
|
const [hideNavigation, setHideNavigation] = useState(DEFAULT_HIDE_NAVIGATION);
|
|
36
|
+
const [swipeY, setSwipeY] = useState(0);
|
|
36
37
|
const isDesktop = useIsDesktop();
|
|
37
38
|
const isCurrentVideo = !!imagesMeta[currentSlideIndex]?.player?.current;
|
|
38
39
|
const bottomButton = images[currentSlideIndex]?.bottomButton;
|
|
@@ -111,6 +112,11 @@ const Gallery = ({ open, images, slideIndex, initialSlide = 0, loop = true, onCl
|
|
|
111
112
|
swiper?.slideTo(currentSlideIndex);
|
|
112
113
|
}
|
|
113
114
|
}, [uncontrolled, currentSlideIndex, swiper]);
|
|
115
|
+
useEffect(() => {
|
|
116
|
+
if (!open) {
|
|
117
|
+
setSwipeY(0);
|
|
118
|
+
}
|
|
119
|
+
}, [open]);
|
|
114
120
|
useEffect(() => {
|
|
115
121
|
document.addEventListener('keydown', handleKeyDown);
|
|
116
122
|
return () => {
|
|
@@ -118,24 +124,59 @@ const Gallery = ({ open, images, slideIndex, initialSlide = 0, loop = true, onCl
|
|
|
118
124
|
};
|
|
119
125
|
}, [handleKeyDown]);
|
|
120
126
|
useEffect(() => {
|
|
121
|
-
|
|
127
|
+
if (!open) {
|
|
128
|
+
return undefined;
|
|
129
|
+
}
|
|
130
|
+
let startX = 0;
|
|
131
|
+
let startY = 0;
|
|
132
|
+
let lockedDirection = null;
|
|
133
|
+
const directionLockThreshold = 10;
|
|
122
134
|
const abortController = new AbortController();
|
|
123
135
|
const { signal } = abortController;
|
|
124
136
|
document.addEventListener('touchstart', (e) => {
|
|
137
|
+
startX = e.touches[0].clientX;
|
|
125
138
|
startY = e.touches[0].clientY;
|
|
139
|
+
lockedDirection = null;
|
|
126
140
|
}, { signal });
|
|
127
141
|
document.addEventListener('touchmove', (e) => {
|
|
128
|
-
const
|
|
129
|
-
const
|
|
130
|
-
|
|
131
|
-
|
|
142
|
+
const currentX = e.touches[0].clientX;
|
|
143
|
+
const currentY = e.touches[0].clientY;
|
|
144
|
+
const deltaX = currentX - startX;
|
|
145
|
+
const deltaY = currentY - startY;
|
|
146
|
+
if (!lockedDirection) {
|
|
147
|
+
const absX = Math.abs(deltaX);
|
|
148
|
+
const absY = Math.abs(deltaY);
|
|
149
|
+
if (absX > absY && absX > directionLockThreshold) {
|
|
150
|
+
lockedDirection = 'horizontal';
|
|
151
|
+
}
|
|
152
|
+
else if (absY > absX && absY > directionLockThreshold) {
|
|
153
|
+
lockedDirection = 'vertical';
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
if (lockedDirection === 'horizontal') {
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
if (deltaY <= 0) {
|
|
163
|
+
setSwipeY(0);
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
setSwipeY(deltaY);
|
|
167
|
+
if (deltaY > SWIPE_THRESHOLD) {
|
|
168
|
+
setSwipeY(0);
|
|
132
169
|
onClose();
|
|
133
170
|
}
|
|
134
171
|
}, { signal });
|
|
172
|
+
document.addEventListener('touchend', () => {
|
|
173
|
+
lockedDirection = null;
|
|
174
|
+
setSwipeY(0);
|
|
175
|
+
}, { signal });
|
|
135
176
|
return () => {
|
|
136
177
|
abortController.abort();
|
|
137
178
|
};
|
|
138
|
-
}, [onClose]);
|
|
179
|
+
}, [onClose, open]);
|
|
139
180
|
const singleSlide = images.length === 1;
|
|
140
181
|
const showNavigationBar = !singleSlide && !fullScreen;
|
|
141
182
|
// eslint-disable-next-line react/jsx-no-constructed-context-values
|
|
@@ -167,7 +208,9 @@ const Gallery = ({ open, images, slideIndex, initialSlide = 0, loop = true, onCl
|
|
|
167
208
|
};
|
|
168
209
|
return (React.createElement(GalleryContext.Provider, { value: galleryContext },
|
|
169
210
|
React.createElement(BaseModal, { open: open, className: cn(styles.modal, popupClassName), onEscapeKeyDown: handleEscapeKeyDown, Backdrop: Backdrop, onUnmount: onUnmount },
|
|
170
|
-
React.createElement("div", {
|
|
211
|
+
React.createElement("div", { "data-content-area": true, style: {
|
|
212
|
+
transform: `translateY(${swipeY}px)`,
|
|
213
|
+
}, className: cn(styles.container, {
|
|
171
214
|
[styles.mobile]: !isDesktop,
|
|
172
215
|
}) },
|
|
173
216
|
isDesktop ? React.createElement(Header, null) : React.createElement(HeaderMobile, null),
|
package/modern/Component.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Component.js","sources":["../src/Component.tsx"],"sourcesContent":["import React, { type FC, type MouseEvent, useCallback, useEffect, useState } from 'react';\nimport cn from 'classnames';\nimport type SwiperCore from 'swiper';\n\nimport { BaseModal } from '@alfalab/core-components-base-modal';\nimport { useIsDesktop } from '@alfalab/core-components-mq';\n\nimport { BottomButton } from './components/bottom-button';\nimport { Single } from './components/image-viewer/single';\nimport { Subtitles } from './components/subtitles';\nimport { Header, HeaderMobile, ImageViewer, InfoBar, NavigationBar } from './components';\nimport { SWIPE_THRESHOLD } from './constants';\nimport { GalleryContext } from './context';\nimport { type GalleryImage, type ImageMeta } from './types';\n\nimport styles from './index.module.css';\n\nexport type GalleryProps = {\n /**\n * Управление видимостью\n */\n open: boolean;\n\n /**\n * Массив изображений\n */\n images: GalleryImage[];\n\n /**\n * Зациклить галерею\n * @default true\n */\n loop?: boolean;\n\n /**\n * Индекс открытого изображение\n * @default 0\n */\n initialSlide?: number;\n\n /**\n * Обработчик закрытия\n */\n onClose: () => void;\n\n /**\n * Индекс текущего изображения\n */\n slideIndex?: number;\n\n /**\n * Обработчик изменения текущего изображения\n */\n onSlideIndexChange?: (index: number) => void;\n\n /**\n * Дополнительный класс для попапа\n */\n popupClassName?: string;\n};\n\nconst DEFAULT_FULL_SCREEN = false;\nconst DEFAULT_MUTED_VIDEO = true;\nconst DEFAULT_PLAYING_VIDEO = true;\nconst DEFAULT_HIDE_NAVIGATION = false;\n\nconst Backdrop = () => null;\n\nexport const Gallery: FC<GalleryProps> = ({\n open,\n images,\n slideIndex,\n initialSlide = 0,\n loop = true,\n onClose,\n onSlideIndexChange,\n popupClassName,\n}) => {\n const currentSlideIndexState = useState(initialSlide);\n const uncontrolled = slideIndex === undefined;\n const [currentSlideIndex, setCurrentSlideIndex] = uncontrolled\n ? currentSlideIndexState\n : [slideIndex, onSlideIndexChange];\n\n const [swiper, setSwiper] = useState<SwiperCore>();\n const [imagesMeta, setImagesMeta] = useState<ImageMeta[]>([]);\n const [fullScreen, setFullScreen] = useState<boolean>(DEFAULT_FULL_SCREEN);\n const [mutedVideo, setMutedVideo] = useState<boolean>(DEFAULT_MUTED_VIDEO);\n const [playingVideo, setPlayingVideo] = useState<boolean>(DEFAULT_PLAYING_VIDEO);\n const [hideNavigation, setHideNavigation] = useState<boolean>(DEFAULT_HIDE_NAVIGATION);\n\n const isDesktop = useIsDesktop();\n\n const isCurrentVideo = !!imagesMeta[currentSlideIndex]?.player?.current;\n\n const bottomButton = images[currentSlideIndex]?.bottomButton;\n\n const slideTo = useCallback(\n (index: number) => {\n if (images[index]) {\n setCurrentSlideIndex?.(index);\n\n if (swiper) {\n setPlayingVideo(true);\n swiper.slideTo(index);\n }\n }\n },\n [images, setCurrentSlideIndex, swiper],\n );\n\n const slideNext = useCallback(() => {\n const lastIndex = images.length - 1;\n\n let nextIndex = currentSlideIndex + 1;\n\n if (nextIndex >= images.length) {\n nextIndex = loop ? 0 : lastIndex;\n }\n\n slideTo(nextIndex);\n }, [images.length, loop, currentSlideIndex, slideTo]);\n\n const slidePrev = useCallback(() => {\n const lastIndex = images.length - 1;\n\n let nextIndex = currentSlideIndex - 1;\n\n if (nextIndex < 0) {\n nextIndex = loop ? lastIndex : 0;\n }\n\n slideTo(nextIndex);\n }, [images.length, loop, currentSlideIndex, slideTo]);\n\n const setImageMeta = useCallback((meta: ImageMeta, index: number) => {\n setImagesMeta((prevImagesMeta) => {\n const nextImagesMeta = prevImagesMeta.slice();\n\n nextImagesMeta[index] = meta;\n\n return nextImagesMeta;\n });\n }, []);\n\n const handleBottomButtonClick = useCallback(\n (e: MouseEvent) => {\n e.stopPropagation();\n if (bottomButton?.onClick) {\n bottomButton.onClick(e);\n }\n },\n [bottomButton],\n );\n\n const handleClose = useCallback(() => {\n onClose();\n\n if (uncontrolled) {\n setCurrentSlideIndex?.(initialSlide);\n }\n\n setFullScreen(false);\n }, [initialSlide, onClose, setCurrentSlideIndex, uncontrolled]);\n\n const handleEscapeKeyDown = () => {\n if (fullScreen) {\n setFullScreen(false);\n } else {\n handleClose();\n }\n };\n\n const handleKeyDown = useCallback(\n (event: KeyboardEvent) => {\n if (!open || fullScreen) {\n return;\n }\n\n switch (event.key) {\n case 'ArrowLeft':\n slidePrev();\n break;\n case 'ArrowRight':\n slideNext();\n break;\n }\n },\n [fullScreen, open, slideNext, slidePrev],\n );\n\n const onUnmount = useCallback(() => {\n setPlayingVideo(DEFAULT_PLAYING_VIDEO);\n setMutedVideo(DEFAULT_MUTED_VIDEO);\n }, [setPlayingVideo]);\n\n useEffect(() => {\n if (!uncontrolled && !swiper?.destroyed) {\n swiper?.slideTo(currentSlideIndex);\n }\n }, [uncontrolled, currentSlideIndex, swiper]);\n\n useEffect(() => {\n document.addEventListener('keydown', handleKeyDown);\n\n return () => {\n document.removeEventListener('keydown', handleKeyDown);\n };\n }, [handleKeyDown]);\n\n useEffect(() => {\n let startY: number;\n const abortController = new AbortController();\n const { signal } = abortController;\n\n document.addEventListener(\n 'touchstart',\n (e) => {\n startY = e.touches[0].clientY;\n },\n { signal },\n );\n\n document.addEventListener(\n 'touchmove',\n (e) => {\n const endY = e.changedTouches[0].clientY;\n const deltaY = startY - endY;\n\n // Если свайп вниз, закрываем галерею\n if (deltaY < SWIPE_THRESHOLD) {\n onClose();\n }\n },\n { signal },\n );\n\n return () => {\n abortController.abort();\n };\n }, [onClose]);\n\n const singleSlide = images.length === 1;\n\n const showNavigationBar = !singleSlide && !fullScreen;\n\n // eslint-disable-next-line react/jsx-no-constructed-context-values\n const galleryContext: GalleryContext = {\n view: isDesktop ? 'desktop' : 'mobile',\n singleSlide,\n currentSlideIndex,\n images,\n imagesMeta,\n fullScreen,\n initialSlide: uncontrolled ? initialSlide : currentSlideIndex,\n setFullScreen,\n playingVideo,\n setPlayingVideo,\n mutedVideo,\n setMutedVideo,\n hideNavigation,\n setHideNavigation,\n setImageMeta,\n slideNext,\n slidePrev,\n slideTo,\n getSwiper: () => swiper,\n setSwiper,\n onClose: handleClose,\n setCurrentSlideIndex,\n getCurrentImage: () => images[currentSlideIndex],\n getCurrentImageMeta: () => imagesMeta[currentSlideIndex],\n };\n\n return (\n <GalleryContext.Provider value={galleryContext}>\n <BaseModal\n open={open}\n className={cn(styles.modal, popupClassName)}\n onEscapeKeyDown={handleEscapeKeyDown}\n Backdrop={Backdrop}\n onUnmount={onUnmount}\n >\n <div\n className={cn(styles.container, {\n [styles.mobile]: !isDesktop,\n })}\n >\n {isDesktop ? <Header /> : <HeaderMobile />}\n {images.length === 1 ? <Single /> : <ImageViewer />}\n <nav\n className={cn({\n [styles.navigationVideo]: isCurrentVideo && !isDesktop,\n [styles.hide]: showNavigationBar && hideNavigation && !isDesktop,\n [styles.hideInfo]: !showNavigationBar && hideNavigation && !isDesktop,\n })}\n >\n {!isDesktop && <Subtitles />}\n {isCurrentVideo && !isDesktop && bottomButton && (\n <BottomButton\n bottomButton={bottomButton}\n onClick={handleBottomButtonClick}\n className={styles.bottomButton}\n />\n )}\n\n {showNavigationBar && <NavigationBar />}\n {!isDesktop && <InfoBar />}\n </nav>\n </div>\n </BaseModal>\n </GalleryContext.Provider>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AA6DA,MAAM,mBAAmB,GAAG,KAAK;AACjC,MAAM,mBAAmB,GAAG,IAAI;AAChC,MAAM,qBAAqB,G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AC,MAAM,CAAC,eAAe,GAAG,cAAc,IAAI,CAAC,SAAS;wBACtD,CAAC,MAAM,CAAC,IAAI,GAAG,iBAAiB,IAAI,cAAc,IAAI,CAAC,SAAS;wBAChE,CAAC,MAAM,CAAC,QAAQ,GAAG,CAAC,iBAAiB,IAAI,cAAc,IAAI,CAAC,SAAS;qBACxE,CAAC,EAAA;AAED,oBAAA,CAAC,SAAS,IAAI,KAAC,CAAA,aAAA,CAAA,SAAS,EAAG,IAAA,CAAA;oBAC3B,cAAc,IAAI,CAAC,SAAS,IAAI,YAAY,KACzC,KAAA,CAAA,aAAA,CAAC,YAAY,EAAA,EACT,YAAY,EAAE,YAAY,EAC1B,OAAO,EAAE,uBAAuB,EAChC,SAAS,EAAE,MAAM,CAAC,YAAY,EAAA,CAChC,CACL;oBAEA,iBAAiB,IAAI,KAAC,CAAA,aAAA,CAAA,aAAa,EAAG,IAAA,CAAA;oBACtC,CAAC,SAAS,IAAI,KAAA,CAAA,aAAA,CAAC,OAAO,EAAA,IAAA,CAAG,CACxB,CACJ,CACE,CACU;AAElC;;;;"}
|
|
1
|
+
{"version":3,"file":"Component.js","sources":["../src/Component.tsx"],"sourcesContent":["import React, { type FC, type MouseEvent, useCallback, useEffect, useState } from 'react';\nimport cn from 'classnames';\nimport type SwiperCore from 'swiper';\n\nimport { BaseModal } from '@alfalab/core-components-base-modal';\nimport { useIsDesktop } from '@alfalab/core-components-mq';\n\nimport { BottomButton } from './components/bottom-button';\nimport { Single } from './components/image-viewer/single';\nimport { Subtitles } from './components/subtitles';\nimport { Header, HeaderMobile, ImageViewer, InfoBar, NavigationBar } from './components';\nimport { SWIPE_THRESHOLD } from './constants';\nimport { GalleryContext } from './context';\nimport { type GalleryImage, type ImageMeta } from './types';\n\nimport styles from './index.module.css';\n\nexport type GalleryProps = {\n /**\n * Управление видимостью\n */\n open: boolean;\n\n /**\n * Массив изображений\n */\n images: GalleryImage[];\n\n /**\n * Зациклить галерею\n * @default true\n */\n loop?: boolean;\n\n /**\n * Индекс открытого изображение\n * @default 0\n */\n initialSlide?: number;\n\n /**\n * Обработчик закрытия\n */\n onClose: () => void;\n\n /**\n * Индекс текущего изображения\n */\n slideIndex?: number;\n\n /**\n * Обработчик изменения текущего изображения\n */\n onSlideIndexChange?: (index: number) => void;\n\n /**\n * Дополнительный класс для попапа\n */\n popupClassName?: string;\n};\n\nconst DEFAULT_FULL_SCREEN = false;\nconst DEFAULT_MUTED_VIDEO = true;\nconst DEFAULT_PLAYING_VIDEO = true;\nconst DEFAULT_HIDE_NAVIGATION = false;\n\nconst Backdrop = () => null;\n\nexport const Gallery: FC<GalleryProps> = ({\n open,\n images,\n slideIndex,\n initialSlide = 0,\n loop = true,\n onClose,\n onSlideIndexChange,\n popupClassName,\n}) => {\n const currentSlideIndexState = useState(initialSlide);\n const uncontrolled = slideIndex === undefined;\n const [currentSlideIndex, setCurrentSlideIndex] = uncontrolled\n ? currentSlideIndexState\n : [slideIndex, onSlideIndexChange];\n\n const [swiper, setSwiper] = useState<SwiperCore>();\n const [imagesMeta, setImagesMeta] = useState<ImageMeta[]>([]);\n const [fullScreen, setFullScreen] = useState<boolean>(DEFAULT_FULL_SCREEN);\n const [mutedVideo, setMutedVideo] = useState<boolean>(DEFAULT_MUTED_VIDEO);\n const [playingVideo, setPlayingVideo] = useState<boolean>(DEFAULT_PLAYING_VIDEO);\n const [hideNavigation, setHideNavigation] = useState<boolean>(DEFAULT_HIDE_NAVIGATION);\n const [swipeY, setSwipeY] = useState<number>(0);\n\n const isDesktop = useIsDesktop();\n\n const isCurrentVideo = !!imagesMeta[currentSlideIndex]?.player?.current;\n\n const bottomButton = images[currentSlideIndex]?.bottomButton;\n\n const slideTo = useCallback(\n (index: number) => {\n if (images[index]) {\n setCurrentSlideIndex?.(index);\n\n if (swiper) {\n setPlayingVideo(true);\n swiper.slideTo(index);\n }\n }\n },\n [images, setCurrentSlideIndex, swiper],\n );\n\n const slideNext = useCallback(() => {\n const lastIndex = images.length - 1;\n\n let nextIndex = currentSlideIndex + 1;\n\n if (nextIndex >= images.length) {\n nextIndex = loop ? 0 : lastIndex;\n }\n\n slideTo(nextIndex);\n }, [images.length, loop, currentSlideIndex, slideTo]);\n\n const slidePrev = useCallback(() => {\n const lastIndex = images.length - 1;\n\n let nextIndex = currentSlideIndex - 1;\n\n if (nextIndex < 0) {\n nextIndex = loop ? lastIndex : 0;\n }\n\n slideTo(nextIndex);\n }, [images.length, loop, currentSlideIndex, slideTo]);\n\n const setImageMeta = useCallback((meta: ImageMeta, index: number) => {\n setImagesMeta((prevImagesMeta) => {\n const nextImagesMeta = prevImagesMeta.slice();\n\n nextImagesMeta[index] = meta;\n\n return nextImagesMeta;\n });\n }, []);\n\n const handleBottomButtonClick = useCallback(\n (e: MouseEvent) => {\n e.stopPropagation();\n if (bottomButton?.onClick) {\n bottomButton.onClick(e);\n }\n },\n [bottomButton],\n );\n\n const handleClose = useCallback(() => {\n onClose();\n\n if (uncontrolled) {\n setCurrentSlideIndex?.(initialSlide);\n }\n\n setFullScreen(false);\n }, [initialSlide, onClose, setCurrentSlideIndex, uncontrolled]);\n\n const handleEscapeKeyDown = () => {\n if (fullScreen) {\n setFullScreen(false);\n } else {\n handleClose();\n }\n };\n\n const handleKeyDown = useCallback(\n (event: KeyboardEvent) => {\n if (!open || fullScreen) {\n return;\n }\n\n switch (event.key) {\n case 'ArrowLeft':\n slidePrev();\n break;\n case 'ArrowRight':\n slideNext();\n break;\n }\n },\n [fullScreen, open, slideNext, slidePrev],\n );\n\n const onUnmount = useCallback(() => {\n setPlayingVideo(DEFAULT_PLAYING_VIDEO);\n setMutedVideo(DEFAULT_MUTED_VIDEO);\n }, [setPlayingVideo]);\n\n useEffect(() => {\n if (!uncontrolled && !swiper?.destroyed) {\n swiper?.slideTo(currentSlideIndex);\n }\n }, [uncontrolled, currentSlideIndex, swiper]);\n\n useEffect(() => {\n if (!open) {\n setSwipeY(0);\n }\n }, [open]);\n\n useEffect(() => {\n document.addEventListener('keydown', handleKeyDown);\n\n return () => {\n document.removeEventListener('keydown', handleKeyDown);\n };\n }, [handleKeyDown]);\n\n useEffect(() => {\n if (!open) {\n return undefined;\n }\n\n let startX = 0;\n let startY = 0;\n let lockedDirection: 'horizontal' | 'vertical' | null = null;\n const directionLockThreshold = 10;\n\n const abortController = new AbortController();\n const { signal } = abortController;\n\n document.addEventListener(\n 'touchstart',\n (e) => {\n startX = e.touches[0].clientX;\n startY = e.touches[0].clientY;\n lockedDirection = null;\n },\n { signal },\n );\n\n document.addEventListener(\n 'touchmove',\n (e) => {\n const currentX = e.touches[0].clientX;\n const currentY = e.touches[0].clientY;\n const deltaX = currentX - startX;\n const deltaY = currentY - startY;\n\n if (!lockedDirection) {\n const absX = Math.abs(deltaX);\n const absY = Math.abs(deltaY);\n\n if (absX > absY && absX > directionLockThreshold) {\n lockedDirection = 'horizontal';\n } else if (absY > absX && absY > directionLockThreshold) {\n lockedDirection = 'vertical';\n } else {\n return;\n }\n }\n\n if (lockedDirection === 'horizontal') {\n return;\n }\n\n if (deltaY <= 0) {\n setSwipeY(0);\n\n return;\n }\n\n setSwipeY(deltaY);\n\n if (deltaY > SWIPE_THRESHOLD) {\n setSwipeY(0);\n onClose();\n }\n },\n { signal },\n );\n\n document.addEventListener(\n 'touchend',\n () => {\n lockedDirection = null;\n setSwipeY(0);\n },\n { signal },\n );\n\n return () => {\n abortController.abort();\n };\n }, [onClose, open]);\n\n const singleSlide = images.length === 1;\n\n const showNavigationBar = !singleSlide && !fullScreen;\n\n // eslint-disable-next-line react/jsx-no-constructed-context-values\n const galleryContext: GalleryContext = {\n view: isDesktop ? 'desktop' : 'mobile',\n singleSlide,\n currentSlideIndex,\n images,\n imagesMeta,\n fullScreen,\n initialSlide: uncontrolled ? initialSlide : currentSlideIndex,\n setFullScreen,\n playingVideo,\n setPlayingVideo,\n mutedVideo,\n setMutedVideo,\n hideNavigation,\n setHideNavigation,\n setImageMeta,\n slideNext,\n slidePrev,\n slideTo,\n getSwiper: () => swiper,\n setSwiper,\n onClose: handleClose,\n setCurrentSlideIndex,\n getCurrentImage: () => images[currentSlideIndex],\n getCurrentImageMeta: () => imagesMeta[currentSlideIndex],\n };\n\n return (\n <GalleryContext.Provider value={galleryContext}>\n <BaseModal\n open={open}\n className={cn(styles.modal, popupClassName)}\n onEscapeKeyDown={handleEscapeKeyDown}\n Backdrop={Backdrop}\n onUnmount={onUnmount}\n >\n <div\n data-content-area={true}\n style={{\n transform: `translateY(${swipeY}px)`,\n }}\n className={cn(styles.container, {\n [styles.mobile]: !isDesktop,\n })}\n >\n {isDesktop ? <Header /> : <HeaderMobile />}\n {images.length === 1 ? <Single /> : <ImageViewer />}\n <nav\n className={cn({\n [styles.navigationVideo]: isCurrentVideo && !isDesktop,\n [styles.hide]: showNavigationBar && hideNavigation && !isDesktop,\n [styles.hideInfo]: !showNavigationBar && hideNavigation && !isDesktop,\n })}\n >\n {!isDesktop && <Subtitles />}\n {isCurrentVideo && !isDesktop && bottomButton && (\n <BottomButton\n bottomButton={bottomButton}\n onClick={handleBottomButtonClick}\n className={styles.bottomButton}\n />\n )}\n\n {showNavigationBar && <NavigationBar />}\n {!isDesktop && <InfoBar />}\n </nav>\n </div>\n </BaseModal>\n </GalleryContext.Provider>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AA6DA,MAAM,mBAAmB,GAAG,KAAK;AACjC,MAAM,mBAAmB,GAAG,IAAI;AAChC,MAAM,qBAAqB,GAAG,IAAI;AAClC,MAAM,uBAAuB,GAAG,KAAK;AAErC,MAAM,QAAQ,GAAG,MAAM,IAAI;AAEd,MAAA,OAAO,GAAqB,CAAC,EACtC,IAAI,EACJ,MAAM,EACN,UAAU,EACV,YAAY,GAAG,CAAC,EAChB,IAAI,GAAG,IAAI,EACX,OAAO,EACP,kBAAkB,EAClB,cAAc,GACjB,KAAI;AACD,IAAA,MAAM,sBAAsB,GAAG,QAAQ,CAAC,YAAY,CAAC;AACrD,IAAA,MAAM,YAAY,GAAG,UAAU,K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iBAAiB,IAAI,cAAc,IAAI,CAAC,SAAS;qBACxE,CAAC,EAAA;AAED,oBAAA,CAAC,SAAS,IAAI,KAAC,CAAA,aAAA,CAAA,SAAS,EAAG,IAAA,CAAA;oBAC3B,cAAc,IAAI,CAAC,SAAS,IAAI,YAAY,KACzC,KAAA,CAAA,aAAA,CAAC,YAAY,EAAA,EACT,YAAY,EAAE,YAAY,EAC1B,OAAO,EAAE,uBAAuB,EAChC,SAAS,EAAE,MAAM,CAAC,YAAY,EAAA,CAChC,CACL;oBAEA,iBAAiB,IAAI,KAAC,CAAA,aAAA,CAAA,aAAa,EAAG,IAAA,CAAA;oBACtC,CAAC,SAAS,IAAI,KAAA,CAAA,aAAA,CAAC,OAAO,EAAA,IAAA,CAAG,CACxB,CACJ,CACE,CACU;AAElC;;;;"}
|
|
@@ -3,20 +3,20 @@
|
|
|
3
3
|
--color-static-neutral-translucent-500-inverted-hover: rgba(233, 233, 250, 0.37);
|
|
4
4
|
--color-static-neutral-translucent-500-inverted-press: rgba(238, 238, 254, 0.46);
|
|
5
5
|
}
|
|
6
|
-
.
|
|
6
|
+
.gallery__component_pbhbi {
|
|
7
7
|
background-color: var(--color-static-neutral-translucent-500-inverted);
|
|
8
8
|
}
|
|
9
|
-
.
|
|
9
|
+
.gallery__component_pbhbi:hover {
|
|
10
10
|
background-color: var(--color-static-neutral-translucent-500-inverted-hover);
|
|
11
11
|
}
|
|
12
|
-
.
|
|
12
|
+
.gallery__component_pbhbi:active {
|
|
13
13
|
background-color: var(--color-static-neutral-translucent-500-inverted-press);
|
|
14
14
|
}
|
|
15
|
-
.
|
|
15
|
+
.gallery__component_pbhbi {
|
|
16
16
|
|
|
17
17
|
transition: transform 1s ease-in-out;
|
|
18
18
|
will-change: transform;
|
|
19
19
|
}
|
|
20
|
-
.
|
|
20
|
+
.gallery__notVisible_pbhbi {
|
|
21
21
|
transform: translateY(250%);
|
|
22
22
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import './index.css';
|
|
2
2
|
|
|
3
|
-
const styles = {"component":"
|
|
3
|
+
const styles = {"component":"gallery__component_pbhbi","notVisible":"gallery__notVisible_pbhbi"};
|
|
4
4
|
|
|
5
5
|
export { styles as default };
|
|
6
6
|
//# sourceMappingURL=index.module.css.js.map
|
|
@@ -7,19 +7,19 @@
|
|
|
7
7
|
:root {
|
|
8
8
|
--gap-32: 32px;
|
|
9
9
|
}
|
|
10
|
-
.
|
|
10
|
+
.gallery__buttons_cha95 {
|
|
11
11
|
display: flex;
|
|
12
12
|
padding-left: var(--gap-32);
|
|
13
13
|
}
|
|
14
|
-
.
|
|
14
|
+
.gallery__buttons_cha95 path {
|
|
15
15
|
color: var(--color-static-neutral-translucent-1300-inverted);
|
|
16
16
|
}
|
|
17
|
-
.
|
|
17
|
+
.gallery__iconButton_cha95 path {
|
|
18
18
|
color: var(--color-static-neutral-100);
|
|
19
19
|
}
|
|
20
|
-
.
|
|
20
|
+
.gallery__iconButton_cha95:hover path {
|
|
21
21
|
color: var(--color-static-neutral-100-hover);
|
|
22
22
|
}
|
|
23
|
-
.
|
|
23
|
+
.gallery__iconButton_cha95:active path {
|
|
24
24
|
color: var(--color-static-neutral-100-press);
|
|
25
25
|
}
|
|
@@ -11,7 +11,9 @@ export declare const Pause: FC<Props>;
|
|
|
11
11
|
export declare const ExitFullscreen: FC<Props>;
|
|
12
12
|
export declare const MuteVideo: FC<Props>;
|
|
13
13
|
export declare const UnmuteVideo: FC<Props>;
|
|
14
|
-
export declare const Download: FC<Props
|
|
14
|
+
export declare const Download: FC<Props & {
|
|
15
|
+
href?: string;
|
|
16
|
+
}>;
|
|
15
17
|
export declare const Share: FC<Props>;
|
|
16
18
|
export declare const Exit: FC<Props>;
|
|
17
19
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import cn from 'classnames';
|
|
3
3
|
import { IconButton } from '@alfalab/core-components-icon-button/modern';
|
|
4
|
+
import { useIsDesktop } from '@alfalab/core-components-mq/modern';
|
|
4
5
|
import { TooltipDesktop } from '@alfalab/core-components-tooltip/modern/desktop';
|
|
5
6
|
import { ArrowLeftMIcon } from '@alfalab/icons-glyph/ArrowLeftMIcon';
|
|
6
7
|
import { ArrowsInwardMIcon } from '@alfalab/icons-glyph/ArrowsInwardMIcon';
|
|
@@ -12,23 +13,61 @@ import { PointerDownMIcon } from '@alfalab/icons-glyph/PointerDownMIcon';
|
|
|
12
13
|
import { ShareMIcon } from '@alfalab/icons-glyph/ShareMIcon';
|
|
13
14
|
import { SoundCrossMIcon } from '@alfalab/icons-glyph/SoundCrossMIcon';
|
|
14
15
|
import { SoundMIcon } from '@alfalab/icons-glyph/SoundMIcon';
|
|
16
|
+
import { isVideo } from '../../utils/utils.js';
|
|
17
|
+
import { downloadFile } from '../../utils/modern-download.js';
|
|
15
18
|
import styles from './index.module.css.js';
|
|
16
19
|
|
|
17
|
-
const Fullscreen = ({ buttonRef, ...restProps }) =>
|
|
18
|
-
|
|
20
|
+
const Fullscreen = ({ buttonRef, ...restProps }) => {
|
|
21
|
+
const isDesktop = useIsDesktop();
|
|
22
|
+
const iconButton = (React.createElement(IconButton, { ...restProps, ref: buttonRef, icon: ArrowsOutwardMIcon, "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', className: styles.iconButton }));
|
|
23
|
+
return isDesktop ? (React.createElement(TooltipDesktop, { view: 'hint', colors: 'inverted', 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'] }, iconButton)) : (iconButton);
|
|
24
|
+
};
|
|
19
25
|
const BackArrow = ({ buttonRef, ...restProps }) => (React.createElement(IconButton, { ...restProps, ref: buttonRef, icon: ArrowLeftMIcon, "aria-label": '\u0412\u0435\u0440\u043D\u0443\u0442\u044C\u0441\u044F \u043D\u0430\u0437\u0430\u0434', className: styles.iconButton }));
|
|
20
26
|
const Play = ({ buttonRef, className, ...restProps }) => (React.createElement(IconButton, { ...restProps, ref: buttonRef, icon: PlayCompactMIcon, "aria-label": '\u041F\u0440\u043E\u0438\u0433\u0440\u0430\u0442\u044C \u0432\u0438\u0434\u0435\u043E', className: cn(styles.iconButton, className) }));
|
|
21
27
|
const Pause = ({ buttonRef, className, ...restProps }) => (React.createElement(IconButton, { ...restProps, ref: buttonRef, icon: PauseCompactMIcon, "aria-label": '\u041F\u043E\u0441\u0442\u0430\u0432\u0438\u0442\u044C \u043F\u0430\u0443\u0437\u0443 \u043D\u0430 \u0432\u0438\u0434\u0435\u043E', className: cn(styles.iconButton, className) }));
|
|
22
|
-
const ExitFullscreen = ({ buttonRef, ...restProps }) =>
|
|
23
|
-
|
|
24
|
-
const
|
|
25
|
-
React.createElement(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const
|
|
29
|
-
React.createElement(IconButton, { ...
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
const ExitFullscreen = ({ buttonRef, ...restProps }) => {
|
|
29
|
+
const isDesktop = useIsDesktop();
|
|
30
|
+
const iconButton = (React.createElement(IconButton, { ...restProps, ref: buttonRef, icon: ArrowsInwardMIcon, "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', className: styles.iconButton }));
|
|
31
|
+
return isDesktop ? (React.createElement(TooltipDesktop, { view: 'hint', colors: 'inverted', 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'] }, iconButton)) : (iconButton);
|
|
32
|
+
};
|
|
33
|
+
const MuteVideo = ({ buttonRef, className, ...restProps }) => {
|
|
34
|
+
const isDesktop = useIsDesktop();
|
|
35
|
+
const iconButton = (React.createElement(IconButton, { ...restProps, ref: buttonRef, icon: SoundMIcon, "aria-label": '\u0412\u044B\u043A\u043B\u044E\u0447\u0438\u0442\u044C \u0437\u0432\u0443\u043A', className: styles.iconButton }));
|
|
36
|
+
return isDesktop ? (React.createElement(TooltipDesktop, { view: 'hint', colors: 'inverted', trigger: 'hover', position: 'bottom', content: '\u0412\u044B\u043A\u043B\u044E\u0447\u0438\u0442\u044C \u0437\u0432\u0443\u043A', fallbackPlacements: ['bottom-end'], targetClassName: className }, iconButton)) : (iconButton);
|
|
37
|
+
};
|
|
38
|
+
const UnmuteVideo = ({ buttonRef, className, ...restProps }) => {
|
|
39
|
+
const isDesktop = useIsDesktop();
|
|
40
|
+
const iconButton = (React.createElement(IconButton, { ...restProps, ref: buttonRef, icon: SoundCrossMIcon, "aria-label": '\u0412\u043A\u043B\u044E\u0447\u0438\u0442\u044C \u0437\u0432\u0443\u043A', className: styles.iconButton }));
|
|
41
|
+
return isDesktop ? (React.createElement(TooltipDesktop, { view: 'hint', colors: 'inverted', trigger: 'hover', position: 'bottom', content: '\u0412\u043A\u043B\u044E\u0447\u0438\u0442\u044C \u0437\u0432\u0443\u043A', fallbackPlacements: ['bottom-end'], targetClassName: className }, iconButton)) : (iconButton);
|
|
42
|
+
};
|
|
43
|
+
const Download = ({ href, ...props }) => {
|
|
44
|
+
const isDesktop = useIsDesktop();
|
|
45
|
+
const handleMobileVideoDownload = async (e) => {
|
|
46
|
+
e.preventDefault();
|
|
47
|
+
if (!href)
|
|
48
|
+
return;
|
|
49
|
+
const fileName = props.download?.toString() || 'video';
|
|
50
|
+
const fileType = isVideo(href) ? 'video/*' : undefined;
|
|
51
|
+
await downloadFile({
|
|
52
|
+
url: href,
|
|
53
|
+
fileName,
|
|
54
|
+
fileType,
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
const iconButtonProps = {
|
|
58
|
+
...props,
|
|
59
|
+
icon: PointerDownMIcon,
|
|
60
|
+
'aria-label': 'Скачать',
|
|
61
|
+
className: styles.iconButton,
|
|
62
|
+
};
|
|
63
|
+
const iconButton = !isDesktop && isVideo(href) ? (React.createElement(IconButton, { ...iconButtonProps, onClick: handleMobileVideoDownload })) : (React.createElement(IconButton, { ...iconButtonProps, href: href }));
|
|
64
|
+
return isDesktop ? (React.createElement(TooltipDesktop, { view: 'hint', colors: 'inverted', trigger: 'hover', position: 'bottom', content: '\u0421\u043A\u0430\u0447\u0430\u0442\u044C', fallbackPlacements: ['bottom-end'] }, iconButton)) : (iconButton);
|
|
65
|
+
};
|
|
66
|
+
const Share = (props) => {
|
|
67
|
+
const isDesktop = useIsDesktop();
|
|
68
|
+
const iconButton = (React.createElement(IconButton, { ...props, icon: ShareMIcon, "aria-label": '\u041F\u043E\u0434\u0435\u043B\u0438\u0442\u044C\u0441\u044F', className: styles.iconButton }));
|
|
69
|
+
return isDesktop ? (React.createElement(TooltipDesktop, { view: 'hint', colors: 'inverted', trigger: 'hover', position: 'bottom', content: '\u041F\u043E\u0434\u0435\u043B\u0438\u0442\u044C\u0441\u044F', fallbackPlacements: ['bottom-end'] }, iconButton)) : (iconButton);
|
|
70
|
+
};
|
|
32
71
|
const Exit = (props) => (React.createElement(IconButton, { ...props, icon: CrossMIcon, "aria-label": '\u0417\u0430\u043A\u0440\u044B\u0442\u044C', className: styles.iconButton }));
|
|
33
72
|
|
|
34
73
|
export { BackArrow, Download, Exit, ExitFullscreen, Fullscreen, MuteVideo, Pause, Play, Share, UnmuteVideo };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/buttons/index.tsx"],"sourcesContent":["import React, { type FC, type MutableRefObject } from 'react';\nimport cn from 'classnames';\n\nimport { IconButton, type IconButtonProps } from '@alfalab/core-components-icon-button';\nimport { TooltipDesktop } from '@alfalab/core-components-tooltip/desktop';\nimport { ArrowLeftMIcon } from '@alfalab/icons-glyph/ArrowLeftMIcon';\nimport { ArrowsInwardMIcon } from '@alfalab/icons-glyph/ArrowsInwardMIcon';\nimport { ArrowsOutwardMIcon } from '@alfalab/icons-glyph/ArrowsOutwardMIcon';\nimport { CrossMIcon } from '@alfalab/icons-glyph/CrossMIcon';\nimport { PauseCompactMIcon } from '@alfalab/icons-glyph/PauseCompactMIcon';\nimport { PlayCompactMIcon } from '@alfalab/icons-glyph/PlayCompactMIcon';\nimport { PointerDownMIcon } from '@alfalab/icons-glyph/PointerDownMIcon';\nimport { ShareMIcon } from '@alfalab/icons-glyph/ShareMIcon';\nimport { SoundCrossMIcon } from '@alfalab/icons-glyph/SoundCrossMIcon';\nimport { SoundMIcon } from '@alfalab/icons-glyph/SoundMIcon';\n\nimport styles from './index.module.css';\n\ntype Props = Omit<IconButtonProps, 'icon' | 'colors'> & {\n buttonRef?: MutableRefObject<HTMLButtonElement | null>;\n download?: string | boolean;\n};\n\nexport const Fullscreen: FC<Props> = ({ buttonRef, ...restProps }) => (\n <TooltipDesktop\n trigger='hover'\n position='bottom'\n content='Открыть в полноэкранном режиме'\n fallbackPlacements={['bottom-end']}\n >\n <IconButton\n {...restProps}\n ref={buttonRef}\n icon={ArrowsOutwardMIcon}\n aria-label='Открыть в полноэкранном режиме'\n className={styles.iconButton}\n />\n </TooltipDesktop>\n);\n\nexport const BackArrow: FC<Props> = ({ buttonRef, ...restProps }) => (\n <IconButton\n {...restProps}\n ref={buttonRef}\n icon={ArrowLeftMIcon}\n aria-label='Вернуться назад'\n className={styles.iconButton}\n />\n);\n\nexport const Play: FC<Props> = ({ buttonRef, className, ...restProps }) => (\n <IconButton\n {...restProps}\n ref={buttonRef}\n icon={PlayCompactMIcon}\n aria-label='Проиграть видео'\n className={cn(styles.iconButton, className)}\n />\n);\n\nexport const Pause: FC<Props> = ({ buttonRef, className, ...restProps }) => (\n <IconButton\n {...restProps}\n ref={buttonRef}\n icon={PauseCompactMIcon}\n aria-label='Поставить паузу на видео'\n className={cn(styles.iconButton, className)}\n />\n);\n\nexport const ExitFullscreen: FC<Props> = ({ buttonRef, ...restProps }) => (\n <TooltipDesktop\n trigger='hover'\n position='bottom'\n content='Выйти из полноэкранного режима'\n fallbackPlacements={['bottom-end']}\n >\n <IconButton\n {...restProps}\n ref={buttonRef}\n icon={ArrowsInwardMIcon}\n aria-label='Выйти из полноэкранного режима'\n className={styles.iconButton}\n />\n </TooltipDesktop>\n);\n\nexport const MuteVideo: FC<Props> = ({ buttonRef, className, ...restProps }) => (\n <TooltipDesktop\n trigger='hover'\n position='bottom'\n content='Выключить звук'\n fallbackPlacements={['bottom-end']}\n targetClassName={className}\n >\n <IconButton\n {...restProps}\n ref={buttonRef}\n icon={SoundMIcon}\n aria-label='Выключить звук'\n className={styles.iconButton}\n />\n </TooltipDesktop>\n);\n\nexport const UnmuteVideo: FC<Props> = ({ buttonRef, className, ...restProps }) => (\n <TooltipDesktop\n trigger='hover'\n position='bottom'\n content='Включить звук'\n fallbackPlacements={['bottom-end']}\n targetClassName={className}\n >\n <IconButton\n {...restProps}\n ref={buttonRef}\n icon={SoundCrossMIcon}\n aria-label='Включить звук'\n className={styles.iconButton}\n />\n </TooltipDesktop>\n);\n\nexport const Download: FC<Props> = (props) => (\n <TooltipDesktop\n trigger='hover'\n position='bottom'\n content='Скачать'\n fallbackPlacements={['bottom-end']}\n >\n <IconButton\n {...props}\n icon={PointerDownMIcon}\n aria-label='Скачать'\n className={styles.iconButton}\n />\n </TooltipDesktop>\n);\n\nexport const Share: FC<Props> = (props) => (\n <TooltipDesktop\n trigger='hover'\n position='bottom'\n content='Поделиться'\n fallbackPlacements={['bottom-end']}\n >\n <IconButton\n {...props}\n icon={ShareMIcon}\n aria-label='Поделиться'\n className={styles.iconButton}\n />\n </TooltipDesktop>\n);\n\nexport const Exit: FC<Props> = (props) => (\n <IconButton {...props} icon={CrossMIcon} aria-label='Закрыть' className={styles.iconButton} />\n);\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAuBO,MAAM,UAAU,GAAc,CAAC,EAAE,SAAS,EAAE,GAAG,SAAS,EAAE,MAC7D,KAAC,CAAA,aAAA,CAAA,cAAc,EACX,EAAA,OAAO,EAAC,OAAO,EACf,QAAQ,EAAC,QAAQ,EACjB,OAAO,EAAC,uKAAgC,EACxC,kBAAkB,EAAE,CAAC,YAAY,CAAC,EAAA;IAElC,KAAC,CAAA,aAAA,CAAA,UAAU,OACH,SAAS,EACb,GAAG,EAAE,SAAS,EACd,IAAI,EAAE,kBAAkB,gBACb,uKAAgC,EAC3C,SAAS,EAAE,MAAM,CAAC,UAAU,EAAA,CAC9B,CACW;AAGR,MAAA,SAAS,GAAc,CAAC,EAAE,SAAS,EAAE,GAAG,SAAS,EAAE,MAC5D,oBAAC,UAAU,EAAA,EAAA,GACH,SAAS,EACb,GAAG,EAAE,SAAS,EACd,IAAI,EAAE,cAAc,EAAA,YAAA,EACT,uFAAiB,EAC5B,SAAS,EAAE,MAAM,CAAC,UAAU,EAAA,CAC9B;MAGO,IAAI,GAAc,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,SAAS,EAAE,MAClE,KAAC,CAAA,aAAA,CAAA,UAAU,OACH,SAAS,EACb,GAAG,EAAE,SAAS,EACd,IAAI,EAAE,gBAAgB,EACX,YAAA,EAAA,uFAAiB,EAC5B,SAAS,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU,EAAE,SAAS,CAAC,EAAA,CAC7C;MAGO,KAAK,GAAc,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,SAAS,EAAE,MACnE,KAAC,CAAA,aAAA,CAAA,UAAU,OACH,SAAS,EACb,GAAG,EAAE,SAAS,EACd,IAAI,EAAE,iBAAiB,EACZ,YAAA,EAAA,mIAA0B,EACrC,SAAS,EAAE,EAAE,CAAC,MA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C,UAAU,EAAA,CAC9B,CACW;AAGd,MAAM,QAAQ,GAAc,CAAC,KAAK,MACrC,KAAC,CAAA,aAAA,CAAA,cAAc,EACX,EAAA,OAAO,EAAC,OAAO,EACf,QAAQ,EAAC,QAAQ,EACjB,OAAO,EAAC,4CAAS,EACjB,kBAAkB,EAAE,CAAC,YAAY,CAAC,EAAA;AAElC,IAAA,KAAA,CAAA,aAAA,CAAC,UAAU,EACH,EAAA,GAAA,KAAK,EACT,IAAI,EAAE,gBAAgB,EACX,YAAA,EAAA,4CAAS,EACpB,SAAS,EAAE,MAAM,CAAC,UAAU,EAC9B,CAAA,CACW;AAGd,MAAM,KAAK,GAAc,CAAC,KAAK,MAClC,KAAC,CAAA,aAAA,CAAA,cAAc,EACX,EAAA,OAAO,EAAC,OAAO,EACf,QAAQ,EAAC,QAAQ,EACjB,OAAO,EAAC,8DAAY,EACpB,kBAAkB,EAAE,CAAC,YAAY,CAAC,EAAA;AAElC,IAAA,KAAA,CAAA,aAAA,CAAC,UAAU,EACH,EAAA,GAAA,KAAK,EACT,IAAI,EAAE,UAAU,EACL,YAAA,EAAA,8DAAY,EACvB,SAAS,EAAE,MAAM,CAAC,UAAU,EAC9B,CAAA,CACW;AAGd,MAAM,IAAI,GAAc,CAAC,KAAK,MACjC,KAAC,CAAA,aAAA,CAAA,UAAU,EAAK,EAAA,GAAA,KAAK,EAAE,IAAI,EAAE,UAAU,EAAa,YAAA,EAAA,4CAAS,EAAC,SAAS,EAAE,MAAM,CAAC,UAAU,EAAI,CAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/buttons/index.tsx"],"sourcesContent":["import React, { type FC, type MutableRefObject } from 'react';\nimport cn from 'classnames';\n\nimport { IconButton, type IconButtonProps } from '@alfalab/core-components-icon-button';\nimport { useIsDesktop } from '@alfalab/core-components-mq';\nimport { TooltipDesktop } from '@alfalab/core-components-tooltip/desktop';\nimport { ArrowLeftMIcon } from '@alfalab/icons-glyph/ArrowLeftMIcon';\nimport { ArrowsInwardMIcon } from '@alfalab/icons-glyph/ArrowsInwardMIcon';\nimport { ArrowsOutwardMIcon } from '@alfalab/icons-glyph/ArrowsOutwardMIcon';\nimport { CrossMIcon } from '@alfalab/icons-glyph/CrossMIcon';\nimport { PauseCompactMIcon } from '@alfalab/icons-glyph/PauseCompactMIcon';\nimport { PlayCompactMIcon } from '@alfalab/icons-glyph/PlayCompactMIcon';\nimport { PointerDownMIcon } from '@alfalab/icons-glyph/PointerDownMIcon';\nimport { ShareMIcon } from '@alfalab/icons-glyph/ShareMIcon';\nimport { SoundCrossMIcon } from '@alfalab/icons-glyph/SoundCrossMIcon';\nimport { SoundMIcon } from '@alfalab/icons-glyph/SoundMIcon';\n\nimport { downloadFile, isVideo } from '../../utils';\n\nimport styles from './index.module.css';\n\ntype Props = Omit<IconButtonProps, 'icon' | 'colors'> & {\n buttonRef?: MutableRefObject<HTMLButtonElement | null>;\n download?: string | boolean;\n};\n\nexport const Fullscreen: FC<Props> = ({ buttonRef, ...restProps }) => {\n const isDesktop = useIsDesktop();\n\n const iconButton = (\n <IconButton\n {...restProps}\n ref={buttonRef}\n icon={ArrowsOutwardMIcon}\n aria-label='Открыть в полноэкранном режиме'\n className={styles.iconButton}\n />\n );\n\n return isDesktop ? (\n <TooltipDesktop\n view='hint'\n colors='inverted'\n trigger='hover'\n position='bottom'\n content='Открыть в полноэкранном режиме'\n fallbackPlacements={['bottom-end']}\n >\n {iconButton}\n </TooltipDesktop>\n ) : (\n iconButton\n );\n};\n\nexport const BackArrow: FC<Props> = ({ buttonRef, ...restProps }) => (\n <IconButton\n {...restProps}\n ref={buttonRef}\n icon={ArrowLeftMIcon}\n aria-label='Вернуться назад'\n className={styles.iconButton}\n />\n);\n\nexport const Play: FC<Props> = ({ buttonRef, className, ...restProps }) => (\n <IconButton\n {...restProps}\n ref={buttonRef}\n icon={PlayCompactMIcon}\n aria-label='Проиграть видео'\n className={cn(styles.iconButton, className)}\n />\n);\n\nexport const Pause: FC<Props> = ({ buttonRef, className, ...restProps }) => (\n <IconButton\n {...restProps}\n ref={buttonRef}\n icon={PauseCompactMIcon}\n aria-label='Поставить паузу на видео'\n className={cn(styles.iconButton, className)}\n />\n);\n\nexport const ExitFullscreen: FC<Props> = ({ buttonRef, ...restProps }) => {\n const isDesktop = useIsDesktop();\n\n const iconButton = (\n <IconButton\n {...restProps}\n ref={buttonRef}\n icon={ArrowsInwardMIcon}\n aria-label='Выйти из полноэкранного режима'\n className={styles.iconButton}\n />\n );\n\n return isDesktop ? (\n <TooltipDesktop\n view='hint'\n colors='inverted'\n trigger='hover'\n position='bottom'\n content='Выйти из полноэкранного режима'\n fallbackPlacements={['bottom-end']}\n >\n {iconButton}\n </TooltipDesktop>\n ) : (\n iconButton\n );\n};\n\nexport const MuteVideo: FC<Props> = ({ buttonRef, className, ...restProps }) => {\n const isDesktop = useIsDesktop();\n\n const iconButton = (\n <IconButton\n {...restProps}\n ref={buttonRef}\n icon={SoundMIcon}\n aria-label='Выключить звук'\n className={styles.iconButton}\n />\n );\n\n return isDesktop ? (\n <TooltipDesktop\n view='hint'\n colors='inverted'\n trigger='hover'\n position='bottom'\n content='Выключить звук'\n fallbackPlacements={['bottom-end']}\n targetClassName={className}\n >\n {iconButton}\n </TooltipDesktop>\n ) : (\n iconButton\n );\n};\n\nexport const UnmuteVideo: FC<Props> = ({ buttonRef, className, ...restProps }) => {\n const isDesktop = useIsDesktop();\n\n const iconButton = (\n <IconButton\n {...restProps}\n ref={buttonRef}\n icon={SoundCrossMIcon}\n aria-label='Включить звук'\n className={styles.iconButton}\n />\n );\n\n return isDesktop ? (\n <TooltipDesktop\n view='hint'\n colors='inverted'\n trigger='hover'\n position='bottom'\n content='Включить звук'\n fallbackPlacements={['bottom-end']}\n targetClassName={className}\n >\n {iconButton}\n </TooltipDesktop>\n ) : (\n iconButton\n );\n};\n\nexport const Download: FC<Props & { href?: string }> = ({ href, ...props }) => {\n const isDesktop = useIsDesktop();\n\n const handleMobileVideoDownload = async (e: React.MouseEvent) => {\n e.preventDefault();\n\n if (!href) return;\n\n const fileName = props.download?.toString() || 'video';\n const fileType = isVideo(href) ? 'video/*' : undefined;\n\n await downloadFile({\n url: href,\n fileName,\n fileType,\n });\n };\n\n const iconButtonProps = {\n ...props,\n icon: PointerDownMIcon,\n 'aria-label': 'Скачать' as const,\n className: styles.iconButton,\n };\n\n const iconButton =\n !isDesktop && isVideo(href) ? (\n <IconButton {...iconButtonProps} onClick={handleMobileVideoDownload} />\n ) : (\n <IconButton {...iconButtonProps} href={href} />\n );\n\n return isDesktop ? (\n <TooltipDesktop\n view='hint'\n colors='inverted'\n trigger='hover'\n position='bottom'\n content='Скачать'\n fallbackPlacements={['bottom-end']}\n >\n {iconButton}\n </TooltipDesktop>\n ) : (\n iconButton\n );\n};\n\nexport const Share: FC<Props> = (props) => {\n const isDesktop = useIsDesktop();\n\n const iconButton = (\n <IconButton\n {...props}\n icon={ShareMIcon}\n aria-label='Поделиться'\n className={styles.iconButton}\n />\n );\n\n return isDesktop ? (\n <TooltipDesktop\n view='hint'\n colors='inverted'\n trigger='hover'\n position='bottom'\n content='Поделиться'\n fallbackPlacements={['bottom-end']}\n >\n {iconButton}\n </TooltipDesktop>\n ) : (\n iconButton\n );\n};\n\nexport const Exit: FC<Props> = (props) => (\n <IconButton {...props} icon={CrossMIcon} aria-label='Закрыть' className={styles.iconButton} />\n);\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AA0BO,MAAM,UAAU,GAAc,CAAC,EAAE,SAAS,EAAE,GAAG,SAAS,EAAE,KAAI;AACjE,IAAA,MAAM,SAAS,GAAG,YAAY,EAAE;IAEhC,MAAM,UAAU,IACZ,KAAC,CAAA,aAAA,CAAA,UAAU,OACH,SAAS,EACb,GAAG,EAAE,SAAS,EACd,IAAI,EAAE,kBAAkB,EACb,YAAA,EAAA,uKAAgC,EAC3C,SAAS,EAAE,MAAM,CAAC,UAAU,EAC9B,CAAA,CACL;AAED,IAAA,OAAO,SAA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
|
justify-content: space-between;
|
|
8
9
|
flex-shrink: 0;
|
|
9
10
|
width: 100%;
|
|
10
|
-
padding: var(--gap-16) var(--gap-32);
|
|
11
|
+
padding: var(--gap-16) var(--gap-24) var(--gap-16) var(--gap-32);
|
|
11
12
|
box-sizing: border-box;
|
|
12
13
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.module.css.js","sources":["../../src/components/header/index.module.css"],"sourcesContent":["@import '@alfalab/core-components-vars/src/index.css';\n\n.header {\n display: flex;\n justify-content: space-between;\n flex-shrink: 0;\n width: 100%;\n padding: var(--gap-16) var(--gap-32);\n box-sizing: border-box;\n}\n"],"names":[],"mappings":";;AAEgB,eAAe,CAAC,QAAQ,CAAC,uBAAuB,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"index.module.css.js","sources":["../../src/components/header/index.module.css"],"sourcesContent":["@import '@alfalab/core-components-vars/src/index.css';\n\n.header {\n display: flex;\n justify-content: space-between;\n flex-shrink: 0;\n width: 100%;\n padding: var(--gap-16) var(--gap-24) var(--gap-16) var(--gap-32);\n box-sizing: border-box;\n}\n"],"names":[],"mappings":";;AAEgB,eAAe,CAAC,QAAQ,CAAC,uBAAuB,CAAC;;;;"}
|
|
@@ -7,7 +7,7 @@ const HeaderInfoBlock = ({ filename, description }) => {
|
|
|
7
7
|
const [head, tail] = splitFilename(filename);
|
|
8
8
|
return (React.createElement("div", { className: styles.info },
|
|
9
9
|
React.createElement("div", { className: styles.filenameContainer },
|
|
10
|
-
React.createElement(TypographyTitle, { tag: '
|
|
10
|
+
React.createElement(TypographyTitle, { tag: 'h2', className: styles.filenameHead, view: 'small', font: 'system', color: 'static-primary-light' }, head),
|
|
11
11
|
React.createElement(TypographyTitle, { tag: 'h1', view: 'xsmall', font: 'system', color: 'static-primary-light' }, tail)),
|
|
12
12
|
description ? (React.createElement(TypographyText, { className: styles.description, tag: 'div', view: 'primary-medium', color: 'static-secondary-light' }, description)) : null));
|
|
13
13
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Component.js","sources":["../../../src/components/header-info-block/Component.tsx"],"sourcesContent":["import React, { type FC } from 'react';\n\nimport { TypographyText, TypographyTitle } from '@alfalab/core-components-typography';\n\nimport { splitFilename } from '../../utils';\n\nimport styles from './index.module.css';\n\nexport type HeaderInfoBlockProps = {\n filename: string;\n description?: string;\n};\n\nexport const HeaderInfoBlock: FC<HeaderInfoBlockProps> = ({ filename, description }) => {\n const [head, tail] = splitFilename(filename);\n\n return (\n <div className={styles.info}>\n <div className={styles.filenameContainer}>\n <TypographyTitle\n tag='
|
|
1
|
+
{"version":3,"file":"Component.js","sources":["../../../src/components/header-info-block/Component.tsx"],"sourcesContent":["import React, { type FC } from 'react';\n\nimport { TypographyText, TypographyTitle } from '@alfalab/core-components-typography';\n\nimport { splitFilename } from '../../utils';\n\nimport styles from './index.module.css';\n\nexport type HeaderInfoBlockProps = {\n filename: string;\n description?: string;\n};\n\nexport const HeaderInfoBlock: FC<HeaderInfoBlockProps> = ({ filename, description }) => {\n const [head, tail] = splitFilename(filename);\n\n return (\n <div className={styles.info}>\n <div className={styles.filenameContainer}>\n <TypographyTitle\n tag='h2'\n className={styles.filenameHead}\n view='small'\n font='system'\n color='static-primary-light'\n >\n {head}\n </TypographyTitle>\n\n <TypographyTitle tag='h1' view='xsmall' font='system' color='static-primary-light'>\n {tail}\n </TypographyTitle>\n </div>\n\n {description ? (\n <TypographyText\n className={styles.description}\n tag='div'\n view='primary-medium'\n color='static-secondary-light'\n >\n {description}\n </TypographyText>\n ) : null}\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;AAaa,MAAA,eAAe,GAA6B,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,KAAI;IACnF,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,aAAa,CAAC,QAAQ,CAAC;AAE5C,IAAA,QACI,KAAK,CAAA,aAAA,CAAA,KAAA,EAAA,EAAA,SAAS,EAAE,MAAM,CAAC,IAAI,EAAA;AACvB,QAAA,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,MAAM,CAAC,iBAAiB,EAAA;YACpC,KAAC,CAAA,aAAA,CAAA,eAAe,EACZ,EAAA,GAAG,EAAC,IAAI,EACR,SAAS,EAAE,MAAM,CAAC,YAAY,EAC9B,IAAI,EAAC,OAAO,EACZ,IAAI,EAAC,QAAQ,EACb,KAAK,EAAC,sBAAsB,EAE3B,EAAA,IAAI,CACS;YAElB,KAAC,CAAA,aAAA,CAAA,eAAe,IAAC,GAAG,EAAC,IAAI,EAAC,IAAI,EAAC,QAAQ,EAAC,IAAI,EAAC,QAAQ,EAAC,KAAK,EAAC,sBAAsB,EAC7E,EAAA,IAAI,CACS,CAChB;AAEL,QAAA,WAAW,IACR,oBAAC,cAAc,EAAA,EACX,SAAS,EAAE,MAAM,CAAC,WAAW,EAC7B,GAAG,EAAC,KAAK,EACT,IAAI,EAAC,gBAAgB,EACrB,KAAK,EAAC,wBAAwB,EAE7B,EAAA,WAAW,CACC,IACjB,IAAI,CACN;AAEd;;;;"}
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
:root {
|
|
2
2
|
--gap-4: 4px;
|
|
3
3
|
}
|
|
4
|
-
.
|
|
4
|
+
.gallery__info_qlcug {
|
|
5
5
|
height: 100%;
|
|
6
6
|
display: flex;
|
|
7
7
|
flex-direction: column;
|
|
8
8
|
justify-content: center;
|
|
9
9
|
overflow: hidden;
|
|
10
10
|
}
|
|
11
|
-
.
|
|
11
|
+
.gallery__filenameHead_qlcug {
|
|
12
12
|
display: inline;
|
|
13
13
|
text-overflow: ellipsis;
|
|
14
14
|
overflow: hidden;
|
|
15
15
|
white-space: nowrap;
|
|
16
16
|
}
|
|
17
|
-
.
|
|
17
|
+
.gallery__filenameContainer_qlcug {
|
|
18
18
|
overflow: hidden;
|
|
19
19
|
display: inline-flex;
|
|
20
20
|
}
|
|
21
|
-
.
|
|
21
|
+
.gallery__description_qlcug {
|
|
22
22
|
display: inline;
|
|
23
23
|
text-overflow: ellipsis;
|
|
24
24
|
overflow: hidden;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import './index.css';
|
|
2
2
|
|
|
3
|
-
const styles = {"info":"
|
|
3
|
+
const styles = {"info":"gallery__info_qlcug","filenameHead":"gallery__filenameHead_qlcug","filenameContainer":"gallery__filenameContainer_qlcug","description":"gallery__description_qlcug"};
|
|
4
4
|
|
|
5
5
|
export { styles as default };
|
|
6
6
|
//# sourceMappingURL=index.module.css.js.map
|
|
@@ -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
|
-
const styles = {"headerMobile":"
|
|
3
|
+
const 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
|
|
@@ -67,7 +67,7 @@ const ImagePreview = ({ image, active = false, index, onSelect, className }) =>
|
|
|
67
67
|
}
|
|
68
68
|
if (isVideo(image.src)) {
|
|
69
69
|
return (React.createElement("div", { className: cn(styles.preview, styles.image, {
|
|
70
|
-
[styles.loading]: !meta,
|
|
70
|
+
[styles.loading]: !meta?.loaded,
|
|
71
71
|
[styles.mobile]: isMobile,
|
|
72
72
|
}) },
|
|
73
73
|
React.createElement("canvas", { className: cn(styles.canvasPreview, { [styles.mobile]: isMobile }), "data-testid": 'canvas', width: previewWidth, height: previewHeight, ref: canvasRef })));
|