@ecl/gallery 5.0.0-aplha.13 → 5.0.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.
package/README.md CHANGED
@@ -11,9 +11,9 @@ npm install --save @ecl/gallery
11
11
  - **"grid"** (boolean) (default: false) Display gallery as a grid
12
12
  - **"grid_template"** (int) (default: 0) Id of the template to be used. Grid display only
13
13
  - **"column"** (int) (default: 3) Number of columns. Grid display only
14
- - **"ratio"** (string) (default: '3-2') Image aspect ratio. Grid dipslay only
15
- - **"picture_zoom"** (bool) (default: false): Should the thumbnail pictures be animated?
16
- - **"id"**: (string) (default: random): Unique id for the gallery
14
+ - **"ratio"** (string) (default: '3-2') Image aspect ratio. Grid display only
15
+ - **"picture_zoom"** (boolean) (default: false) Should the thumbnail pictures have a zoom animation?
16
+ - **"id"** (string) (default: random) Unique id for the gallery
17
17
  - **"overlay"** (object) (default: {})
18
18
  - "close" (object) (default: {}): object of type button
19
19
  - "previous" (object) (default: {}): object of type button
@@ -28,12 +28,12 @@ npm install --save @ecl/gallery
28
28
  - "description" (string) (default: '')
29
29
  - "meta" (string) (default: '')
30
30
  - "icon" (object) (default: {}): object of type icon
31
- - "thumbnail" (optional) (object) (default: {}) Picture to the thumbnail, type Picture; uses "picture" if empty
32
- - "picture" (optional) (object) (default: {}) object of type Picture; always needed, even for video
33
- - "video" (optional) (object) (default: {})
34
- - "embedded_video" (optional) (object) (default: {})
31
+ - "thumbnail" (object) (default: {}) Thumbnail picture, following ECL Picture structure; falls back to "picture" if empty
32
+ - "picture" (object) (default: {}) Full-size picture, following ECL Picture structure; always required, even for video items
33
+ - "video" (object) (default: {}) Video object for video items
34
+ - "embedded_video" (object) (default: {}) Embedded video object (iframe-based)
35
35
  - "sr_video_audio" (string) (default: ''): additional text to indicate if there is an audio description; for screen readers
36
- - "share_path" (optional) (string) (default: '')
36
+ - "share_path" (string) (default: '') URL for the share button in the overlay
37
37
  - **"visible_items"** (integer) (default: 8) Number of visible items in an expandable gallery
38
38
  - **"expandable"** (boolean) (default: true) collapsible/expandable gallery
39
39
  - **"sr_gallery_label"** (string) (default: ''): additional label for the gallery, providing instruction; for screen readers
@@ -47,8 +47,8 @@ npm install --save @ecl/gallery
47
47
  - **"disable_overlay"** (boolean) (default: false) Disables the overlay functionality
48
48
  - **"full_width"** (boolean) (default: false) Full width gallery for desktop and tablet viewports
49
49
  - **"selected_item_id"** (int) (default: 0)
50
- - **"extra_classes"** (optional) (string) (default: '') Extra classes (space separated)
51
- - **"extra_attributes"** (optional) (array) (default: []) Extra attributes
50
+ - **"extra_classes"** (string) (default: '') Extra classes (space separated)
51
+ - **"extra_attributes"** (array) (default: []) Extra attributes
52
52
  - "name" (string) Attribute name, eg. 'data-test'
53
53
  - "value" (string) Attribute value, eg: 'data-test-1'
54
54
 
@@ -49,6 +49,17 @@
49
49
  {% set _css_class = _css_class ~ ' ' ~ extra_classes %}
50
50
  {% endif %}
51
51
 
52
+ {# Process image alt #}
53
+ {% set _image_alt = '' %}
54
+ {% if _thumbnail.img is defined and _thumbnail.img.alt is defined %}
55
+ {% set _image_alt = _thumbnail.img.alt %}
56
+ {% endif %}
57
+ {% if _image_alt is not empty and _item is not empty %}
58
+ {% if (_item.video is not empty or _item.embedded_video is not empty) and _sr_video_label is not empty %}
59
+ {% set _image_alt = _image_alt ~ ' - ' ~ _sr_video_label %}
60
+ {% endif %}
61
+ {% endif %}
62
+
52
63
  {# Setting up Video and image variables #}
53
64
  {% set _video_title = '' %}
54
65
  {% if _item and _item is not empty %}
@@ -93,6 +104,9 @@
93
104
  data-ecl-gallery-item
94
105
  class="ecl-gallery__item-link"
95
106
  id="{{ _id }}"
107
+ {%- if _image_alt is not empty -%}
108
+ aria-label="{{ _image_alt }}"
109
+ {%- endif -%}
96
110
  {%- if _media_share_path is not empty -%}
97
111
  data-ecl-gallery-item-share="{{ _media_share_path }}"
98
112
  {%- endif -%}
@@ -107,21 +121,26 @@
107
121
  {% endif %}
108
122
  >
109
123
  {% if _item is not empty %}
110
- {% set _image_alt = _thumbnail.img.alt|default('') %}
124
+
111
125
  <figure class="ecl-gallery__image-container">
126
+ {# Zoom icon #}
127
+ <div class="ecl-gallery__icon-zoom-wrapper">
128
+ {%- include '@ecl/icon/icon.html.twig' with {
129
+ icon: {
130
+ name: 'fullscreen',
131
+ size: 's',
132
+ },
133
+ extra_classes: 'ecl-gallery__icon-zoom',
134
+ } only %}
135
+ </div>
112
136
 
113
137
  {% if _item.video is not empty or _item.embedded_video is not empty %}
114
138
  {# Display video icon #}
115
- {% if _sr_video_label is not empty %}
116
- {% set _image_alt = _image_alt ~ ' - ' ~ _sr_video_label %}
117
- {% endif %}
118
-
119
139
  <div class="ecl-gallery__item-icon-wrapper">
120
140
  {%- include '@ecl/icon/icon.html.twig' with {
121
141
  icon: {
122
- name: 'play-filled',
123
- size: 'l',
124
- color: 'inverted',
142
+ name: 'play',
143
+ size: 's',
125
144
  },
126
145
  extra_classes: 'ecl-gallery__item-icon',
127
146
  } only %}
@@ -24,7 +24,6 @@
24
24
  {% set _css_media_class = 'ecl-gallery__slider-media-container' %}
25
25
  {% set _extra_attributes = '' %}
26
26
  {% set _button_type = 'button' %}
27
- {% set _button_variant = 'ghost' %}
28
27
  {% set _overlay = overlay|default({}) %}
29
28
  {% set _item = item|default({}) %}
30
29
 
@@ -57,7 +56,8 @@
57
56
  <header class="ecl-gallery__close" data-ecl-gallery-overlay-header>
58
57
  {% include '@ecl/button/button.html.twig' with _overlay.close|merge({
59
58
  extra_classes: 'ecl-gallery__close-button',
60
- variant: _button_variant,
59
+ variant: 'tertiary',
60
+ style: 'inverted',
61
61
  type: 'submit',
62
62
  extra_attributes: [
63
63
  { name: 'data-ecl-gallery-close' },
@@ -90,7 +90,7 @@ $gallery-print: null !default;
90
90
  vertical-align: text-bottom;
91
91
  width: calc(100% - (#{map.get($theme, 'spacing-print', 'xs')} * 2));
92
92
  bottom: 0;
93
- left: 0;
93
+ inset-inline-start: 0;
94
94
  position: absolute;
95
95
  }
96
96
 
@@ -121,7 +121,7 @@ $gallery-print: null !default;
121
121
  display: none;
122
122
  flex-direction: column;
123
123
  height: 100%;
124
- left: 0;
124
+ inset-inline-start: 0;
125
125
  margin: 0;
126
126
  max-height: 100vh;
127
127
  max-width: 100%;
package/gallery.html.twig CHANGED
@@ -168,7 +168,7 @@
168
168
  {% include '@ecl/button/button.html.twig' with {
169
169
  label: _view_all_label,
170
170
  type: 'submit',
171
- variant: 'ghost',
171
+ variant: 'tertiary',
172
172
  extra_attributes: [
173
173
  { name: 'data-ecl-gallery-all' },
174
174
  { name: 'data-ecl-gallery-collapsed-label', value: _view_all_label },
package/gallery.js CHANGED
@@ -595,7 +595,7 @@ export class Gallery {
595
595
  if (description) {
596
596
  this.overlayDescription.innerHTML = description.innerHTML;
597
597
  }
598
- if (actionMobile.childNodes.length > 0) {
598
+ if (actionMobile.children.length > 0) {
599
599
  this.overlayDescription.prepend(actionMobile);
600
600
  }
601
601
  }
package/gallery.scss CHANGED
@@ -48,28 +48,52 @@ $_description-height-desktop: 108px;
48
48
 
49
49
  .ecl-gallery__item-link {
50
50
  text-decoration: none;
51
+
52
+ .ecl-gallery:not(.ecl-gallery--no-overlay):hover & {
53
+ cursor: zoom-in;
54
+ }
55
+ }
56
+
57
+ .ecl-gallery__icon-zoom-wrapper {
58
+ align-items: center;
59
+ background: var(--c-w-600, rgb(255 255 255 / 0.6));
60
+ color: var(--cm-on-surface-brand, var(--c-d-140));
61
+ display: none;
62
+ justify-content: center;
63
+ position: absolute;
64
+ inset-inline-end: 0.25rem;
65
+ top: 0.25rem;
66
+ border-radius: map.get($theme, 'border-radius', 's');
67
+ width: 2rem;
68
+ height: 2rem;
69
+ pointer-events: none;
70
+ z-index: 1;
71
+ }
72
+
73
+ .ecl-gallery:not(.ecl-gallery--no-overlay)
74
+ .ecl-gallery__item-link:focus-visible
75
+ .ecl-gallery__icon-zoom-wrapper {
76
+ display: inline-flex;
51
77
  }
52
78
 
53
79
  .ecl-gallery__item-icon-wrapper {
54
- background: var(--cm-on-surface-dark, var(--c-d));
55
- box-shadow: 0 0 15px 6px
56
- color-mix(in srgb, var(--cm-surface-dark, var(--c-d-80)) 55%, transparent);
57
- display: inline-block;
80
+ align-items: center;
81
+ background: var(--c-w-600, rgb(255 255 255 / 0.6));
82
+ box-shadow: var(--sh-2);
83
+ color: var(--cm-on-surface-brand, var(--c-d-140));
84
+ display: inline-flex;
85
+ justify-content: center;
58
86
  position: absolute;
59
87
  left: 50%;
60
88
  top: 50%;
61
89
  border-radius: 50%;
62
- width: 2rem;
63
- height: 2rem;
90
+ width: 3rem;
91
+ height: 3rem;
64
92
  pointer-events: none;
65
93
  transform: translate(-50%, -50%);
66
94
  z-index: 1;
67
95
  }
68
96
 
69
- .ecl-gallery__item-icon {
70
- transform: scale(1.2);
71
- }
72
-
73
97
  .ecl-gallery__image-container {
74
98
  display: flex;
75
99
  height: $_image-height-mobile;
@@ -79,6 +103,7 @@ $_description-height-desktop: 108px;
79
103
  overflow: hidden;
80
104
  }
81
105
 
106
+ // stylelint-disable-next-line no-descending-specificity
82
107
  .ecl-gallery__item-link:focus-visible {
83
108
  outline: none;
84
109
 
@@ -121,18 +146,13 @@ $_description-height-desktop: 108px;
121
146
  }
122
147
  }
123
148
 
124
- .ecl-gallery__image-icon {
125
- display: none;
126
- }
127
-
128
149
  .ecl-gallery__description {
129
150
  align-items: center;
130
- bottom: 0;
151
+ bottom: -100%;
131
152
  background-color: map.get($gallery, 'description-background');
132
153
  color: $_description-color;
133
- display: none;
134
154
  font: map.get($gallery, 'description-font');
135
- left: 0;
155
+ inset-inline-start: 0;
136
156
  overflow: hidden;
137
157
  padding: var(--s-2xs) var(--s-xs);
138
158
  pointer-events: none;
@@ -148,14 +168,14 @@ $_description-height-desktop: 108px;
148
168
  .ecl-gallery__item-link:hover,
149
169
  .ecl-gallery__item-link:focus-visible {
150
170
  .ecl-gallery__description {
151
- display: block;
171
+ bottom: 0;
152
172
  }
153
173
  }
154
174
  }
155
175
 
156
176
  .ecl-gallery__list .ecl-gallery__caption,
157
177
  .ecl-gallery__list .ecl-gallery__meta {
158
- @include screen-reader.sr-only;
178
+ display: none;
159
179
  }
160
180
 
161
181
  .ecl-gallery__info {
@@ -178,7 +198,7 @@ $_description-height-desktop: 108px;
178
198
  display: flex;
179
199
  flex-direction: column;
180
200
  margin: 0 auto;
181
- max-width: 1140px;
201
+ max-width: map.get($theme, 'container', 'xxl');
182
202
  padding-top: var(--s-xs);
183
203
  }
184
204
 
@@ -188,7 +208,7 @@ $_description-height-desktop: 108px;
188
208
  }
189
209
 
190
210
  .ecl-gallery__footer-link {
191
- text-align: right;
211
+ text-align: end;
192
212
  margin-top: var(--s-s);
193
213
  width: 100%;
194
214
  }
@@ -219,16 +239,6 @@ $_description-height-desktop: 108px;
219
239
  margin: 0 auto;
220
240
  }
221
241
 
222
- .ecl-gallery__image-icon {
223
- background-color: map.get($gallery, 'description-background');
224
- bottom: 0;
225
- display: block;
226
- fill: $_description-color;
227
- padding: var(--s-s);
228
- position: absolute;
229
- right: 0;
230
- }
231
-
232
242
  .ecl-gallery__footer {
233
243
  align-items: center;
234
244
  flex-direction: row;
@@ -256,17 +266,16 @@ $_description-height-desktop: 108px;
256
266
 
257
267
  .ecl-gallery--full-width {
258
268
  border-radius: 0;
259
- left: 50%;
260
- margin-inline-start: -50vw;
269
+ margin-inline: calc(50% - 50vw);
261
270
  position: relative;
262
271
  width: 100vw;
263
272
 
264
273
  .ecl-gallery__footer-link {
265
- margin-inline-start: ar(--s-m);
274
+ margin-inline-start: var(--s-m);
266
275
  }
267
276
 
268
277
  .ecl-gallery__view-all {
269
- margin-inline-end: ar(--s-m);
278
+ margin-inline-end: var(--s-m);
270
279
  }
271
280
  }
272
281
  }
@@ -297,7 +306,7 @@ $_description-height-desktop: 108px;
297
306
  display: none;
298
307
  flex-direction: column;
299
308
  height: 100%;
300
- left: 0;
309
+ inset-inline-start: 0;
301
310
  margin: 0;
302
311
  max-height: 100vh;
303
312
  max-width: 100%;
@@ -320,13 +329,7 @@ $_description-height-desktop: 108px;
320
329
  }
321
330
 
322
331
  .ecl-gallery__close-button {
323
- color: #fff;
324
332
  margin: var(--s-xs);
325
-
326
- &:focus-visible {
327
- border-color: #fff;
328
- color: #fff;
329
- }
330
333
  }
331
334
 
332
335
  .ecl-gallery__controls {
@@ -422,8 +425,7 @@ $_description-height-desktop: 108px;
422
425
 
423
426
  .ecl-gallery__detail-counter {
424
427
  align-self: center;
425
- border-left: 1px solid #fff;
426
- border-right: 1px solid #fff;
428
+ border-inline: 1px solid #fff;
427
429
  display: inline-flex;
428
430
  margin: 0;
429
431
  padding: 0 var(--s-xs);
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@ecl/gallery",
3
3
  "author": "European Commission",
4
4
  "license": "EUPL-1.2",
5
- "version": "5.0.0-aplha.13",
5
+ "version": "5.0.0",
6
6
  "description": "ECL Gallery",
7
7
  "publishConfig": {
8
8
  "access": "public"
@@ -11,13 +11,17 @@
11
11
  "module": "gallery.js",
12
12
  "style": "gallery.scss",
13
13
  "dependencies": {
14
- "@ecl/button": "5.0.0-aplha.13",
15
- "@ecl/dom-utils": "5.0.0-aplha.13",
16
- "@ecl/icon": "5.0.0-aplha.13",
17
- "@ecl/link": "5.0.0-aplha.13",
18
- "@ecl/picture": "5.0.0-aplha.13",
19
- "@ecl/video": "5.0.0-aplha.13",
20
- "focus-trap": "7.6.4"
14
+ "@ecl/button": "5.0.0",
15
+ "@ecl/dom-utils": "5.0.0",
16
+ "@ecl/icon": "5.0.0",
17
+ "@ecl/link": "5.0.0",
18
+ "@ecl/picture": "5.0.0",
19
+ "@ecl/video": "5.0.0",
20
+ "focus-trap": "8.2.1"
21
+ },
22
+ "devDependencies": {
23
+ "@ecl/grid": "5.0.0",
24
+ "@ecl/utility-screen-reader": "5.0.0"
21
25
  },
22
26
  "repository": {
23
27
  "type": "git",
@@ -33,5 +37,5 @@
33
37
  "design-system",
34
38
  "twig"
35
39
  ],
36
- "gitHead": "b5ce1b660b26e315055172169c3a7e9daa638f63"
40
+ "gitHead": "70ad1f5d6ae8b6e11c7d2422c3d5e7a1a74adf57"
37
41
  }