@ecl/gallery 5.0.0-RC1

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.
@@ -0,0 +1,174 @@
1
+ {% apply spaceless %}
2
+
3
+ {#
4
+ Parameters:
5
+ - "overlay" (object) (default: {})
6
+ - "close" (object) (default: {}): object of type button
7
+ - "previous (object) (default: {}): object of type button
8
+ - "next" (object) (default: {}): object of type button
9
+ - "counter_separator" (string) (default: '')
10
+ - "full_screen_label" (string) (default: '')
11
+ - "download" (object) (default: {}): object of type link
12
+ - "share" (object) (default: {}): object of type link
13
+ - "sr_overlay_label" (string) (default: '') aria-label for the overlay
14
+ - "item" (object) (default: {}): object of type gallery-item
15
+ - "extra_classes" (string) (default: '')
16
+ - "extra_attributes" (optional) (array) (default: [])
17
+ - "name" (string) Attribute name, eg. 'data-test'
18
+ - "value" (string) Attribute value, eg: 'data-test-1'
19
+ #}
20
+
21
+ {# variables #}
22
+
23
+ {% set _css_class = 'ecl-gallery__overlay' %}
24
+ {% set _css_media_class = 'ecl-gallery__slider-media-container' %}
25
+ {% set _extra_attributes = '' %}
26
+ {% set _button_type = 'button' %}
27
+ {% set _overlay = overlay|default({}) %}
28
+ {% set _item = item|default({}) %}
29
+
30
+ {# Internal logic - Process properties #}
31
+
32
+ {% if extra_classes is defined and extra_classes is not empty %}
33
+ {% set _css_class = _css_class ~ ' ' ~ extra_classes %}
34
+ {% endif %}
35
+
36
+ {% if extra_attributes is defined and extra_attributes is not empty and extra_attributes is iterable %}
37
+ {% for attr in extra_attributes %}
38
+ {% if attr.value is defined %}
39
+ {% set _extra_attributes = _extra_attributes ~ ' ' ~ attr.name|e('html_attr') ~ '="' ~ attr.value|e('html_attr') ~ '"' %}
40
+ {% else %}
41
+ {% set _extra_attributes = _extra_attributes ~ ' ' ~ attr.name|e('html_attr') %}
42
+ {% endif %}
43
+ {% endfor %}
44
+ {% endif %}
45
+
46
+ {# Print the result #}
47
+
48
+ <dialog
49
+ class="{{ _css_class }}"
50
+ {{ _extra_attributes|raw }}
51
+ data-ecl-gallery-overlay
52
+ {% if _overlay.sr_overlay_label is defined and _overlay.sr_overlay_label is not empty %}
53
+ aria-label="{{ _overlay.sr_overlay_label }}"
54
+ {% endif %}
55
+ >
56
+ <header class="ecl-gallery__close" data-ecl-gallery-overlay-header>
57
+ {% include '@ecl/button/button.html.twig' with _overlay.close|merge({
58
+ extra_classes: 'ecl-gallery__close-button',
59
+ variant: 'tertiary',
60
+ style: 'inverted',
61
+ type: 'submit',
62
+ extra_attributes: [
63
+ { name: 'data-ecl-gallery-close' },
64
+ ],
65
+ }) only %}
66
+ </header>
67
+
68
+ <section class="ecl-gallery__slider">
69
+ <div class="{{ _css_media_class }}" data-ecl-gallery-overlay-media></div>
70
+ </section>
71
+
72
+ <footer class="ecl-gallery__detail" data-ecl-gallery-overlay-footer>
73
+ <div class="ecl-container">
74
+ <div class="ecl-gallery__detail-container">
75
+ <div class="ecl-gallery__pager">
76
+ {% if _overlay.counter_separator is defined and _overlay.counter_separator is not empty %}
77
+ <div class="ecl-gallery__detail-counter">
78
+ <span data-ecl-gallery-overlay-counter-current>0</span>{{- ' ' -}}
79
+ {{- _overlay.counter_separator }}{{- ' ' -}}
80
+ <span data-ecl-gallery-overlay-counter-max>0</span>
81
+ </div>
82
+ {% endif %}
83
+ {% if _overlay.previous is not empty or _overlay.next is not empty %}
84
+ <div class="ecl-gallery__controls">
85
+ {% if _overlay.previous is defined and _overlay.previous is not empty %}
86
+ {% include '@ecl/button/button.html.twig' with _overlay.previous|merge({
87
+ extra_classes: 'ecl-gallery__slider-previous',
88
+ type: _button_type,
89
+ variant: 'tertiary',
90
+ icon_position: 'before',
91
+ hide_label: true,
92
+ icon: _overlay.previous.icon|merge({
93
+ size: 'm',
94
+ transform: 'rotate-270',
95
+ name: 'corner-arrow',
96
+ }),
97
+ extra_attributes: [
98
+ { name: 'data-ecl-gallery-overlay-previous' },
99
+ ],
100
+ }) only %}
101
+ {% endif %}
102
+ {% if (_overlay.next is defined and _overlay.next is not empty) and
103
+ (_overlay.next.icon is defined and _overlay.next.icon is not empty) %}
104
+ {% include '@ecl/button/button.html.twig' with _overlay.next|merge({
105
+ extra_classes: 'ecl-gallery__slider-next',
106
+ type: _button_type,
107
+ variant: 'tertiary',
108
+ hide_label: true,
109
+ icon: _overlay.next.icon|merge({
110
+ size: 'm',
111
+ transform: 'rotate-90',
112
+ name: 'corner-arrow',
113
+ }),
114
+ extra_attributes: [
115
+ { name: 'data-ecl-gallery-overlay-next' },
116
+ ],
117
+ }) only %}
118
+ {% endif %}
119
+ </div>
120
+ {% endif %}
121
+ </div>
122
+ <div class="ecl-gallery__detail-actions">
123
+ {% if _overlay.full_screen_label is not empty %}
124
+ {% include '@ecl/link/link.html.twig' with {
125
+ link: {
126
+ icon_position: 'after',
127
+ type: 'standalone',
128
+ inverted: true,
129
+ label: _overlay.full_screen_label ?: _overlay.download.link.label|default(''),
130
+ },
131
+ icon: {
132
+ name: 'fullscreen',
133
+ size: 'fluid',
134
+ },
135
+ extra_classes: 'ecl-gallery__download',
136
+ extra_attributes: [
137
+ { name: 'target', value: '_blank' },
138
+ { name: 'data-ecl-gallery-overlay-download' },
139
+ ],
140
+ } only %}
141
+ {% endif %}
142
+ {% if (_overlay.share is defined and _overlay.share is not empty) and
143
+ (_overlay.share.link is defined and _overlay.share.link is not empty) %}
144
+ {% include '@ecl/link/link.html.twig' with _overlay.share|merge({
145
+ link: _overlay.share.link|merge({
146
+ icon_position: 'after',
147
+ type: 'standalone',
148
+ inverted: true,
149
+ }),
150
+ icon: _overlay.share.icon|merge({
151
+ name: 'share',
152
+ size: 'fluid',
153
+ }),
154
+ extra_classes: 'ecl-gallery__share',
155
+ extra_attributes: [
156
+ { name: 'data-ecl-gallery-overlay-share' },
157
+ ],
158
+ }) only %}
159
+ {% endif %}
160
+ </div>
161
+ </div>
162
+ {% if _item.description is defined and _item.description is not empty %}
163
+ <div
164
+ class="ecl-gallery__detail-description"
165
+ data-ecl-gallery-overlay-description
166
+ >
167
+ {{- _item.description -}}
168
+ </div>
169
+ {% endif %}
170
+ </div>
171
+ </footer>
172
+ </dialog>
173
+
174
+ {% endapply %}
@@ -0,0 +1,365 @@
1
+ /**
2
+ * Gallery print
3
+ * @define gallery
4
+ */
5
+
6
+ @use 'sass:map';
7
+
8
+ // Exposed variables
9
+ $theme: null !default;
10
+ $gallery: null !default;
11
+ $gallery-print: null !default;
12
+
13
+ .ecl-gallery {
14
+ margin: 0;
15
+ }
16
+
17
+ .ecl-gallery__list {
18
+ display: flex;
19
+ flex-direction: row;
20
+ flex-wrap: wrap;
21
+ list-style: none;
22
+ margin-bottom: 0;
23
+ margin-top: -#{map.get($theme, 'spacing-print', 'xs')};
24
+ padding-inline-start: 0;
25
+ }
26
+
27
+ .ecl-gallery__item {
28
+ display: block;
29
+ flex-grow: 1;
30
+ height: 5cm;
31
+ margin-bottom: 0;
32
+ margin-inline-start: map.get($theme, 'spacing-print', 'xs');
33
+ margin-top: map.get($theme, 'spacing-print', 'xs');
34
+ min-width: 7cm;
35
+ position: relative;
36
+ }
37
+
38
+ .ecl-gallery__item-icon {
39
+ display: none;
40
+ }
41
+
42
+ .ecl-gallery__image-container {
43
+ display: flex;
44
+ height: 5cm;
45
+ position: relative;
46
+ flex-grow: 1;
47
+ margin: 0;
48
+ }
49
+
50
+ .ecl-gallery__thumbnail {
51
+ display: none;
52
+ height: 100%;
53
+
54
+ &:not(.ecl-gallery__slider-image) {
55
+ display: flex;
56
+ flex-grow: 1;
57
+ }
58
+ }
59
+
60
+ .ecl-gallery__picture {
61
+ display: flex;
62
+ height: 100%;
63
+
64
+ &:not(.ecl-gallery__slider-image) {
65
+ display: none;
66
+ flex-grow: 1;
67
+ }
68
+ }
69
+
70
+ @supports (object-fit: cover) {
71
+ .ecl-gallery__image {
72
+ display: block;
73
+ min-width: 5cm;
74
+ flex-grow: 1;
75
+ object-fit: cover;
76
+ }
77
+ }
78
+
79
+ .ecl-gallery__description {
80
+ align-items: center;
81
+ background-color: rgb(0, 0, 0, 0.7);
82
+ color: #fff;
83
+ font: map.get($gallery-print, 'description-font');
84
+ padding: map.get($theme, 'spacing-print', '2xs')
85
+ map.get($theme, 'spacing-print', 'xs');
86
+ text-decoration: none;
87
+ white-space: nowrap;
88
+ overflow: hidden;
89
+ text-overflow: ellipsis;
90
+ vertical-align: text-bottom;
91
+ width: calc(100% - (#{map.get($theme, 'spacing-print', 'xs')} * 2));
92
+ bottom: 0;
93
+ left: 0;
94
+ position: absolute;
95
+ }
96
+
97
+ .ecl-gallery--no-hover .ecl-gallery__description {
98
+ display: none;
99
+ }
100
+
101
+ .ecl-gallery__description-icon {
102
+ display: none;
103
+ }
104
+
105
+ .ecl-gallery__list .ecl-gallery__caption,
106
+ .ecl-gallery__list .ecl-gallery__meta,
107
+ .ecl-gallery__video-title {
108
+ display: none;
109
+ }
110
+
111
+ .ecl-gallery__footer {
112
+ display: none;
113
+ }
114
+
115
+ // Overlay
116
+
117
+ .ecl-gallery__overlay {
118
+ background-color: map.get($gallery, 'overlay-background');
119
+ backdrop-filter: blur(25px);
120
+ border-width: 0;
121
+ display: none;
122
+ flex-direction: column;
123
+ height: 100%;
124
+ left: 0;
125
+ margin: 0;
126
+ max-height: 100vh;
127
+ max-width: 100%;
128
+ padding: 0;
129
+ position: fixed;
130
+ top: 0;
131
+ width: 100%;
132
+ z-index: map.get($theme, 'z-index', 'overlay');
133
+
134
+ .ecl-gallery__close,
135
+ .ecl-gallery__slider-previous,
136
+ .ecl-gallery__slider-next,
137
+ .ecl-gallery__detail-actions {
138
+ display: none;
139
+ }
140
+
141
+ .ecl-gallery__slider {
142
+ align-items: center;
143
+ display: flex;
144
+ flex-direction: row;
145
+ flex-grow: 1;
146
+ justify-content: center;
147
+ overflow: hidden;
148
+ position: relative;
149
+ }
150
+
151
+ .ecl-gallery__slider-image *,
152
+ .ecl-gallery__slider-video {
153
+ display: flex;
154
+ flex-basis: auto;
155
+ flex-grow: 0;
156
+ flex-shrink: 0;
157
+ height: 100%;
158
+ margin: 0;
159
+ object-fit: contain;
160
+ width: 100%;
161
+ }
162
+
163
+ .ecl-gallery__detail {
164
+ padding: map.get($theme, 'spacing-print', 'm');
165
+
166
+ * {
167
+ color: #fff;
168
+ }
169
+ }
170
+
171
+ .ecl-gallery__detail-counter {
172
+ display: none;
173
+ }
174
+
175
+ .ecl-gallery__meta,
176
+ .ecl-gallery__title {
177
+ height: 1px;
178
+ left: -10000px;
179
+ overflow: hidden;
180
+ position: absolute;
181
+ top: auto;
182
+ width: 1px;
183
+ }
184
+
185
+ .ecl-gallery__detail-meta {
186
+ margin-top: map.get($theme, 'spacing-print', 'xs');
187
+ }
188
+
189
+ .ecl-gallery__slider-embed-audio {
190
+ display: none;
191
+ }
192
+
193
+ .ecl-gallery__pager {
194
+ display: flex;
195
+ flex-direction: row-reverse;
196
+ margin-top: map.get($theme, 'spacing-print', 'xs');
197
+
198
+ * {
199
+ align-self: flex-end;
200
+ font: map.get($theme, 'font-print', 's');
201
+ }
202
+ }
203
+ }
204
+
205
+ .ecl-gallery__overlay[open] {
206
+ display: flex;
207
+ overflow: auto;
208
+ }
209
+
210
+ .ecl-gallery--ratio-3-1 {
211
+ .ecl-gallery__item,
212
+ .ecl-gallery__image {
213
+ aspect-ratio: 3/1;
214
+ }
215
+ }
216
+
217
+ // Variant: grid
218
+ .ecl-gallery--grid {
219
+ .ecl-gallery__item {
220
+ aspect-ratio: 3/2;
221
+ flex-grow: 0;
222
+ height: auto;
223
+ margin-inline-start: 0;
224
+ margin-top: 0;
225
+ min-width: auto;
226
+ }
227
+
228
+ .ecl-gallery__image {
229
+ aspect-ratio: 3/2;
230
+ height: auto;
231
+ min-width: auto;
232
+ width: 100%;
233
+ }
234
+
235
+ .ecl-gallery__list {
236
+ display: grid;
237
+ grid-template-columns: repeat(3, 1fr);
238
+ row-gap: 1rem;
239
+ column-gap: 1rem;
240
+ margin-inline-start: 0;
241
+ }
242
+
243
+ .ecl-gallery__image-container {
244
+ height: auto;
245
+ }
246
+
247
+ &.ecl-gallery--template-1 {
248
+ .ecl-gallery__list {
249
+ grid-template-columns: repeat(12, 1fr);
250
+
251
+ .ecl-gallery__item:nth-child(9n + 1),
252
+ .ecl-gallery__item:nth-child(9n + 2) {
253
+ grid-area: span 6 / span 6;
254
+ }
255
+
256
+ .ecl-gallery__item:nth-child(9n + 3),
257
+ .ecl-gallery__item:nth-child(9n + 4),
258
+ .ecl-gallery__item:nth-child(9n + 5) {
259
+ grid-area: span 4 / span 4;
260
+ }
261
+
262
+ .ecl-gallery__item:nth-child(9n + 6),
263
+ .ecl-gallery__item:nth-child(9n + 7),
264
+ .ecl-gallery__item:nth-child(9n + 8),
265
+ .ecl-gallery__item:nth-child(9n + 9) {
266
+ grid-area: span 3 / span 3;
267
+ }
268
+ }
269
+ }
270
+
271
+ &.ecl-gallery--template-2 {
272
+ .ecl-gallery__list {
273
+ grid-auto-flow: dense;
274
+ grid-auto-columns: 1fr;
275
+
276
+ .ecl-gallery__item:nth-child(10n + 1),
277
+ .ecl-gallery__item:nth-child(10n + 10) {
278
+ aspect-ratio: auto;
279
+ grid-area: span 2 / span 2;
280
+ height: 100%;
281
+
282
+ .ecl-gallery__image-container {
283
+ height: 100%;
284
+ }
285
+ }
286
+
287
+ .ecl-gallery__item:nth-child(10n + 2) {
288
+ grid-column: 3;
289
+ }
290
+
291
+ .ecl-gallery__item:nth-child(10n + 3) {
292
+ grid-column: 4;
293
+ }
294
+
295
+ .ecl-gallery__item:nth-child(10n + 8) {
296
+ grid-column: 1;
297
+ }
298
+
299
+ .ecl-gallery__item:nth-child(10n + 9) {
300
+ grid-column: 2;
301
+ }
302
+ }
303
+ }
304
+
305
+ &.ecl-gallery--template-3 {
306
+ .ecl-gallery__list {
307
+ grid-auto-flow: dense;
308
+ grid-auto-columns: 1fr;
309
+
310
+ .ecl-gallery__item:nth-child(9n + 2) {
311
+ grid-column: 1;
312
+ }
313
+
314
+ .ecl-gallery__item:nth-child(9n + 3) {
315
+ aspect-ratio: auto;
316
+ grid-area: span 2 / span 2;
317
+ height: 100%;
318
+
319
+ .ecl-gallery__image-container {
320
+ height: 100%;
321
+ }
322
+ }
323
+
324
+ .ecl-gallery__item:nth-child(9n + 5) {
325
+ grid-column: 4;
326
+ }
327
+ }
328
+ }
329
+
330
+ &.ecl-gallery--template-4 {
331
+ .ecl-gallery__list {
332
+ grid-template-columns: repeat(4, 1fr);
333
+
334
+ .ecl-gallery__item:nth-child(8n + 1) {
335
+ aspect-ratio: auto;
336
+ grid-area: span 3 / span 3;
337
+ height: 100%;
338
+
339
+ .ecl-gallery__image-container {
340
+ height: 100%;
341
+ }
342
+ }
343
+ }
344
+ }
345
+
346
+ &.ecl-gallery--template-0 {
347
+ &.ecl-gallery--col-2 {
348
+ .ecl-gallery__list {
349
+ grid-template-columns: repeat(2, 1fr);
350
+ }
351
+ }
352
+
353
+ &.ecl-gallery--col-3 {
354
+ .ecl-gallery__list {
355
+ grid-template-columns: repeat(3, 1fr);
356
+ }
357
+ }
358
+
359
+ &.ecl-gallery--col-4 {
360
+ .ecl-gallery__list {
361
+ grid-template-columns: repeat(4, 1fr);
362
+ }
363
+ }
364
+ }
365
+ }