@alfalab/core-components-gallery 7.1.1 → 7.1.2-alfasans

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.
Files changed (95) hide show
  1. package/components/bottom-button/index.css +5 -5
  2. package/components/bottom-button/index.module.css.js +1 -1
  3. package/components/buttons/index.css +5 -5
  4. package/components/buttons/index.module.css.js +1 -1
  5. package/components/header/index.css +1 -1
  6. package/components/header/index.module.css.js +1 -1
  7. package/components/header-info-block/index.css +4 -4
  8. package/components/header-info-block/index.module.css.js +1 -1
  9. package/components/header-mobile/index.css +6 -6
  10. package/components/header-mobile/index.module.css.js +1 -1
  11. package/components/image-preview/index.css +17 -17
  12. package/components/image-preview/index.module.css.js +1 -1
  13. package/components/image-viewer/component.d.ts +0 -1
  14. package/components/image-viewer/component.js +2 -4
  15. package/components/image-viewer/component.js.map +1 -1
  16. package/components/image-viewer/index.css +86 -25
  17. package/components/image-viewer/index.module.css.js +1 -1
  18. package/components/image-viewer/index.module.css.js.map +1 -1
  19. package/components/image-viewer/video/index.css +7 -7
  20. package/components/image-viewer/video/index.module.css.js +1 -1
  21. package/components/info-bar/index.css +3 -3
  22. package/components/info-bar/index.module.css.js +1 -1
  23. package/components/navigation-bar/index.css +8 -8
  24. package/components/navigation-bar/index.module.css.js +1 -1
  25. package/components/subtitles/index.css +3 -3
  26. package/components/subtitles/index.module.css.js +1 -1
  27. package/cssm/components/image-viewer/component.d.ts +0 -1
  28. package/cssm/components/image-viewer/component.js +2 -4
  29. package/cssm/components/image-viewer/component.js.map +1 -1
  30. package/cssm/components/image-viewer/index.module.css +61 -0
  31. package/esm/components/bottom-button/index.css +5 -5
  32. package/esm/components/bottom-button/index.module.css.js +1 -1
  33. package/esm/components/buttons/index.css +5 -5
  34. package/esm/components/buttons/index.module.css.js +1 -1
  35. package/esm/components/header/index.css +1 -1
  36. package/esm/components/header/index.module.css.js +1 -1
  37. package/esm/components/header-info-block/index.css +4 -4
  38. package/esm/components/header-info-block/index.module.css.js +1 -1
  39. package/esm/components/header-mobile/index.css +6 -6
  40. package/esm/components/header-mobile/index.module.css.js +1 -1
  41. package/esm/components/image-preview/index.css +17 -17
  42. package/esm/components/image-preview/index.module.css.js +1 -1
  43. package/esm/components/image-viewer/component.d.ts +0 -1
  44. package/esm/components/image-viewer/component.js +2 -3
  45. package/esm/components/image-viewer/component.js.map +1 -1
  46. package/esm/components/image-viewer/index.css +86 -25
  47. package/esm/components/image-viewer/index.module.css.js +1 -1
  48. package/esm/components/image-viewer/index.module.css.js.map +1 -1
  49. package/esm/components/image-viewer/video/index.css +7 -7
  50. package/esm/components/image-viewer/video/index.module.css.js +1 -1
  51. package/esm/components/info-bar/index.css +3 -3
  52. package/esm/components/info-bar/index.module.css.js +1 -1
  53. package/esm/components/navigation-bar/index.css +8 -8
  54. package/esm/components/navigation-bar/index.module.css.js +1 -1
  55. package/esm/components/subtitles/index.css +3 -3
  56. package/esm/components/subtitles/index.module.css.js +1 -1
  57. package/esm/index.css +9 -9
  58. package/esm/index.module.css.js +1 -1
  59. package/index.css +9 -9
  60. package/index.module.css.js +1 -1
  61. package/modern/components/bottom-button/index.css +5 -5
  62. package/modern/components/bottom-button/index.module.css.js +1 -1
  63. package/modern/components/buttons/index.css +5 -5
  64. package/modern/components/buttons/index.module.css.js +1 -1
  65. package/modern/components/header/index.css +1 -1
  66. package/modern/components/header/index.module.css.js +1 -1
  67. package/modern/components/header-info-block/index.css +4 -4
  68. package/modern/components/header-info-block/index.module.css.js +1 -1
  69. package/modern/components/header-mobile/index.css +6 -6
  70. package/modern/components/header-mobile/index.module.css.js +1 -1
  71. package/modern/components/image-preview/index.css +17 -17
  72. package/modern/components/image-preview/index.module.css.js +1 -1
  73. package/modern/components/image-viewer/component.d.ts +0 -1
  74. package/modern/components/image-viewer/component.js +2 -3
  75. package/modern/components/image-viewer/component.js.map +1 -1
  76. package/modern/components/image-viewer/index.css +86 -25
  77. package/modern/components/image-viewer/index.module.css.js +1 -1
  78. package/modern/components/image-viewer/index.module.css.js.map +1 -1
  79. package/modern/components/image-viewer/video/index.css +7 -7
  80. package/modern/components/image-viewer/video/index.module.css.js +1 -1
  81. package/modern/components/info-bar/index.css +3 -3
  82. package/modern/components/info-bar/index.module.css.js +1 -1
  83. package/modern/components/navigation-bar/index.css +8 -8
  84. package/modern/components/navigation-bar/index.module.css.js +1 -1
  85. package/modern/components/subtitles/index.css +3 -3
  86. package/modern/components/subtitles/index.module.css.js +1 -1
  87. package/modern/index.css +9 -9
  88. package/modern/index.module.css.js +1 -1
  89. package/moderncssm/components/image-viewer/component.d.ts +0 -1
  90. package/moderncssm/components/image-viewer/component.js +2 -3
  91. package/moderncssm/components/image-viewer/component.js.map +1 -1
  92. package/moderncssm/components/image-viewer/index.module.css +61 -0
  93. package/package.json +12 -12
  94. package/src/components/image-viewer/component.tsx +4 -6
  95. package/src/components/image-viewer/index.module.css +63 -0
@@ -7,22 +7,22 @@
7
7
  --border-radius-0: 0;
8
8
  --border-radius-24: var(--border-radius-3xl);
9
9
  }
10
- .gallery__videoWrapper_rrxe4 {
10
+ .gallery__videoWrapper_1md53 {
11
11
  display: flex;
12
12
  justify-content: center;
13
13
  height: 100%;
14
14
  width: auto;
15
15
  position: relative;
16
16
  }
17
- .gallery__video_rrxe4 {
17
+ .gallery__video_1md53 {
18
18
  max-width: 100%;
19
19
  max-height: 100%;
20
20
  border-radius: var(--border-radius-24);
21
21
  }
22
- .gallery__mobile_rrxe4 {
22
+ .gallery__mobile_1md53 {
23
23
  border-radius: var(--border-radius-0);
24
24
  }
25
- .gallery__videoButton_rrxe4 {
25
+ .gallery__videoButton_1md53 {
26
26
  position: absolute;
27
27
  top: 50%;
28
28
  left: 50%;
@@ -30,13 +30,13 @@
30
30
  z-index: 1;
31
31
  color: green;
32
32
  }
33
- .gallery__icon_rrxe4 {
33
+ .gallery__icon_1md53 {
34
34
  color: var(--color-static-neutral-0);
35
35
  }
36
- .gallery__iconShape_rrxe4 {
36
+ .gallery__iconShape_1md53 {
37
37
  fill: var(--color-static-neutral-translucent-700);
38
38
  }
39
- .gallery__bottomButton_rrxe4 {
39
+ .gallery__bottomButton_1md53 {
40
40
  position: absolute;
41
41
  bottom: 48px;
42
42
  left: 32px;
@@ -1,6 +1,6 @@
1
1
  import './index.css';
2
2
 
3
- const styles = {"videoWrapper":"gallery__videoWrapper_rrxe4","video":"gallery__video_rrxe4","mobile":"gallery__mobile_rrxe4","videoButton":"gallery__videoButton_rrxe4","icon":"gallery__icon_rrxe4","iconShape":"gallery__iconShape_rrxe4","bottomButton":"gallery__bottomButton_rrxe4"};
3
+ const styles = {"videoWrapper":"gallery__videoWrapper_1md53","video":"gallery__video_1md53","mobile":"gallery__mobile_1md53","videoButton":"gallery__videoButton_1md53","icon":"gallery__icon_1md53","iconShape":"gallery__iconShape_1md53","bottomButton":"gallery__bottomButton_1md53"};
4
4
 
5
5
  export { styles as default };
6
6
  //# sourceMappingURL=index.module.css.js.map
@@ -7,10 +7,10 @@
7
7
  --gap-4: var(--gap-2xs);
8
8
  --gap-8: var(--gap-xs);
9
9
  }
10
- .gallery__description_16ykd {
10
+ .gallery__description_znsly {
11
11
  text-align: center;
12
12
  }
13
- .gallery__infoWrapper_16ykd {
13
+ .gallery__infoWrapper_znsly {
14
14
  background-color: var(--color-static-neutral-0-inverted);
15
15
  display: flex;
16
16
  align-items: center;
@@ -19,7 +19,7 @@
19
19
  position: relative;
20
20
  height: 48px;
21
21
  }
22
- .gallery__infoWrapper_16ykd.gallery__video_16ykd {
22
+ .gallery__infoWrapper_znsly.gallery__video_znsly {
23
23
  padding: 0 var(--gap-4) var(--gap-4);
24
24
  justify-content: space-between;
25
25
  }
@@ -1,6 +1,6 @@
1
1
  import './index.css';
2
2
 
3
- const styles = {"description":"gallery__description_16ykd","infoWrapper":"gallery__infoWrapper_16ykd","video":"gallery__video_16ykd"};
3
+ const styles = {"description":"gallery__description_znsly","infoWrapper":"gallery__infoWrapper_znsly","video":"gallery__video_znsly"};
4
4
 
5
5
  export { styles as default };
6
6
  //# sourceMappingURL=index.module.css.js.map
@@ -13,7 +13,7 @@
13
13
  --gap-12: var(--gap-s);
14
14
  --gap-24: var(--gap-xl);
15
15
  }
16
- .gallery__component_uzlb9 {
16
+ .gallery__component_1cybw {
17
17
  display: flex;
18
18
  flex-wrap: nowrap;
19
19
  align-content: center;
@@ -25,25 +25,25 @@
25
25
  scrollbar-width: none;
26
26
  background-color: var(--color-static-neutral-0-inverted);
27
27
  }
28
- .gallery__component_uzlb9.gallery__mobile_uzlb9 {
28
+ .gallery__component_1cybw.gallery__mobile_1cybw {
29
29
  padding: var(--gap-8) var(--gap-24);
30
30
  }
31
- .gallery__component_uzlb9::-webkit-scrollbar {
31
+ .gallery__component_1cybw::-webkit-scrollbar {
32
32
  display: none;
33
33
  }
34
- .gallery__previews_uzlb9 {
34
+ .gallery__previews_1cybw {
35
35
  display: flex;
36
36
  }
37
- .gallery__preview_uzlb9 {
37
+ .gallery__preview_1cybw {
38
38
  flex-shrink: 0;
39
39
  margin-right: var(--gap-4);
40
40
  }
41
- .gallery__preview_uzlb9.gallery__mobile_uzlb9 {
41
+ .gallery__preview_1cybw.gallery__mobile_1cybw {
42
42
  margin-right: var(--gap-2);
43
43
  }
44
- .gallery__preview_uzlb9:first-child {
44
+ .gallery__preview_1cybw:first-child {
45
45
  margin-left: auto;
46
46
  }
47
- .gallery__preview_uzlb9:last-child {
47
+ .gallery__preview_1cybw:last-child {
48
48
  margin-right: auto;
49
49
  }
@@ -1,6 +1,6 @@
1
1
  import './index.css';
2
2
 
3
- const styles = {"component":"gallery__component_uzlb9","mobile":"gallery__mobile_uzlb9","preview":"gallery__preview_uzlb9"};
3
+ const styles = {"component":"gallery__component_1cybw","mobile":"gallery__mobile_1cybw","preview":"gallery__preview_1cybw"};
4
4
 
5
5
  export { styles as default };
6
6
  //# sourceMappingURL=index.module.css.js.map
@@ -5,7 +5,7 @@
5
5
  --gap-16: var(--gap-m);
6
6
  --gap-32: var(--gap-2xl);
7
7
  }
8
- .gallery__subtitles_12ysr {
8
+ .gallery__subtitles_8qn9e {
9
9
  position: absolute;
10
10
  align-self: flex-end;
11
11
  padding: var(--gap-0) var(--gap-32);
@@ -18,10 +18,10 @@
18
18
  opacity 500ms ease-in-out,
19
19
  margin-bottom 270ms ease-in-out;
20
20
  }
21
- .gallery__subtitles_12ysr.gallery__mobile_12ysr {
21
+ .gallery__subtitles_8qn9e.gallery__mobile_8qn9e {
22
22
  position: static;
23
23
  position: initial;
24
24
  }
25
- .gallery__hideSubtitles_12ysr {
25
+ .gallery__hideSubtitles_8qn9e {
26
26
  opacity: 0;
27
27
  }
@@ -1,6 +1,6 @@
1
1
  import './index.css';
2
2
 
3
- const styles = {"subtitles":"gallery__subtitles_12ysr","mobile":"gallery__mobile_12ysr","hideSubtitles":"gallery__hideSubtitles_12ysr"};
3
+ const styles = {"subtitles":"gallery__subtitles_8qn9e","mobile":"gallery__mobile_8qn9e","hideSubtitles":"gallery__hideSubtitles_8qn9e"};
4
4
 
5
5
  export { styles as default };
6
6
  //# sourceMappingURL=index.module.css.js.map
package/modern/index.css CHANGED
@@ -13,7 +13,7 @@
13
13
  --sat: env(safe-area-inset-top, var(--gap-0));
14
14
  --sab: env(safe-area-inset-bottom, var(--gap-0));
15
15
  }
16
- .gallery__container_13kqg {
16
+ .gallery__container_qgt61 {
17
17
  position: relative;
18
18
  overflow-x: hidden;
19
19
  overflow-y: auto;
@@ -26,16 +26,16 @@
26
26
  padding-top: var(--sat);
27
27
  padding-bottom: var(--sab);
28
28
  }
29
- .gallery__container_13kqg.gallery__mobile_13kqg {
29
+ .gallery__container_qgt61.gallery__mobile_qgt61 {
30
30
  overflow: hidden;
31
31
  }
32
- .gallery__modal_13kqg {
32
+ .gallery__modal_qgt61 {
33
33
  flex-grow: 1;
34
34
  width: 100vw;
35
35
  height: 100vh;
36
36
  background: transparent;
37
37
  }
38
- .gallery__navigationVideo_13kqg {
38
+ .gallery__navigationVideo_qgt61 {
39
39
  z-index: 3;
40
40
  width: 100%;
41
41
  position: absolute;
@@ -44,18 +44,18 @@
44
44
  transition: transform 0.3s ease-in-out;
45
45
  text-align: center;
46
46
  }
47
- .gallery__hide_13kqg {
47
+ .gallery__hide_qgt61 {
48
48
  transform: translateY(114px);
49
49
  }
50
- .gallery__hideInfo_13kqg {
50
+ .gallery__hideInfo_qgt61 {
51
51
  transform: translateY(48px);
52
52
  }
53
- .gallery__bottomButton_13kqg {
53
+ .gallery__bottomButton_qgt61 {
54
54
  width: calc(100% - var(--gap-32));
55
55
  margin: var(--gap-16);
56
56
  background-color: var(--color-static-neutral-translucent-500-inverted);
57
57
  }
58
- .gallery__subtitles_13kqg {
58
+ .gallery__subtitles_qgt61 {
59
59
  padding: var(--gap-0) var(--gap-32);
60
60
  margin-bottom: var(--gap-16);
61
61
  width: 100%;
@@ -66,6 +66,6 @@
66
66
  opacity 500ms ease-in-out,
67
67
  margin-bottom 270ms ease-in-out;
68
68
  }
69
- .gallery__hideSubtitles_13kqg {
69
+ .gallery__hideSubtitles_qgt61 {
70
70
  opacity: 0;
71
71
  }
@@ -1,6 +1,6 @@
1
1
  import './index.css';
2
2
 
3
- const styles = {"container":"gallery__container_13kqg","mobile":"gallery__mobile_13kqg","modal":"gallery__modal_13kqg","navigationVideo":"gallery__navigationVideo_13kqg","hide":"gallery__hide_13kqg","hideInfo":"gallery__hideInfo_13kqg","bottomButton":"gallery__bottomButton_13kqg"};
3
+ const styles = {"container":"gallery__container_qgt61","mobile":"gallery__mobile_qgt61","modal":"gallery__modal_qgt61","navigationVideo":"gallery__navigationVideo_qgt61","hide":"gallery__hide_qgt61","hideInfo":"gallery__hideInfo_qgt61","bottomButton":"gallery__bottomButton_qgt61"};
4
4
 
5
5
  export { styles as default };
6
6
  //# sourceMappingURL=index.module.css.js.map
@@ -1,3 +1,2 @@
1
1
  import { type FC } from 'react';
2
- import 'swiper/swiper.min.css';
3
2
  export declare const ImageViewer: FC;
@@ -1,6 +1,6 @@
1
1
  import React, { useContext, useCallback, useMemo } from 'react';
2
2
  import cn from 'classnames';
3
- import SwiperCore, { EffectFade, A11y, Controller } from 'swiper';
3
+ import { A11y, Controller } from 'swiper/modules';
4
4
  import { Swiper, SwiperSlide } from 'swiper/react';
5
5
  import { useFocus } from '@alfalab/hooks';
6
6
  import { ChevronBackHeavyMIcon } from '@alfalab/icons-glyph/ChevronBackHeavyMIcon';
@@ -10,10 +10,8 @@ import { isVideo, getImageAlt, getImageKey } from '../../utils/utils.js';
10
10
  import { TestIds } from '../../utils/constants.js';
11
11
  import { useHandleImageViewer } from './hooks.js';
12
12
  import { Slide } from './slide.js';
13
- import 'swiper/swiper.min.css';
14
13
  import styles from './index.module.css';
15
14
 
16
- SwiperCore.use([EffectFade, A11y, Controller]);
17
15
  const ImageViewer = () => {
18
16
  const { images, imagesMeta, fullScreen, currentSlideIndex, initialSlide, setCurrentSlideIndex, getSwiper, setSwiper, slidePrev, slideNext, getCurrentImage, } = useContext(GalleryContext);
19
17
  const { handleWrapperClick, isMobile, rightArrowRef, leftArrowRef } = useHandleImageViewer();
@@ -49,6 +47,7 @@ const ImageViewer = () => {
49
47
  [styles.mobile]: isMobile,
50
48
  [styles.mobileVideo]: isMobile && isVideo(currentImage?.src),
51
49
  }),
50
+ modules: [A11y, Controller],
52
51
  controller: { control: swiper },
53
52
  a11y: {
54
53
  slideRole: 'img',
@@ -1 +1 @@
1
- {"version":3,"file":"component.js","sources":["../../../src/components/image-viewer/component.tsx"],"sourcesContent":["import React, { type FC, type KeyboardEventHandler, useCallback, useContext, useMemo } from 'react';\nimport cn from 'classnames';\nimport SwiperCore, { A11y, Controller, EffectFade } from 'swiper';\nimport { Swiper, SwiperSlide } from 'swiper/react';\n\nimport { useFocus } from '@alfalab/hooks';\nimport { ChevronBackHeavyMIcon } from '@alfalab/icons-glyph/ChevronBackHeavyMIcon';\nimport { ChevronForwardHeavyMIcon } from '@alfalab/icons-glyph/ChevronForwardHeavyMIcon';\n\nimport { GalleryContext } from '../../context';\nimport { getImageAlt, getImageKey, isVideo, TestIds } from '../../utils';\n\nimport { useHandleImageViewer } from './hooks';\nimport { Slide } from './slide';\n\nimport 'swiper/swiper.min.css';\nimport styles from './index.module.css';\n\nSwiperCore.use([EffectFade, A11y, Controller]);\n\nexport const ImageViewer: FC = () => {\n const {\n images,\n imagesMeta,\n fullScreen,\n currentSlideIndex,\n initialSlide,\n setCurrentSlideIndex,\n getSwiper,\n setSwiper,\n slidePrev,\n slideNext,\n getCurrentImage,\n } = useContext(GalleryContext);\n\n const { handleWrapperClick, isMobile, rightArrowRef, leftArrowRef } = useHandleImageViewer();\n\n const [leftArrowFocused] = useFocus(leftArrowRef, 'keyboard');\n const [rightArrowFocused] = useFocus(rightArrowRef, 'keyboard');\n\n const swiper = getSwiper();\n const currentImage = getCurrentImage();\n\n const handleSlideChange = useCallback(() => {\n setCurrentSlideIndex?.(swiper?.activeIndex ?? initialSlide);\n }, [setCurrentSlideIndex, swiper, initialSlide]);\n\n const handlePrevClick = () => {\n slidePrev();\n };\n\n const handleNextClick = () => {\n slideNext();\n };\n\n const handleArrowLeftKeyDown: KeyboardEventHandler = (event) => {\n if (event.key === 'Enter') {\n slidePrev();\n }\n };\n\n const handleArrowRightKeyDown: KeyboardEventHandler = (event) => {\n if (event.key === 'Enter') {\n slideNext();\n }\n };\n\n const swiperProps = useMemo<Swiper>(\n () => ({\n slidesPerView: 1,\n effect: 'slide',\n className: cn(styles.swiper, {\n [styles.hidden]: fullScreen && !isVideo(currentImage?.src),\n [styles.fullScreenVideo]: fullScreen && isVideo(currentImage?.src),\n [styles.mobile]: isMobile,\n [styles.mobileVideo]: isMobile && isVideo(currentImage?.src),\n }),\n controller: { control: swiper },\n a11y: {\n slideRole: 'img',\n },\n initialSlide,\n simulateTouch: false,\n zoom: { maxRatio: 4, minRatio: 1, toggle: true },\n onSwiper: setSwiper,\n onSlideChange: handleSlideChange,\n lazy: { loadPrevNext: true },\n }),\n [\n fullScreen,\n currentImage?.src,\n isMobile,\n swiper,\n initialSlide,\n setSwiper,\n handleSlideChange,\n ],\n );\n\n const showControls = !fullScreen && !isMobile && !!images.length;\n\n const swiperWidth = swiper?.width || 1;\n const swiperHeight = swiper?.height || swiper?.width || 1;\n\n const swiperAspectRatio = swiperWidth / swiperHeight;\n\n return (\n <div\n className={cn(styles.component, {\n [styles.mobile]: isMobile,\n [styles.mobileVideo]: isMobile && isVideo(currentImage?.src),\n })}\n aria-hidden={true}\n onClick={handleWrapperClick}\n >\n {showControls && (\n <div\n className={cn(styles.arrow, {\n [styles.focused]: leftArrowFocused,\n })}\n onClick={handlePrevClick}\n role='button'\n onKeyDown={handleArrowLeftKeyDown}\n tabIndex={0}\n ref={leftArrowRef}\n aria-label='Предыдущее изображение'\n data-test-id={TestIds.PREV_SLIDE_BUTTON}\n >\n <ChevronBackHeavyMIcon />\n </div>\n )}\n\n {fullScreen && !isVideo(currentImage?.src) && (\n <img\n src={currentImage?.src}\n alt={currentImage ? getImageAlt(currentImage, currentSlideIndex) : ''}\n className={styles.fullScreenImage}\n />\n )}\n\n <Swiper {...swiperProps}>\n {images.map((image, index) => {\n const meta = imagesMeta[index];\n\n const imageWidth = meta?.width || 1;\n const imageHeight = meta?.height || 1;\n\n const imageAspectRatio = imageWidth / imageHeight;\n\n const slideVisible = index === currentSlideIndex;\n\n return (\n <SwiperSlide\n key={getImageKey(image, index)}\n style={{\n pointerEvents: slideVisible ? 'auto' : 'none',\n transitionProperty: 'opacity',\n }}\n >\n {({ isActive }) => (\n <Slide\n isActive={isActive}\n containerAspectRatio={swiperAspectRatio}\n image={image}\n containerHeight={swiperHeight}\n meta={meta}\n index={index}\n imageAspectRatio={imageAspectRatio}\n slideVisible={slideVisible}\n />\n )}\n </SwiperSlide>\n );\n })}\n </Swiper>\n\n {showControls && (\n <div\n className={cn(styles.arrow, {\n [styles.focused]: rightArrowFocused,\n })}\n onClick={handleNextClick}\n role='button'\n onKeyDown={handleArrowRightKeyDown}\n tabIndex={0}\n ref={rightArrowRef}\n aria-label='Следующее изображение'\n data-test-id={TestIds.NEXT_SLIDE_BUTTON}\n >\n <ChevronForwardHeavyMIcon />\n </div>\n )}\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AAkBA,UAAU,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC;AAEvC,MAAM,WAAW,GAAO,MAAK;AAChC,IAAA,MAAM,EACF,MAAM,EACN,UAAU,EACV,UAAU,EACV,iBAAiB,EACjB,YAAY,EACZ,oBAAoB,EACpB,SAAS,EACT,SAAS,EACT,SAAS,EACT,SAAS,EACT,eAAe,GAClB,GAAG,UAAU,CAAC,cAAc,CAAC;AAE9B,IAAA,MAAM,EAAE,kBAAkB,EAAE,QAAQ,EAAE,aAAa,EAAE,YAAY,EAAE,GAAG,oBAAoB,EAAE;IAE5F,MAAM,CAAC,gBAAgB,CAAC,GAAG,QAAQ,CAAC,YAAY,EAAE,UAAU,CAAC;IAC7D,MAAM,CAAC,iBAAiB,CAAC,GAAG,QAAQ,CAAC,aAAa,EAAE,UAAU,CAAC;AAE/D,IAAA,MAAM,MAAM,GAAG,SAAS,EAAE;AAC1B,IAAA,MAAM,YAAY,GAAG,eAAe,EAAE;AAEtC,IAAA,MAAM,iBAAiB,GAAG,WAAW,CAAC,MAAK;QACvC,oBAAoB,GAAG,MAAM,EAAE,WAAW,IAAI,YAAY,CAAC;KAC9D,EAAE,CAAC,oBAAoB,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC;IAEhD,MAAM,eAAe,GAAG,MAAK;AACzB,QAAA,SAAS,EAAE;AACf,KAAC;IAED,MAAM,eAAe,GAAG,MAAK;AACzB,QAAA,SAAS,EAAE;AACf,KAAC;AAED,IAAA,MAAM,sBAAsB,GAAyB,CAAC,KAAK,KAAI;AAC3D,QAAA,IAAI,KAAK,CAAC,GAAG,KAAK,OAAO,EAAE;AACvB,YAAA,SAAS,EAAE;;AAEnB,KAAC;AAED,IAAA,MAAM,u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A,cAAA,EACpB,OAAO,CAAC,iBAAiB,EAAA;AAEvC,YAAA,KAAA,CAAA,aAAA,CAAC,wBAAwB,EAAG,IAAA,CAAA,CAC1B,CACT,CACC;AAEd;;;;"}
1
+ {"version":3,"file":"component.js","sources":["../../../src/components/image-viewer/component.tsx"],"sourcesContent":["import React, { type FC, type KeyboardEventHandler, useCallback, useContext, useMemo } from 'react';\nimport cn from 'classnames';\nimport { A11y, Controller } from 'swiper/modules';\nimport { Swiper, type SwiperProps, SwiperSlide } from 'swiper/react';\n\nimport { useFocus } from '@alfalab/hooks';\nimport { ChevronBackHeavyMIcon } from '@alfalab/icons-glyph/ChevronBackHeavyMIcon';\nimport { ChevronForwardHeavyMIcon } from '@alfalab/icons-glyph/ChevronForwardHeavyMIcon';\n\nimport { GalleryContext } from '../../context';\nimport { getImageAlt, getImageKey, isVideo, TestIds } from '../../utils';\n\nimport { useHandleImageViewer } from './hooks';\nimport { Slide } from './slide';\n\nimport styles from './index.module.css';\n\nexport const ImageViewer: FC = () => {\n const {\n images,\n imagesMeta,\n fullScreen,\n currentSlideIndex,\n initialSlide,\n setCurrentSlideIndex,\n getSwiper,\n setSwiper,\n slidePrev,\n slideNext,\n getCurrentImage,\n } = useContext(GalleryContext);\n\n const { handleWrapperClick, isMobile, rightArrowRef, leftArrowRef } = useHandleImageViewer();\n\n const [leftArrowFocused] = useFocus(leftArrowRef, 'keyboard');\n const [rightArrowFocused] = useFocus(rightArrowRef, 'keyboard');\n\n const swiper = getSwiper();\n const currentImage = getCurrentImage();\n\n const handleSlideChange = useCallback(() => {\n setCurrentSlideIndex?.(swiper?.activeIndex ?? initialSlide);\n }, [setCurrentSlideIndex, swiper, initialSlide]);\n\n const handlePrevClick = () => {\n slidePrev();\n };\n\n const handleNextClick = () => {\n slideNext();\n };\n\n const handleArrowLeftKeyDown: KeyboardEventHandler = (event) => {\n if (event.key === 'Enter') {\n slidePrev();\n }\n };\n\n const handleArrowRightKeyDown: KeyboardEventHandler = (event) => {\n if (event.key === 'Enter') {\n slideNext();\n }\n };\n\n const swiperProps = useMemo<SwiperProps>(\n () => ({\n slidesPerView: 1,\n effect: 'slide',\n className: cn(styles.swiper, {\n [styles.hidden]: fullScreen && !isVideo(currentImage?.src),\n [styles.fullScreenVideo]: fullScreen && isVideo(currentImage?.src),\n [styles.mobile]: isMobile,\n [styles.mobileVideo]: isMobile && isVideo(currentImage?.src),\n }),\n modules: [A11y, Controller],\n controller: { control: swiper },\n a11y: {\n slideRole: 'img',\n },\n initialSlide,\n simulateTouch: false,\n zoom: { maxRatio: 4, minRatio: 1, toggle: true },\n onSwiper: setSwiper,\n onSlideChange: handleSlideChange,\n lazy: { loadPrevNext: true },\n }),\n [\n fullScreen,\n currentImage?.src,\n isMobile,\n swiper,\n initialSlide,\n setSwiper,\n handleSlideChange,\n ],\n );\n\n const showControls = !fullScreen && !isMobile && !!images.length;\n\n const swiperWidth = swiper?.width || 1;\n const swiperHeight = swiper?.height || swiper?.width || 1;\n\n const swiperAspectRatio = swiperWidth / swiperHeight;\n\n return (\n <div\n className={cn(styles.component, {\n [styles.mobile]: isMobile,\n [styles.mobileVideo]: isMobile && isVideo(currentImage?.src),\n })}\n aria-hidden={true}\n onClick={handleWrapperClick}\n >\n {showControls && (\n <div\n className={cn(styles.arrow, {\n [styles.focused]: leftArrowFocused,\n })}\n onClick={handlePrevClick}\n role='button'\n onKeyDown={handleArrowLeftKeyDown}\n tabIndex={0}\n ref={leftArrowRef}\n aria-label='Предыдущее изображение'\n data-test-id={TestIds.PREV_SLIDE_BUTTON}\n >\n <ChevronBackHeavyMIcon />\n </div>\n )}\n\n {fullScreen && !isVideo(currentImage?.src) && (\n <img\n src={currentImage?.src}\n alt={currentImage ? getImageAlt(currentImage, currentSlideIndex) : ''}\n className={styles.fullScreenImage}\n />\n )}\n\n <Swiper {...swiperProps}>\n {images.map((image, index) => {\n const meta = imagesMeta[index];\n\n const imageWidth = meta?.width || 1;\n const imageHeight = meta?.height || 1;\n\n const imageAspectRatio = imageWidth / imageHeight;\n\n const slideVisible = index === currentSlideIndex;\n\n return (\n <SwiperSlide\n key={getImageKey(image, index)}\n style={{\n pointerEvents: slideVisible ? 'auto' : 'none',\n transitionProperty: 'opacity',\n }}\n >\n {({ isActive }) => (\n <Slide\n isActive={isActive}\n containerAspectRatio={swiperAspectRatio}\n image={image}\n containerHeight={swiperHeight}\n meta={meta}\n index={index}\n imageAspectRatio={imageAspectRatio}\n slideVisible={slideVisible}\n />\n )}\n </SwiperSlide>\n );\n })}\n </Swiper>\n\n {showControls && (\n <div\n className={cn(styles.arrow, {\n [styles.focused]: rightArrowFocused,\n })}\n onClick={handleNextClick}\n role='button'\n onKeyDown={handleArrowRightKeyDown}\n tabIndex={0}\n ref={rightArrowRef}\n aria-label='Следующее изображение'\n data-test-id={TestIds.NEXT_SLIDE_BUTTON}\n >\n <ChevronForwardHeavyMIcon />\n </div>\n )}\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAiBO,MAAM,WAAW,GAAO,MAAK;AAChC,IAAA,MAAM,EACF,MAAM,EACN,UAAU,EACV,UAAU,EACV,iBAAiB,EACjB,YAAY,EACZ,oBAAoB,EACpB,SAAS,EACT,SAAS,EACT,SAAS,EACT,SAAS,EACT,eAAe,GAClB,GAAG,UAAU,CAAC,cAAc,CAAC;AAE9B,IAAA,MAAM,EAAE,kBAAkB,EAAE,QAAQ,EAAE,aAAa,EAAE,YAAY,EAAE,GAAG,oBAAoB,EAAE;IAE5F,MAAM,CAAC,gBAAgB,CAAC,GAAG,QAAQ,CAAC,YAAY,EAAE,UAAU,CAAC;IAC7D,MAAM,CAAC,iBAAiB,CAAC,GAAG,QAAQ,CAAC,aAAa,EAAE,UAAU,CAAC;AAE/D,IAAA,MAAM,MAAM,GAAG,SAAS,EAAE;AAC1B,IAAA,MAAM,YAAY,GAAG,eAAe,EAAE;AAEtC,IAAA,MAAM,iBAAiB,GAAG,WAAW,CAAC,MAAK;QACvC,oBAAoB,GAAG,MA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AI,EACV,KAAK,EAAE,KAAK,EACZ,gBAAgB,EAAE,gBAAgB,EAClC,YAAY,EAAE,YAAY,EAC5B,CAAA,CACL,CACS;AAEtB,SAAC,CAAC,CACG;QAER,YAAY,KACT,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EACI,SAAS,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE;AACxB,gBAAA,CAAC,MAAM,CAAC,OAAO,GAAG,iBAAiB;aACtC,CAAC,EACF,OAAO,EAAE,eAAe,EACxB,IAAI,EAAC,QAAQ,EACb,SAAS,EAAE,uBAAuB,EAClC,QAAQ,EAAE,CAAC,EACX,GAAG,EAAE,aAAa,EAAA,YAAA,EACP,2HAAuB,EAAA,cAAA,EACpB,OAAO,CAAC,iBAAiB,EAAA;AAEvC,YAAA,KAAA,CAAA,aAAA,CAAC,wBAAwB,EAAG,IAAA,CAAA,CAC1B,CACT,CACC;AAEd;;;;"}
@@ -5,6 +5,67 @@
5
5
  flex-grow: 1;
6
6
  justify-content: center;
7
7
  background-color: var(--color-static-neutral-0-inverted);
8
+ :global(.swiper) {
9
+ margin-left: auto;
10
+ margin-right: auto;
11
+ position: relative;
12
+ overflow: hidden;
13
+ list-style: none;
14
+ padding: 0;
15
+ z-index: 1;
16
+ display: block;
17
+ }
18
+ :global(.swiper-wrapper) {
19
+ position: relative;
20
+ width: 100%;
21
+ height: 100%;
22
+ z-index: 1;
23
+ display: flex;
24
+ transition-property: transform;
25
+ transition-timing-function: var(--swiper-wrapper-transition-timing-function, ease);
26
+ transition-timing-function: var(--swiper-wrapper-transition-timing-function, initial);
27
+ box-sizing: content-box;
28
+ }
29
+ :global(.swiper-android) :global(.swiper-slide),
30
+ :global(.swiper-ios) :global(.swiper-slide),
31
+ :global(.swiper-wrapper) {
32
+ transform: translate3d(0, 0, 0);
33
+ }
34
+ :global(.swiper-horizontal) {
35
+ touch-action: pan-y;
36
+ }
37
+ :global(.swiper-slide) {
38
+ flex-shrink: 0;
39
+ width: 100%;
40
+ height: 100%;
41
+ position: relative;
42
+ transition-property: transform;
43
+ display: block;
44
+ }
45
+ :global(.swiper-slide-invisible-blank) {
46
+ visibility: hidden;
47
+ }
48
+ :global(.swiper-autoheight),
49
+ :global(.swiper-autoheight) :global(.swiper-slide) {
50
+ height: auto;
51
+ }
52
+ :global(.swiper-autoheight) :global(.swiper-wrapper) {
53
+ align-items: flex-start;
54
+ transition-property: transform, height;
55
+ }
56
+ :global(.swiper-backface-hidden) :global(.swiper-slide) {
57
+ transform: translateZ(0);
58
+ -webkit-backface-visibility: hidden;
59
+ backface-visibility: hidden;
60
+ }
61
+ :global(.swiper) :global(.swiper-notification) {
62
+ position: absolute;
63
+ left: 0;
64
+ top: 0;
65
+ pointer-events: none;
66
+ opacity: 0;
67
+ z-index: -1000;
68
+ }
8
69
  }
9
70
 
10
71
  .swiper {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alfalab/core-components-gallery",
3
- "version": "7.1.1",
3
+ "version": "7.1.2-alfasans",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "license": "MIT",
@@ -10,21 +10,21 @@
10
10
  "main": "index.js",
11
11
  "module": "./esm/index.js",
12
12
  "dependencies": {
13
- "@alfalab/core-components-base-modal": "^7.1.2",
14
- "@alfalab/core-components-button": "^13.1.1",
15
- "@alfalab/core-components-icon-button": "^8.0.4",
16
- "@alfalab/core-components-icon-view": "^5.0.2",
17
- "@alfalab/core-components-mq": "^6.0.3",
18
- "@alfalab/core-components-spinner": "^6.0.3",
19
- "@alfalab/core-components-tooltip": "^9.0.7",
20
- "@alfalab/core-components-typography": "^6.0.3",
13
+ "@alfalab/core-components-base-modal": "7.1.2-alfasans",
14
+ "@alfalab/core-components-button": "13.1.1-alfasans",
15
+ "@alfalab/core-components-icon-button": "8.0.4-alfasans",
16
+ "@alfalab/core-components-icon-view": "5.0.2-alfasans",
17
+ "@alfalab/core-components-mq": "6.0.3-alfasans",
18
+ "@alfalab/core-components-spinner": "6.0.3-alfasans",
19
+ "@alfalab/core-components-tooltip": "9.0.7-alfasans",
20
+ "@alfalab/core-components-typography": "6.0.3-alfasans",
21
21
  "@alfalab/hooks": "^1.13.1",
22
22
  "@alfalab/icons-glyph": "^2.260.0",
23
23
  "classnames": "^2.5.1",
24
24
  "element-closest": "^3.0.2",
25
25
  "hls.js": "^1.5.13",
26
26
  "lodash": "^4.17.21",
27
- "swiper": "^6.8.2",
27
+ "swiper": "^12.1.3",
28
28
  "tslib": "^2.4.0"
29
29
  },
30
30
  "peerDependencies": {
@@ -35,6 +35,6 @@
35
35
  "access": "public",
36
36
  "directory": "dist"
37
37
  },
38
- "themesVersion": "15.0.2",
39
- "varsVersion": "11.0.2"
38
+ "themesVersion": "15.0.2-alfasans",
39
+ "varsVersion": "11.0.2-alfasans"
40
40
  }
@@ -1,7 +1,7 @@
1
1
  import React, { type FC, type KeyboardEventHandler, useCallback, useContext, useMemo } from 'react';
2
2
  import cn from 'classnames';
3
- import SwiperCore, { A11y, Controller, EffectFade } from 'swiper';
4
- import { Swiper, SwiperSlide } from 'swiper/react';
3
+ import { A11y, Controller } from 'swiper/modules';
4
+ import { Swiper, type SwiperProps, SwiperSlide } from 'swiper/react';
5
5
 
6
6
  import { useFocus } from '@alfalab/hooks';
7
7
  import { ChevronBackHeavyMIcon } from '@alfalab/icons-glyph/ChevronBackHeavyMIcon';
@@ -13,11 +13,8 @@ import { getImageAlt, getImageKey, isVideo, TestIds } from '../../utils';
13
13
  import { useHandleImageViewer } from './hooks';
14
14
  import { Slide } from './slide';
15
15
 
16
- import 'swiper/swiper.min.css';
17
16
  import styles from './index.module.css';
18
17
 
19
- SwiperCore.use([EffectFade, A11y, Controller]);
20
-
21
18
  export const ImageViewer: FC = () => {
22
19
  const {
23
20
  images,
@@ -65,7 +62,7 @@ export const ImageViewer: FC = () => {
65
62
  }
66
63
  };
67
64
 
68
- const swiperProps = useMemo<Swiper>(
65
+ const swiperProps = useMemo<SwiperProps>(
69
66
  () => ({
70
67
  slidesPerView: 1,
71
68
  effect: 'slide',
@@ -75,6 +72,7 @@ export const ImageViewer: FC = () => {
75
72
  [styles.mobile]: isMobile,
76
73
  [styles.mobileVideo]: isMobile && isVideo(currentImage?.src),
77
74
  }),
75
+ modules: [A11y, Controller],
78
76
  controller: { control: swiper },
79
77
  a11y: {
80
78
  slideRole: 'img',
@@ -5,6 +5,69 @@
5
5
  flex-grow: 1;
6
6
  justify-content: center;
7
7
  background-color: var(--color-static-neutral-0-inverted);
8
+
9
+ /* swiper/swiper.css; */
10
+ :global(.swiper) {
11
+ margin-left: auto;
12
+ margin-right: auto;
13
+ position: relative;
14
+ overflow: hidden;
15
+ list-style: none;
16
+ padding: 0;
17
+ z-index: 1;
18
+ display: block;
19
+ }
20
+ :global(.swiper-wrapper) {
21
+ position: relative;
22
+ width: 100%;
23
+ height: 100%;
24
+ z-index: 1;
25
+ display: flex;
26
+ transition-property: transform;
27
+ transition-timing-function: var(--swiper-wrapper-transition-timing-function, initial);
28
+ box-sizing: content-box;
29
+ }
30
+ :global(.swiper-android) :global(.swiper-slide),
31
+ :global(.swiper-ios) :global(.swiper-slide),
32
+ :global(.swiper-wrapper) {
33
+ transform: translate3d(0, 0, 0);
34
+ }
35
+ :global(.swiper-horizontal) {
36
+ touch-action: pan-y;
37
+ }
38
+ :global(.swiper-slide) {
39
+ flex-shrink: 0;
40
+ width: 100%;
41
+ height: 100%;
42
+ position: relative;
43
+ transition-property: transform;
44
+ display: block;
45
+ }
46
+ :global(.swiper-slide-invisible-blank) {
47
+ visibility: hidden;
48
+ }
49
+ :global(.swiper-autoheight),
50
+ :global(.swiper-autoheight) :global(.swiper-slide) {
51
+ height: auto;
52
+ }
53
+ :global(.swiper-autoheight) :global(.swiper-wrapper) {
54
+ align-items: flex-start;
55
+ transition-property: transform, height;
56
+ }
57
+ :global(.swiper-backface-hidden) :global(.swiper-slide) {
58
+ transform: translateZ(0);
59
+ backface-visibility: hidden;
60
+ }
61
+
62
+ /* swiper/modules/a11y.css */
63
+ :global(.swiper) :global(.swiper-notification) {
64
+ position: absolute;
65
+ left: 0;
66
+ top: 0;
67
+ pointer-events: none;
68
+ opacity: 0;
69
+ z-index: -1000;
70
+ }
8
71
  }
9
72
 
10
73
  .swiper {