@alfalab/core-components-gallery 1.2.0 → 2.0.1

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 (104) hide show
  1. package/CHANGELOG.md +64 -0
  2. package/dist/Component.d.ts +2 -0
  3. package/dist/Component.js +4 -3
  4. package/dist/components/header/Component.js +7 -6
  5. package/dist/components/header/buttons.js +1 -1
  6. package/dist/components/header/index.css +3 -3
  7. package/dist/components/header/index.js +2 -1
  8. package/dist/components/header-info-block/Component.js +1 -1
  9. package/dist/components/header-info-block/index.css +5 -5
  10. package/dist/components/image-preview/Component.js +1 -1
  11. package/dist/components/image-preview/index.css +12 -12
  12. package/dist/components/image-viewer/component.js +6 -5
  13. package/dist/components/image-viewer/index.css +19 -19
  14. package/dist/components/image-viewer/index.js +3 -2
  15. package/dist/components/image-viewer/slide.js +2 -1
  16. package/dist/components/index.js +3 -2
  17. package/dist/components/navigation-bar/Component.js +3 -2
  18. package/dist/components/navigation-bar/index.css +6 -6
  19. package/dist/components/navigation-bar/index.js +1 -0
  20. package/dist/cssm/Component.d.ts +2 -0
  21. package/dist/cssm/Component.js +1 -0
  22. package/dist/cssm/components/header/Component.js +5 -4
  23. package/dist/cssm/components/header/index.js +1 -0
  24. package/dist/cssm/components/header/index.module.css +1 -1
  25. package/dist/cssm/components/image-viewer/component.js +4 -3
  26. package/dist/cssm/components/image-viewer/index.js +1 -0
  27. package/dist/cssm/components/image-viewer/slide.d.ts +1 -0
  28. package/dist/cssm/components/image-viewer/slide.js +3 -2
  29. package/dist/cssm/components/index.js +1 -0
  30. package/dist/cssm/components/navigation-bar/Component.js +2 -1
  31. package/dist/cssm/components/navigation-bar/index.js +1 -0
  32. package/dist/cssm/index.d.ts +1 -0
  33. package/dist/cssm/index.js +10 -2
  34. package/dist/cssm/utils/constants.d.ts +11 -0
  35. package/dist/cssm/utils/constants.js +16 -0
  36. package/dist/cssm/utils/index.d.ts +1 -0
  37. package/dist/cssm/utils/index.js +2 -0
  38. package/dist/esm/Component.d.ts +2 -0
  39. package/dist/esm/Component.js +4 -3
  40. package/dist/esm/components/header/Component.js +7 -6
  41. package/dist/esm/components/header/buttons.js +1 -1
  42. package/dist/esm/components/header/index.css +3 -3
  43. package/dist/esm/components/header/index.js +2 -1
  44. package/dist/esm/components/header-info-block/Component.js +1 -1
  45. package/dist/esm/components/header-info-block/index.css +5 -5
  46. package/dist/esm/components/image-preview/Component.js +1 -1
  47. package/dist/esm/components/image-preview/index.css +12 -12
  48. package/dist/esm/components/image-viewer/component.js +6 -5
  49. package/dist/esm/components/image-viewer/index.css +19 -19
  50. package/dist/esm/components/image-viewer/index.js +3 -2
  51. package/dist/esm/components/image-viewer/slide.js +2 -1
  52. package/dist/esm/components/index.js +3 -2
  53. package/dist/esm/components/navigation-bar/Component.js +3 -2
  54. package/dist/esm/components/navigation-bar/index.css +6 -6
  55. package/dist/esm/components/navigation-bar/index.js +1 -0
  56. package/dist/esm/index.css +3 -3
  57. package/dist/esm/index.d.ts +1 -0
  58. package/dist/esm/index.js +5 -4
  59. package/dist/esm/{slide-c6c2a8da.d.ts → slide-d5922694.d.ts} +1 -0
  60. package/dist/esm/{slide-c6c2a8da.js → slide-d5922694.js} +4 -3
  61. package/dist/esm/{tslib.es6-5424b006.d.ts → tslib.es6-a0d8427a.d.ts} +0 -0
  62. package/dist/esm/{tslib.es6-5424b006.js → tslib.es6-a0d8427a.js} +0 -0
  63. package/dist/esm/utils/constants.d.ts +11 -0
  64. package/dist/esm/utils/constants.js +12 -0
  65. package/dist/esm/utils/index.d.ts +1 -0
  66. package/dist/esm/utils/index.js +1 -0
  67. package/dist/index.css +3 -3
  68. package/dist/index.d.ts +1 -0
  69. package/dist/index.js +12 -4
  70. package/dist/modern/Component.d.ts +2 -0
  71. package/dist/modern/Component.js +3 -2
  72. package/dist/modern/components/header/Component.js +6 -5
  73. package/dist/modern/components/header/index.css +3 -3
  74. package/dist/modern/components/header/index.js +1 -0
  75. package/dist/modern/components/header-info-block/Component.js +1 -1
  76. package/dist/modern/components/header-info-block/index.css +5 -5
  77. package/dist/modern/components/image-preview/Component.js +1 -1
  78. package/dist/modern/components/image-preview/index.css +12 -12
  79. package/dist/modern/components/image-viewer/component.js +5 -4
  80. package/dist/modern/components/image-viewer/index.css +19 -19
  81. package/dist/modern/components/image-viewer/index.js +2 -1
  82. package/dist/modern/components/image-viewer/slide.js +2 -1
  83. package/dist/modern/components/index.js +2 -1
  84. package/dist/modern/components/navigation-bar/Component.js +3 -2
  85. package/dist/modern/components/navigation-bar/index.css +6 -6
  86. package/dist/modern/components/navigation-bar/index.js +1 -0
  87. package/dist/modern/index.css +3 -3
  88. package/dist/modern/index.d.ts +1 -0
  89. package/dist/modern/index.js +4 -3
  90. package/dist/modern/{slide-cbb4ff18.d.ts → slide-ed99bfd2.d.ts} +1 -0
  91. package/dist/modern/{slide-cbb4ff18.js → slide-ed99bfd2.js} +4 -3
  92. package/dist/modern/utils/constants.d.ts +11 -0
  93. package/dist/modern/utils/constants.js +12 -0
  94. package/dist/modern/utils/index.d.ts +1 -0
  95. package/dist/modern/utils/index.js +1 -0
  96. package/dist/{slide-a45fd2cc.d.ts → slide-72dcb819.d.ts} +1 -0
  97. package/dist/{slide-a45fd2cc.js → slide-72dcb819.js} +4 -3
  98. package/dist/{tslib.es6-36496c07.d.ts → tslib.es6-404db855.d.ts} +0 -0
  99. package/dist/{tslib.es6-36496c07.js → tslib.es6-404db855.js} +0 -0
  100. package/dist/utils/constants.d.ts +11 -0
  101. package/dist/utils/constants.js +16 -0
  102. package/dist/utils/index.d.ts +1 -0
  103. package/dist/utils/index.js +2 -0
  104. package/package.json +5 -5
@@ -1,4 +1,4 @@
1
- /* hash: 8d9io */
1
+ /* hash: 1nhze */
2
2
  :root {
3
3
  --color-light-bg-primary: #fff;
4
4
  --color-light-border-link: #007aff;
@@ -29,14 +29,14 @@
29
29
  :root {
30
30
  --gallery-broken-image-icon: url('https://alfabank.st/icons/art_no-image_s.svg');
31
31
  }
32
- .gallery__component_8d9io {
32
+ .gallery__component_1pu6o {
33
33
  display: flex;
34
34
  flex-grow: 1;
35
35
  justify-content: center;
36
36
  align-items: center;
37
37
  background-color: var(--color-light-bg-primary-inverted-alpha-50);
38
38
  }
39
- .gallery__swiper_8d9io {
39
+ .gallery__swiper_1pu6o {
40
40
  display: flex;
41
41
  width: 100%;
42
42
  height: 100%;
@@ -46,14 +46,14 @@
46
46
  padding: var(--gap-2xl) var(--gap-m);
47
47
  box-sizing: border-box;
48
48
  }
49
- .gallery__singleSlide_8d9io .gallery__swiper_8d9io {
49
+ .gallery__singleSlide_1pu6o .gallery__swiper_1pu6o {
50
50
  max-height: calc(100vh - 80px);
51
51
  padding: var(--gap-2xl);
52
52
  }
53
- .gallery__hidden_8d9io {
53
+ .gallery__hidden_1pu6o {
54
54
  display: none;
55
55
  }
56
- .gallery__slide_8d9io {
56
+ .gallery__slide_1pu6o {
57
57
  position: relative;
58
58
  display: flex;
59
59
  justify-content: center;
@@ -61,12 +61,12 @@
61
61
  width: 100%;
62
62
  height: 100%;
63
63
  }
64
- .gallery__slideLoading_8d9io {
64
+ .gallery__slideLoading_1pu6o {
65
65
  /* TODO: цвета нет в палитре */
66
66
  background-color: #e9eaeb;
67
67
  border-radius: var(--border-radius-m);
68
68
  }
69
- .gallery__image_8d9io {
69
+ .gallery__image_1pu6o {
70
70
  width: 0;
71
71
  height: 0;
72
72
  -webkit-user-select: none;
@@ -74,7 +74,7 @@
74
74
  background-color: var(--color-light-bg-primary);
75
75
  border-radius: var(--border-radius-m);
76
76
  }
77
- .gallery__smallImage_8d9io {
77
+ .gallery__smallImage_1pu6o {
78
78
  position: relative;
79
79
  width: auto;
80
80
  height: auto;
@@ -82,15 +82,15 @@
82
82
  user-select: none;
83
83
  background-color: var(--color-light-bg-primary);
84
84
  }
85
- .gallery__verticalImageFit_8d9io {
85
+ .gallery__verticalImageFit_1pu6o {
86
86
  width: auto;
87
87
  height: 100%;
88
88
  }
89
- .gallery__horizontalImageFit_8d9io {
89
+ .gallery__horizontalImageFit_1pu6o {
90
90
  width: 100%;
91
91
  height: auto;
92
92
  }
93
- .gallery__arrow_8d9io {
93
+ .gallery__arrow_1pu6o {
94
94
  display: flex;
95
95
  flex-direction: column;
96
96
  justify-content: center;
@@ -103,17 +103,17 @@
103
103
  transition: background-color 0.15s ease-in-out;
104
104
  outline: none
105
105
  }
106
- .gallery__arrow_8d9io:hover {
106
+ .gallery__arrow_1pu6o:hover {
107
107
  background-color: var(--color-light-bg-primary-inverted-alpha-10);
108
108
  }
109
- .gallery__arrow_8d9io:active {
109
+ .gallery__arrow_1pu6o:active {
110
110
  background-color: var(--color-light-bg-primary-inverted-alpha-20);
111
111
  }
112
- .gallery__focused_8d9io {
112
+ .gallery__focused_1pu6o {
113
113
  outline: 2px solid var(--focus-color);
114
114
  outline-offset: 2px;
115
115
  }
116
- .gallery__placeholder_8d9io {
116
+ .gallery__placeholder_1pu6o {
117
117
  display: flex;
118
118
  justify-content: center;
119
119
  align-items: center;
@@ -122,7 +122,7 @@
122
122
  border-radius: var(--border-radius-m);
123
123
  background-color: var(--color-light-bg-primary);
124
124
  }
125
- .gallery__brokenImgWrapper_8d9io {
125
+ .gallery__brokenImgWrapper_1pu6o {
126
126
  position: relative;
127
127
  display: flex;
128
128
  flex-direction: column;
@@ -130,7 +130,7 @@
130
130
  width: 150px;
131
131
  text-align: center;
132
132
  }
133
- .gallery__brokenImgIcon_8d9io {
133
+ .gallery__brokenImgIcon_1pu6o {
134
134
  width: 80px;
135
135
  height: 80px;
136
136
  margin-bottom: var(--gap-2xs);
@@ -138,7 +138,7 @@
138
138
  background-size: contain;
139
139
  background-repeat: no-repeat;
140
140
  }
141
- .gallery__fullScreenImage_8d9io {
141
+ .gallery__fullScreenImage_1pu6o {
142
142
  width: 100%;
143
143
  height: auto;
144
144
  background-color: var(--color-light-bg-primary);
@@ -3,13 +3,14 @@ import 'classnames';
3
3
  import '@alfalab/hooks';
4
4
  import '../../context.js';
5
5
  import '../../utils/utils.js';
6
+ import '../../utils/constants.js';
6
7
  import '@alfalab/core-components-typography/dist/esm';
7
- import '../../tslib.es6-5424b006.js';
8
+ import '../../tslib.es6-a0d8427a.js';
8
9
  import 'swiper';
9
10
  import 'swiper/react';
10
11
  import 'element-closest';
11
12
  import 'swiper/swiper.min.css';
12
13
  import '@alfalab/icons-glyph/ChevronBackHeavyMIcon';
13
14
  import '@alfalab/icons-glyph/ChevronForwardHeavyMIcon';
14
- import '../../slide-c6c2a8da.js';
15
+ import '../../slide-d5922694.js';
15
16
  export { ImageViewer } from './component.js';
@@ -1,5 +1,6 @@
1
1
  import 'react';
2
2
  import 'classnames';
3
3
  import '../../utils/utils.js';
4
+ import '../../utils/constants.js';
4
5
  import '@alfalab/core-components-typography/dist/esm';
5
- export { S as Slide } from '../../slide-c6c2a8da.js';
6
+ export { S as Slide } from '../../slide-d5922694.js';
@@ -6,9 +6,10 @@ export { ImagePreview } from './image-preview/Component.js';
6
6
  export { NavigationBar } from './navigation-bar/Component.js';
7
7
  import '../utils/split-filename.js';
8
8
  import '../utils/utils.js';
9
+ import '../utils/constants.js';
9
10
  import '@alfalab/core-components-typography/dist/esm';
10
11
  import './header-info-block/Component.js';
11
- import '../tslib.es6-5424b006.js';
12
+ import '../tslib.es6-a0d8427a.js';
12
13
  import '@alfalab/core-components-icon-button/dist/esm';
13
14
  import '@alfalab/core-components-tooltip/dist/esm';
14
15
  import '@alfalab/icons-glyph/PointerDownMIcon';
@@ -23,5 +24,5 @@ import 'element-closest';
23
24
  import 'swiper/swiper.min.css';
24
25
  import '@alfalab/icons-glyph/ChevronBackHeavyMIcon';
25
26
  import '@alfalab/icons-glyph/ChevronForwardHeavyMIcon';
26
- import '../slide-c6c2a8da.js';
27
+ import '../slide-d5922694.js';
27
28
  export { ImageViewer } from './image-viewer/component.js';
@@ -4,8 +4,9 @@ import '@alfalab/hooks';
4
4
  import { GalleryContext } from '../../context.js';
5
5
  import { ImagePreview } from '../image-preview/Component.js';
6
6
  import { getImageKey } from '../../utils/utils.js';
7
+ import { TestIds } from '../../utils/constants.js';
7
8
 
8
- var styles = {"component":"gallery__component_1yma8","preview":"gallery__preview_1yma8"};
9
+ var styles = {"component":"gallery__component_1av5e","preview":"gallery__preview_1av5e"};
9
10
  require('./index.css')
10
11
 
11
12
  var MIN_SCROLL_STEP = 24;
@@ -55,7 +56,7 @@ var NavigationBar = function () {
55
56
  }, [currentSlideIndex, handlePreviewPosition, scroll]);
56
57
  return (
57
58
  // eslint-disable-next-line jsx-a11y/no-static-element-interactions
58
- React.createElement("div", { className: styles.component, ref: containerRef, onKeyDown: handleKeyDown }, images.map(function (image, index) {
59
+ React.createElement("div", { className: styles.component, ref: containerRef, onKeyDown: handleKeyDown, "data-test-id": TestIds.NAVIGATION_BAR }, images.map(function (image, index) {
59
60
  var active = index === currentSlideIndex;
60
61
  return (React.createElement(ImagePreview, { key: getImageKey(image, index), image: image, active: active, index: index, onSelect: handlePreviewSelect, className: styles.preview }));
61
62
  })));
@@ -1,4 +1,4 @@
1
- /* hash: 1yma8 */
1
+ /* hash: 11p5o */
2
2
  :root {
3
3
  --color-light-bg-tertiary-inverted: #3c4c5d;
4
4
  }
@@ -14,7 +14,7 @@
14
14
  --gap-3xs: 2px;
15
15
  --gap-xl: 24px;
16
16
  }
17
- .gallery__component_1yma8 {
17
+ .gallery__component_1av5e {
18
18
  display: flex;
19
19
  flex-wrap: nowrap;
20
20
  align-content: center;
@@ -27,16 +27,16 @@
27
27
  background-color: var(--color-light-bg-tertiary-inverted);
28
28
  scrollbar-width: none
29
29
  }
30
- .gallery__component_1yma8::-webkit-scrollbar {
30
+ .gallery__component_1av5e::-webkit-scrollbar {
31
31
  display: none;
32
32
  }
33
- .gallery__preview_1yma8 {
33
+ .gallery__preview_1av5e {
34
34
  flex-shrink: 0;
35
35
  margin: 0 var(--gap-3xs)
36
36
  }
37
- .gallery__preview_1yma8:first-child {
37
+ .gallery__preview_1av5e:first-child {
38
38
  margin-left: auto;
39
39
  }
40
- .gallery__preview_1yma8:last-child {
40
+ .gallery__preview_1av5e:last-child {
41
41
  margin-right: auto;
42
42
  }
@@ -5,3 +5,4 @@ import '../../context.js';
5
5
  import '../image-preview/Component.js';
6
6
  export { NavigationBar } from './Component.js';
7
7
  import '../../utils/utils.js';
8
+ import '../../utils/constants.js';
@@ -1,4 +1,4 @@
1
- /* hash: hrh6l */
1
+ /* hash: mfm0r */
2
2
  :root {
3
3
 
4
4
  /* Hard */
@@ -7,14 +7,14 @@
7
7
 
8
8
  /* Hard up */
9
9
  }
10
- .gallery__container_hrh6l {
10
+ .gallery__container_1j27p {
11
11
  display: flex;
12
12
  flex-direction: column;
13
13
  justify-content: space-between;
14
14
  height: 100%;
15
15
  width: 100%;
16
16
  }
17
- .gallery__modal_hrh6l {
17
+ .gallery__modal_1j27p {
18
18
  flex-grow: 1;
19
19
  width: 100%;
20
20
  background: transparent;
@@ -1 +1,2 @@
1
1
  export * from "./Component";
2
+ export * from "./utils/index";
package/dist/esm/index.js CHANGED
@@ -5,11 +5,12 @@ import '@alfalab/hooks';
5
5
  import './context.js';
6
6
  import './components/image-preview/Component.js';
7
7
  import './components/navigation-bar/Component.js';
8
- import './utils/split-filename.js';
9
- import './utils/utils.js';
8
+ export { splitFilename } from './utils/split-filename.js';
9
+ export { PLACEHOLDER_HEIGHT, PLACEHOLDER_WIDTH, getImageAlt, getImageKey, isSmallImage } from './utils/utils.js';
10
+ export { TestIds } from './utils/constants.js';
10
11
  import '@alfalab/core-components-typography/dist/esm';
11
12
  import './components/header-info-block/Component.js';
12
- import './tslib.es6-5424b006.js';
13
+ import './tslib.es6-a0d8427a.js';
13
14
  import '@alfalab/core-components-icon-button/dist/esm';
14
15
  import '@alfalab/core-components-tooltip/dist/esm';
15
16
  import '@alfalab/icons-glyph/PointerDownMIcon';
@@ -24,6 +25,6 @@ import 'element-closest';
24
25
  import 'swiper/swiper.min.css';
25
26
  import '@alfalab/icons-glyph/ChevronBackHeavyMIcon';
26
27
  import '@alfalab/icons-glyph/ChevronForwardHeavyMIcon';
27
- import './slide-c6c2a8da.js';
28
+ import './slide-d5922694.js';
28
29
  import './components/image-viewer/component.js';
29
30
  export { Gallery } from './Component.js';
@@ -8,6 +8,7 @@ type SlideProps = {
8
8
  imageAspectRatio: number;
9
9
  index: number;
10
10
  swiperHeight: number;
11
+ slideVisible: boolean;
11
12
  handleLoad: (event: SyntheticEvent<HTMLImageElement>, index: number) => void;
12
13
  handleLoadError: (index: number) => void;
13
14
  };
@@ -1,14 +1,15 @@
1
1
  import React from 'react';
2
2
  import cn from 'classnames';
3
3
  import { isSmallImage, getImageAlt } from './utils/utils.js';
4
+ import { TestIds } from './utils/constants.js';
4
5
  import { Typography } from '@alfalab/core-components-typography/dist/esm';
5
6
 
6
- var styles = {"component":"gallery__component_8d9io","swiper":"gallery__swiper_8d9io","singleSlide":"gallery__singleSlide_8d9io","hidden":"gallery__hidden_8d9io","slide":"gallery__slide_8d9io","slideLoading":"gallery__slideLoading_8d9io","image":"gallery__image_8d9io","smallImage":"gallery__smallImage_8d9io","verticalImageFit":"gallery__verticalImageFit_8d9io","horizontalImageFit":"gallery__horizontalImageFit_8d9io","arrow":"gallery__arrow_8d9io","focused":"gallery__focused_8d9io","placeholder":"gallery__placeholder_8d9io","brokenImgWrapper":"gallery__brokenImgWrapper_8d9io","brokenImgIcon":"gallery__brokenImgIcon_8d9io","fullScreenImage":"gallery__fullScreenImage_8d9io"};
7
+ var styles = {"component":"gallery__component_1pu6o","swiper":"gallery__swiper_1pu6o","singleSlide":"gallery__singleSlide_1pu6o","hidden":"gallery__hidden_1pu6o","slide":"gallery__slide_1pu6o","slideLoading":"gallery__slideLoading_1pu6o","image":"gallery__image_1pu6o","smallImage":"gallery__smallImage_1pu6o","verticalImageFit":"gallery__verticalImageFit_1pu6o","horizontalImageFit":"gallery__horizontalImageFit_1pu6o","arrow":"gallery__arrow_1pu6o","focused":"gallery__focused_1pu6o","placeholder":"gallery__placeholder_1pu6o","brokenImgWrapper":"gallery__brokenImgWrapper_1pu6o","brokenImgIcon":"gallery__brokenImgIcon_1pu6o","fullScreenImage":"gallery__fullScreenImage_1pu6o"};
7
8
  require('./components/image-viewer/index.css')
8
9
 
9
10
  var Slide = function (_a) {
10
11
  var _b;
11
- var isActive = _a.isActive, meta = _a.meta, swiperAspectRatio = _a.swiperAspectRatio, imageAspectRatio = _a.imageAspectRatio, image = _a.image, index = _a.index, swiperHeight = _a.swiperHeight, handleLoad = _a.handleLoad, handleLoadError = _a.handleLoadError;
12
+ var isActive = _a.isActive, meta = _a.meta, swiperAspectRatio = _a.swiperAspectRatio, imageAspectRatio = _a.imageAspectRatio, image = _a.image, index = _a.index, swiperHeight = _a.swiperHeight, slideVisible = _a.slideVisible, handleLoad = _a.handleLoad, handleLoadError = _a.handleLoadError;
12
13
  var broken = Boolean(meta === null || meta === void 0 ? void 0 : meta.broken);
13
14
  var small = isSmallImage(meta);
14
15
  var verticalImageFit = !small && swiperAspectRatio > imageAspectRatio;
@@ -21,7 +22,7 @@ var Slide = function (_a) {
21
22
  _b[styles.horizontalImageFit] = horizontalImageFit,
22
23
  _b)), onLoad: function (event) { return handleLoad(event, index); }, onError: function () { return handleLoadError(index); }, style: {
23
24
  maxHeight: swiperHeight + "px",
24
- } })));
25
+ }, "data-test-id": slideVisible ? TestIds.ACTIVE_IMAGE : undefined })));
25
26
  };
26
27
  var SlideInner = function (_a) {
27
28
  var _b;
@@ -0,0 +1,11 @@
1
+ declare const TestIds: {
2
+ ACTIVE_IMAGE: string;
3
+ PREV_SLIDE_BUTTON: string;
4
+ NEXT_SLIDE_BUTTON: string;
5
+ CLOSE_BUTTON: string;
6
+ FULLSCREEN_BUTTON: string;
7
+ EXIT_FULLSCREEN_BUTTON: string;
8
+ DOWNLOAD_BUTTON: string;
9
+ NAVIGATION_BAR: string;
10
+ };
11
+ export { TestIds };
@@ -0,0 +1,12 @@
1
+ var TestIds = {
2
+ ACTIVE_IMAGE: 'active-image',
3
+ PREV_SLIDE_BUTTON: 'prev-slide-button',
4
+ NEXT_SLIDE_BUTTON: 'next-slide-button',
5
+ CLOSE_BUTTON: 'close-button',
6
+ FULLSCREEN_BUTTON: 'fullscreen-button',
7
+ EXIT_FULLSCREEN_BUTTON: 'exit-fullscreen-button',
8
+ DOWNLOAD_BUTTON: 'download-button',
9
+ NAVIGATION_BAR: 'navigation-bar',
10
+ };
11
+
12
+ export { TestIds };
@@ -1,2 +1,3 @@
1
1
  export * from "./split-filename";
2
2
  export * from "./utils";
3
+ export * from "./constants";
@@ -1,2 +1,3 @@
1
1
  export { splitFilename } from './split-filename.js';
2
2
  export { PLACEHOLDER_HEIGHT, PLACEHOLDER_WIDTH, getImageAlt, getImageKey, isSmallImage } from './utils.js';
3
+ export { TestIds } from './constants.js';
package/dist/index.css CHANGED
@@ -1,4 +1,4 @@
1
- /* hash: hrh6l */
1
+ /* hash: mfm0r */
2
2
  :root {
3
3
 
4
4
  /* Hard */
@@ -7,14 +7,14 @@
7
7
 
8
8
  /* Hard up */
9
9
  }
10
- .gallery__container_hrh6l {
10
+ .gallery__container_1j27p {
11
11
  display: flex;
12
12
  flex-direction: column;
13
13
  justify-content: space-between;
14
14
  height: 100%;
15
15
  width: 100%;
16
16
  }
17
- .gallery__modal_hrh6l {
17
+ .gallery__modal_1j27p {
18
18
  flex-grow: 1;
19
19
  width: 100%;
20
20
  background: transparent;
package/dist/index.d.ts CHANGED
@@ -1 +1,2 @@
1
1
  export * from "./Component";
2
+ export * from "./utils/index";
package/dist/index.js CHANGED
@@ -9,11 +9,12 @@ require('@alfalab/hooks');
9
9
  require('./context.js');
10
10
  require('./components/image-preview/Component.js');
11
11
  require('./components/navigation-bar/Component.js');
12
- require('./utils/split-filename.js');
13
- require('./utils/utils.js');
12
+ var utils_splitFilename = require('./utils/split-filename.js');
13
+ var utils_utils = require('./utils/utils.js');
14
+ var utils_constants = require('./utils/constants.js');
14
15
  require('@alfalab/core-components-typography');
15
16
  require('./components/header-info-block/Component.js');
16
- require('./tslib.es6-36496c07.js');
17
+ require('./tslib.es6-404db855.js');
17
18
  require('@alfalab/core-components-icon-button');
18
19
  require('@alfalab/core-components-tooltip');
19
20
  require('@alfalab/icons-glyph/PointerDownMIcon');
@@ -28,10 +29,17 @@ require('element-closest');
28
29
  require('swiper/swiper.min.css');
29
30
  require('@alfalab/icons-glyph/ChevronBackHeavyMIcon');
30
31
  require('@alfalab/icons-glyph/ChevronForwardHeavyMIcon');
31
- require('./slide-a45fd2cc.js');
32
+ require('./slide-72dcb819.js');
32
33
  require('./components/image-viewer/component.js');
33
34
  var Component = require('./Component.js');
34
35
 
35
36
 
36
37
 
38
+ exports.splitFilename = utils_splitFilename.splitFilename;
39
+ exports.PLACEHOLDER_HEIGHT = utils_utils.PLACEHOLDER_HEIGHT;
40
+ exports.PLACEHOLDER_WIDTH = utils_utils.PLACEHOLDER_WIDTH;
41
+ exports.getImageAlt = utils_utils.getImageAlt;
42
+ exports.getImageKey = utils_utils.getImageKey;
43
+ exports.isSmallImage = utils_utils.isSmallImage;
44
+ exports.TestIds = utils_constants.TestIds;
37
45
  exports.Gallery = Component.Gallery;
@@ -11,10 +11,12 @@ type GalleryProps = {
11
11
  images: GalleryImage[];
12
12
  /**
13
13
  * Зациклить галерею
14
+ * @default true
14
15
  */
15
16
  loop?: boolean;
16
17
  /**
17
18
  * Индекс открытого изображение
19
+ * @default 0
18
20
  */
19
21
  initialSlide?: number;
20
22
  /**
@@ -7,6 +7,7 @@ import './components/image-preview/Component.js';
7
7
  import { NavigationBar } from './components/navigation-bar/Component.js';
8
8
  import './utils/split-filename.js';
9
9
  import './utils/utils.js';
10
+ import './utils/constants.js';
10
11
  import '@alfalab/core-components-typography/dist/modern';
11
12
  import './components/header-info-block/Component.js';
12
13
  import '@alfalab/core-components-icon-button/dist/modern';
@@ -23,10 +24,10 @@ import 'element-closest';
23
24
  import 'swiper/swiper.min.css';
24
25
  import '@alfalab/icons-glyph/ChevronBackHeavyMIcon';
25
26
  import '@alfalab/icons-glyph/ChevronForwardHeavyMIcon';
26
- import './slide-cbb4ff18.js';
27
+ import './slide-ed99bfd2.js';
27
28
  import { ImageViewer } from './components/image-viewer/component.js';
28
29
 
29
- var styles = {"container":"gallery__container_hrh6l","modal":"gallery__modal_hrh6l"};
30
+ var styles = {"container":"gallery__container_1j27p","modal":"gallery__modal_1j27p"};
30
31
  require('./index.css')
31
32
 
32
33
  const Backdrop = () => null;
@@ -2,6 +2,7 @@ import React, { useContext, useRef, useEffect } from 'react';
2
2
  import { GalleryContext } from '../../context.js';
3
3
  import '../../utils/split-filename.js';
4
4
  import { isSmallImage } from '../../utils/utils.js';
5
+ import { TestIds } from '../../utils/constants.js';
5
6
  import '@alfalab/core-components-typography/dist/modern';
6
7
  import { HeaderInfoBlock } from '../header-info-block/Component.js';
7
8
  import '@alfalab/core-components-icon-button/dist/modern';
@@ -12,7 +13,7 @@ import '@alfalab/icons-glyph/ArrowsInwardMIcon';
12
13
  import '@alfalab/icons-glyph/CrossMIcon';
13
14
  import { ExitFullscreen, Fullscreen, Download, Exit } from './buttons.js';
14
15
 
15
- var styles = {"component":"gallery__component_3knbd","buttons":"gallery__buttons_3knbd"};
16
+ var styles = {"header":"gallery__header_1awwr","buttons":"gallery__buttons_1awwr"};
16
17
  require('./index.css')
17
18
 
18
19
  const Header = () => {
@@ -38,13 +39,13 @@ const Header = () => {
38
39
  const meta = getCurrentImageMeta();
39
40
  const showFullScreenButton = !isSmallImage(meta) && !meta?.broken;
40
41
  const showDownloadButton = !meta?.broken && canDownload;
41
- const renderToggleFullScreenButton = () => fullScreen ? (React.createElement(ExitFullscreen, { onClick: closeFullScreen, buttonRef: toggleFullScreenButton })) : (React.createElement(Fullscreen, { onClick: openFullScreen, buttonRef: toggleFullScreenButton }));
42
- return (React.createElement("div", { className: styles.component },
42
+ const renderToggleFullScreenButton = () => fullScreen ? (React.createElement(ExitFullscreen, { onClick: closeFullScreen, buttonRef: toggleFullScreenButton, dataTestId: TestIds.EXIT_FULLSCREEN_BUTTON })) : (React.createElement(Fullscreen, { onClick: openFullScreen, buttonRef: toggleFullScreenButton, dataTestId: TestIds.FULLSCREEN_BUTTON }));
43
+ return (React.createElement("div", { className: styles.header },
43
44
  React.createElement(HeaderInfoBlock, { filename: filename, description: description }),
44
45
  React.createElement("div", { className: styles.buttons },
45
46
  showFullScreenButton && renderToggleFullScreenButton(),
46
- showDownloadButton && (React.createElement(Download, { href: currentImage?.src, download: currentImage?.name })),
47
- React.createElement(Exit, { onClick: onClose }))));
47
+ showDownloadButton && (React.createElement(Download, { href: currentImage?.src, download: currentImage?.name, dataTestId: TestIds.DOWNLOAD_BUTTON })),
48
+ React.createElement(Exit, { onClick: onClose, dataTestId: TestIds.CLOSE_BUTTON }))));
48
49
  };
49
50
 
50
51
  export { Header };
@@ -1,4 +1,4 @@
1
- /* hash: 3knbd */
1
+ /* hash: 1q19v */
2
2
  :root {
3
3
  --color-light-bg-tertiary-inverted: #3c4c5d;
4
4
  }
@@ -15,7 +15,7 @@
15
15
  --gap-xl: 24px;
16
16
  --gap-2xl: 32px;
17
17
  }
18
- .gallery__component_3knbd {
18
+ .gallery__header_1awwr {
19
19
  display: flex;
20
20
  justify-content: space-between;
21
21
  flex-shrink: 0;
@@ -24,7 +24,7 @@
24
24
  background-color: var(--color-light-bg-tertiary-inverted);
25
25
  box-sizing: border-box;
26
26
  }
27
- .gallery__buttons_3knbd {
27
+ .gallery__buttons_1awwr {
28
28
  display: flex;
29
29
  padding-left: var(--gap-2xl);
30
30
  }
@@ -2,6 +2,7 @@ import 'react';
2
2
  import '../../context.js';
3
3
  import '../../utils/split-filename.js';
4
4
  import '../../utils/utils.js';
5
+ import '../../utils/constants.js';
5
6
  import '@alfalab/core-components-typography/dist/modern';
6
7
  import '../header-info-block/Component.js';
7
8
  import '@alfalab/core-components-icon-button/dist/modern';
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { splitFilename } from '../../utils/split-filename.js';
3
3
  import { Typography } from '@alfalab/core-components-typography/dist/modern';
4
4
 
5
- var styles = {"info":"gallery__info_1sn36","filenameHead":"gallery__filenameHead_1sn36","filenameContainer":"gallery__filenameContainer_1sn36","description":"gallery__description_1sn36"};
5
+ var styles = {"info":"gallery__info_ls0el","filenameHead":"gallery__filenameHead_ls0el","filenameContainer":"gallery__filenameContainer_ls0el","description":"gallery__description_ls0el"};
6
6
  require('./index.css')
7
7
 
8
8
  const HeaderInfoBlock = ({ filename, description }) => {
@@ -1,4 +1,4 @@
1
- /* hash: 1sn36 */
1
+ /* hash: 66gm4 */
2
2
  :root {
3
3
 
4
4
  /* Hard */
@@ -10,24 +10,24 @@
10
10
  :root {
11
11
  --gap-2xs: 4px;
12
12
  }
13
- .gallery__info_1sn36 {
13
+ .gallery__info_ls0el {
14
14
  height: 100%;
15
15
  display: flex;
16
16
  flex-direction: column;
17
17
  justify-content: center;
18
18
  overflow: hidden;
19
19
  }
20
- .gallery__filenameHead_1sn36 {
20
+ .gallery__filenameHead_ls0el {
21
21
  display: inline;
22
22
  text-overflow: ellipsis;
23
23
  overflow: hidden;
24
24
  white-space: nowrap;
25
25
  }
26
- .gallery__filenameContainer_1sn36 {
26
+ .gallery__filenameContainer_ls0el {
27
27
  overflow: hidden;
28
28
  display: inline-flex;
29
29
  }
30
- .gallery__description_1sn36 {
30
+ .gallery__description_ls0el {
31
31
  display: inline;
32
32
  text-overflow: ellipsis;
33
33
  overflow: hidden;
@@ -3,7 +3,7 @@ import cn from 'classnames';
3
3
  import { useFocus } from '@alfalab/hooks';
4
4
  import { GalleryContext } from '../../context.js';
5
5
 
6
- var styles = {"component":"gallery__component_s0unj","active":"gallery__active_s0unj","image":"gallery__image_s0unj","preview":"gallery__preview_s0unj","loading":"gallery__loading_s0unj","brokenImageWrapper":"gallery__brokenImageWrapper_s0unj","brokenIcon":"gallery__brokenIcon_s0unj","focused":"gallery__focused_s0unj"};
6
+ var styles = {"component":"gallery__component_11679","active":"gallery__active_11679","image":"gallery__image_11679","preview":"gallery__preview_11679","loading":"gallery__loading_11679","brokenImageWrapper":"gallery__brokenImageWrapper_11679","brokenIcon":"gallery__brokenIcon_11679","focused":"gallery__focused_11679"};
7
7
  require('./index.css')
8
8
 
9
9
  const ImagePreview = ({ image, active = false, index, onSelect, className }) => {