@ecl/gallery 5.0.0-alpha.9 → 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,15 +28,14 @@ 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
- - **"icon_path"** (string) (default: '') Path to the icon sprite
40
39
  - **"sr_gallery_label"** (string) (default: ''): additional label for the gallery, providing instruction; for screen readers
41
40
  - **"sr_video_label"** (string) (default: ''): additional label for the video items; for screen readers
42
41
  - **"sr_video_player"** (string) (default: ''): additional label for the video player; for screen readers
@@ -48,8 +47,8 @@ npm install --save @ecl/gallery
48
47
  - **"disable_overlay"** (boolean) (default: false) Disables the overlay functionality
49
48
  - **"full_width"** (boolean) (default: false) Full width gallery for desktop and tablet viewports
50
49
  - **"selected_item_id"** (int) (default: 0)
51
- - **"extra_classes"** (optional) (string) (default: '') Extra classes (space separated)
52
- - **"extra_attributes"** (optional) (array) (default: []) Extra attributes
50
+ - **"extra_classes"** (string) (default: '') Extra classes (space separated)
51
+ - **"extra_attributes"** (array) (default: []) Extra attributes
53
52
  - "name" (string) Attribute name, eg. 'data-test'
54
53
  - "value" (string) Attribute value, eg: 'data-test-1'
55
54
 
@@ -96,7 +95,6 @@ npm install --save @ecl/gallery
96
95
  description: 'Living, working, travelling in the EU',
97
96
  meta: 'Copyright, Author, Licence for image 2',
98
97
  icon: {
99
- path: 'path/to/icons.svg',
100
98
  name: 'audio',
101
99
  },
102
100
  share_href: '/share#example-image2.jpg',
@@ -110,7 +108,6 @@ npm install --save @ecl/gallery
110
108
  aria_label: "View all link aria-label value"
111
109
  },
112
110
  icon: {
113
- path: "/icons.svg",
114
111
  name: "external",
115
112
  size: "s"
116
113
  }
@@ -120,7 +117,6 @@ npm install --save @ecl/gallery
120
117
  variant: 'ghost',
121
118
  label: 'Close',
122
119
  icon: {
123
- path: 'path/to/icons.svg',
124
120
  name: 'close',
125
121
  size: 's',
126
122
  },
@@ -129,7 +125,6 @@ npm install --save @ecl/gallery
129
125
  variant: 'ghost',
130
126
  label: 'Previous',
131
127
  icon: {
132
- path: 'path/to/icons.svg',
133
128
  name: 'corner-arrow',
134
129
  transform: 'rotate-270',
135
130
  size: 'l',
@@ -140,7 +135,6 @@ npm install --save @ecl/gallery
140
135
  variant: 'ghost',
141
136
  label: 'Next',
142
137
  icon: {
143
- path: 'path/to/icons.svg',
144
138
  name: 'corner-arrow',
145
139
  transform: 'rotate-90',
146
140
  size: 'l',
@@ -151,7 +145,6 @@ npm install --save @ecl/gallery
151
145
  share: {
152
146
  label: 'Share',
153
147
  icon: {
154
- path: 'path/to/icons.svg',
155
148
  name: 'share',
156
149
  size: 'fluid',
157
150
  },
@@ -14,7 +14,6 @@
14
14
  - "embedded_video" (optional) (object) (default: {})
15
15
  - "sr_video_audio" (string) (default: ''): additional text to indicate if there is an audio description; for screen readers
16
16
  - "share_path" (optional) (string) (default: '')
17
- - "icon_path": (string) (default '')
18
17
  - "sr_video_label" (string) (default: ''): additional label for the video items; for screen readers
19
18
  - "sr_video_player" (string) (default: ''): additional label for the video player; for screen readers
20
19
  - "picture_zoom" (bool) (default: false): Should the thumbnail pictures be animated?
@@ -36,7 +35,6 @@
36
35
  {% set _item = item|default({}) %}
37
36
  {% set _picture = item.picture|default({}) %}
38
37
  {% set _thumbnail = item.thumbnail|default({}) %}
39
- {% set _icon_path = icon_path|default('') %}
40
38
  {% set _sr_video_label = sr_video_label|default('') %}
41
39
  {% set _sr_video_player = sr_video_player|default('') %}
42
40
  {% set _picture_zoom = picture_zoom|default(false) %}
@@ -51,6 +49,17 @@
51
49
  {% set _css_class = _css_class ~ ' ' ~ extra_classes %}
52
50
  {% endif %}
53
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
+
54
63
  {# Setting up Video and image variables #}
55
64
  {% set _video_title = '' %}
56
65
  {% if _item and _item is not empty %}
@@ -95,6 +104,9 @@
95
104
  data-ecl-gallery-item
96
105
  class="ecl-gallery__item-link"
97
106
  id="{{ _id }}"
107
+ {%- if _image_alt is not empty -%}
108
+ aria-label="{{ _image_alt }}"
109
+ {%- endif -%}
98
110
  {%- if _media_share_path is not empty -%}
99
111
  data-ecl-gallery-item-share="{{ _media_share_path }}"
100
112
  {%- endif -%}
@@ -109,28 +121,30 @@
109
121
  {% endif %}
110
122
  >
111
123
  {% if _item is not empty %}
112
- {% set _image_alt = _thumbnail.img.alt|default('') %}
124
+
113
125
  <figure class="ecl-gallery__image-container">
114
-
115
- {% if _item.video is not empty or _item.embedded_video is not empty %}
116
- {# Display video icon #}
117
- {% if _sr_video_label is not empty %}
118
- {% set _image_alt = _image_alt ~ ' - ' ~ _sr_video_label %}
119
- {% endif %}
120
-
121
- {% if _icon_path is not empty %}
122
- <div class="ecl-gallery__item-icon-wrapper">
126
+ {# Zoom icon #}
127
+ <div class="ecl-gallery__icon-zoom-wrapper">
123
128
  {%- include '@ecl/icon/icon.html.twig' with {
124
129
  icon: {
125
- name: 'play-filled',
126
- size: 'l',
127
- path: _icon_path,
128
- color: 'inverted',
130
+ name: 'fullscreen',
131
+ size: 's',
129
132
  },
130
- extra_classes: 'ecl-gallery__item-icon',
133
+ extra_classes: 'ecl-gallery__icon-zoom',
131
134
  } only %}
132
- </div>
133
- {% endif %}
135
+ </div>
136
+
137
+ {% if _item.video is not empty or _item.embedded_video is not empty %}
138
+ {# Display video icon #}
139
+ <div class="ecl-gallery__item-icon-wrapper">
140
+ {%- include '@ecl/icon/icon.html.twig' with {
141
+ icon: {
142
+ name: 'play',
143
+ size: 's',
144
+ },
145
+ extra_classes: 'ecl-gallery__item-icon',
146
+ } only %}
147
+ </div>
134
148
  {% endif %}
135
149
 
136
150
  {% set _thumbnail_markup %}
@@ -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' },
@@ -131,7 +131,6 @@
131
131
  icon: {
132
132
  name: 'fullscreen',
133
133
  size: 'fluid',
134
- path: icon_path|default('')
135
134
  },
136
135
  extra_classes: 'ecl-gallery__download',
137
136
  extra_attributes: [
@@ -78,7 +78,7 @@ $gallery-print: null !default;
78
78
 
79
79
  .ecl-gallery__description {
80
80
  align-items: center;
81
- background-color: rgba(0, 0, 0, 0.7);
81
+ background-color: rgb(0, 0, 0, 0.7);
82
82
  color: #fff;
83
83
  font: map.get($gallery-print, 'description-font');
84
84
  padding: map.get($theme, 'spacing-print', '2xs')
@@ -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
@@ -37,7 +37,6 @@
37
37
  - "embedded_video" (optional) (object) (default: {})
38
38
  - "sr_video_audio" (string) (default: ''): additional text to indicate if there is an audio description; for screen readers
39
39
  - "share_path" (optional) (string) (default: '')
40
- - "icon_path": (string) (default: '')
41
40
  - "sr_gallery_label" (string) (default: ''): additional label for the gallery, providing instruction; for screen readers
42
41
  - "sr_video_label" (string) (default: ''): additional label for the video items; for screen readers
43
42
  - "sr_video_player" (string) (default: ''): additional label for the video player; for screen readers
@@ -67,7 +66,6 @@
67
66
  {% set _visible_items = visible_items|default(8) %}
68
67
  {% set _disable_hover = disable_hover|default(false) %}
69
68
  {% set _disable_overlay = disable_overlay|default(false) %}
70
- {% set _icon_path = icon_path|default('') %}
71
69
  {% set _sr_gallery_label = sr_gallery_label|default('') %}
72
70
  {% set _sr_video_label = sr_video_label|default('') %}
73
71
  {% set _expandable = expandable ?? true %}
@@ -152,7 +150,6 @@
152
150
  {% include '@ecl/gallery/gallery-item.html.twig' with {
153
151
  id: "ecl-gallery-item-" ~ _id ~ '-' ~ _key,
154
152
  item: _item,
155
- icon_path: _icon_path,
156
153
  sr_video_label: _sr_video_label,
157
154
  sr_video_player: _sr_video_player,
158
155
  disable_overlay: _disable_overlay,
@@ -171,7 +168,7 @@
171
168
  {% include '@ecl/button/button.html.twig' with {
172
169
  label: _view_all_label,
173
170
  type: 'submit',
174
- variant: 'ghost',
171
+ variant: 'tertiary',
175
172
  extra_attributes: [
176
173
  { name: 'data-ecl-gallery-all' },
177
174
  { name: 'data-ecl-gallery-collapsed-label', value: _view_all_label },
@@ -210,7 +207,6 @@
210
207
  extra_attributes: _overlay_attrs,
211
208
  extra_classes: _overlay_class,
212
209
  item: _selected_item,
213
- icon_path: _icon_path,
214
210
  } only %}
215
211
  </section>
216
212
 
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
  }
@@ -721,7 +721,7 @@ export class Gallery {
721
721
  *
722
722
  * @param {Event} e
723
723
  */
724
- // eslint-disable-next-line class-methods-use-this
724
+
725
725
  preventClickOnItem(e) {
726
726
  e.preventDefault();
727
727
  e.stopPropagation();
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-alpha.9",
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-alpha.9",
15
- "@ecl/dom-utils": "5.0.0-alpha.9",
16
- "@ecl/icon": "5.0.0-alpha.9",
17
- "@ecl/link": "5.0.0-alpha.9",
18
- "@ecl/picture": "5.0.0-alpha.9",
19
- "@ecl/video": "5.0.0-alpha.9",
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": "9ce8853975dc4e5c768598fbecddf3646608bce1"
40
+ "gitHead": "70ad1f5d6ae8b6e11c7d2422c3d5e7a1a74adf57"
37
41
  }