@ecl/gallery 5.0.0-alpha.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.
package/gallery.scss ADDED
@@ -0,0 +1,688 @@
1
+ /**
2
+ * Gallery
3
+ * @define gallery
4
+ */
5
+
6
+ @use 'sass:map';
7
+ @use '@ecl/grid/mixins/breakpoints';
8
+ @use '@ecl/utility-screen-reader/screen-reader';
9
+
10
+ // Exposed variables
11
+ $theme: null !default;
12
+ $gallery: null !default;
13
+
14
+ // Internal variables
15
+ $_description-color: map.get($theme, 'color', 'white');
16
+ $_image-height: 192px;
17
+ $_image-height-mobile: 260px;
18
+ $_description-height-mobile: 132px;
19
+ $_description-height-desktop: 108px;
20
+
21
+ .ecl-gallery {
22
+ margin: 0;
23
+ }
24
+
25
+ .ecl-gallery__list {
26
+ display: block;
27
+ list-style: none;
28
+ margin-bottom: 0;
29
+ margin-top: calc(-1 * var(--s-xs));
30
+ padding-inline-start: 0;
31
+ }
32
+
33
+ .ecl-gallery__item {
34
+ display: block;
35
+ height: $_image-height-mobile;
36
+ margin-bottom: 0;
37
+ margin-top: var(--s-xs);
38
+ position: relative;
39
+ }
40
+
41
+ .ecl-gallery__item__link--frozen {
42
+ cursor: default;
43
+ }
44
+
45
+ .ecl-gallery__item--hidden {
46
+ display: none;
47
+ }
48
+
49
+ .ecl-gallery__item-link {
50
+ text-decoration: none;
51
+ }
52
+
53
+ .ecl-gallery__item-icon-wrapper {
54
+ background: var(--c-d);
55
+ box-shadow: 0 0 15px 6px color-mix(in srgb, var(--c-d-80) 55%, transparent);
56
+ display: inline-block;
57
+ position: absolute;
58
+ left: 50%;
59
+ top: 50%;
60
+ border-radius: 50%;
61
+ width: 2rem;
62
+ height: 2rem;
63
+ pointer-events: none;
64
+ transform: translate(-50%, -50%);
65
+ z-index: 1;
66
+ }
67
+
68
+ .ecl-gallery__item-icon {
69
+ transform: scale(1.2);
70
+ }
71
+
72
+ .ecl-gallery__image-container {
73
+ display: flex;
74
+ height: $_image-height-mobile;
75
+ position: relative;
76
+ flex-grow: 1;
77
+ margin: 0;
78
+ overflow: hidden;
79
+ }
80
+
81
+ .ecl-gallery__item-link:focus-visible {
82
+ outline: none;
83
+
84
+ .ecl-gallery__image-container {
85
+ outline: 2px solid var(--c-p);
86
+ outline-offset: 2px;
87
+ }
88
+ }
89
+
90
+ .ecl-gallery__thumbnail {
91
+ display: none;
92
+ height: 100%;
93
+
94
+ &:not(.ecl-gallery__slider-image) {
95
+ display: flex;
96
+ flex-grow: 1;
97
+ }
98
+ }
99
+
100
+ .ecl-gallery__picture {
101
+ display: flex;
102
+ height: 100%;
103
+
104
+ &:not(.ecl-gallery__slider-image) {
105
+ display: none;
106
+ flex-grow: 1;
107
+ }
108
+ }
109
+
110
+ .ecl-gallery__image {
111
+ display: block;
112
+ flex-grow: 0;
113
+ width: 100%;
114
+ }
115
+
116
+ @supports (object-fit: cover) {
117
+ .ecl-gallery__image {
118
+ flex-grow: 1;
119
+ object-fit: cover;
120
+ }
121
+ }
122
+
123
+ .ecl-gallery__image-icon {
124
+ display: none;
125
+ }
126
+
127
+ .ecl-gallery__description {
128
+ align-items: center;
129
+ bottom: 0;
130
+ background-color: map.get($gallery, 'description-background');
131
+ color: $_description-color;
132
+ display: none;
133
+ font: var(--f-s);
134
+ left: 0;
135
+ overflow: hidden;
136
+ padding: var(--s-2xs) var(--s-xs);
137
+ pointer-events: none;
138
+ position: absolute;
139
+ text-decoration: none;
140
+ text-overflow: ellipsis;
141
+ vertical-align: text-bottom;
142
+ white-space: nowrap;
143
+ width: calc(100% - (var(--s-xs) * 2));
144
+ }
145
+
146
+ .ecl-gallery:not(.ecl-gallery--no-hover) {
147
+ .ecl-gallery__item-link:hover,
148
+ .ecl-gallery__item-link:focus-visible {
149
+ .ecl-gallery__description {
150
+ display: block;
151
+ }
152
+ }
153
+ }
154
+
155
+ .ecl-gallery__list .ecl-gallery__caption,
156
+ .ecl-gallery__list .ecl-gallery__meta {
157
+ @include screen-reader.sr-only;
158
+ }
159
+
160
+ .ecl-gallery__info {
161
+ color: map.get($gallery, 'gallery-info-color');
162
+ display: flex;
163
+ flex-direction: row;
164
+ font: var(--f-s);
165
+ }
166
+
167
+ .ecl-gallery__info-total {
168
+ align-self: center;
169
+ flex-grow: 1;
170
+
171
+ * {
172
+ margin-inline-end: var(--s-xs);
173
+ }
174
+ }
175
+
176
+ .ecl-gallery__footer {
177
+ display: flex;
178
+ flex-direction: column;
179
+ margin: 0 auto;
180
+ max-width: 1140px;
181
+ padding-top: var(--s-xs);
182
+ }
183
+
184
+ .ecl-gallery__view-all {
185
+ justify-self: flex-end;
186
+ margin-inline-start: var(--s-m);
187
+ }
188
+
189
+ .ecl-gallery__footer-link {
190
+ text-align: right;
191
+ margin-top: var(--s-s);
192
+ width: 100%;
193
+ }
194
+
195
+ .ecl-gallery__footer-divider {
196
+ background: var(--c-n-100);
197
+ border: none;
198
+ height: 1px;
199
+ width: 100%;
200
+ }
201
+
202
+ /* stylelint-disable-next-line order/order */
203
+ @include breakpoints.up('s') {
204
+ .ecl-gallery__list {
205
+ display: flex;
206
+ flex-direction: row;
207
+ flex-wrap: wrap;
208
+ margin-inline-start: calc(-1 * var(--s-xs));
209
+ }
210
+
211
+ .ecl-gallery__item {
212
+ flex-grow: 1;
213
+ margin-inline-start: var(--s-xs);
214
+ min-width: $_image-height-mobile;
215
+ }
216
+
217
+ .ecl-gallery__image {
218
+ margin: 0 auto;
219
+ }
220
+
221
+ .ecl-gallery__image-icon {
222
+ background-color: map.get($gallery, 'description-background');
223
+ bottom: 0;
224
+ display: block;
225
+ fill: $_description-color;
226
+ padding: var(--s-s);
227
+ position: absolute;
228
+ right: 0;
229
+ }
230
+
231
+ .ecl-gallery__footer {
232
+ align-items: center;
233
+ flex-direction: row;
234
+ justify-content: flex-start;
235
+ }
236
+
237
+ .ecl-gallery__info {
238
+ flex-grow: 1;
239
+ }
240
+
241
+ .ecl-gallery__info-total {
242
+ flex-grow: 0;
243
+ }
244
+
245
+ .ecl-gallery__footer-link {
246
+ align-items: center;
247
+ display: flex;
248
+ margin-top: 0;
249
+ width: auto;
250
+ }
251
+
252
+ .ecl-gallery__footer-divider {
253
+ display: none;
254
+ }
255
+
256
+ .ecl-gallery--full-width {
257
+ border-radius: 0;
258
+ left: 50%;
259
+ margin-inline-start: -50vw;
260
+ position: relative;
261
+ width: 100vw;
262
+
263
+ .ecl-gallery__footer-link {
264
+ margin-inline-start: ar(--s-m);
265
+ }
266
+
267
+ .ecl-gallery__view-all {
268
+ margin-inline-end: ar(--s-m);
269
+ }
270
+ }
271
+ }
272
+
273
+ @include breakpoints.up('l') {
274
+ .ecl-gallery__item,
275
+ .ecl-gallery__image {
276
+ height: $_image-height;
277
+ }
278
+
279
+ .ecl-gallery__image {
280
+ min-width: $_image-height;
281
+ }
282
+
283
+ .ecl-gallery__image-container {
284
+ height: $_image-height;
285
+ }
286
+ }
287
+
288
+ /*
289
+ * Overlay
290
+ */
291
+ .ecl-gallery__overlay {
292
+ background-color: map.get($gallery, 'overlay-background');
293
+ backdrop-filter: blur(25px);
294
+ border-width: 0;
295
+ box-shadow: map.get($gallery, 'overlay-shadow');
296
+ display: none;
297
+ flex-direction: column;
298
+ height: 100%;
299
+ left: 0;
300
+ margin: 0;
301
+ max-height: 100vh;
302
+ max-width: 100%;
303
+ padding: 0;
304
+ position: fixed;
305
+ top: 0;
306
+ width: 100%;
307
+ z-index: map.get($theme, 'z-index', 'overlay');
308
+ }
309
+
310
+ .ecl-gallery__overlay[open] {
311
+ display: flex;
312
+ overflow: auto;
313
+ }
314
+
315
+ .ecl-gallery__close {
316
+ display: flex;
317
+ flex-shrink: 0;
318
+ justify-content: flex-end;
319
+ }
320
+
321
+ .ecl-gallery__close-button {
322
+ color: map.get($theme, 'color', 'white');
323
+ margin: var(--s-xs);
324
+
325
+ &:focus-visible {
326
+ border-color: map.get($theme, 'color', 'white');
327
+ color: map.get($theme, 'color', 'white');
328
+ }
329
+ }
330
+
331
+ .ecl-gallery__controls {
332
+ display: inline-flex;
333
+ }
334
+
335
+ .ecl-gallery__slider {
336
+ align-items: center;
337
+ display: flex;
338
+ flex-direction: column;
339
+ flex-grow: 1;
340
+ position: relative;
341
+ overflow: hidden;
342
+ }
343
+
344
+ .ecl-gallery__slider-media-container {
345
+ align-items: center;
346
+ align-self: stretch;
347
+ display: flex;
348
+ flex-grow: 1;
349
+ justify-content: center;
350
+ }
351
+
352
+ .ecl-gallery__slider-image img,
353
+ .ecl-gallery__slider-video {
354
+ display: flex;
355
+ flex-basis: auto;
356
+ flex-grow: 0;
357
+ flex-shrink: 0;
358
+ margin: 0;
359
+ object-fit: contain;
360
+ height: 100%;
361
+ width: 100%;
362
+ }
363
+
364
+ .ecl-gallery__slider-embed-audio {
365
+ @include screen-reader.sr-only;
366
+ }
367
+
368
+ .ecl-gallery__slider-embed {
369
+ align-items: center;
370
+ display: flex;
371
+ justify-content: center;
372
+ overflow: visible;
373
+ width: 100%;
374
+ }
375
+
376
+ .ecl-gallery__pager {
377
+ display: flex;
378
+ flex-direction: row;
379
+ flex-wrap: nowrap;
380
+ justify-content: space-between;
381
+ }
382
+
383
+ .ecl-gallery__slider-previous {
384
+ margin-inline-start: var(--s-xl);
385
+ }
386
+
387
+ .ecl-gallery__slider-next {
388
+ margin-inline-start: var(--s-m);
389
+ }
390
+
391
+ .ecl-gallery__slider-previous,
392
+ .ecl-gallery__slider-next {
393
+ background: map.get($theme, 'color', 'white');
394
+ flex-shrink: 0;
395
+
396
+ &:hover {
397
+ background-color: var(--c-p-20);
398
+ }
399
+
400
+ &:focus-visible {
401
+ background-color: map.get($theme, 'color', 'white');
402
+ outline: 2px solid map.get($theme, 'color', 'white');
403
+ outline-offset: 0;
404
+ }
405
+ }
406
+
407
+ .ecl-gallery__detail {
408
+ box-sizing: border-box;
409
+ color: map.get($gallery, 'detail-color');
410
+ display: flex;
411
+ flex-direction: column;
412
+ flex-shrink: 0;
413
+ padding: var(--s-xl) var(--s-xs);
414
+
415
+ .ecl-container {
416
+ position: static;
417
+ width: 100%;
418
+ }
419
+ }
420
+
421
+ .ecl-gallery__detail-counter {
422
+ align-self: center;
423
+ border-left: 1px solid map.get($theme, 'color', 'white');
424
+ border-right: 1px solid map.get($theme, 'color', 'white');
425
+ display: inline-flex;
426
+ font: var(--f-m);
427
+ margin: 0;
428
+ padding: 0 var(--s-xs);
429
+ white-space: pre-wrap;
430
+ }
431
+
432
+ .ecl-gallery__detail-actions {
433
+ display: none;
434
+ margin-top: map.get($gallery, 'actions-margin');
435
+ }
436
+
437
+ .ecl-gallery__detail-actions-mobile {
438
+ margin-bottom: map.get($gallery, 'actions-margin');
439
+ }
440
+
441
+ .ecl-gallery__download {
442
+ margin-inline-end: var(--s-xl);
443
+ }
444
+
445
+ .ecl-gallery__download,
446
+ .ecl-gallery__share {
447
+ &[hidden] {
448
+ display: none;
449
+ }
450
+ }
451
+
452
+ .ecl-gallery__detail-container {
453
+ display: flex;
454
+ flex-direction: column;
455
+ }
456
+
457
+ .ecl-gallery__detail-description {
458
+ font: var(--f-m);
459
+ height: $_description-height-mobile;
460
+ margin-top: var(--s-s);
461
+ overflow: auto;
462
+
463
+ .ecl-gallery__title {
464
+ display: block;
465
+ font-weight: map.get($theme, 'font-weight', 'bold');
466
+ }
467
+
468
+ .ecl-gallery__meta {
469
+ display: block;
470
+ margin-top: var(--s-s);
471
+ }
472
+ }
473
+
474
+ /* stylelint-disable-next-line order/order */
475
+ @include breakpoints.up('m') {
476
+ .ecl-gallery__detail-description {
477
+ height: $_description-height-desktop;
478
+ }
479
+
480
+ .ecl-gallery__slider {
481
+ flex-grow: 1;
482
+ flex-direction: row;
483
+ justify-content: space-between;
484
+ align-items: center;
485
+ overflow: hidden;
486
+ }
487
+
488
+ .ecl-gallery__detail-actions {
489
+ display: block;
490
+ margin-top: 0;
491
+ }
492
+
493
+ .ecl-gallery__detail-actions-mobile {
494
+ display: none;
495
+ }
496
+
497
+ .ecl-gallery__detail-container {
498
+ align-items: center;
499
+ flex-direction: row-reverse;
500
+ }
501
+
502
+ .ecl-gallery__pager {
503
+ flex-grow: 1;
504
+ justify-content: flex-end;
505
+ }
506
+ }
507
+
508
+ @include breakpoints.up('xl') {
509
+ .ecl-gallery__detail .ecl-container {
510
+ display: flex;
511
+ flex-direction: column;
512
+ width: 1140px;
513
+ }
514
+ }
515
+
516
+ // Variant: grid
517
+ .ecl-gallery--grid {
518
+ .ecl-gallery__item {
519
+ aspect-ratio: 3/2;
520
+ flex-grow: 0;
521
+ height: auto;
522
+ margin-inline-start: 0;
523
+ margin-top: 0;
524
+ min-width: auto;
525
+ }
526
+
527
+ .ecl-gallery__image {
528
+ aspect-ratio: 3/2;
529
+ height: auto;
530
+ min-width: auto;
531
+ width: 100%;
532
+ }
533
+
534
+ .ecl-gallery__list {
535
+ column-gap: 1rem;
536
+ display: grid;
537
+ grid-template-columns: repeat(1, 1fr);
538
+ margin-inline-start: 0;
539
+ row-gap: 1rem;
540
+ }
541
+
542
+ // stylelint-disable-next-line no-descending-specificity
543
+ .ecl-gallery__image-container {
544
+ height: auto;
545
+ }
546
+ }
547
+
548
+ .ecl-gallery--ratio-3-1 {
549
+ .ecl-gallery__item,
550
+ .ecl-gallery__image {
551
+ aspect-ratio: 3/1;
552
+ }
553
+ }
554
+
555
+ @include breakpoints.up('m') {
556
+ .ecl-gallery--grid {
557
+ .ecl-gallery__list {
558
+ grid-template-columns: repeat(3, 1fr);
559
+ margin-top: 0;
560
+ }
561
+
562
+ &.ecl-gallery--template-1 {
563
+ .ecl-gallery__list {
564
+ grid-template-columns: repeat(12, 1fr);
565
+
566
+ .ecl-gallery__item:nth-child(9n + 1),
567
+ .ecl-gallery__item:nth-child(9n + 2) {
568
+ grid-area: span 6 / span 6;
569
+ }
570
+
571
+ .ecl-gallery__item:nth-child(9n + 3),
572
+ .ecl-gallery__item:nth-child(9n + 4),
573
+ .ecl-gallery__item:nth-child(9n + 5) {
574
+ grid-area: span 4 / span 4;
575
+ }
576
+
577
+ .ecl-gallery__item:nth-child(9n + 6),
578
+ .ecl-gallery__item:nth-child(9n + 7),
579
+ .ecl-gallery__item:nth-child(9n + 8),
580
+ .ecl-gallery__item:nth-child(9n + 9) {
581
+ grid-area: span 3 / span 3;
582
+ }
583
+ }
584
+ }
585
+
586
+ &.ecl-gallery--template-2 {
587
+ .ecl-gallery__list {
588
+ grid-auto-flow: dense;
589
+ grid-auto-columns: 1fr;
590
+
591
+ .ecl-gallery__item:nth-child(10n + 1),
592
+ .ecl-gallery__item:nth-child(10n + 10) {
593
+ aspect-ratio: auto;
594
+ grid-area: span 2 / span 2;
595
+ height: 100%;
596
+
597
+ .ecl-gallery__image-container {
598
+ height: 100%;
599
+ }
600
+ }
601
+
602
+ .ecl-gallery__item:nth-child(10n + 2) {
603
+ grid-column: 3;
604
+ }
605
+
606
+ .ecl-gallery__item:nth-child(10n + 3) {
607
+ grid-column: 4;
608
+ }
609
+
610
+ .ecl-gallery__item:nth-child(10n + 8) {
611
+ grid-column: 1;
612
+ }
613
+
614
+ .ecl-gallery__item:nth-child(10n + 9) {
615
+ grid-column: 2;
616
+ }
617
+ }
618
+ }
619
+
620
+ &.ecl-gallery--template-3 {
621
+ .ecl-gallery__list {
622
+ grid-auto-flow: dense;
623
+ grid-auto-columns: 1fr;
624
+
625
+ .ecl-gallery__item:nth-child(9n + 2) {
626
+ grid-column: 1;
627
+ }
628
+
629
+ .ecl-gallery__item:nth-child(9n + 3) {
630
+ aspect-ratio: auto;
631
+ grid-area: span 2 / span 2;
632
+ height: 100%;
633
+
634
+ .ecl-gallery__image-container {
635
+ height: 100%;
636
+ }
637
+ }
638
+
639
+ .ecl-gallery__item:nth-child(9n + 5) {
640
+ grid-column: 4;
641
+ }
642
+ }
643
+ }
644
+
645
+ &.ecl-gallery--template-4 {
646
+ .ecl-gallery__list {
647
+ grid-template-columns: repeat(4, 1fr);
648
+
649
+ .ecl-gallery__item:nth-child(8n + 1) {
650
+ aspect-ratio: auto;
651
+ grid-area: span 3 / span 3;
652
+ height: 100%;
653
+
654
+ .ecl-gallery__image-container {
655
+ height: 100%;
656
+ }
657
+ }
658
+ }
659
+ }
660
+
661
+ &.ecl-gallery--template-0 {
662
+ &.ecl-gallery--col-2 {
663
+ .ecl-gallery__list {
664
+ grid-template-columns: repeat(2, 1fr);
665
+ }
666
+ }
667
+
668
+ &.ecl-gallery--col-3 {
669
+ .ecl-gallery__list {
670
+ grid-template-columns: repeat(3, 1fr);
671
+ }
672
+ }
673
+
674
+ &.ecl-gallery--col-4 {
675
+ .ecl-gallery__list {
676
+ grid-template-columns: repeat(4, 1fr);
677
+ }
678
+ }
679
+ }
680
+ }
681
+ }
682
+
683
+ // DEPRECATED
684
+ .ecl-gallery__video-title {
685
+ @include screen-reader.sr-only;
686
+
687
+ background-color: map.get($theme, 'color', 'white');
688
+ }
package/package.json ADDED
@@ -0,0 +1,37 @@
1
+ {
2
+ "name": "@ecl/gallery",
3
+ "author": "European Commission",
4
+ "license": "EUPL-1.2",
5
+ "version": "5.0.0-alpha.1",
6
+ "description": "ECL Gallery",
7
+ "publishConfig": {
8
+ "access": "public"
9
+ },
10
+ "main": "gallery.js",
11
+ "module": "gallery.js",
12
+ "style": "gallery.scss",
13
+ "dependencies": {
14
+ "@ecl/button": "5.0.0-alpha.1",
15
+ "@ecl/dom-utils": "5.0.0-alpha.1",
16
+ "@ecl/icon": "5.0.0-alpha.1",
17
+ "@ecl/link": "5.0.0-alpha.1",
18
+ "@ecl/picture": "5.0.0-alpha.1",
19
+ "@ecl/video": "5.0.0-alpha.1",
20
+ "focus-trap": "7.6.4"
21
+ },
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "git+https://github.com/ec-europa/europa-component-library.git"
25
+ },
26
+ "bugs": {
27
+ "url": "https://github.com/ec-europa/europa-component-library/issues"
28
+ },
29
+ "homepage": "https://github.com/ec-europa/europa-component-library",
30
+ "keywords": [
31
+ "ecl",
32
+ "europa-component-library",
33
+ "design-system",
34
+ "twig"
35
+ ],
36
+ "gitHead": "f800b6d2de209fcfe182aadca5f7e45ad497b23a"
37
+ }