@hh.ru/magritte-ui-media-viewer 1.0.7 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/index.css +166 -88
  2. package/index.d.ts +3 -4
  3. package/index.js +25 -19
  4. package/index.js.map +1 -1
  5. package/index.mock.d.ts +9 -0
  6. package/index.mock.js +55 -0
  7. package/index.mock.js.map +1 -0
  8. package/internal/Counter.js +9 -5
  9. package/internal/Counter.js.map +1 -1
  10. package/internal/GalleryItemBody.d.ts +2 -0
  11. package/internal/GalleryItemBody.js +41 -23
  12. package/internal/GalleryItemBody.js.map +1 -1
  13. package/internal/ImagesLoader.d.ts +1 -1
  14. package/internal/ImagesLoader.js +16 -6
  15. package/internal/ImagesLoader.js.map +1 -1
  16. package/internal/PreviewItem.js +3 -2
  17. package/internal/PreviewItem.js.map +1 -1
  18. package/internal/PreviewItemBody.js +28 -16
  19. package/internal/PreviewItemBody.js.map +1 -1
  20. package/internal/PreviewZoomControl.js +42 -16
  21. package/internal/PreviewZoomControl.js.map +1 -1
  22. package/internal/animations.d.ts +1 -0
  23. package/internal/animations.js +12 -0
  24. package/internal/animations.js.map +1 -0
  25. package/internal/context.d.ts +28 -9
  26. package/internal/context.js +54 -9
  27. package/internal/context.js.map +1 -1
  28. package/internal/hooks/useAutoHideTools.d.ts +2 -1
  29. package/internal/hooks/useAutoHideTools.js +23 -6
  30. package/internal/hooks/useAutoHideTools.js.map +1 -1
  31. package/internal/hooks/useDoubleTapScale.js +8 -3
  32. package/internal/hooks/useDoubleTapScale.js.map +1 -1
  33. package/internal/hooks/useGalleryItemController.d.ts +8 -8
  34. package/internal/hooks/useGalleryItemController.js +27 -14
  35. package/internal/hooks/useGalleryItemController.js.map +1 -1
  36. package/internal/hooks/usePan.d.ts +2 -2
  37. package/internal/hooks/usePan.js +2 -0
  38. package/internal/hooks/usePan.js.map +1 -1
  39. package/internal/hooks/usePinchToZoom.d.ts +2 -6
  40. package/internal/hooks/usePinchToZoom.js +4 -8
  41. package/internal/hooks/usePinchToZoom.js.map +1 -1
  42. package/internal/hooks/useSwipe.js +8 -2
  43. package/internal/hooks/useSwipe.js.map +1 -1
  44. package/internal/hooks/useSwipeToClose.d.ts +1 -1
  45. package/internal/hooks/useSwipeToClose.js +55 -33
  46. package/internal/hooks/useSwipeToClose.js.map +1 -1
  47. package/internal/hooks/useTapToToggleTools.js +4 -1
  48. package/internal/hooks/useTapToToggleTools.js.map +1 -1
  49. package/internal/hooks/useVirtualization.js +2 -0
  50. package/internal/hooks/useVirtualization.js.map +1 -1
  51. package/internal/hooks/useWheelToZoom.d.ts +2 -6
  52. package/internal/hooks/useWheelToZoom.js +6 -10
  53. package/internal/hooks/useWheelToZoom.js.map +1 -1
  54. package/internal/utils.d.ts +5 -2
  55. package/internal/utils.js +19 -5
  56. package/internal/utils.js.map +1 -1
  57. package/media-viewer-EEyLOGS2.js +5 -0
  58. package/media-viewer-EEyLOGS2.js.map +1 -0
  59. package/package.json +12 -7
  60. package/public/Footer.d.ts +2 -0
  61. package/public/Footer.js +10 -0
  62. package/public/Footer.js.map +1 -0
  63. package/public/Gallery.js +46 -16
  64. package/public/Gallery.js.map +1 -1
  65. package/public/GalleryItem.d.ts +2 -2
  66. package/public/GalleryItem.js +8 -3
  67. package/public/GalleryItem.js.map +1 -1
  68. package/public/Header.d.ts +2 -0
  69. package/public/Header.js +10 -0
  70. package/public/Header.js.map +1 -0
  71. package/public/MediaViewer.d.ts +13 -2
  72. package/public/MediaViewer.js +299 -65
  73. package/public/MediaViewer.js.map +1 -1
  74. package/public/Preview.d.ts +2 -6
  75. package/public/Preview.js +22 -15
  76. package/public/Preview.js.map +1 -1
  77. package/public/Toolbar.d.ts +6 -6
  78. package/public/Toolbar.js +12 -8
  79. package/public/Toolbar.js.map +1 -1
  80. package/public/Tools.d.ts +2 -0
  81. package/public/Tools.js +11 -2
  82. package/public/Tools.js.map +1 -1
  83. package/internal/ObservableValue.d.ts +0 -9
  84. package/internal/ObservableValue.js +0 -29
  85. package/internal/ObservableValue.js.map +0 -1
  86. package/media-viewer-BNuKXbLq.js +0 -5
  87. package/media-viewer-BNuKXbLq.js.map +0 -1
package/index.css CHANGED
@@ -1,32 +1,45 @@
1
- .magritte-media-viewer___KnrXP_1-0-7{
1
+ :root{
2
+ --magritte-color-background-overlay-viewer-v24-4-0:#000000;
3
+ --magritte-color-background-overlay-toolbar-v24-4-0:#000000a3;
4
+ --magritte-color-component-skeleton-background-content-v24-4-0:#8293a23d;;
5
+ --magritte-gradient-component-media-viewer-background-fade-v24-4-0:#00000000 0%, #00000052 100%;
6
+ }
7
+
8
+ :root{
9
+ --magritte-semantic-animation-time-m-duration-v24-4-0:400ms;
10
+ --magritte-semantic-animation-ease-base-timing-function-v24-4-0:cubic-bezier(0.4, 0.24, 0, 1);
11
+ }
12
+
13
+ .magritte-night-theme{
14
+ --magritte-color-component-skeleton-background-content-v24-4-0:#5e5e5e3d;
15
+ }
16
+ .magritte-media-viewer___KnrXP_1-2-0{
2
17
  position:fixed;
3
18
  inset:0;
4
- display:flex;
19
+ display:grid;
20
+ grid-template-rows:auto 1fr auto;
5
21
  flex-direction:column;
6
22
  touch-action:none;
7
23
  user-select:none;
8
- --magritte-ui-nav-bar-background-color-override:var(--magritte-color-background-overlay-toolbar-v24-3-0);
24
+ --media-viewer-toolbars-opacity:calc(1 - var(--magritte-ui-media-viewer-close-progress) - var(--magritte-ui-media-viewer-hide-tools-progress));
25
+ --media-viewer-background-opacity:calc(1 - var(--magritte-ui-media-viewer-close-progress));
26
+ --magritte-ui-nav-bar-background-color-override:var(--magritte-color-background-overlay-toolbar-v24-4-0);
9
27
  }
10
- .magritte-media-viewer___KnrXP_1-0-7::before{
28
+ .magritte-media-viewer___KnrXP_1-2-0::before{
11
29
  content:'';
12
30
  position:absolute;
13
31
  inset:0;
14
- background:var(--magritte-color-background-overlay-viewer-v24-3-0);
15
- opacity:calc(1 - var(--magritte-ui-media-viewer-close-progress));
32
+ background:var(--magritte-color-background-overlay-viewer-v24-4-0);
33
+ opacity:var(--media-viewer-background-opacity);
16
34
  pointer-events:none;
17
35
  }
18
- .magritte-media-viewer-nav-bar___JcBBD_1-0-7{
19
- z-index:2;
20
- opacity:calc(1 - var(--magritte-ui-media-viewer-close-progress) - var(--magritte-ui-media-viewer-hide-tools-progress));
21
- transform:translateY(calc(var(--magritte-ui-media-viewer-hide-tools-progress) * -100%));
22
- }
23
- .magritte-gallery-placeholder___rUoGL_1-0-7{
36
+ .magritte-gallery-placeholder___rUoGL_1-2-0{
24
37
  display:flex;
25
- flex-grow:1;
26
- order:1;
27
38
  align-items:stretch;
39
+ grid-row:2;
40
+ min-height:0;
28
41
  }
29
- .magritte-media-viewer-gallery___P0SnN_1-0-7{
42
+ .magritte-media-viewer-gallery___P0SnN_1-2-0{
30
43
  display:grid;
31
44
  flex-grow:1;
32
45
  contain:layout size;
@@ -35,23 +48,25 @@
35
48
  inset:0;
36
49
  }
37
50
  @media (min-width: 1020px){
38
- body.magritte-old-layout .magritte-media-viewer-gallery___P0SnN_1-0-7{
51
+ body.magritte-old-layout .magritte-media-viewer-gallery___P0SnN_1-2-0{
39
52
  position:relative;
40
53
  }
41
54
  }
42
55
  @media (min-width: 1024px){
43
- body:not(.magritte-old-layout) .magritte-media-viewer-gallery___P0SnN_1-0-7{
56
+ body:not(.magritte-old-layout) .magritte-media-viewer-gallery___P0SnN_1-2-0{
44
57
  position:relative;
45
58
  }
46
59
  }
47
- .magritte-gallery-item___Js0Z5_1-0-7{
60
+ .magritte-gallery-item___Js0Z5_1-2-0{
61
+ position:relative;
48
62
  grid-area:1 / 1;
49
63
  contain:size;
50
64
  touch-action:none;
51
65
  overflow-x:clip;
52
66
  overflow-y:visible;
67
+ opacity:calc(1 - var(--magritte-ui-media-viewer-image-close-progress, 0));
53
68
  }
54
- .magritte-gallery-item-transform-container___N8-sA_1-0-7{
69
+ .magritte-gallery-item-transform-container___N8-sA_1-2-0{
55
70
  position:absolute;
56
71
  top:50%;
57
72
  left:50%;
@@ -59,99 +74,104 @@
59
74
  will-change:transform;
60
75
  touch-action:none;
61
76
  }
62
- .magritte-preview-counter___uP2Hc_1-0-7{
77
+ .magritte-preview-counter___uP2Hc_1-2-0{
63
78
  min-width:0;
64
79
  text-align:center;
65
80
  }
66
81
  @media (min-width: 1020px){
67
- body.magritte-old-layout .magritte-preview-counter___uP2Hc_1-0-7{
82
+ body.magritte-old-layout .magritte-preview-counter___uP2Hc_1-2-0{
68
83
  text-align:left;
69
84
  }
70
85
  }
71
86
  @media (min-width: 1024px){
72
- body:not(.magritte-old-layout) .magritte-preview-counter___uP2Hc_1-0-7{
87
+ body:not(.magritte-old-layout) .magritte-preview-counter___uP2Hc_1-2-0{
73
88
  text-align:left;
74
89
  }
75
90
  }
76
- .magritte-preview-counter___uP2Hc_1-0-7.magritte-with-description___-w7ld_1-0-7{
91
+ .magritte-preview-counter___uP2Hc_1-2-0.magritte-with-description___-w7ld_1-2-0{
77
92
  cursor:pointer;
78
93
  }
79
- .magritte-counter-number___gUpMp_1-0-7{
94
+ .magritte-counter-number___gUpMp_1-2-0{
80
95
  display:block;
81
96
  transform:translateY(calc(18px * 0.5));
82
- transition:transform 0.2s;
97
+ transition:transform var(--magritte-semantic-animation-time-m-duration-v24-4-0) var(--magritte-semantic-animation-ease-base-timing-function-v24-4-0);
83
98
  }
84
- .magritte-with-description___-w7ld_1-0-7 .magritte-counter-number___gUpMp_1-0-7{
99
+ .magritte-with-description___-w7ld_1-2-0 .magritte-counter-number___gUpMp_1-2-0{
85
100
  transform:translateY(0);
86
101
  }
87
- .magritte-no-description-placeholder___qc6h2_1-0-7{
102
+ .magritte-no-description-placeholder___qc6h2_1-2-0{
88
103
  display:block;
89
104
  height:18px;
90
105
  padding:0;
91
106
  }
92
- .magritte-preview-zoom-control___026jA_1-0-7{
107
+ .magritte-preview-zoom-control___026jA_1-2-0{
93
108
  display:flex;
94
109
  flex-direction:row;
95
110
  gap:2px;
96
111
  align-items:center;
97
112
  justify-self:end;
98
113
  }
99
- .magritte-preview-container___nwjNY_1-0-7{
114
+ .magritte-preview-container___nwjNY_1-2-0{
100
115
  display:grid;
101
116
  grid-template-columns:1fr auto 1fr;
102
117
  gap:16px;
103
118
  padding:4px 16px;
104
- background:var(--magritte-color-background-overlay-toolbar-v24-3-0);
119
+ background:var(--magritte-color-background-overlay-toolbar-v24-4-0);
105
120
  align-items:center;
121
+ grid-row:3;
122
+ z-index:10;
106
123
  }
107
124
  @media (min-width: 1020px){
108
- body.magritte-old-layout .magritte-preview-container___nwjNY_1-0-7{
125
+ body.magritte-old-layout .magritte-preview-container___nwjNY_1-2-0{
109
126
  padding:16px 24px;
110
127
  }
111
128
  }
112
129
  @media (min-width: 1024px){
113
- body:not(.magritte-old-layout) .magritte-preview-container___nwjNY_1-0-7{
130
+ body:not(.magritte-old-layout) .magritte-preview-container___nwjNY_1-2-0{
114
131
  padding:16px 24px;
115
132
  }
116
133
  }
117
- .magritte-preview___0Ge4C_1-0-7{
134
+ .magritte-preview___0Ge4C_1-2-0{
135
+ display:flex;
136
+ flex-direction:row;
118
137
  touch-action:none;
119
138
  grid-column:2;
120
139
  min-width:0;
121
140
  }
122
141
  @media (min-width: 1020px){
123
- body.magritte-old-layout .magritte-preview___0Ge4C_1-0-7{
124
- max-width:calc(((32 + 8) * (var(--media-viewer-max-visible-items) - 1) + 64) * 1px);
142
+ body.magritte-old-layout .magritte-preview___0Ge4C_1-2-0{
143
+ max-width:calc(((40 + 8) * (var(--media-viewer-max-visible-items) - 1) + 80) * 1px);
125
144
  overflow:hidden;
126
145
  }
127
146
  }
128
147
  @media (min-width: 1024px){
129
- body:not(.magritte-old-layout) .magritte-preview___0Ge4C_1-0-7{
130
- max-width:calc(((32 + 8) * (var(--media-viewer-max-visible-items) - 1) + 64) * 1px);
148
+ body:not(.magritte-old-layout) .magritte-preview___0Ge4C_1-2-0{
149
+ max-width:calc(((40 + 8) * (var(--media-viewer-max-visible-items) - 1) + 80) * 1px);
131
150
  overflow:hidden;
132
151
  }
133
152
  }
134
- .magritte-preview-list___SAXLZ_1-0-7{
153
+ .magritte-preview-list___SAXLZ_1-2-0{
135
154
  margin-left:50%;
136
155
  contain:layout paint;
137
156
  display:flex;
138
157
  gap:2px;
139
158
  overflow:hidden;
140
159
  width:fit-content;
160
+ flex:0 0 auto;
141
161
  }
142
162
  @media (min-width: 1020px){
143
- body.magritte-old-layout .magritte-preview-list___SAXLZ_1-0-7{
163
+ body.magritte-old-layout .magritte-preview-list___SAXLZ_1-2-0{
144
164
  margin:0;
145
165
  gap:8px;
146
166
  }
147
167
  }
148
168
  @media (min-width: 1024px){
149
- body:not(.magritte-old-layout) .magritte-preview-list___SAXLZ_1-0-7{
169
+ body:not(.magritte-old-layout) .magritte-preview-list___SAXLZ_1-2-0{
150
170
  margin:0;
151
171
  gap:8px;
152
172
  }
153
173
  }
154
- .magritte-preview-item___gz5f2_1-0-7{
174
+ .magritte-preview-item___gz5f2_1-2-0{
155
175
  contain:layout paint size;
156
176
  position:relative;
157
177
  flex-shrink:0;
@@ -162,33 +182,36 @@
162
182
  display:flex;
163
183
  align-items:center;
164
184
  justify-content:center;
185
+ background-color:var(--magritte-color-component-skeleton-background-content-v24-4-0);
165
186
  }
166
187
  @media (min-width: 1020px){
167
- body.magritte-old-layout .magritte-preview-item___gz5f2_1-0-7{
168
- height:64px;
188
+ body.magritte-old-layout .magritte-preview-item___gz5f2_1-2-0{
189
+ height:80px;
190
+ border-radius:8px;
169
191
  }
170
192
  }
171
193
  @media (min-width: 1024px){
172
- body:not(.magritte-old-layout) .magritte-preview-item___gz5f2_1-0-7{
173
- height:64px;
194
+ body:not(.magritte-old-layout) .magritte-preview-item___gz5f2_1-2-0{
195
+ height:80px;
196
+ border-radius:8px;
174
197
  }
175
198
  }
176
- .magritte-preview-item-container___JDVsk_1-0-7{
199
+ .magritte-preview-item-container___JDVsk_1-2-0{
177
200
  contain:layout paint size;
178
201
  overflow:hidden;
179
202
  scale:1;
180
203
  }
181
204
  @media (min-width: 1020px){
182
- body.magritte-old-layout .magritte-preview-item-container___JDVsk_1-0-7{
183
- scale:1.33333333;
205
+ body.magritte-old-layout .magritte-preview-item-container___JDVsk_1-2-0{
206
+ scale:1.66666667;
184
207
  }
185
208
  }
186
209
  @media (min-width: 1024px){
187
- body:not(.magritte-old-layout) .magritte-preview-item-container___JDVsk_1-0-7{
188
- scale:1.33333333;
210
+ body:not(.magritte-old-layout) .magritte-preview-item-container___JDVsk_1-2-0{
211
+ scale:1.66666667;
189
212
  }
190
213
  }
191
- .magritte-preview-item-container___JDVsk_1-0-7 *{
214
+ .magritte-preview-item-container___JDVsk_1-2-0 *{
192
215
  touch-action:none;
193
216
  position:absolute;
194
217
  top:0;
@@ -198,92 +221,147 @@
198
221
  height:100%;
199
222
  user-select:none;
200
223
  }
201
- .magritte-media-viewer-toolbar___2C8nr_1-0-7{
202
- background:var(--magritte-color-background-overlay-toolbar-v24-3-0);
224
+ .magritte-media-viewer-toolbar___2C8nr_1-2-0{
225
+ background:var(--magritte-color-background-overlay-toolbar-v24-4-0);
203
226
  padding:0 8px;
204
227
  display:grid;
205
228
  grid-template-columns:1fr auto 1fr;
206
229
  align-items:center;
207
230
  height:48px;
208
231
  gap:8px;
232
+ grid-row:4;
233
+ z-index:10;
209
234
  }
210
- .magritte-media-viewer-toolbar___2C8nr_1-0-7.magritte-no-description___NebrT_1-0-7{
235
+ .magritte-media-viewer-toolbar___2C8nr_1-2-0.magritte-no-description___NebrT_1-2-0{
211
236
  display:flex;
212
237
  justify-content:space-between;
213
238
  }
214
239
  @media (min-width: 1020px){
215
- body.magritte-old-layout .magritte-media-viewer-toolbar___2C8nr_1-0-7{
240
+ body.magritte-old-layout .magritte-media-viewer-toolbar___2C8nr_1-2-0{
216
241
  display:none;
217
242
  }
218
243
  }
219
244
  @media (min-width: 1024px){
220
- body:not(.magritte-old-layout) .magritte-media-viewer-toolbar___2C8nr_1-0-7{
245
+ body:not(.magritte-old-layout) .magritte-media-viewer-toolbar___2C8nr_1-2-0{
221
246
  display:none;
222
247
  }
223
248
  }
224
- .magritte-media-viewer-toolbar-left___YzkJt_1-0-7,
225
- .magritte-media-viewer-toolbar-right___kBER9_1-0-7{
249
+ .magritte-media-viewer-toolbar-left___YzkJt_1-2-0,
250
+ .magritte-media-viewer-toolbar-right___kBER9_1-2-0{
226
251
  display:flex;
227
252
  gap:4px;
228
253
  }
229
- .magritte-media-viewer-toolbar-right___kBER9_1-0-7{
254
+ .magritte-media-viewer-toolbar-right___kBER9_1-2-0{
230
255
  justify-content:end;
231
256
  }
232
- .magritte-prev-button___WMYjR_1-0-7,
233
- .magritte-next-button___f8hJT_1-0-7{
234
- border-width:0;
235
- background:none;
236
- padding:0;
257
+ .magritte-prev-button___WMYjR_1-2-0,
258
+ .magritte-next-button___f8hJT_1-2-0{
237
259
  cursor:pointer;
238
- align-items:center;
239
- justify-content:center;
240
260
  position:absolute;
241
261
  top:0;
242
262
  bottom:0;
243
- width:88px;
244
- display:none;
245
- opacity:calc(1 - var(--magritte-ui-media-viewer-close-progress));
263
+ width:48px;
264
+ opacity:var(--media-viewer-background-opacity);
265
+ }
266
+ .magritte-prev-button___WMYjR_1-2-0:active,
267
+ .magritte-next-button___f8hJT_1-2-0:active{
268
+ background:linear-gradient(90deg, var(--magritte-gradient-component-media-viewer-background-fade-v24-4-0));
246
269
  }
247
270
  @media (min-width: 1020px){
248
- body.magritte-old-layout .magritte-prev-button___WMYjR_1-0-7,
249
- body.magritte-old-layout .magritte-next-button___f8hJT_1-0-7{
250
- display:flex;
271
+ body.magritte-old-layout .magritte-prev-button___WMYjR_1-2-0,
272
+ body.magritte-old-layout .magritte-next-button___f8hJT_1-2-0{
273
+ width:88px;
274
+ }
275
+ body.magritte-old-layout .magritte-prev-button___WMYjR_1-2-0:active,
276
+ body.magritte-old-layout .magritte-next-button___f8hJT_1-2-0:active{
277
+ background:none;
251
278
  }
252
279
  }
253
280
  @media (min-width: 1024px){
254
- body:not(.magritte-old-layout) .magritte-prev-button___WMYjR_1-0-7,
255
- body:not(.magritte-old-layout) .magritte-next-button___f8hJT_1-0-7{
256
- display:flex;
281
+ body:not(.magritte-old-layout) .magritte-prev-button___WMYjR_1-2-0,
282
+ body:not(.magritte-old-layout) .magritte-next-button___f8hJT_1-2-0{
283
+ width:88px;
284
+ }
285
+ body:not(.magritte-old-layout) .magritte-prev-button___WMYjR_1-2-0:active,
286
+ body:not(.magritte-old-layout) .magritte-next-button___f8hJT_1-2-0:active{
287
+ background:none;
257
288
  }
258
289
  }
259
- .magritte-prev-button___WMYjR_1-0-7{
290
+ .magritte-prev-button___WMYjR_1-2-0{
260
291
  left:0;
261
292
  }
262
- .magritte-next-button___f8hJT_1-0-7{
293
+ .magritte-prev-button___WMYjR_1-2-0:active{
294
+ background:linear-gradient(270deg, var(--magritte-gradient-component-media-viewer-background-fade-v24-4-0));
295
+ }
296
+ .magritte-next-button___f8hJT_1-2-0{
263
297
  right:0;
264
298
  }
265
- .magritte-bottom-container___oKHCF_1-0-7{
266
- order:2;
267
- z-index:2;
268
- opacity:calc(1 - var(--magritte-ui-media-viewer-close-progress) - var(--magritte-ui-media-viewer-hide-tools-progress));
269
- transform:translateY(calc(var(--magritte-ui-media-viewer-hide-tools-progress) * 100%));
299
+ .magritte-slide-button___sY8LB_1-2-0{
300
+ display:flex;
301
+ background:none;
302
+ padding:0;
303
+ border-width:0;
304
+ align-items:center;
305
+ justify-content:center;
306
+ position:absolute;
307
+ inset:0;
270
308
  }
271
- .magritte-preview-placeholder___yuhW1_1-0-7{
309
+ .magritte-preview-placeholder___yuhW1_1-2-0{
272
310
  --magritte-media-viewer-preview-width:24px;
273
311
  --magritte-media-viewer-preview-gap:2px;
274
- width:calc(var(--magritte-media-viewer-placeholder-size) * var(--magritte-media-viewer-preview-width) + (var(--magritte-media-viewer-placeholder-size) - 1) * var(--magritte-media-viewer-preview-gap));
312
+ flex:0 0 auto;
313
+ width:calc(var(--magritte-media-viewer-placeholder-size) * (var(--magritte-media-viewer-preview-width) + var(--magritte-media-viewer-preview-gap)));
275
314
  flex-shrink:0;
276
315
  flex-grow:0;
277
316
  }
278
317
  @media (min-width: 1020px){
279
- body.magritte-old-layout .magritte-preview-placeholder___yuhW1_1-0-7{
280
- --magritte-media-viewer-preview-width:32px;
318
+ body.magritte-old-layout .magritte-preview-placeholder___yuhW1_1-2-0{
319
+ --magritte-media-viewer-preview-width:40px;
281
320
  --magritte-media-viewer-preview-gap:8px;
282
321
  }
283
322
  }
284
323
  @media (min-width: 1024px){
285
- body:not(.magritte-old-layout) .magritte-preview-placeholder___yuhW1_1-0-7{
286
- --magritte-media-viewer-preview-width:32px;
324
+ body:not(.magritte-old-layout) .magritte-preview-placeholder___yuhW1_1-2-0{
325
+ --magritte-media-viewer-preview-width:40px;
287
326
  --magritte-media-viewer-preview-gap:8px;
288
327
  }
289
328
  }
329
+ .magritte-gallery-item-loader___70TDe_1-2-0{
330
+ position:absolute;
331
+ top:50%;
332
+ left:50%;
333
+ transform:translate(-50%, -50%);
334
+ }
335
+ .magritte-gallery-item-error-container___Z-HyZ_1-2-0{
336
+ display:flex;
337
+ flex-direction:column;
338
+ align-items:center;
339
+ gap:8px;
340
+ padding:28px;
341
+ position:absolute;
342
+ top:50%;
343
+ left:50%;
344
+ transform:translate(-50%, -50%);
345
+ text-align:center;
346
+ width:100%;
347
+ box-sizing:border-box;
348
+ }
349
+ .magritte-description-bottom-sheet-content___swnEV_1-2-0{
350
+ padding:8px 0;
351
+ }
352
+ .magritte-header___egZXt_1-2-0{
353
+ grid-row:1;
354
+ z-index:2;
355
+ opacity:var(--media-viewer-toolbars-opacity);
356
+ transform:translateY(calc(var(--magritte-ui-media-viewer-hide-tools-progress) * -100%));
357
+ }
358
+ .magritte-footer___rOH-M_1-2-0{
359
+ grid-row:3;
360
+ z-index:2;
361
+ opacity:var(--media-viewer-toolbars-opacity);
362
+ transform:translateY(calc(var(--magritte-ui-media-viewer-hide-tools-progress) * 100%));
363
+ }
364
+ .magritte-description___dYc-E_1-2-0{
365
+ display:inline-block;
366
+ max-width:100%;
367
+ }
package/index.d.ts CHANGED
@@ -1,6 +1,5 @@
1
- export { Gallery } from '@hh.ru/magritte-ui-media-viewer/public/Gallery';
2
- export { GalleryItem } from '@hh.ru/magritte-ui-media-viewer/public/GalleryItem';
3
1
  export { type GalleryItemProps } from '@hh.ru/magritte-ui-media-viewer/internal/GalleryItemBody';
4
2
  export { MediaViewer } from '@hh.ru/magritte-ui-media-viewer/public/MediaViewer';
5
- export { Preview, type PreviewProps } from '@hh.ru/magritte-ui-media-viewer/public/Preview';
6
- export { useMediaViewerContext } from '@hh.ru/magritte-ui-media-viewer/internal/context';
3
+ export { type PreviewProps } from '@hh.ru/magritte-ui-media-viewer/public/Preview';
4
+ export { type ToolbarProps } from '@hh.ru/magritte-ui-media-viewer/public/Toolbar';
5
+ export { useMediaViewerControls, useMediaViewerInfo } from '@hh.ru/magritte-ui-media-viewer/internal/context';
package/index.js CHANGED
@@ -1,40 +1,46 @@
1
1
  import './index.css';
2
- export { Gallery } from './public/Gallery.js';
3
- export { GalleryItem } from './public/GalleryItem.js';
4
2
  export { MediaViewer } from './public/MediaViewer.js';
5
- export { Preview } from './public/Preview.js';
6
- export { useMediaViewerContext } from './internal/context.js';
3
+ export { useMediaViewerControls, useMediaViewerInfo } from './internal/context.js';
7
4
  import 'react/jsx-runtime';
8
5
  import 'react';
6
+ import 'motion/react';
7
+ import '@hh.ru/magritte-common-modal-helper';
8
+ import '@hh.ru/magritte-common-use-translation';
9
+ import '@hh.ru/magritte-design-tokens/types';
10
+ import '@hh.ru/magritte-ui-breakpoint';
11
+ import '@hh.ru/magritte-ui-layer';
12
+ import './internal/animations.js';
13
+ import './internal/hooks/useAutoHideTools.js';
14
+ import './internal/hooks/useSwipeToClose.js';
15
+ import '@use-gesture/react';
16
+ import './internal/utils.js';
17
+ import './internal/hooks/useTapToToggleTools.js';
18
+ import './internal/hooks/useVirtualization.js';
19
+ import './public/Footer.js';
20
+ import './media-viewer-EEyLOGS2.js';
21
+ import './public/Gallery.js';
9
22
  import '@hh.ru/magritte-common-resize';
10
23
  import '@hh.ru/magritte-ui-icon/icon';
11
24
  import './internal/hooks/useSwipe.js';
12
- import '@use-gesture/react';
13
- import 'motion/react';
14
- import './internal/utils.js';
15
- import './media-viewer-BNuKXbLq.js';
25
+ import './public/GalleryItem.js';
16
26
  import './internal/GalleryItemBody.js';
27
+ import '@hh.ru/magritte-ui-loader';
17
28
  import './internal/hooks/useDoubleTapScale.js';
18
29
  import './internal/hooks/useGalleryItemController.js';
19
- import './internal/ObservableValue.js';
20
30
  import './internal/hooks/usePan.js';
21
31
  import './internal/hooks/usePinchToZoom.js';
22
32
  import './internal/hooks/useWheelToZoom.js';
23
- import './internal/hooks/useVirtualization.js';
24
- import 'motion';
25
- import '@hh.ru/magritte-ui-breakpoint';
26
- import './internal/hooks/useAutoHideTools.js';
27
- import './internal/hooks/useSwipeToClose.js';
28
- import './internal/hooks/useTapToToggleTools.js';
29
- import './public/Toolbar.js';
30
- import 'classnames';
33
+ import '@hh.ru/magritte-ui-typography';
34
+ import './public/Header.js';
35
+ import './public/Preview.js';
31
36
  import './internal/Counter.js';
37
+ import 'classnames';
32
38
  import '@hh.ru/magritte-ui-bottom-sheet';
33
39
  import '@hh.ru/magritte-ui-tooltip';
34
- import '@hh.ru/magritte-ui-typography';
35
- import '@hh.ru/magritte-ui-nav-bar';
36
40
  import './internal/PreviewItem.js';
37
41
  import './internal/PreviewItemBody.js';
38
42
  import './internal/PreviewZoomControl.js';
43
+ import './public/Toolbar.js';
44
+ import './public/Tools.js';
39
45
  import './internal/ImagesLoader.js';
40
46
  //# sourceMappingURL=index.js.map
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,9 @@
1
+ export declare const MediaViewer: import("react").ForwardRefExoticComponent<Record<string, unknown>>;
2
+ export declare const useMediaViewerControls: () => {
3
+ goToSlideIndex: (index: number) => void;
4
+ close: VoidFunction;
5
+ };
6
+ export declare const useMediaViewerInfo: () => {
7
+ currentSlideIndex: number;
8
+ totalSlides: number;
9
+ };
package/index.mock.js ADDED
@@ -0,0 +1,55 @@
1
+ import './index.css';
2
+ import { mockComponent } from '@hh.ru/magritte-ui-mock-component';
3
+
4
+ const MediaViewer = mockComponent('MediaViewer', {
5
+ Gallery: mockComponent('Gallery', undefined, {
6
+ withChildren: true,
7
+ }),
8
+ GalleryItem: mockComponent('GalleryItem', undefined, {
9
+ withChildren: true,
10
+ }),
11
+ Preview: mockComponent('Preview', undefined, {
12
+ withChildren: true,
13
+ }),
14
+ Toolbar: mockComponent('Toolbar', undefined, {
15
+ withChildren: true,
16
+ }),
17
+ Header: mockComponent('Header', undefined, {
18
+ withChildren: true,
19
+ }),
20
+ Footer: mockComponent('Footer', undefined, {
21
+ withChildren: true,
22
+ }),
23
+ DesktopTool: mockComponent('DesktopTool', undefined, {
24
+ withChildren: true,
25
+ }),
26
+ MobileTool: mockComponent('MobileTool', undefined, {
27
+ withChildren: true,
28
+ }),
29
+ RotateTool: mockComponent('RotateTool', undefined, {
30
+ withChildren: true,
31
+ }),
32
+ CloseTool: mockComponent('CloseTool', undefined, {
33
+ withChildren: true,
34
+ }),
35
+ FullWidthTool: mockComponent('FullWidthTool', undefined, {
36
+ withChildren: true,
37
+ }),
38
+ }, {
39
+ withChildren: true,
40
+ });
41
+ const useMediaViewerControls = () => {
42
+ return {
43
+ goToSlideIndex: () => { },
44
+ close: () => { },
45
+ };
46
+ };
47
+ const useMediaViewerInfo = () => {
48
+ return {
49
+ currentSlideIndex: 0,
50
+ totalSlides: 1,
51
+ };
52
+ };
53
+
54
+ export { MediaViewer, useMediaViewerControls, useMediaViewerInfo };
55
+ //# sourceMappingURL=index.mock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mock.js","sources":["../src/index.mock.ts"],"sourcesContent":["import { mockComponent } from '@hh.ru/magritte-ui-mock-component';\n\nexport const MediaViewer = mockComponent(\n 'MediaViewer',\n {\n Gallery: mockComponent('Gallery', undefined, {\n withChildren: true,\n }),\n GalleryItem: mockComponent('GalleryItem', undefined, {\n withChildren: true,\n }),\n Preview: mockComponent('Preview', undefined, {\n withChildren: true,\n }),\n Toolbar: mockComponent('Toolbar', undefined, {\n withChildren: true,\n }),\n Header: mockComponent('Header', undefined, {\n withChildren: true,\n }),\n Footer: mockComponent('Footer', undefined, {\n withChildren: true,\n }),\n DesktopTool: mockComponent('DesktopTool', undefined, {\n withChildren: true,\n }),\n MobileTool: mockComponent('MobileTool', undefined, {\n withChildren: true,\n }),\n RotateTool: mockComponent('RotateTool', undefined, {\n withChildren: true,\n }),\n CloseTool: mockComponent('CloseTool', undefined, {\n withChildren: true,\n }),\n FullWidthTool: mockComponent('FullWidthTool', undefined, {\n withChildren: true,\n }),\n },\n {\n withChildren: true,\n }\n);\n\nexport const useMediaViewerControls = (): {\n goToSlideIndex: (index: number) => void;\n close: VoidFunction;\n} => {\n return {\n goToSlideIndex: () => {},\n close: () => {},\n };\n};\n\nexport const useMediaViewerInfo = (): {\n currentSlideIndex: number;\n totalSlides: number;\n} => {\n return {\n currentSlideIndex: 0,\n totalSlides: 1,\n };\n};\n"],"names":[],"mappings":";;AAEa,MAAA,WAAW,GAAG,aAAa,CACpC,aAAa,EACb;AACI,IAAA,OAAO,EAAE,aAAa,CAAC,SAAS,EAAE,SAAS,EAAE;AACzC,QAAA,YAAY,EAAE,IAAI;KACrB,CAAC;AACF,IAAA,WAAW,EAAE,aAAa,CAAC,aAAa,EAAE,SAAS,EAAE;AACjD,QAAA,YAAY,EAAE,IAAI;KACrB,CAAC;AACF,IAAA,OAAO,EAAE,aAAa,CAAC,SAAS,EAAE,SAAS,EAAE;AACzC,QAAA,YAAY,EAAE,IAAI;KACrB,CAAC;AACF,IAAA,OAAO,EAAE,aAAa,CAAC,SAAS,EAAE,SAAS,EAAE;AACzC,QAAA,YAAY,EAAE,IAAI;KACrB,CAAC;AACF,IAAA,MAAM,EAAE,aAAa,CAAC,QAAQ,EAAE,SAAS,EAAE;AACvC,QAAA,YAAY,EAAE,IAAI;KACrB,CAAC;AACF,IAAA,MAAM,EAAE,aAAa,CAAC,QAAQ,EAAE,SAAS,EAAE;AACvC,QAAA,YAAY,EAAE,IAAI;KACrB,CAAC;AACF,IAAA,WAAW,EAAE,aAAa,CAAC,aAAa,EAAE,SAAS,EAAE;AACjD,QAAA,YAAY,EAAE,IAAI;KACrB,CAAC;AACF,IAAA,UAAU,EAAE,aAAa,CAAC,YAAY,EAAE,SAAS,EAAE;AAC/C,QAAA,YAAY,EAAE,IAAI;KACrB,CAAC;AACF,IAAA,UAAU,EAAE,aAAa,CAAC,YAAY,EAAE,SAAS,EAAE;AAC/C,QAAA,YAAY,EAAE,IAAI;KACrB,CAAC;AACF,IAAA,SAAS,EAAE,aAAa,CAAC,WAAW,EAAE,SAAS,EAAE;AAC7C,QAAA,YAAY,EAAE,IAAI;KACrB,CAAC;AACF,IAAA,aAAa,EAAE,aAAa,CAAC,eAAe,EAAE,SAAS,EAAE;AACrD,QAAA,YAAY,EAAE,IAAI;KACrB,CAAC;CACL,EACD;AACI,IAAA,YAAY,EAAE,IAAI;AACrB,CAAA,EACH;AAEK,MAAM,sBAAsB,GAAG,MAGlC;IACA,OAAO;AACH,QAAA,cAAc,EAAE,MAAK,GAAG;AACxB,QAAA,KAAK,EAAE,MAAK,GAAG;KAClB,CAAC;AACN,EAAE;AAEK,MAAM,kBAAkB,GAAG,MAG9B;IACA,OAAO;AACH,QAAA,iBAAiB,EAAE,CAAC;AACpB,QAAA,WAAW,EAAE,CAAC;KACjB,CAAC;AACN;;;;"}
@@ -3,17 +3,20 @@ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
3
3
  import { useState, useRef } from 'react';
4
4
  import classNames from 'classnames';
5
5
  import { useMotionValueEvent } from 'motion/react';
6
+ import { useTranslation } from '@hh.ru/magritte-common-use-translation';
6
7
  import { BottomSheet } from '@hh.ru/magritte-ui-bottom-sheet';
7
8
  import { useMediaViewerContext } from './context.js';
8
- import { Tooltip } from '@hh.ru/magritte-ui-tooltip';
9
+ import { TooltipHover } from '@hh.ru/magritte-ui-tooltip';
9
10
  import { Text } from '@hh.ru/magritte-ui-typography';
10
- import { s as styles } from '../media-viewer-BNuKXbLq.js';
11
+ import { s as styles } from '../media-viewer-EEyLOGS2.js';
11
12
  import './ImagesLoader.js';
12
- import './ObservableValue.js';
13
+ import './utils.js';
14
+ import '@hh.ru/magritte-design-tokens/types';
15
+ import './animations.js';
13
16
 
14
17
  const Counter = ({ items }) => {
15
18
  const globalContext = useMediaViewerContext();
16
- const [currentItemIndex, setCurrentItemIndex] = useState(globalContext.currentSlideIndex.get());
19
+ const [currentItemIndex, setCurrentItemIndex] = useState(Math.round(globalContext.currentSlideIndex.get()));
17
20
  const [showDescription, setShowDescription] = useState(false);
18
21
  const description = items[currentItemIndex]?.props.description;
19
22
  const elementRef = useRef(null);
@@ -21,12 +24,13 @@ const Counter = ({ items }) => {
21
24
  setShowDescription(false);
22
25
  setCurrentItemIndex(Math.round(newIndex));
23
26
  });
27
+ const ofTrl = useTranslation('MediaViewer', 'of');
24
28
  if (items.length <= 1) {
25
29
  return null;
26
30
  }
27
31
  return (jsxs("div", { className: classNames(styles.previewCounter, { [styles.withDescription]: !!description }), onClick: () => {
28
32
  setShowDescription(!!description);
29
- }, children: [jsx("span", { className: styles.counterNumber, children: jsx(Text, { style: "contrast", typography: "subtitle-1-semibold", ellipsis: true, children: `${currentItemIndex + 1} / ${items.length}` }) }), !!description && (jsxs(Fragment, { children: [jsx("span", { ref: elementRef, children: jsx(Text, { style: "contrast-secondary", typography: "label-4-regular", ellipsis: true, children: description }) }), jsx(Tooltip, { placement: 'top-center', activatorRef: elementRef, closeByClickOutside: true, visible: showDescription, onClose: () => setShowDescription(false), children: description }), jsx(BottomSheet, { visible: showDescription, onClose: () => setShowDescription(false), children: jsx(Text, { style: "primary", typography: "paragraph-2-regular", children: description }) })] })), !description && jsx("span", { className: styles.noDescriptionPlaceholder })] }));
33
+ }, children: [jsx("span", { className: styles.counterNumber, "aria-atomic": "true", "aria-live": "polite", children: jsx(Text, { style: "contrast", typography: "subtitle-1-semibold", ellipsis: true, children: `${currentItemIndex + 1} ${ofTrl} ${items.length}` }) }), !!description && (jsxs(Fragment, { children: [jsx("span", { ref: elementRef, className: styles.description, children: jsx(Text, { style: "contrast-secondary", typography: "label-4-regular", ellipsis: true, children: description }) }), jsx(TooltipHover, { placement: 'top-center', activatorRef: elementRef, size: "small", onClose: () => setShowDescription(false), ignoreIntersections: false, children: description }), jsx(BottomSheet, { visible: showDescription, onClose: () => setShowDescription(false), children: jsx("div", { className: styles.descriptionBottomSheetContent, children: jsx(Text, { style: "primary", typography: "paragraph-2-regular", children: description }) }) })] })), !description && jsx("span", { className: styles.noDescriptionPlaceholder })] }));
30
34
  };
31
35
 
32
36
  export { Counter };