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