@alfalab/core-components-gallery 7.1.10 → 7.2.0-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 (140) hide show
  1. package/Component.js +6 -3
  2. package/Component.js.map +1 -1
  3. package/components/bottom-button/index.css +5 -5
  4. package/components/bottom-button/index.module.css.js +1 -1
  5. package/components/buttons/index.css +5 -5
  6. package/components/buttons/index.module.css.js +1 -1
  7. package/components/header/index.css +1 -1
  8. package/components/header/index.module.css.js +1 -1
  9. package/components/header-info-block/index.css +4 -4
  10. package/components/header-info-block/index.module.css.js +1 -1
  11. package/components/header-mobile/index.css +6 -6
  12. package/components/header-mobile/index.module.css.js +1 -1
  13. package/components/image-preview/index.css +17 -17
  14. package/components/image-preview/index.module.css.js +1 -1
  15. package/components/image-viewer/component.js +30 -21
  16. package/components/image-viewer/component.js.map +1 -1
  17. package/components/image-viewer/index.css +85 -37
  18. package/components/image-viewer/index.module.css.js +1 -1
  19. package/components/image-viewer/index.module.css.js.map +1 -1
  20. package/components/image-viewer/single.js +2 -1
  21. package/components/image-viewer/single.js.map +1 -1
  22. package/components/image-viewer/slide.d.ts +1 -0
  23. package/components/image-viewer/slide.js +17 -13
  24. package/components/image-viewer/slide.js.map +1 -1
  25. package/components/image-viewer/video/index.css +13 -8
  26. package/components/image-viewer/video/index.module.css.js +1 -1
  27. package/components/image-viewer/video/index.module.css.js.map +1 -1
  28. package/components/info-bar/index.css +3 -3
  29. package/components/info-bar/index.module.css.js +1 -1
  30. package/components/navigation-bar/index.css +8 -8
  31. package/components/navigation-bar/index.module.css.js +1 -1
  32. package/components/subtitles/index.css +3 -3
  33. package/components/subtitles/index.module.css.js +1 -1
  34. package/cssm/Component.js +6 -3
  35. package/cssm/Component.js.map +1 -1
  36. package/cssm/components/image-viewer/component.js +30 -21
  37. package/cssm/components/image-viewer/component.js.map +1 -1
  38. package/cssm/components/image-viewer/index.module.css +66 -18
  39. package/cssm/components/image-viewer/single.js +2 -1
  40. package/cssm/components/image-viewer/single.js.map +1 -1
  41. package/cssm/components/image-viewer/slide.d.ts +1 -0
  42. package/cssm/components/image-viewer/slide.js +17 -13
  43. package/cssm/components/image-viewer/slide.js.map +1 -1
  44. package/cssm/components/image-viewer/video/index.module.css +6 -1
  45. package/cssm/index.module.css +2 -0
  46. package/esm/Component.js +6 -3
  47. package/esm/Component.js.map +1 -1
  48. package/esm/components/bottom-button/index.css +5 -5
  49. package/esm/components/bottom-button/index.module.css.js +1 -1
  50. package/esm/components/buttons/index.css +5 -5
  51. package/esm/components/buttons/index.module.css.js +1 -1
  52. package/esm/components/header/index.css +1 -1
  53. package/esm/components/header/index.module.css.js +1 -1
  54. package/esm/components/header-info-block/index.css +4 -4
  55. package/esm/components/header-info-block/index.module.css.js +1 -1
  56. package/esm/components/header-mobile/index.css +6 -6
  57. package/esm/components/header-mobile/index.module.css.js +1 -1
  58. package/esm/components/image-preview/index.css +17 -17
  59. package/esm/components/image-preview/index.module.css.js +1 -1
  60. package/esm/components/image-viewer/component.js +31 -22
  61. package/esm/components/image-viewer/component.js.map +1 -1
  62. package/esm/components/image-viewer/index.css +85 -37
  63. package/esm/components/image-viewer/index.module.css.js +1 -1
  64. package/esm/components/image-viewer/index.module.css.js.map +1 -1
  65. package/esm/components/image-viewer/single.js +3 -2
  66. package/esm/components/image-viewer/single.js.map +1 -1
  67. package/esm/components/image-viewer/slide.d.ts +1 -0
  68. package/esm/components/image-viewer/slide.js +18 -14
  69. package/esm/components/image-viewer/slide.js.map +1 -1
  70. package/esm/components/image-viewer/video/index.css +13 -8
  71. package/esm/components/image-viewer/video/index.module.css.js +1 -1
  72. package/esm/components/image-viewer/video/index.module.css.js.map +1 -1
  73. package/esm/components/info-bar/index.css +3 -3
  74. package/esm/components/info-bar/index.module.css.js +1 -1
  75. package/esm/components/navigation-bar/index.css +8 -8
  76. package/esm/components/navigation-bar/index.module.css.js +1 -1
  77. package/esm/components/subtitles/index.css +3 -3
  78. package/esm/components/subtitles/index.module.css.js +1 -1
  79. package/esm/index.css +11 -9
  80. package/esm/index.module.css.js +1 -1
  81. package/esm/index.module.css.js.map +1 -1
  82. package/index.css +11 -9
  83. package/index.module.css.js +1 -1
  84. package/index.module.css.js.map +1 -1
  85. package/modern/Component.js +6 -3
  86. package/modern/Component.js.map +1 -1
  87. package/modern/components/bottom-button/index.css +5 -5
  88. package/modern/components/bottom-button/index.module.css.js +1 -1
  89. package/modern/components/buttons/index.css +5 -5
  90. package/modern/components/buttons/index.module.css.js +1 -1
  91. package/modern/components/header/index.css +1 -1
  92. package/modern/components/header/index.module.css.js +1 -1
  93. package/modern/components/header-info-block/index.css +4 -4
  94. package/modern/components/header-info-block/index.module.css.js +1 -1
  95. package/modern/components/header-mobile/index.css +6 -6
  96. package/modern/components/header-mobile/index.module.css.js +1 -1
  97. package/modern/components/image-preview/index.css +17 -17
  98. package/modern/components/image-preview/index.module.css.js +1 -1
  99. package/modern/components/image-viewer/component.js +21 -13
  100. package/modern/components/image-viewer/component.js.map +1 -1
  101. package/modern/components/image-viewer/index.css +85 -37
  102. package/modern/components/image-viewer/index.module.css.js +1 -1
  103. package/modern/components/image-viewer/index.module.css.js.map +1 -1
  104. package/modern/components/image-viewer/single.js +3 -2
  105. package/modern/components/image-viewer/single.js.map +1 -1
  106. package/modern/components/image-viewer/slide.d.ts +1 -0
  107. package/modern/components/image-viewer/slide.js +11 -7
  108. package/modern/components/image-viewer/slide.js.map +1 -1
  109. package/modern/components/image-viewer/video/index.css +13 -8
  110. package/modern/components/image-viewer/video/index.module.css.js +1 -1
  111. package/modern/components/image-viewer/video/index.module.css.js.map +1 -1
  112. package/modern/components/info-bar/index.css +3 -3
  113. package/modern/components/info-bar/index.module.css.js +1 -1
  114. package/modern/components/navigation-bar/index.css +8 -8
  115. package/modern/components/navigation-bar/index.module.css.js +1 -1
  116. package/modern/components/subtitles/index.css +3 -3
  117. package/modern/components/subtitles/index.module.css.js +1 -1
  118. package/modern/index.css +11 -9
  119. package/modern/index.module.css.js +1 -1
  120. package/modern/index.module.css.js.map +1 -1
  121. package/moderncssm/Component.js +6 -3
  122. package/moderncssm/Component.js.map +1 -1
  123. package/moderncssm/components/image-viewer/component.js +21 -13
  124. package/moderncssm/components/image-viewer/component.js.map +1 -1
  125. package/moderncssm/components/image-viewer/index.module.css +65 -17
  126. package/moderncssm/components/image-viewer/single.js +3 -2
  127. package/moderncssm/components/image-viewer/single.js.map +1 -1
  128. package/moderncssm/components/image-viewer/slide.d.ts +1 -0
  129. package/moderncssm/components/image-viewer/slide.js +11 -7
  130. package/moderncssm/components/image-viewer/slide.js.map +1 -1
  131. package/moderncssm/components/image-viewer/video/index.module.css +6 -1
  132. package/moderncssm/index.module.css +2 -0
  133. package/package.json +11 -11
  134. package/src/Component.tsx +8 -7
  135. package/src/components/image-viewer/component.tsx +62 -41
  136. package/src/components/image-viewer/index.module.css +60 -15
  137. package/src/components/image-viewer/single.tsx +14 -6
  138. package/src/components/image-viewer/slide.tsx +24 -5
  139. package/src/components/image-viewer/video/index.module.css +5 -1
  140. package/src/index.module.css +2 -0
@@ -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 { 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,E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W,GAAG,IAAI,EAAE,MAAM,IAAI,CAAC;AAErC,YAAA,MAAM,gBAAgB,GAAG,UAAU,GAAG,WAAW;AAEjD,YAAA,MAAM,YAAY,GAAG,KAAK,KAAK,iBAAiB;AAEhD,YAAA,QACI,KAAA,CAAA,aAAA,CAAC,WAAW,EAAA,EACR,GAAG,EAAE,WAAW,CAAC,KAAK,EAAE,KAAK,CAAC,EAC9B,KAAK,EAAE;oBACH,aAAa,EAAE,YAAY,GAAG,MAAM,GAAG,MAAM;AAC7C,oBAAA,kBAAkB,EAAE,SAAS;iBAChC,EAEA,EAAA,CAAC,EAAE,QAAQ,EAAE,MACV,KAAC,CAAA,aAAA,CAAA,KAAK,IACF,QAAQ,EAAE,QAAQ,EAClB,oBAAoB,EAAE,iBAAiB,EACvC,KAAK,EAAE,KAAK,EACZ,eAAe,EAAE,YAAY,EAC7B,IAAI,EAAE,IAAI,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;;;;"}
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 { 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 && currentImage && !isVideo(currentImage.src) && (\n <div className={styles.fullScreenFrame}>\n <Slide\n isActive={true}\n containerAspectRatio={swiperAspectRatio}\n image={currentImage}\n containerHeight={swiperHeight}\n meta={imagesMeta[currentSlideIndex]}\n index={currentSlideIndex}\n imageAspectRatio={\n (imagesMeta[currentSlideIndex]?.width || 1) /\n (imagesMeta[currentSlideIndex]?.height || 1)\n }\n slideVisible={false}\n fullScreen={true}\n />\n </div>\n )}\n\n <div\n className={cn(styles.swiperFrame, {\n [styles.mobile]: isMobile,\n [styles.mobileVideo]: isMobile && isVideo(currentImage?.src),\n [styles.fullScreenFrame]: fullScreen,\n [styles.hiddenFrame]: fullScreen && !isVideo(currentImage?.src),\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 fullScreen={fullScreen && isVideo(image.src)}\n />\n )}\n </SwiperSlide>\n );\n })}\n </Swiper>\n </div>\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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tC,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;;;;"}
@@ -1,5 +1,4 @@
1
1
  :root {
2
- --color-light-base-bg-primary: #fff;
3
2
  --color-light-status-info: #2288fa;
4
3
  --color-static-neutral-0-inverted: #262629;
5
4
  --color-static-neutral-0-inverted-hover: #2f2f32;
@@ -17,6 +16,7 @@
17
16
  --gap-2xs: 4px;
18
17
  --gap-m: 16px;
19
18
  --gap-2xl: 32px;
19
+ --gap-0: 0px;
20
20
  --gap-4: var(--gap-2xs);
21
21
  --gap-16: var(--gap-m);
22
22
  --gap-32: var(--gap-2xl);
@@ -24,10 +24,11 @@
24
24
  :root {
25
25
  --focus-color: var(--color-light-status-info);
26
26
  }
27
- .gallery__component_1gta9 {
27
+ .gallery__component_pbjik {
28
28
  display: flex;
29
29
  flex-grow: 1;
30
30
  justify-content: center;
31
+ min-height: 0;
31
32
  background-color: var(--color-static-neutral-0-inverted);
32
33
  .swiper {
33
34
  margin-left: auto;
@@ -91,47 +92,81 @@
91
92
  z-index: -1000;
92
93
  }
93
94
 
94
- .gallery__swiper_1gta9 {
95
+ .gallery__swiperFrame_pbjik {
95
96
  display: flex;
96
97
  width: 100%;
97
98
  height: 100%;
99
+ min-height: 0;
98
100
  max-height: calc(100vh - 168px);
101
+ max-height: calc(100dvh - 168px);
99
102
  padding: var(--gap-32) var(--gap-16);
100
103
  box-sizing: border-box;
101
104
  }
102
105
 
103
- .gallery__swiper_1gta9.gallery__mobile_1gta9 {
106
+ .gallery__swiperFrame_pbjik.gallery__mobile_pbjik {
104
107
  max-height: calc(100vh - 210px);
108
+ max-height: calc(100dvh - 210px);
105
109
  }
106
110
 
107
- .gallery__swiper_1gta9.gallery__mobileVideo_1gta9 {
111
+ .gallery__swiperFrame_pbjik.gallery__mobileVideo_pbjik {
108
112
  max-height: 100vh;
113
+ max-height: 100dvh;
109
114
  }
110
115
 
111
- .gallery__singleSlideContainer_1gta9 {
116
+ .gallery__fullScreenFrame_pbjik {
117
+ display: flex;
118
+ align-items: center;
119
+ justify-content: center;
120
+ width: 100%;
121
+ height: 100%;
122
+ max-height: none;
123
+ min-height: 0;
124
+ padding: var(--gap-0);
125
+ box-sizing: border-box;
126
+ overflow: hidden;
127
+ }
128
+
129
+ .gallery__hiddenFrame_pbjik {
130
+ flex: 0 0 0;
131
+ width: 0;
132
+ height: 0;
133
+ padding: var(--gap-0);
134
+ overflow: hidden;
135
+ }
136
+
137
+ .gallery__swiper_pbjik {
138
+ width: 100%;
139
+ height: 100%;
140
+ }
141
+
142
+ .gallery__hidden_pbjik {
143
+ display: none;
144
+ }
145
+
146
+ .gallery__singleSlideContainer_pbjik {
112
147
  display: flex;
113
148
  width: 100%;
114
149
  height: 100%;
150
+ min-height: 0;
115
151
 
116
152
  max-height: calc(100vh - 80px);
153
+ max-height: calc(100dvh - 80px);
117
154
  padding: var(--gap-32);
118
155
  box-sizing: border-box;
119
156
  }
120
157
 
121
- .gallery__singleSlideContainer_1gta9.gallery__mobile_1gta9 {
158
+ .gallery__singleSlideContainer_pbjik.gallery__mobile_pbjik {
122
159
  max-height: calc(100vh - 174px);
160
+ max-height: calc(100dvh - 174px);
123
161
  padding: 0;
124
162
  }
125
163
 
126
- .gallery__singleSlideContainer_1gta9.gallery__mobileVideo_1gta9 {
164
+ .gallery__singleSlideContainer_pbjik.gallery__mobileVideo_pbjik {
127
165
  max-height: 100vh;
166
+ max-height: 100dvh;
128
167
  }
129
168
 
130
- .gallery__hidden_1gta9 {
131
- display: none;
132
- }
133
-
134
- .gallery__slide_1gta9 {
169
+ .gallery__slide_pbjik {
135
170
  position: relative;
136
171
  display: flex;
137
172
  justify-content: center;
@@ -140,49 +175,67 @@
140
175
  height: 100%;
141
176
  }
142
177
 
143
- .gallery__slideLoading_1gta9 {
178
+ .gallery__slideLoading_pbjik {
144
179
  background-color: var(--color-static-neutral-translucent-100-inverted);
145
180
  border-radius: var(--border-radius-8);
146
181
  }
147
182
 
148
- .gallery__spinner_1gta9 {
183
+ .gallery__spinner_pbjik {
149
184
  position: absolute;
150
185
  color: var(--color-static-neutral-translucent-1300-inverted);
151
186
  }
152
187
 
153
- .gallery__image_1gta9 {
154
- width: 0;
155
- height: 0;
188
+ .gallery__image_pbjik {
189
+ width: auto;
190
+ height: auto;
191
+ max-width: 100%;
192
+ max-height: 100%;
193
+ -o-object-fit: contain;
194
+ object-fit: contain;
156
195
  -webkit-user-select: none;
157
196
  -moz-user-select: none;
158
197
  user-select: none;
159
198
  border-radius: var(--border-radius-8);
160
199
  }
161
200
 
162
- .gallery__image_1gta9.gallery__mobile_1gta9 {
201
+ .gallery__image_pbjik.gallery__mobile_pbjik {
163
202
  border-radius: var(--border-radius-0);
164
203
  }
165
204
 
166
- .gallery__smallImage_1gta9 {
205
+ .gallery__smallImage_pbjik {
167
206
  position: relative;
168
207
  width: auto;
169
208
  height: auto;
209
+ max-width: 100%;
210
+ max-height: 100%;
211
+ -o-object-fit: contain;
212
+ object-fit: contain;
170
213
  -webkit-user-select: none;
171
214
  -moz-user-select: none;
172
215
  user-select: none;
173
216
  }
174
217
 
175
- .gallery__verticalImageFit_1gta9 {
218
+ .gallery__verticalImageFit_pbjik {
176
219
  width: auto;
177
220
  height: 100%;
178
221
  }
179
222
 
180
- .gallery__horizontalImageFit_1gta9 {
223
+ .gallery__horizontalImageFit_pbjik {
181
224
  width: 100%;
182
225
  height: auto;
183
226
  }
184
227
 
185
- .gallery__arrow_1gta9 {
228
+ .gallery__fullScreenMedia_pbjik {
229
+ width: 100%;
230
+ height: 100%;
231
+ max-width: 100%;
232
+ max-height: 100%;
233
+ -o-object-fit: contain;
234
+ object-fit: contain;
235
+ border-radius: var(--border-radius-0);
236
+ }
237
+
238
+ .gallery__arrow_pbjik {
186
239
  display: flex;
187
240
  flex-direction: column;
188
241
  justify-content: center;
@@ -196,20 +249,20 @@
196
249
  outline: none;
197
250
  }
198
251
 
199
- .gallery__arrow_1gta9:hover {
252
+ .gallery__arrow_pbjik:hover {
200
253
  background-color: var(--color-static-neutral-0-inverted-hover);
201
254
  }
202
255
 
203
- .gallery__arrow_1gta9:active {
256
+ .gallery__arrow_pbjik:active {
204
257
  background-color: var(--color-static-neutral-0-inverted-press);
205
258
  }
206
259
 
207
- .gallery__focused_1gta9 {
260
+ .gallery__focused_pbjik {
208
261
  outline: 2px solid var(--focus-color);
209
262
  outline-offset: 2px;
210
263
  }
211
264
 
212
- .gallery__placeholder_1gta9 {
265
+ .gallery__placeholder_pbjik {
213
266
  display: flex;
214
267
  justify-content: center;
215
268
  align-items: center;
@@ -219,7 +272,7 @@
219
272
  background-color: var(--color-static-neutral-300-inverted);
220
273
  }
221
274
 
222
- .gallery__brokenImgWrapper_1gta9 {
275
+ .gallery__brokenImgWrapper_pbjik {
223
276
  position: relative;
224
277
  display: flex;
225
278
  flex-direction: column;
@@ -228,20 +281,15 @@
228
281
  text-align: center;
229
282
  }
230
283
 
231
- .gallery__brokenImgIcon_1gta9 {
284
+ .gallery__brokenImgIcon_pbjik {
232
285
  width: 80px;
233
286
  height: 80px;
234
287
  margin-bottom: var(--gap-4);
235
288
  }
236
289
 
237
- .gallery__fullScreenImage_1gta9 {
290
+ .gallery__fullScreenVideo_pbjik {
238
291
  width: 100%;
239
- height: auto;
240
- background-color: var(--color-light-base-bg-primary);
241
- }
242
-
243
- .gallery__fullScreenVideo_1gta9 {
244
- width: calc(100% - 192px);
245
- max-height: calc(100vh - 82px);
292
+ height: 100%;
293
+ max-height: none;
246
294
  }
247
295
  }
@@ -1,6 +1,6 @@
1
1
  import './index.css';
2
2
 
3
- const styles = {"component":"gallery__component_1gta9","swiper":"gallery__swiper_1gta9","mobile":"gallery__mobile_1gta9","mobileVideo":"gallery__mobileVideo_1gta9","singleSlideContainer":"gallery__singleSlideContainer_1gta9","hidden":"gallery__hidden_1gta9","slide":"gallery__slide_1gta9","slideLoading":"gallery__slideLoading_1gta9","spinner":"gallery__spinner_1gta9","image":"gallery__image_1gta9","smallImage":"gallery__smallImage_1gta9","verticalImageFit":"gallery__verticalImageFit_1gta9","horizontalImageFit":"gallery__horizontalImageFit_1gta9","arrow":"gallery__arrow_1gta9","focused":"gallery__focused_1gta9","placeholder":"gallery__placeholder_1gta9","brokenImgWrapper":"gallery__brokenImgWrapper_1gta9","brokenImgIcon":"gallery__brokenImgIcon_1gta9","fullScreenImage":"gallery__fullScreenImage_1gta9","fullScreenVideo":"gallery__fullScreenVideo_1gta9"};
3
+ const styles = {"component":"gallery__component_pbjik","swiperFrame":"gallery__swiperFrame_pbjik","mobile":"gallery__mobile_pbjik","mobileVideo":"gallery__mobileVideo_pbjik","fullScreenFrame":"gallery__fullScreenFrame_pbjik","hiddenFrame":"gallery__hiddenFrame_pbjik","swiper":"gallery__swiper_pbjik","hidden":"gallery__hidden_pbjik","singleSlideContainer":"gallery__singleSlideContainer_pbjik","slide":"gallery__slide_pbjik","slideLoading":"gallery__slideLoading_pbjik","spinner":"gallery__spinner_pbjik","image":"gallery__image_pbjik","smallImage":"gallery__smallImage_pbjik","verticalImageFit":"gallery__verticalImageFit_pbjik","horizontalImageFit":"gallery__horizontalImageFit_pbjik","fullScreenMedia":"gallery__fullScreenMedia_pbjik","arrow":"gallery__arrow_pbjik","focused":"gallery__focused_pbjik","placeholder":"gallery__placeholder_pbjik","brokenImgWrapper":"gallery__brokenImgWrapper_pbjik","brokenImgIcon":"gallery__brokenImgIcon_pbjik","fullScreenVideo":"gallery__fullScreenVideo_pbjik"};
4
4
 
5
5
  export { styles as default };
6
6
  //# sourceMappingURL=index.module.css.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.module.css.js","sources":["../../src/components/image-viewer/index.module.css"],"sourcesContent":["@import '@alfalab/core-components-vars/src/index.css';\n\n.component {\n display: flex;\n flex-grow: 1;\n justify-content: center;\n background-color: var(--color-static-neutral-0-inverted);\n\n /* swiper/swiper.css; */\n :global(.swiper) {\n margin-left: auto;\n margin-right: auto;\n position: relative;\n overflow: hidden;\n list-style: none;\n padding: 0;\n z-index: 1;\n display: block;\n }\n :global(.swiper-wrapper) {\n position: relative;\n width: 100%;\n height: 100%;\n z-index: 1;\n display: flex;\n transition-property: transform;\n transition-timing-function: var(--swiper-wrapper-transition-timing-function, initial);\n box-sizing: content-box;\n }\n :global(.swiper-android) :global(.swiper-slide),\n :global(.swiper-ios) :global(.swiper-slide),\n :global(.swiper-wrapper) {\n transform: translate3d(0, 0, 0);\n }\n :global(.swiper-horizontal) {\n touch-action: pan-y;\n }\n :global(.swiper-slide) {\n flex-shrink: 0;\n width: 100%;\n height: 100%;\n position: relative;\n transition-property: transform;\n display: block;\n }\n :global(.swiper-slide-invisible-blank) {\n visibility: hidden;\n }\n :global(.swiper-autoheight),\n :global(.swiper-autoheight) :global(.swiper-slide) {\n height: auto;\n }\n :global(.swiper-autoheight) :global(.swiper-wrapper) {\n align-items: flex-start;\n transition-property: transform, height;\n }\n :global(.swiper-backface-hidden) :global(.swiper-slide) {\n transform: translateZ(0);\n backface-visibility: hidden;\n }\n\n /* swiper/modules/a11y.css */\n :global(.swiper) :global(.swiper-notification) {\n position: absolute;\n left: 0;\n top: 0;\n pointer-events: none;\n opacity: 0;\n z-index: -1000;\n }\n\n .swiper {\n display: flex;\n width: 100%;\n height: 100%;\n\n /* 168px - высота хэдера и футера */\n max-height: calc(100vh - 168px);\n padding: var(--gap-32) var(--gap-16);\n box-sizing: border-box;\n\n &.mobile {\n max-height: calc(100vh - 210px);\n }\n\n &.mobileVideo {\n max-height: 100vh;\n }\n }\n\n .singleSlideContainer {\n display: flex;\n width: 100%;\n height: 100%;\n\n max-height: calc(100vh - 80px);\n padding: var(--gap-32);\n box-sizing: border-box;\n\n &.mobile {\n max-height: calc(100vh - 174px);\n padding: 0;\n }\n\n &.mobileVideo {\n max-height: 100vh;\n }\n }\n\n .hidden {\n display: none;\n }\n\n .slide {\n position: relative;\n display: flex;\n justify-content: center;\n align-items: center;\n width: 100%;\n height: 100%;\n }\n\n .slideLoading {\n background-color: var(--color-static-neutral-translucent-100-inverted);\n border-radius: var(--border-radius-8);\n }\n\n .spinner {\n position: absolute;\n color: var(--color-static-neutral-translucent-1300-inverted);\n }\n\n .image {\n width: 0;\n height: 0;\n user-select: none;\n border-radius: var(--border-radius-8);\n\n &.mobile {\n border-radius: var(--border-radius-0);\n }\n }\n\n .smallImage {\n position: relative;\n width: auto;\n height: auto;\n user-select: none;\n }\n\n .verticalImageFit {\n width: auto;\n height: 100%;\n }\n\n .horizontalImageFit {\n width: 100%;\n height: auto;\n }\n\n .arrow {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n flex-shrink: 0;\n width: 96px;\n height: 100%;\n cursor: pointer;\n color: var(--color-static-neutral-translucent-1300-inverted);\n transition: background-color 0.15s ease-in-out;\n outline: none;\n\n &:hover {\n background-color: var(--color-static-neutral-0-inverted-hover);\n }\n\n &:active {\n background-color: var(--color-static-neutral-0-inverted-press);\n }\n }\n\n .focused {\n @mixin focus-outline;\n }\n\n .placeholder {\n display: flex;\n justify-content: center;\n align-items: center;\n width: 100%;\n height: 100%;\n border-radius: var(--border-radius-8);\n background-color: var(--color-static-neutral-300-inverted);\n }\n\n .brokenImgWrapper {\n position: relative;\n display: flex;\n flex-direction: column;\n align-items: center;\n width: 150px;\n text-align: center;\n }\n\n .brokenImgIcon {\n width: 80px;\n height: 80px;\n margin-bottom: var(--gap-4);\n }\n\n .fullScreenImage {\n width: 100%;\n height: auto;\n background-color: var(--color-light-base-bg-primary);\n }\n\n .fullScreenVideo {\n width: calc(100% - 192px);\n max-height: calc(100vh - 82px);\n }\n}\n"],"names":[],"mappings":";;AAEgB,eAAe,CAAC,WAAW,CAAC,0BAA0B,CAAC,QAAQ,CAAC,uBAAuB,CAAC,QAAQ,CAAC,uBAAuB,CAAC,aAAa,CAAC,4BAA4B,CAAC,sBAAsB,CAAC,qCAAqC,CAAC,QAAQ,CAAC,uBAAuB,CAAC,OAAO,CAAC,sBAAsB,CAAC,cAAc,CAAC,6BAA6B,CAAC,SAAS,CAAC,wBAAwB,CAAC,OAAO,CAAC,sBAAsB,CAAC,YAAY,CAAC,2BAA2B,CAAC,kBAAkB,CAAC,iCAAiC,CAAC,oBAAoB,CAAC,mCAAmC,CAAC,OAAO,CAAC,sBAAsB,CAAC,SAAS,CAAC,wBAAwB,CAAC,aAAa,CAAC,4BAA4B,CAAC,kBAAkB,CAAC,iCAAiC,CAAC,eAAe,CAAC,8BAA8B,CAAC,iBAAiB,CAAC,gCAAgC,CAAC,iBAAiB,CAAC,gCAAgC,CAAC;;;;"}
1
+ {"version":3,"file":"index.module.css.js","sources":["../../src/components/image-viewer/index.module.css"],"sourcesContent":["@import '@alfalab/core-components-vars/src/index.css';\n\n.component {\n display: flex;\n flex-grow: 1;\n justify-content: center;\n min-height: 0;\n background-color: var(--color-static-neutral-0-inverted);\n\n /* swiper/swiper.css; */\n :global(.swiper) {\n margin-left: auto;\n margin-right: auto;\n position: relative;\n overflow: hidden;\n list-style: none;\n padding: 0;\n z-index: 1;\n display: block;\n }\n :global(.swiper-wrapper) {\n position: relative;\n width: 100%;\n height: 100%;\n z-index: 1;\n display: flex;\n transition-property: transform;\n transition-timing-function: var(--swiper-wrapper-transition-timing-function, initial);\n box-sizing: content-box;\n }\n :global(.swiper-android) :global(.swiper-slide),\n :global(.swiper-ios) :global(.swiper-slide),\n :global(.swiper-wrapper) {\n transform: translate3d(0, 0, 0);\n }\n :global(.swiper-horizontal) {\n touch-action: pan-y;\n }\n :global(.swiper-slide) {\n flex-shrink: 0;\n width: 100%;\n height: 100%;\n position: relative;\n transition-property: transform;\n display: block;\n }\n :global(.swiper-slide-invisible-blank) {\n visibility: hidden;\n }\n :global(.swiper-autoheight),\n :global(.swiper-autoheight) :global(.swiper-slide) {\n height: auto;\n }\n :global(.swiper-autoheight) :global(.swiper-wrapper) {\n align-items: flex-start;\n transition-property: transform, height;\n }\n :global(.swiper-backface-hidden) :global(.swiper-slide) {\n transform: translateZ(0);\n backface-visibility: hidden;\n }\n\n /* swiper/modules/a11y.css */\n :global(.swiper) :global(.swiper-notification) {\n position: absolute;\n left: 0;\n top: 0;\n pointer-events: none;\n opacity: 0;\n z-index: -1000;\n }\n\n .swiperFrame {\n display: flex;\n width: 100%;\n height: 100%;\n min-height: 0;\n\n /* 168px - высота хэдера и футера */\n max-height: calc(100vh - 168px);\n max-height: calc(100dvh - 168px);\n padding: var(--gap-32) var(--gap-16);\n box-sizing: border-box;\n\n &.mobile {\n max-height: calc(100vh - 210px);\n max-height: calc(100dvh - 210px);\n }\n\n &.mobileVideo {\n max-height: 100vh;\n max-height: 100dvh;\n }\n }\n\n .fullScreenFrame {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 100%;\n height: 100%;\n max-height: none;\n min-height: 0;\n padding: var(--gap-0);\n box-sizing: border-box;\n overflow: hidden;\n }\n\n .hiddenFrame {\n flex: 0 0 0;\n width: 0;\n height: 0;\n padding: var(--gap-0);\n overflow: hidden;\n }\n\n .swiper {\n width: 100%;\n height: 100%;\n }\n\n .hidden {\n display: none;\n }\n\n .singleSlideContainer {\n display: flex;\n width: 100%;\n height: 100%;\n min-height: 0;\n\n max-height: calc(100vh - 80px);\n max-height: calc(100dvh - 80px);\n padding: var(--gap-32);\n box-sizing: border-box;\n\n &.mobile {\n max-height: calc(100vh - 174px);\n max-height: calc(100dvh - 174px);\n padding: 0;\n }\n\n &.mobileVideo {\n max-height: 100vh;\n max-height: 100dvh;\n }\n }\n\n .slide {\n position: relative;\n display: flex;\n justify-content: center;\n align-items: center;\n width: 100%;\n height: 100%;\n }\n\n .slideLoading {\n background-color: var(--color-static-neutral-translucent-100-inverted);\n border-radius: var(--border-radius-8);\n }\n\n .spinner {\n position: absolute;\n color: var(--color-static-neutral-translucent-1300-inverted);\n }\n\n .image {\n width: auto;\n height: auto;\n max-width: 100%;\n max-height: 100%;\n object-fit: contain;\n user-select: none;\n border-radius: var(--border-radius-8);\n\n &.mobile {\n border-radius: var(--border-radius-0);\n }\n }\n\n .smallImage {\n position: relative;\n width: auto;\n height: auto;\n max-width: 100%;\n max-height: 100%;\n object-fit: contain;\n user-select: none;\n }\n\n .verticalImageFit {\n width: auto;\n height: 100%;\n }\n\n .horizontalImageFit {\n width: 100%;\n height: auto;\n }\n\n .fullScreenMedia {\n width: 100%;\n height: 100%;\n max-width: 100%;\n max-height: 100%;\n object-fit: contain;\n border-radius: var(--border-radius-0);\n }\n\n .arrow {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n flex-shrink: 0;\n width: 96px;\n height: 100%;\n cursor: pointer;\n color: var(--color-static-neutral-translucent-1300-inverted);\n transition: background-color 0.15s ease-in-out;\n outline: none;\n\n &:hover {\n background-color: var(--color-static-neutral-0-inverted-hover);\n }\n\n &:active {\n background-color: var(--color-static-neutral-0-inverted-press);\n }\n }\n\n .focused {\n @mixin focus-outline;\n }\n\n .placeholder {\n display: flex;\n justify-content: center;\n align-items: center;\n width: 100%;\n height: 100%;\n border-radius: var(--border-radius-8);\n background-color: var(--color-static-neutral-300-inverted);\n }\n\n .brokenImgWrapper {\n position: relative;\n display: flex;\n flex-direction: column;\n align-items: center;\n width: 150px;\n text-align: center;\n }\n\n .brokenImgIcon {\n width: 80px;\n height: 80px;\n margin-bottom: var(--gap-4);\n }\n\n .fullScreenVideo {\n width: 100%;\n height: 100%;\n max-height: none;\n }\n}\n"],"names":[],"mappings":";;AAEgB,eAAe,CAAC,WAAW,CAAC,0BAA0B,CAAC,aAAa,CAAC,4BAA4B,CAAC,QAAQ,CAAC,uBAAuB,CAAC,aAAa,CAAC,4BAA4B,CAAC,iBAAiB,CAAC,gCAAgC,CAAC,aAAa,CAAC,4BAA4B,CAAC,QAAQ,CAAC,uBAAuB,CAAC,QAAQ,CAAC,uBAAuB,CAAC,sBAAsB,CAAC,qCAAqC,CAAC,OAAO,CAAC,sBAAsB,CAAC,cAAc,CAAC,6BAA6B,CAAC,SAAS,CAAC,wBAAwB,CAAC,OAAO,CAAC,sBAAsB,CAAC,YAAY,CAAC,2BAA2B,CAAC,kBAAkB,CAAC,iCAAiC,CAAC,oBAAoB,CAAC,mCAAmC,CAAC,iBAAiB,CAAC,gCAAgC,CAAC,OAAO,CAAC,sBAAsB,CAAC,SAAS,CAAC,wBAAwB,CAAC,aAAa,CAAC,4BAA4B,CAAC,kBAAkB,CAAC,iCAAiC,CAAC,eAAe,CAAC,8BAA8B,CAAC,iBAAiB,CAAC,gCAAgC,CAAC;;;;"}
@@ -1,7 +1,7 @@
1
1
  import React, { useContext, useRef } from 'react';
2
2
  import cn from 'classnames';
3
3
  import { GalleryContext } from '../../context.js';
4
- import { isVideo, getImageAlt } from '../../utils/utils.js';
4
+ import { isVideo } from '../../utils/utils.js';
5
5
  import { useHandleImageViewer } from './hooks.js';
6
6
  import { Slide } from './slide.js';
7
7
  import styles from './index.module.css.js';
@@ -21,7 +21,8 @@ const Single = () => {
21
21
  const wrapperAspectRatio = (wrapperRect?.width || 1) / (wrapperRect?.height || 1);
22
22
  return (
23
23
  /* eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions */
24
- React.createElement("div", { className: styles.component, onClick: handleWrapperClick }, fullScreen && !isVideo(currentImage?.src) ? (React.createElement("img", { src: currentImage?.src, alt: currentImage ? getImageAlt(currentImage, currentSlideIndex) : '', className: styles.fullScreenImage })) : (React.createElement("div", { className: cn(styles.singleSlideContainer, {
24
+ React.createElement("div", { className: styles.component, onClick: handleWrapperClick }, fullScreen && !isVideo(currentImage?.src) ? (React.createElement("div", { className: styles.fullScreenFrame },
25
+ React.createElement(Slide, { isActive: true, containerAspectRatio: wrapperAspectRatio, image: currentImage, containerHeight: wrapperRect?.height || 0, meta: currentImageMeta, index: currentSlideIndex, imageAspectRatio: imageAspectRatio, slideVisible: false, fullScreen: true }))) : (React.createElement("div", { className: cn(styles.singleSlideContainer, {
25
26
  [styles.mobile]: isMobile,
26
27
  [styles.mobileVideo]: isMobile && isVideo(currentImage?.src),
27
28
  }), ref: wrapperRef },
@@ -1 +1 @@
1
- {"version":3,"file":"single.js","sources":["../../../src/components/image-viewer/single.tsx"],"sourcesContent":["import React, { type FC, useContext, useRef } from 'react';\nimport cn from 'classnames';\n\nimport { GalleryContext } from '../../context';\nimport { getImageAlt, isVideo } from '../../utils';\n\nimport { useHandleImageViewer } from './hooks';\nimport { Slide } from './slide';\n\nimport styles from './index.module.css';\n\nexport const Single: FC = () => {\n const { fullScreen, currentSlideIndex, getCurrentImage, getCurrentImageMeta } =\n useContext(GalleryContext);\n\n const { handleWrapperClick, isMobile } = useHandleImageViewer();\n\n const wrapperRef = useRef<HTMLDivElement>(null);\n\n const currentImage = getCurrentImage();\n const currentImageMeta = getCurrentImageMeta();\n\n if (!currentImage) return null;\n\n const imageWidth = currentImageMeta?.width || 1;\n const imageHeight = currentImageMeta?.height || 1;\n\n const imageAspectRatio = imageWidth / imageHeight;\n\n const wrapperRect = wrapperRef.current?.getBoundingClientRect();\n\n const wrapperAspectRatio = (wrapperRect?.width || 1) / (wrapperRect?.height || 1);\n\n return (\n /* eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions */\n <div className={styles.component} onClick={handleWrapperClick}>\n {fullScreen && !isVideo(currentImage?.src) ? (\n <img\n src={currentImage?.src}\n alt={currentImage ? getImageAlt(currentImage, currentSlideIndex) : ''}\n className={styles.fullScreenImage}\n />\n ) : (\n <div\n className={cn(styles.singleSlideContainer, {\n [styles.mobile]: isMobile,\n [styles.mobileVideo]: isMobile && isVideo(currentImage?.src),\n })}\n ref={wrapperRef}\n >\n <Slide\n isActive={true}\n containerAspectRatio={wrapperAspectRatio}\n image={currentImage}\n containerHeight={wrapperRect?.height || 0}\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SAAS,EAAE,MAAM,CAAC,eAAe,EACnC,CAAA,KAEF,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EACI,SAAS,EAAE,EAAE,CAAC,MAAM,CAAC,oBAAoB,EAAE;AACvC,YAAA,CAAC,MAAM,CAAC,MAAM,GAAG,QAAQ;AACzB,YAAA,CAAC,MAAM,CAAC,WAAW,GAAG,QAAQ,IAAI,OAAO,CAAC,YAAY,EAAE,GAAG,CAAC;SAC/D,CAAC,EACF,GAAG,EAAE,UAAU,EAAA;AAEf,QAAA,KAAA,CAAA,aAAA,CAAC,KAAK,EACF,EAAA,QAAQ,EAAE,IAAI,EACd,oBAAoB,EAAE,kBAAkB,EACxC,KAAK,EAAE,YAAY,EACnB,eAAe,EAAE,WAAW,EAAE,MAAM,IAAI,CAAC,EACzC,IAAI,EAAE,gBAAgB,EACtB,KAAK,EAAE,iBAAiB,EACxB,gBAAgB,EAAE,gBAAgB,EAClC,YAAY,EAAE,IAAI,EAAA,CACpB,CACA,CACT,CACC;AAEd;;;;"}
1
+ {"version":3,"file":"single.js","sources":["../../../src/components/image-viewer/single.tsx"],"sourcesContent":["import React, { type FC, useContext, useRef } from 'react';\nimport cn from 'classnames';\n\nimport { GalleryContext } from '../../context';\nimport { isVideo } from '../../utils';\n\nimport { useHandleImageViewer } from './hooks';\nimport { Slide } from './slide';\n\nimport styles from './index.module.css';\n\nexport const Single: FC = () => {\n const { fullScreen, currentSlideIndex, getCurrentImage, getCurrentImageMeta } =\n useContext(GalleryContext);\n\n const { handleWrapperClick, isMobile } = useHandleImageViewer();\n\n const wrapperRef = useRef<HTMLDivElement>(null);\n\n const currentImage = getCurrentImage();\n const currentImageMeta = getCurrentImageMeta();\n\n if (!currentImage) return null;\n\n const imageWidth = currentImageMeta?.width || 1;\n const imageHeight = currentImageMeta?.height || 1;\n\n const imageAspectRatio = imageWidth / imageHeight;\n\n const wrapperRect = wrapperRef.current?.getBoundingClientRect();\n\n const wrapperAspectRatio = (wrapperRect?.width || 1) / (wrapperRect?.height || 1);\n\n return (\n /* eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions */\n <div className={styles.component} onClick={handleWrapperClick}>\n {fullScreen && !isVideo(currentImage?.src) ? (\n <div className={styles.fullScreenFrame}>\n <Slide\n isActive={true}\n containerAspectRatio={wrapperAspectRatio}\n image={currentImage}\n containerHeight={wrapperRect?.height || 0}\n meta={currentImageMeta}\n index={currentSlideIndex}\n imageAspectRatio={imageAspectRatio}\n slideVisible={false}\n fullScreen={true}\n />\n </div>\n ) : (\n <div\n className={cn(styles.singleSlideContainer, {\n [styles.mobile]: isMobile,\n [styles.mobileVideo]: isMobile && isVideo(currentImage?.src),\n })}\n ref={wrapperRef}\n >\n <Slide\n isActive={true}\n containerAspectRatio={wrapperAspectRatio}\n image={currentImage}\n containerHeight={wrapperRect?.height || 0}\n meta={currentImageMeta}\n index={currentSlideIndex}\n imageAspectRatio={imageAspectRatio}\n slideVisible={true}\n />\n </div>\n )}\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;;;AAWO,MAAM,MAAM,GAAO,MAAK;AAC3B,IAAA,MAAM,EAAE,UAAU,EAAE,iBAAiB,EAAE,eAAe,EAAE,mBAAmB,EAAE,GACzE,UAAU,CAAC,cAAc,CAAC;IAE9B,MAAM,EAAE,kBAAkB,EAAE,QAAQ,EAAE,GAAG,oBAAoB,EAAE;AAE/D,IAAA,MAAM,UAAU,GAAG,MAAM,CAAiB,IAAI,CAAC;AAE/C,IAAA,MAAM,YAAY,GAAG,eAAe,EAAE;AACtC,IAAA,MAAM,gBAAgB,GAAG,mBAAmB,EAAE;AAE9C,IAAA,IAAI,CAAC,YAAY;AAAE,QAAA,OAAO,IAAI;AAE9B,IAAA,MAAM,UAAU,GAAG,gBAAgB,EAAE,KAAK,IAAI,CAAC;AAC/C,IAAA,MAAM,WAAW,GAAG,gBAAgB,EAAE,MAAM,IAAI,CAAC;AAEjD,IAAA,MAAM,gBAAgB,GAAG,UAAU,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I,EAAE,gBAAgB,EACtB,KAAK,EAAE,iBAAiB,EACxB,gBAAgB,EAAE,gBAAgB,EAClC,YAAY,EAAE,IAAI,EAAA,CACpB,CACA,CACT,CACC;AAEd;;;;"}
@@ -9,6 +9,7 @@ type SlideProps = {
9
9
  index: number;
10
10
  containerHeight: number;
11
11
  slideVisible: boolean;
12
+ fullScreen?: boolean;
12
13
  };
13
14
  export declare const Slide: FC<SlideProps>;
14
15
  export {};
@@ -1,4 +1,4 @@
1
- import React, { useContext } from 'react';
1
+ import React, { useContext, useCallback } from 'react';
2
2
  import cn from 'classnames';
3
3
  import { Spinner } from '@alfalab/core-components-spinner/modern';
4
4
  import { TypographyText } from '@alfalab/core-components-typography/modern';
@@ -24,27 +24,31 @@ const SlideInner = ({ children, broken, loading, isVideoView }) => {
24
24
  broken ? React.createElement("div", { className: styles.placeholder }, content) : content,
25
25
  React.createElement(Spinner, { className: styles.spinner, preset: 48, visible: loading })));
26
26
  };
27
- const Slide = ({ isActive, meta, containerAspectRatio, imageAspectRatio, image, index, containerHeight, slideVisible, }) => {
27
+ const Slide = ({ isActive, meta, containerAspectRatio, imageAspectRatio, image, index, containerHeight, slideVisible, fullScreen, }) => {
28
28
  const { view } = useContext(GalleryContext);
29
29
  const { handleLoad, handleLoadError } = useHandleImageViewer();
30
30
  const broken = Boolean(meta?.broken);
31
31
  const small = isSmallImage(meta);
32
32
  const verticalImageFit = !small && containerAspectRatio > imageAspectRatio;
33
33
  const horizontalImageFit = !small && containerAspectRatio <= imageAspectRatio;
34
+ const handleImageRef = useCallback((node) => {
35
+ if (node?.complete && node.naturalWidth > 0 && !meta) {
36
+ handleLoad({ currentTarget: node }, index);
37
+ }
38
+ }, [handleLoad, index, meta]);
34
39
  if (isVideo(image.src)) {
35
40
  return (React.createElement(SlideInner, { isVideoView: true, active: isActive, broken: broken, loading: !meta },
36
- React.createElement(Video, { url: image.src, index: index, isActive: isActive })));
41
+ React.createElement(Video, { url: image.src, index: index, isActive: isActive, className: cn({ [styles.fullScreenMedia]: fullScreen }) })));
37
42
  }
38
43
  return (React.createElement(SlideInner, { active: isActive, broken: broken, loading: !meta },
39
- React.createElement("img", { src: image.src, alt: getImageAlt(image, index), className: cn({
44
+ React.createElement("img", { ref: handleImageRef, src: image.src, alt: getImageAlt(image, index), className: cn({
40
45
  [styles.smallImage]: small,
41
46
  [styles.image]: !small && meta,
42
47
  [styles.mobile]: view === 'mobile',
48
+ [styles.fullScreenMedia]: fullScreen,
43
49
  [styles.verticalImageFit]: verticalImageFit,
44
50
  [styles.horizontalImageFit]: horizontalImageFit,
45
- }), onLoad: (event) => handleLoad(event, index), onError: () => handleLoadError(index), style: {
46
- maxHeight: `${containerHeight}px`,
47
- }, "data-test-id": slideVisible ? TestIds.ACTIVE_IMAGE : undefined })));
51
+ }), onLoad: (event) => handleLoad(event, index), onError: () => handleLoadError(index), style: fullScreen ? undefined : { maxHeight: `${containerHeight}px` }, "data-test-id": slideVisible ? TestIds.ACTIVE_IMAGE : undefined })));
48
52
  };
49
53
 
50
54
  export { Slide };
@@ -1 +1 @@
1
- {"version":3,"file":"slide.js","sources":["../../../src/components/image-viewer/slide.tsx"],"sourcesContent":["import React, { type FC, type ReactNode, 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};\n\nexport const Slide: FC<SlideProps> = ({\n isActive,\n meta,\n containerAspectRatio,\n imageAspectRatio,\n image,\n index,\n containerHeight,\n slideVisible,\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 if (isVideo(image.src)) {\n return (\n <SlideInner isVideoView={true} active={isActive} broken={broken} loading={!meta}>\n <Video url={image.src} index={index} isActive={isActive} />\n </SlideInner>\n );\n }\n\n return (\n <SlideInner active={isActive} broken={broken} loading={!meta}>\n <img\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.verticalImageFit]: verticalImageFit,\n [styles.horizontalImageFit]: horizontalImageFit,\n })}\n onLoad={(event) => handleLoad(event, index)}\n onError={() => handleLoadError(index)}\n style={{\n maxHeight: `${containerHeight}px`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K,EAAE,QAAQ,EAAE,QAAQ,EAAI,CAAA,CAClD;;AAIrB,IAAA,QACI,KAAA,CAAA,aAAA,CAAC,UAAU,EAAA,EAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,IAAI,EAAA;AACxD,QAAA,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EACI,GAAG,EAAE,KAAK,CAAC,GAAG,EACd,GAAG,EAAE,WAAW,CAAC,KAAK,EAAE,KAAK,CAAC,EAC9B,SAAS,EAAE,EAAE,CAAC;AACV,gBAAA,CAAC,MAAM,CAAC,UAAU,GAAG,KAAK;gBAC1B,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,KAAK,IAAI,IAAI;AAC9B,gBAAA,CAAC,MAAM,CAAC,MAAM,GAAG,IAAI,KAAK,QAAQ;AAClC,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;gBACH,SAAS,EAAE,CAAG,EAAA,eAAe,CAAI,EAAA,CAAA;AACpC,aAAA,EAAA,cAAA,EACa,YAAY,GAAG,OAAO,CAAC,YAAY,GAAG,SAAS,EAC/D,CAAA,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\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,EA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,GAAG,EACd,GAAG,EAAE,WAAW,CAAC,KAAK,EAAE,KAAK,CAAC,EAC9B,SAAS,EAAE,EAAE,CAAC;AACV,gBAAA,CAAC,MAAM,CAAC,UAAU,GAAG,KAAK;gBAC1B,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,KAAK,IAAI,IAAI;AAC9B,gBAAA,CAAC,MAAM,CAAC,MAAM,GAAG,IAAI,KAAK,QAAQ;AAClC,gBAAA,CAAC,MAAM,CAAC,eAAe,GAAG,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;;;;"}
@@ -7,22 +7,27 @@
7
7
  --border-radius-0: 0;
8
8
  --border-radius-24: var(--border-radius-3xl);
9
9
  }
10
- .gallery__videoWrapper_15aby {
10
+ .gallery__videoWrapper_138oj {
11
11
  display: flex;
12
+ align-items: center;
12
13
  justify-content: center;
13
14
  height: 100%;
14
- width: auto;
15
+ width: 100%;
16
+ min-width: 0;
17
+ min-height: 0;
15
18
  position: relative;
16
19
  }
17
- .gallery__video_15aby {
20
+ .gallery__video_138oj {
18
21
  max-width: 100%;
19
22
  max-height: 100%;
23
+ -o-object-fit: contain;
24
+ object-fit: contain;
20
25
  border-radius: var(--border-radius-24);
21
26
  }
22
- .gallery__mobile_15aby {
27
+ .gallery__mobile_138oj {
23
28
  border-radius: var(--border-radius-0);
24
29
  }
25
- .gallery__videoButton_15aby {
30
+ .gallery__videoButton_138oj {
26
31
  position: absolute;
27
32
  top: 50%;
28
33
  left: 50%;
@@ -30,13 +35,13 @@
30
35
  z-index: 1;
31
36
  color: green;
32
37
  }
33
- .gallery__icon_15aby {
38
+ .gallery__icon_138oj {
34
39
  color: var(--color-static-neutral-0);
35
40
  }
36
- .gallery__iconShape_15aby {
41
+ .gallery__iconShape_138oj {
37
42
  fill: var(--color-static-neutral-translucent-700);
38
43
  }
39
- .gallery__bottomButton_15aby {
44
+ .gallery__bottomButton_138oj {
40
45
  position: absolute;
41
46
  bottom: 48px;
42
47
  left: 32px;
@@ -1,6 +1,6 @@
1
1
  import './index.css';
2
2
 
3
- const styles = {"videoWrapper":"gallery__videoWrapper_15aby","video":"gallery__video_15aby","mobile":"gallery__mobile_15aby","videoButton":"gallery__videoButton_15aby","icon":"gallery__icon_15aby","iconShape":"gallery__iconShape_15aby","bottomButton":"gallery__bottomButton_15aby"};
3
+ const styles = {"videoWrapper":"gallery__videoWrapper_138oj","video":"gallery__video_138oj","mobile":"gallery__mobile_138oj","videoButton":"gallery__videoButton_138oj","icon":"gallery__icon_138oj","iconShape":"gallery__iconShape_138oj","bottomButton":"gallery__bottomButton_138oj"};
4
4
 
5
5
  export { styles as default };
6
6
  //# sourceMappingURL=index.module.css.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.module.css.js","sources":["../../../src/components/image-viewer/video/index.module.css"],"sourcesContent":["@import '@alfalab/core-components-vars/src/index.css';\n\n.videoWrapper {\n display: flex;\n justify-content: center;\n height: 100%;\n width: auto;\n position: relative;\n}\n\n.video {\n max-width: 100%;\n max-height: 100%;\n border-radius: var(--border-radius-24);\n}\n\n.mobile {\n border-radius: var(--border-radius-0);\n}\n\n.videoButton {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n z-index: 1;\n color: green;\n}\n\n.icon {\n color: var(--color-static-neutral-0);\n}\n\n.iconShape {\n fill: var(--color-static-neutral-translucent-700);\n}\n\n.bottomButton {\n position: absolute;\n bottom: 48px;\n left: 32px;\n right: 32px;\n}\n"],"names":[],"mappings":";;AAEgB,eAAe,CAAC,cAAc,CAAC,6BAA6B,CAAC,OAAO,CAAC,sBAAsB,CAAC,QAAQ,CAAC,uBAAuB,CAAC,aAAa,CAAC,4BAA4B,CAAC,MAAM,CAAC,qBAAqB,CAAC,WAAW,CAAC,0BAA0B,CAAC,cAAc,CAAC,6BAA6B,CAAC;;;;"}
1
+ {"version":3,"file":"index.module.css.js","sources":["../../../src/components/image-viewer/video/index.module.css"],"sourcesContent":["@import '@alfalab/core-components-vars/src/index.css';\n\n.videoWrapper {\n display: flex;\n align-items: center;\n justify-content: center;\n height: 100%;\n width: 100%;\n min-width: 0;\n min-height: 0;\n position: relative;\n}\n\n.video {\n max-width: 100%;\n max-height: 100%;\n object-fit: contain;\n border-radius: var(--border-radius-24);\n}\n\n.mobile {\n border-radius: var(--border-radius-0);\n}\n\n.videoButton {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n z-index: 1;\n color: green;\n}\n\n.icon {\n color: var(--color-static-neutral-0);\n}\n\n.iconShape {\n fill: var(--color-static-neutral-translucent-700);\n}\n\n.bottomButton {\n position: absolute;\n bottom: 48px;\n left: 32px;\n right: 32px;\n}\n"],"names":[],"mappings":";;AAEgB,eAAe,CAAC,cAAc,CAAC,6BAA6B,CAAC,OAAO,CAAC,sBAAsB,CAAC,QAAQ,CAAC,uBAAuB,CAAC,aAAa,CAAC,4BAA4B,CAAC,MAAM,CAAC,qBAAqB,CAAC,WAAW,CAAC,0BAA0B,CAAC,cAAc,CAAC,6BAA6B,CAAC;;;;"}
@@ -7,10 +7,10 @@
7
7
  --gap-4: var(--gap-2xs);
8
8
  --gap-8: var(--gap-xs);
9
9
  }
10
- .gallery__description_9txux {
10
+ .gallery__description_56ogm {
11
11
  text-align: center;
12
12
  }
13
- .gallery__infoWrapper_9txux {
13
+ .gallery__infoWrapper_56ogm {
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_9txux.gallery__video_9txux {
22
+ .gallery__infoWrapper_56ogm.gallery__video_56ogm {
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_9txux","infoWrapper":"gallery__infoWrapper_9txux","video":"gallery__video_9txux"};
3
+ const styles = {"description":"gallery__description_56ogm","infoWrapper":"gallery__infoWrapper_56ogm","video":"gallery__video_56ogm"};
4
4
 
5
5
  export { styles as default };
6
6
  //# sourceMappingURL=index.module.css.js.map