@alfalab/core-components-gallery 7.2.0 → 7.2.1-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 (90) 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/index.css +30 -29
  14. package/components/image-viewer/index.module.css.js +1 -1
  15. package/components/image-viewer/index.module.css.js.map +1 -1
  16. package/components/image-viewer/slide.js +2 -1
  17. package/components/image-viewer/slide.js.map +1 -1
  18. package/components/image-viewer/video/index.css +7 -7
  19. package/components/image-viewer/video/index.module.css.js +1 -1
  20. package/components/info-bar/index.css +3 -3
  21. package/components/info-bar/index.module.css.js +1 -1
  22. package/components/navigation-bar/index.css +8 -8
  23. package/components/navigation-bar/index.module.css.js +1 -1
  24. package/components/subtitles/index.css +3 -3
  25. package/components/subtitles/index.module.css.js +1 -1
  26. package/cssm/components/image-viewer/index.module.css +2 -1
  27. package/cssm/components/image-viewer/slide.js +2 -1
  28. package/cssm/components/image-viewer/slide.js.map +1 -1
  29. package/esm/components/bottom-button/index.css +5 -5
  30. package/esm/components/bottom-button/index.module.css.js +1 -1
  31. package/esm/components/buttons/index.css +5 -5
  32. package/esm/components/buttons/index.module.css.js +1 -1
  33. package/esm/components/header/index.css +1 -1
  34. package/esm/components/header/index.module.css.js +1 -1
  35. package/esm/components/header-info-block/index.css +4 -4
  36. package/esm/components/header-info-block/index.module.css.js +1 -1
  37. package/esm/components/header-mobile/index.css +6 -6
  38. package/esm/components/header-mobile/index.module.css.js +1 -1
  39. package/esm/components/image-preview/index.css +17 -17
  40. package/esm/components/image-preview/index.module.css.js +1 -1
  41. package/esm/components/image-viewer/index.css +30 -29
  42. package/esm/components/image-viewer/index.module.css.js +1 -1
  43. package/esm/components/image-viewer/index.module.css.js.map +1 -1
  44. package/esm/components/image-viewer/slide.js +2 -1
  45. package/esm/components/image-viewer/slide.js.map +1 -1
  46. package/esm/components/image-viewer/video/index.css +7 -7
  47. package/esm/components/image-viewer/video/index.module.css.js +1 -1
  48. package/esm/components/info-bar/index.css +3 -3
  49. package/esm/components/info-bar/index.module.css.js +1 -1
  50. package/esm/components/navigation-bar/index.css +8 -8
  51. package/esm/components/navigation-bar/index.module.css.js +1 -1
  52. package/esm/components/subtitles/index.css +3 -3
  53. package/esm/components/subtitles/index.module.css.js +1 -1
  54. package/esm/index.css +9 -9
  55. package/esm/index.module.css.js +1 -1
  56. package/index.css +9 -9
  57. package/index.module.css.js +1 -1
  58. package/modern/components/bottom-button/index.css +5 -5
  59. package/modern/components/bottom-button/index.module.css.js +1 -1
  60. package/modern/components/buttons/index.css +5 -5
  61. package/modern/components/buttons/index.module.css.js +1 -1
  62. package/modern/components/header/index.css +1 -1
  63. package/modern/components/header/index.module.css.js +1 -1
  64. package/modern/components/header-info-block/index.css +4 -4
  65. package/modern/components/header-info-block/index.module.css.js +1 -1
  66. package/modern/components/header-mobile/index.css +6 -6
  67. package/modern/components/header-mobile/index.module.css.js +1 -1
  68. package/modern/components/image-preview/index.css +17 -17
  69. package/modern/components/image-preview/index.module.css.js +1 -1
  70. package/modern/components/image-viewer/index.css +30 -29
  71. package/modern/components/image-viewer/index.module.css.js +1 -1
  72. package/modern/components/image-viewer/index.module.css.js.map +1 -1
  73. package/modern/components/image-viewer/slide.js +2 -1
  74. package/modern/components/image-viewer/slide.js.map +1 -1
  75. package/modern/components/image-viewer/video/index.css +7 -7
  76. package/modern/components/image-viewer/video/index.module.css.js +1 -1
  77. package/modern/components/info-bar/index.css +3 -3
  78. package/modern/components/info-bar/index.module.css.js +1 -1
  79. package/modern/components/navigation-bar/index.css +8 -8
  80. package/modern/components/navigation-bar/index.module.css.js +1 -1
  81. package/modern/components/subtitles/index.css +3 -3
  82. package/modern/components/subtitles/index.module.css.js +1 -1
  83. package/modern/index.css +9 -9
  84. package/modern/index.module.css.js +1 -1
  85. package/moderncssm/components/image-viewer/index.module.css +2 -1
  86. package/moderncssm/components/image-viewer/slide.js +2 -1
  87. package/moderncssm/components/image-viewer/slide.js.map +1 -1
  88. package/package.json +11 -11
  89. package/src/components/image-viewer/index.module.css +2 -1
  90. package/src/components/image-viewer/slide.tsx +3 -1
@@ -7,10 +7,10 @@
7
7
  --gap-4: var(--gap-2xs);
8
8
  --gap-8: var(--gap-xs);
9
9
  }
10
- .gallery__description_kr284 {
10
+ .gallery__description_fw1es {
11
11
  text-align: center;
12
12
  }
13
- .gallery__infoWrapper_kr284 {
13
+ .gallery__infoWrapper_fw1es {
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_kr284.gallery__video_kr284 {
22
+ .gallery__infoWrapper_fw1es.gallery__video_fw1es {
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_kr284","infoWrapper":"gallery__infoWrapper_kr284","video":"gallery__video_kr284"};
3
+ const styles = {"description":"gallery__description_fw1es","infoWrapper":"gallery__infoWrapper_fw1es","video":"gallery__video_fw1es"};
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_1roeg {
16
+ .gallery__component_19am2 {
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_1roeg.gallery__mobile_1roeg {
28
+ .gallery__component_19am2.gallery__mobile_19am2 {
29
29
  padding: var(--gap-8) var(--gap-24);
30
30
  }
31
- .gallery__component_1roeg::-webkit-scrollbar {
31
+ .gallery__component_19am2::-webkit-scrollbar {
32
32
  display: none;
33
33
  }
34
- .gallery__previews_1roeg {
34
+ .gallery__previews_19am2 {
35
35
  display: flex;
36
36
  }
37
- .gallery__preview_1roeg {
37
+ .gallery__preview_19am2 {
38
38
  flex-shrink: 0;
39
39
  margin-right: var(--gap-4);
40
40
  }
41
- .gallery__preview_1roeg.gallery__mobile_1roeg {
41
+ .gallery__preview_19am2.gallery__mobile_19am2 {
42
42
  margin-right: var(--gap-2);
43
43
  }
44
- .gallery__preview_1roeg:first-child {
44
+ .gallery__preview_19am2:first-child {
45
45
  margin-left: auto;
46
46
  }
47
- .gallery__preview_1roeg:last-child {
47
+ .gallery__preview_19am2: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_1roeg","mobile":"gallery__mobile_1roeg","preview":"gallery__preview_1roeg"};
3
+ const styles = {"component":"gallery__component_19am2","mobile":"gallery__mobile_19am2","preview":"gallery__preview_19am2"};
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_9u7yv {
8
+ .gallery__subtitles_4cgc7 {
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_9u7yv.gallery__mobile_9u7yv {
21
+ .gallery__subtitles_4cgc7.gallery__mobile_4cgc7 {
22
22
  position: static;
23
23
  position: initial;
24
24
  }
25
- .gallery__hideSubtitles_9u7yv {
25
+ .gallery__hideSubtitles_4cgc7 {
26
26
  opacity: 0;
27
27
  }
@@ -1,6 +1,6 @@
1
1
  import './index.css';
2
2
 
3
- const styles = {"subtitles":"gallery__subtitles_9u7yv","mobile":"gallery__mobile_9u7yv","hideSubtitles":"gallery__hideSubtitles_9u7yv"};
3
+ const styles = {"subtitles":"gallery__subtitles_4cgc7","mobile":"gallery__mobile_4cgc7","hideSubtitles":"gallery__hideSubtitles_4cgc7"};
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_1wpb9 {
16
+ .gallery__container_eqypj {
17
17
  position: relative;
18
18
  overflow-x: hidden;
19
19
  overflow-y: auto;
@@ -27,17 +27,17 @@
27
27
  padding-top: var(--sat);
28
28
  padding-bottom: var(--sab);
29
29
  }
30
- .gallery__container_1wpb9.gallery__mobile_1wpb9 {
30
+ .gallery__container_eqypj.gallery__mobile_eqypj {
31
31
  overflow: hidden;
32
32
  }
33
- .gallery__modal_1wpb9 {
33
+ .gallery__modal_eqypj {
34
34
  flex-grow: 1;
35
35
  width: 100vw;
36
36
  height: 100vh;
37
37
  height: 100dvh;
38
38
  background: transparent;
39
39
  }
40
- .gallery__navigationVideo_1wpb9 {
40
+ .gallery__navigationVideo_eqypj {
41
41
  z-index: 3;
42
42
  width: 100%;
43
43
  position: absolute;
@@ -46,18 +46,18 @@
46
46
  transition: transform 0.3s ease-in-out;
47
47
  text-align: center;
48
48
  }
49
- .gallery__hide_1wpb9 {
49
+ .gallery__hide_eqypj {
50
50
  transform: translateY(114px);
51
51
  }
52
- .gallery__hideInfo_1wpb9 {
52
+ .gallery__hideInfo_eqypj {
53
53
  transform: translateY(48px);
54
54
  }
55
- .gallery__bottomButton_1wpb9 {
55
+ .gallery__bottomButton_eqypj {
56
56
  width: calc(100% - var(--gap-32));
57
57
  margin: var(--gap-16);
58
58
  background-color: var(--color-static-neutral-translucent-500-inverted);
59
59
  }
60
- .gallery__subtitles_1wpb9 {
60
+ .gallery__subtitles_eqypj {
61
61
  padding: var(--gap-0) var(--gap-32);
62
62
  margin-bottom: var(--gap-16);
63
63
  width: 100%;
@@ -68,6 +68,6 @@
68
68
  opacity 500ms ease-in-out,
69
69
  margin-bottom 270ms ease-in-out;
70
70
  }
71
- .gallery__hideSubtitles_1wpb9 {
71
+ .gallery__hideSubtitles_eqypj {
72
72
  opacity: 0;
73
73
  }
@@ -1,6 +1,6 @@
1
1
  import './index.css';
2
2
 
3
- const styles = {"container":"gallery__container_1wpb9","mobile":"gallery__mobile_1wpb9","modal":"gallery__modal_1wpb9","navigationVideo":"gallery__navigationVideo_1wpb9","hide":"gallery__hide_1wpb9","hideInfo":"gallery__hideInfo_1wpb9","bottomButton":"gallery__bottomButton_1wpb9"};
3
+ const styles = {"container":"gallery__container_eqypj","mobile":"gallery__mobile_eqypj","modal":"gallery__modal_eqypj","navigationVideo":"gallery__navigationVideo_eqypj","hide":"gallery__hide_eqypj","hideInfo":"gallery__hideInfo_eqypj","bottomButton":"gallery__bottomButton_eqypj"};
4
4
 
5
5
  export { styles as default };
6
6
  //# sourceMappingURL=index.module.css.js.map
@@ -70,7 +70,8 @@
70
70
 
71
71
  .swiperFrame {
72
72
  display: flex;
73
- width: 100%;
73
+ flex: 1 1 0;
74
+ min-width: 0;
74
75
  height: 100%;
75
76
  min-height: 0;
76
77
  max-height: calc(100vh - 168px);
@@ -31,6 +31,7 @@ const Slide = ({ isActive, meta, containerAspectRatio, imageAspectRatio, image,
31
31
  const small = isSmallImage(meta);
32
32
  const verticalImageFit = !small && containerAspectRatio > imageAspectRatio;
33
33
  const horizontalImageFit = !small && containerAspectRatio <= imageAspectRatio;
34
+ const imageStyle = fullScreen || !containerHeight ? undefined : { maxHeight: `${containerHeight}px` };
34
35
  const handleImageRef = useCallback((node) => {
35
36
  if (node?.complete && node.naturalWidth > 0 && !meta) {
36
37
  handleLoad({ currentTarget: node }, index);
@@ -48,7 +49,7 @@ const Slide = ({ isActive, meta, containerAspectRatio, imageAspectRatio, image,
48
49
  [styles.fullScreenMedia]: fullScreen,
49
50
  [styles.verticalImageFit]: verticalImageFit,
50
51
  [styles.horizontalImageFit]: horizontalImageFit,
51
- }), onLoad: (event) => handleLoad(event, index), onError: () => handleLoadError(index), style: fullScreen ? undefined : { maxHeight: `${containerHeight}px` }, "data-test-id": slideVisible ? TestIds.ACTIVE_IMAGE : undefined })));
52
+ }), onLoad: (event) => handleLoad(event, index), onError: () => handleLoadError(index), style: imageStyle, "data-test-id": slideVisible ? TestIds.ACTIVE_IMAGE : undefined })));
52
53
  };
53
54
 
54
55
  export { Slide };
@@ -1 +1 @@
1
- {"version":3,"file":"slide.js","sources":["../../../src/components/image-viewer/slide.tsx"],"sourcesContent":["import React, { type FC, type ReactNode, useCallback, useContext } from 'react';\nimport cn from 'classnames';\n\nimport { Spinner } from '@alfalab/core-components-spinner';\nimport { TypographyText } from '@alfalab/core-components-typography';\n\nimport { GalleryContext } from '../../context';\nimport { type GalleryImage, type ImageMeta } from '../../types';\nimport { getImageAlt, isSmallImage, isVideo, TestIds } from '../../utils';\n\nimport { useHandleImageViewer } from './hooks';\nimport { NoImagePaths } from './paths';\nimport { Video } from './video';\n\nimport styles from './index.module.css';\n\ntype SlideInnerProps = {\n active: boolean;\n broken: boolean;\n loading: boolean;\n children: ReactNode;\n isVideoView?: boolean;\n};\n\nconst SlideInner: FC<SlideInnerProps> = ({ children, broken, loading, isVideoView }) => {\n const content = broken ? (\n <div className={styles.brokenImgWrapper}>\n <div className={styles.brokenImgIcon}>\n <svg\n xmlns='http://www.w3.org/2000/svg'\n width='80'\n height='80'\n viewBox='0 0 80 80'\n fill='none'\n >\n <rect width='80' height='80' fill='none' />\n <path\n fillRule='evenodd'\n clipRule='evenodd'\n d={NoImagePaths.baseImage}\n fill='#89898A'\n />\n <path d={NoImagePaths.triangleImage} fill='#89898A' />\n </svg>\n </div>\n\n <TypographyText view='primary-small' color='static-secondary-light'>\n Не удалось загрузить {isVideoView ? 'видео' : 'изображение'}\n </TypographyText>\n </div>\n ) : (\n children\n );\n\n return (\n <div className={cn(styles.slide, { [styles.slideLoading]: loading })}>\n {broken ? <div className={styles.placeholder}>{content}</div> : content}\n <Spinner className={styles.spinner} preset={48} visible={loading} />\n </div>\n );\n};\n\ntype SlideProps = {\n isActive: boolean;\n image: GalleryImage;\n meta?: ImageMeta;\n containerAspectRatio: number;\n imageAspectRatio: number;\n index: number;\n containerHeight: number;\n slideVisible: boolean;\n fullScreen?: boolean;\n};\n\nexport const Slide: FC<SlideProps> = ({\n isActive,\n meta,\n containerAspectRatio,\n imageAspectRatio,\n image,\n index,\n containerHeight,\n slideVisible,\n fullScreen,\n}) => {\n const { view } = useContext(GalleryContext);\n const { handleLoad, handleLoadError } = useHandleImageViewer();\n\n const broken = Boolean(meta?.broken);\n const small = isSmallImage(meta);\n const verticalImageFit = !small && containerAspectRatio > imageAspectRatio;\n const horizontalImageFit = !small && containerAspectRatio <= imageAspectRatio;\n\n const handleImageRef = useCallback(\n (node: HTMLImageElement | null) => {\n if (node?.complete && node.naturalWidth > 0 && !meta) {\n handleLoad(\n { currentTarget: node } as React.SyntheticEvent<HTMLImageElement>,\n index,\n );\n }\n },\n [handleLoad, index, meta],\n );\n\n if (isVideo(image.src)) {\n return (\n <SlideInner isVideoView={true} active={isActive} broken={broken} loading={!meta}>\n <Video\n url={image.src}\n index={index}\n isActive={isActive}\n className={cn({ [styles.fullScreenMedia]: fullScreen })}\n />\n </SlideInner>\n );\n }\n\n return (\n <SlideInner active={isActive} broken={broken} loading={!meta}>\n <img\n ref={handleImageRef}\n src={image.src}\n alt={getImageAlt(image, index)}\n className={cn({\n [styles.smallImage]: small,\n [styles.image]: !small && meta,\n [styles.mobile]: view === 'mobile',\n [styles.fullScreenMedia]: fullScreen,\n [styles.verticalImageFit]: verticalImageFit,\n [styles.horizontalImageFit]: horizontalImageFit,\n })}\n onLoad={(event) => handleLoad(event, index)}\n onError={() => handleLoadError(index)}\n style={fullScreen ? undefined : { maxHeight: `${containerHeight}px` }}\n data-test-id={slideVisible ? TestIds.ACTIVE_IMAGE : undefined}\n />\n </SlideInner>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;AAwBA,MAAM,UAAU,GAAwB,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,KAAI;AACnF,IAAA,MAAM,OAAO,GAAG,MAAM,IAClB,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,MAAM,CAAC,gBAAgB,EAAA;AACnC,QAAA,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,MAAM,CAAC,aAAa,EAAA;AAChC,YAAA,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EACI,KAAK,EAAC,4BAA4B,EAClC,KAAK,EAAC,IAAI,EACV,MAAM,EAAC,IAAI,EACX,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EAAA;gBAEX,KAAM,CAAA,aAAA,CAAA,MAAA,EAAA,EAAA,KAAK,EAAC,IAAI,EAAC,MAAM,EAAC,IAAI,EAAC,IAAI,EAAC,MAAM,EAAG,CAAA;AAC3C,gBAAA,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA,EACI,QAAQ,EAAC,SAAS,EAClB,QAAQ,EAAC,SAAS,EAClB,CAAC,EAAE,YAAY,CAAC,SAAS,EACzB,IAAI,EAAC,SAAS,EAChB,CAAA;gBACF,KAAM,CAAA,aAAA,CAAA,MAAA,EAAA,EAAA,CAAC,EAAE,YAAY,CAAC,aAAa,EAAE,IAA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AG,UAAU;AACpC,gBAAA,CAAC,MAAM,CAAC,gBAAgB,GAAG,gBAAgB;AAC3C,gBAAA,CAAC,MAAM,CAAC,kBAAkB,GAAG,kBAAkB;aAClD,CAAC,EACF,MAAM,EAAE,CAAC,KAAK,KAAK,UAAU,CAAC,KAAK,EAAE,KAAK,CAAC,EAC3C,OAAO,EAAE,MAAM,eAAe,CAAC,KAAK,CAAC,EACrC,KAAK,EAAE,UAAU,GAAG,SAAS,GAAG,EAAE,SAAS,EAAE,CAAA,EAAG,eAAe,CAAA,EAAA,CAAI,EAAE,EAAA,cAAA,EACvD,YAAY,GAAG,OAAO,CAAC,YAAY,GAAG,SAAS,EAAA,CAC/D,CACO;AAErB;;;;"}
1
+ {"version":3,"file":"slide.js","sources":["../../../src/components/image-viewer/slide.tsx"],"sourcesContent":["import React, { type FC, type ReactNode, useCallback, useContext } from 'react';\nimport cn from 'classnames';\n\nimport { Spinner } from '@alfalab/core-components-spinner';\nimport { TypographyText } from '@alfalab/core-components-typography';\n\nimport { GalleryContext } from '../../context';\nimport { type GalleryImage, type ImageMeta } from '../../types';\nimport { getImageAlt, isSmallImage, isVideo, TestIds } from '../../utils';\n\nimport { useHandleImageViewer } from './hooks';\nimport { NoImagePaths } from './paths';\nimport { Video } from './video';\n\nimport styles from './index.module.css';\n\ntype SlideInnerProps = {\n active: boolean;\n broken: boolean;\n loading: boolean;\n children: ReactNode;\n isVideoView?: boolean;\n};\n\nconst SlideInner: FC<SlideInnerProps> = ({ children, broken, loading, isVideoView }) => {\n const content = broken ? (\n <div className={styles.brokenImgWrapper}>\n <div className={styles.brokenImgIcon}>\n <svg\n xmlns='http://www.w3.org/2000/svg'\n width='80'\n height='80'\n viewBox='0 0 80 80'\n fill='none'\n >\n <rect width='80' height='80' fill='none' />\n <path\n fillRule='evenodd'\n clipRule='evenodd'\n d={NoImagePaths.baseImage}\n fill='#89898A'\n />\n <path d={NoImagePaths.triangleImage} fill='#89898A' />\n </svg>\n </div>\n\n <TypographyText view='primary-small' color='static-secondary-light'>\n Не удалось загрузить {isVideoView ? 'видео' : 'изображение'}\n </TypographyText>\n </div>\n ) : (\n children\n );\n\n return (\n <div className={cn(styles.slide, { [styles.slideLoading]: loading })}>\n {broken ? <div className={styles.placeholder}>{content}</div> : content}\n <Spinner className={styles.spinner} preset={48} visible={loading} />\n </div>\n );\n};\n\ntype SlideProps = {\n isActive: boolean;\n image: GalleryImage;\n meta?: ImageMeta;\n containerAspectRatio: number;\n imageAspectRatio: number;\n index: number;\n containerHeight: number;\n slideVisible: boolean;\n fullScreen?: boolean;\n};\n\nexport const Slide: FC<SlideProps> = ({\n isActive,\n meta,\n containerAspectRatio,\n imageAspectRatio,\n image,\n index,\n containerHeight,\n slideVisible,\n fullScreen,\n}) => {\n const { view } = useContext(GalleryContext);\n const { handleLoad, handleLoadError } = useHandleImageViewer();\n\n const broken = Boolean(meta?.broken);\n const small = isSmallImage(meta);\n const verticalImageFit = !small && containerAspectRatio > imageAspectRatio;\n const horizontalImageFit = !small && containerAspectRatio <= imageAspectRatio;\n const imageStyle =\n fullScreen || !containerHeight ? undefined : { maxHeight: `${containerHeight}px` };\n\n const handleImageRef = useCallback(\n (node: HTMLImageElement | null) => {\n if (node?.complete && node.naturalWidth > 0 && !meta) {\n handleLoad(\n { currentTarget: node } as React.SyntheticEvent<HTMLImageElement>,\n index,\n );\n }\n },\n [handleLoad, index, meta],\n );\n\n if (isVideo(image.src)) {\n return (\n <SlideInner isVideoView={true} active={isActive} broken={broken} loading={!meta}>\n <Video\n url={image.src}\n index={index}\n isActive={isActive}\n className={cn({ [styles.fullScreenMedia]: fullScreen })}\n />\n </SlideInner>\n );\n }\n\n return (\n <SlideInner active={isActive} broken={broken} loading={!meta}>\n <img\n ref={handleImageRef}\n src={image.src}\n alt={getImageAlt(image, index)}\n className={cn({\n [styles.smallImage]: small,\n [styles.image]: !small && meta,\n [styles.mobile]: view === 'mobile',\n [styles.fullScreenMedia]: fullScreen,\n [styles.verticalImageFit]: verticalImageFit,\n [styles.horizontalImageFit]: horizontalImageFit,\n })}\n onLoad={(event) => handleLoad(event, index)}\n onError={() => handleLoadError(index)}\n style={imageStyle}\n data-test-id={slideVisible ? TestIds.ACTIVE_IMAGE : undefined}\n />\n </SlideInner>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;AAwBA,MAAM,UAAU,GAAwB,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,KAAI;AACnF,IAAA,MAAM,OAAO,GAAG,MAAM,IAClB,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,MAAM,CAAC,gBAAgB,EAAA;AACnC,QAAA,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,MAAM,CAAC,aAAa,EAAA;AAChC,YAAA,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EACI,KAAK,EAAC,4BAA4B,EAClC,KAAK,EAAC,IAAI,EACV,MAAM,EAAC,IAAI,EACX,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EAAA;gBAEX,KAAM,CAAA,aAAA,CAAA,MAAA,EAAA,EAAA,KAAK,EAAC,IAAI,EAAC,MAAM,EAAC,IAAI,EAAC,IAAI,EAAC,MAAM,EAAG,CAAA;AAC3C,gBAAA,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA,EACI,QAAQ,EAAC,SAAS,EAClB,QAAQ,EAAC,SAAS,EAClB,CAAC,EAAE,YAAY,CAAC,SAAS,EACzB,IAAI,EAAC,SAAS,EAChB,CAAA;gBACF,KAAM,CAAA,aAAA,CAAA,MAAA,EAAA,EAAA,CAAC,EAAE,YAAY,CAAC,aAAa,EAAE,IAAI,EAAC,SAAS,EAAG,CAAA,CACpD,CACJ;QAEN,KAAC,CAAA,aAAA,CAAA,cAAc,IAAC,IAAI,EAAC,eAAe,EAAC,KAAK,EAAC,wBAAwB,EAAA;;AACzC,YAAA,WAAW,GAAG,OAAO,GAAG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gB,GAAG,gBAAgB;AAC3C,gBAAA,CAAC,MAAM,CAAC,kBAAkB,GAAG,kBAAkB;AAClD,aAAA,CAAC,EACF,MAAM,EAAE,CAAC,KAAK,KAAK,UAAU,CAAC,KAAK,EAAE,KAAK,CAAC,EAC3C,OAAO,EAAE,MAAM,eAAe,CAAC,KAAK,CAAC,EACrC,KAAK,EAAE,UAAU,EACH,cAAA,EAAA,YAAY,GAAG,OAAO,CAAC,YAAY,GAAG,SAAS,EAC/D,CAAA,CACO;AAErB;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alfalab/core-components-gallery",
3
- "version": "7.2.0",
3
+ "version": "7.2.1-alfasans",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "license": "MIT",
@@ -13,14 +13,14 @@
13
13
  "build": "rollup -c ../../tools/rollup/rollup.config.mjs --silent"
14
14
  },
15
15
  "dependencies": {
16
- "@alfalab/core-components-base-modal": "^7.1.7",
17
- "@alfalab/core-components-button": "^13.2.1",
18
- "@alfalab/core-components-icon-button": "^8.0.9",
19
- "@alfalab/core-components-icon-view": "^5.0.4",
20
- "@alfalab/core-components-mq": "^6.0.6",
21
- "@alfalab/core-components-spinner": "^6.0.6",
22
- "@alfalab/core-components-tooltip": "^9.0.16",
23
- "@alfalab/core-components-typography": "^6.0.9",
16
+ "@alfalab/core-components-base-modal": "7.1.7-alfasans",
17
+ "@alfalab/core-components-button": "13.2.1-alfasans",
18
+ "@alfalab/core-components-icon-button": "8.0.9-alfasans",
19
+ "@alfalab/core-components-icon-view": "5.0.4-alfasans",
20
+ "@alfalab/core-components-mq": "6.0.6-alfasans",
21
+ "@alfalab/core-components-spinner": "6.0.6-alfasans",
22
+ "@alfalab/core-components-tooltip": "9.0.16-alfasans",
23
+ "@alfalab/core-components-typography": "6.0.9-alfasans",
24
24
  "@alfalab/hooks": "^1.17.0",
25
25
  "@alfalab/icons-glyph": "^2.260.0",
26
26
  "classnames": "^2.5.1",
@@ -38,6 +38,6 @@
38
38
  "access": "public",
39
39
  "directory": "dist"
40
40
  },
41
- "themesVersion": "15.2.0",
42
- "varsVersion": "11.1.0"
41
+ "themesVersion": "15.2.0-alfasans",
42
+ "varsVersion": "11.1.0-alfasans"
43
43
  }
@@ -72,7 +72,8 @@
72
72
 
73
73
  .swiperFrame {
74
74
  display: flex;
75
- width: 100%;
75
+ flex: 1 1 0;
76
+ min-width: 0;
76
77
  height: 100%;
77
78
  min-height: 0;
78
79
 
@@ -90,6 +90,8 @@ export const Slide: FC<SlideProps> = ({
90
90
  const small = isSmallImage(meta);
91
91
  const verticalImageFit = !small && containerAspectRatio > imageAspectRatio;
92
92
  const horizontalImageFit = !small && containerAspectRatio <= imageAspectRatio;
93
+ const imageStyle =
94
+ fullScreen || !containerHeight ? undefined : { maxHeight: `${containerHeight}px` };
93
95
 
94
96
  const handleImageRef = useCallback(
95
97
  (node: HTMLImageElement | null) => {
@@ -132,7 +134,7 @@ export const Slide: FC<SlideProps> = ({
132
134
  })}
133
135
  onLoad={(event) => handleLoad(event, index)}
134
136
  onError={() => handleLoadError(index)}
135
- style={fullScreen ? undefined : { maxHeight: `${containerHeight}px` }}
137
+ style={imageStyle}
136
138
  data-test-id={slideVisible ? TestIds.ACTIVE_IMAGE : undefined}
137
139
  />
138
140
  </SlideInner>