@ecl/mega-menu 5.0.0-alpha.4 → 5.0.0-alpha.6
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 +1 -1
- package/mega-menu-item.html.twig +9 -8
- package/mega-menu.html.twig +1 -2
- package/mega-menu.js +90 -66
- package/mega-menu.scss +16 -12
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -31,7 +31,7 @@ npm install --save @ecl/mega-menu
|
|
|
31
31
|
"featured" (object) (optional) {
|
|
32
32
|
"title": (string)
|
|
33
33
|
"content": (string)
|
|
34
|
-
"items": (associative array)
|
|
34
|
+
"items": (associative array) Array of items with image and link
|
|
35
35
|
}
|
|
36
36
|
"children": (associative array) (optional): [
|
|
37
37
|
{
|
package/mega-menu-item.html.twig
CHANGED
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
- "title" (string) Title of the featured panel
|
|
21
21
|
- "content" (string) Content of the featured panel
|
|
22
22
|
- "items" (associative array) Array of items
|
|
23
|
+
- "picture": (object) (default: {}) Object of type Picture
|
|
23
24
|
- "path" (string) Path or Url for the href
|
|
24
25
|
- "label" (string) Label of the item
|
|
25
26
|
- "external" (boolean) Whether the link is external
|
|
@@ -247,7 +248,7 @@
|
|
|
247
248
|
{% endif %}
|
|
248
249
|
<li
|
|
249
250
|
class="{{ _subitem_class }}"
|
|
250
|
-
{{
|
|
251
|
+
{{ _subitem_attrs|raw }}
|
|
251
252
|
>
|
|
252
253
|
{%- if child.children is defined and child.children is not empty -%}
|
|
253
254
|
{# Children, 2nd level #}
|
|
@@ -322,13 +323,6 @@
|
|
|
322
323
|
data-ecl-mega-menu-featured
|
|
323
324
|
>
|
|
324
325
|
<div class="ecl-mega-menu__featured-scrollable">
|
|
325
|
-
{% if _featured.picture is not empty %}
|
|
326
|
-
{% include '@ecl/picture/picture.html.twig' with {
|
|
327
|
-
picture: _featured.picture,
|
|
328
|
-
extra_classes: 'ecl-mega-menu__featured-picture',
|
|
329
|
-
extra_image_classes: 'ecl-mega-menu__featured-image',
|
|
330
|
-
} only %}
|
|
331
|
-
{% endif %}
|
|
332
326
|
{% if _featured.title is not empty %}
|
|
333
327
|
<span
|
|
334
328
|
class="ecl-mega-menu__featured-title"
|
|
@@ -347,6 +341,13 @@
|
|
|
347
341
|
>
|
|
348
342
|
{% for item in _featured.items %}
|
|
349
343
|
<li class="ecl-mega-menu__featured-list__item">
|
|
344
|
+
{% if item.picture is not empty %}
|
|
345
|
+
{% include '@ecl/picture/picture.html.twig' with {
|
|
346
|
+
picture: item.picture,
|
|
347
|
+
extra_classes: 'ecl-mega-menu__featured-picture',
|
|
348
|
+
extra_image_classes: 'ecl-mega-menu__featured-image',
|
|
349
|
+
} only %}
|
|
350
|
+
{% endif %}
|
|
350
351
|
{% include '@ecl/link/link.html.twig' with {
|
|
351
352
|
link: item|merge({ type: 'standalone', icon_path: _icon_path }),
|
|
352
353
|
extra_attributes: [
|
package/mega-menu.html.twig
CHANGED
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"featured" (oject) (optional) {
|
|
28
28
|
- "title": (string) Title of the featured panel
|
|
29
29
|
- "content": (string) Top content of the featured panel
|
|
30
|
-
- "items": (associative array) (optional)
|
|
30
|
+
- "items": (associative array) (optional) Array of items with image and link
|
|
31
31
|
}
|
|
32
32
|
"children": (associative array) (optional): [
|
|
33
33
|
{
|
|
@@ -93,7 +93,6 @@
|
|
|
93
93
|
{%- if _close is not empty and _close.label is defined and _close.label is not empty -%}
|
|
94
94
|
data-ecl-mega-menu-label-close="{{ _close.label }}"
|
|
95
95
|
{%- endif -%}
|
|
96
|
-
aria-expanded="false"
|
|
97
96
|
role="navigation"
|
|
98
97
|
id={{ _id }}
|
|
99
98
|
{%- if _aria_label is not empty %}
|
package/mega-menu.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import { queryOne, queryAll } from '@ecl/dom-utils';
|
|
4
4
|
import EventManager from '@ecl/event-manager';
|
|
5
|
-
import isMobile from 'mobile-device-detect';
|
|
6
5
|
import { createFocusTrap } from 'focus-trap';
|
|
6
|
+
import Bowser from 'bowser';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* @param {HTMLElement} element DOM element for component instantiation and scope
|
|
@@ -143,6 +143,7 @@ export class MegaMenu {
|
|
|
143
143
|
this.infoLinks = null;
|
|
144
144
|
this.seeAllLinks = null;
|
|
145
145
|
this.featuredLinks = null;
|
|
146
|
+
this.featuredImages = null;
|
|
146
147
|
|
|
147
148
|
// Bind `this` for use in callbacks
|
|
148
149
|
this.handleClickOnOpen = this.handleClickOnOpen.bind(this);
|
|
@@ -152,6 +153,8 @@ export class MegaMenu {
|
|
|
152
153
|
this.handleClickGlobal = this.handleClickGlobal.bind(this);
|
|
153
154
|
this.handleClickOnItem = this.handleClickOnItem.bind(this);
|
|
154
155
|
this.handleClickOnSubitem = this.handleClickOnSubitem.bind(this);
|
|
156
|
+
this.handleClickOnFeaturedImage =
|
|
157
|
+
this.handleClickOnFeaturedImage.bind(this);
|
|
155
158
|
this.handleFocusOut = this.handleFocusOut.bind(this);
|
|
156
159
|
this.handleKeyboard = this.handleKeyboard.bind(this);
|
|
157
160
|
this.handleKeyboardGlobal = this.handleKeyboardGlobal.bind(this);
|
|
@@ -194,6 +197,10 @@ export class MegaMenu {
|
|
|
194
197
|
);
|
|
195
198
|
this.toggleLabel = queryOne('.ecl-button__label', this.open);
|
|
196
199
|
this.menuOverlay = queryOne('.ecl-mega-menu__overlay', this.element);
|
|
200
|
+
this.featuredImages = queryAll(
|
|
201
|
+
'.ecl-mega-menu__featured-image',
|
|
202
|
+
this.element,
|
|
203
|
+
);
|
|
197
204
|
|
|
198
205
|
// Check if we should use desktop display (it does not rely only on breakpoints)
|
|
199
206
|
this.isDesktop = this.useDesktopDisplay();
|
|
@@ -211,6 +218,12 @@ export class MegaMenu {
|
|
|
211
218
|
this.back.addEventListener('keyup', this.handleKeyboard);
|
|
212
219
|
}
|
|
213
220
|
|
|
221
|
+
if (this.featuredImages) {
|
|
222
|
+
this.featuredImages.forEach((img) => {
|
|
223
|
+
img.addEventListener('click', this.handleClickOnFeaturedImage);
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
|
|
214
227
|
// Global click
|
|
215
228
|
if (this.attachClickListener) {
|
|
216
229
|
document.addEventListener('click', this.handleClickGlobal);
|
|
@@ -361,9 +374,13 @@ export class MegaMenu {
|
|
|
361
374
|
this.back.removeEventListener('click', this.handleClickOnBack);
|
|
362
375
|
}
|
|
363
376
|
|
|
364
|
-
if (this.
|
|
365
|
-
|
|
377
|
+
if (this.featuredImages) {
|
|
378
|
+
this.featuredImages.forEach((img) => {
|
|
379
|
+
img.removeEventListener('click', this.handleClickOnFeaturedImage);
|
|
380
|
+
});
|
|
366
381
|
}
|
|
382
|
+
|
|
383
|
+
document.removeEventListener('click', this.handleClickGlobal);
|
|
367
384
|
}
|
|
368
385
|
|
|
369
386
|
if (this.links) {
|
|
@@ -460,13 +477,17 @@ export class MegaMenu {
|
|
|
460
477
|
* - not having hamburger menu on screen
|
|
461
478
|
*/
|
|
462
479
|
useDesktopDisplay() {
|
|
480
|
+
const browser = Bowser.getParser(window.navigator.userAgent);
|
|
481
|
+
const isMobile = browser.getPlatformType() === 'mobile';
|
|
482
|
+
const isTablet = browser.getPlatformType() === 'tablet';
|
|
483
|
+
|
|
463
484
|
// Detect mobile devices
|
|
464
|
-
if (isMobile
|
|
485
|
+
if (isMobile) {
|
|
465
486
|
return false;
|
|
466
487
|
}
|
|
467
488
|
|
|
468
489
|
// Force mobile display on tablet
|
|
469
|
-
if (
|
|
490
|
+
if (isTablet) {
|
|
470
491
|
this.element.classList.add('ecl-mega-menu--forced-mobile');
|
|
471
492
|
return false;
|
|
472
493
|
}
|
|
@@ -578,7 +599,6 @@ export class MegaMenu {
|
|
|
578
599
|
this.checkDropdownHeight(current);
|
|
579
600
|
});
|
|
580
601
|
} else {
|
|
581
|
-
this.element.setAttribute('aria-expanded', 'false');
|
|
582
602
|
this.element.removeAttribute('data-expanded');
|
|
583
603
|
this.open.setAttribute('aria-expanded', 'false');
|
|
584
604
|
this.enableScroll();
|
|
@@ -663,6 +683,11 @@ export class MegaMenu {
|
|
|
663
683
|
checkDropdownHeight(menuItem, hide = true) {
|
|
664
684
|
const infoPanel = queryOne('.ecl-mega-menu__info', menuItem);
|
|
665
685
|
const mainPanel = queryOne('.ecl-mega-menu__mega', menuItem);
|
|
686
|
+
const expanded = queryOne('.ecl-mega-menu__subitem--expanded', menuItem);
|
|
687
|
+
let secondPanel = null;
|
|
688
|
+
if (expanded) {
|
|
689
|
+
secondPanel = queryOne('.ecl-mega-menu__mega--level-2', expanded);
|
|
690
|
+
}
|
|
666
691
|
// Hide the panels while calculating their heights
|
|
667
692
|
if (mainPanel && this.isDesktop && hide) {
|
|
668
693
|
mainPanel.style.opacity = 0;
|
|
@@ -670,6 +695,10 @@ export class MegaMenu {
|
|
|
670
695
|
if (infoPanel && this.isDesktop && hide) {
|
|
671
696
|
infoPanel.style.opacity = 0;
|
|
672
697
|
}
|
|
698
|
+
// Second panel has already zero opacity in reality, this is for consistency
|
|
699
|
+
if (secondPanel && this.isDesktop && hide) {
|
|
700
|
+
secondPanel.opacity = 0;
|
|
701
|
+
}
|
|
673
702
|
setTimeout(() => {
|
|
674
703
|
const viewportHeight = window.innerHeight;
|
|
675
704
|
let infoPanelHeight = 0;
|
|
@@ -677,7 +706,6 @@ export class MegaMenu {
|
|
|
677
706
|
if (this.isDesktop) {
|
|
678
707
|
const heights = [];
|
|
679
708
|
let height = 0;
|
|
680
|
-
let secondPanel = null;
|
|
681
709
|
let featuredPanel = null;
|
|
682
710
|
let itemsHeight = 0;
|
|
683
711
|
let subItemsHeight = 0;
|
|
@@ -724,38 +752,31 @@ export class MegaMenu {
|
|
|
724
752
|
}
|
|
725
753
|
}
|
|
726
754
|
}
|
|
727
|
-
const expanded = queryOne(
|
|
728
|
-
'.ecl-mega-menu__subitem--expanded',
|
|
729
|
-
menuItem,
|
|
730
|
-
);
|
|
731
755
|
|
|
732
|
-
if (
|
|
733
|
-
secondPanel =
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
},
|
|
755
|
-
);
|
|
756
|
+
if (secondPanel) {
|
|
757
|
+
secondPanel.style.height = '';
|
|
758
|
+
const subItems = queryAll(`${this.subItemSelector}`, secondPanel);
|
|
759
|
+
if (subItems.length > 0) {
|
|
760
|
+
subItems.forEach((item) => {
|
|
761
|
+
subItemsHeight += item.getBoundingClientRect().height;
|
|
762
|
+
});
|
|
763
|
+
}
|
|
764
|
+
heights.push(subItemsHeight);
|
|
765
|
+
// Featured panel calculations.
|
|
766
|
+
featuredPanel = queryOne('.ecl-mega-menu__featured', expanded);
|
|
767
|
+
if (featuredPanel) {
|
|
768
|
+
// Get the elements inside the scrollable container and calculate their heights.
|
|
769
|
+
Array.from(featuredPanel.firstElementChild.children).forEach(
|
|
770
|
+
(child) => {
|
|
771
|
+
const elStyle = window.getComputedStyle(child);
|
|
772
|
+
const marginHeight =
|
|
773
|
+
parseFloat(elStyle.marginTop) +
|
|
774
|
+
parseFloat(elStyle.marginBottom);
|
|
775
|
+
featuredHeight += child.offsetHeight + marginHeight;
|
|
776
|
+
},
|
|
777
|
+
);
|
|
756
778
|
|
|
757
|
-
|
|
758
|
-
}
|
|
779
|
+
heights.push(featuredHeight);
|
|
759
780
|
}
|
|
760
781
|
}
|
|
761
782
|
|
|
@@ -800,6 +821,9 @@ export class MegaMenu {
|
|
|
800
821
|
if (infoPanel && this.isDesktop) {
|
|
801
822
|
infoPanel.style.opacity = 1;
|
|
802
823
|
}
|
|
824
|
+
if (secondPanel && this.isDesktop) {
|
|
825
|
+
secondPanel.style.opacity = 1;
|
|
826
|
+
}
|
|
803
827
|
}, 100);
|
|
804
828
|
}
|
|
805
829
|
|
|
@@ -903,7 +927,7 @@ export class MegaMenu {
|
|
|
903
927
|
handleKeyboard(e) {
|
|
904
928
|
const element = e.target;
|
|
905
929
|
const cList = element.classList;
|
|
906
|
-
const menuExpanded = this.element.getAttribute('
|
|
930
|
+
const menuExpanded = this.element.getAttribute('data-expanded');
|
|
907
931
|
|
|
908
932
|
// Detect press on Escape
|
|
909
933
|
if (e.key === 'Escape' || e.key === 'Esc') {
|
|
@@ -911,7 +935,7 @@ export class MegaMenu {
|
|
|
911
935
|
element.blur();
|
|
912
936
|
}
|
|
913
937
|
|
|
914
|
-
if (menuExpanded
|
|
938
|
+
if (!menuExpanded) {
|
|
915
939
|
this.closeOpenDropdown();
|
|
916
940
|
}
|
|
917
941
|
return;
|
|
@@ -1155,7 +1179,7 @@ export class MegaMenu {
|
|
|
1155
1179
|
} else {
|
|
1156
1180
|
e.preventDefault();
|
|
1157
1181
|
this.disableScroll();
|
|
1158
|
-
this.element.setAttribute('
|
|
1182
|
+
this.element.setAttribute('data-expanded', true);
|
|
1159
1183
|
this.element.classList.add('ecl-mega-menu--start-panel');
|
|
1160
1184
|
this.element.classList.remove(
|
|
1161
1185
|
'ecl-mega-menu--one-panel',
|
|
@@ -1197,7 +1221,7 @@ export class MegaMenu {
|
|
|
1197
1221
|
* @fires Menu#onClose
|
|
1198
1222
|
*/
|
|
1199
1223
|
handleClickOnClose(e) {
|
|
1200
|
-
if (this.element.getAttribute('
|
|
1224
|
+
if (this.element.getAttribute('data-expanded')) {
|
|
1201
1225
|
this.focusTrap.deactivate();
|
|
1202
1226
|
this.closeOpenDropdown();
|
|
1203
1227
|
this.trigger('onClose', e);
|
|
@@ -1297,6 +1321,19 @@ export class MegaMenu {
|
|
|
1297
1321
|
this.trigger('onBack', { level: level2 ? 2 : 1 });
|
|
1298
1322
|
}
|
|
1299
1323
|
|
|
1324
|
+
/**
|
|
1325
|
+
* Programmatically click the related link when an image is clicked
|
|
1326
|
+
*
|
|
1327
|
+
* @param {Event} e
|
|
1328
|
+
*/
|
|
1329
|
+
handleClickOnFeaturedImage(e) {
|
|
1330
|
+
const featuredImage = e.target;
|
|
1331
|
+
const featuredLink = featuredImage.parentElement.nextSibling;
|
|
1332
|
+
if (featuredLink) {
|
|
1333
|
+
featuredLink.click();
|
|
1334
|
+
}
|
|
1335
|
+
}
|
|
1336
|
+
|
|
1300
1337
|
/**
|
|
1301
1338
|
* Show/hide the first panel
|
|
1302
1339
|
*
|
|
@@ -1312,7 +1349,6 @@ export class MegaMenu {
|
|
|
1312
1349
|
this.positionMenuOverlay();
|
|
1313
1350
|
this.checkDropdownHeight(menuItem);
|
|
1314
1351
|
this.element.setAttribute('data-expanded', true);
|
|
1315
|
-
this.element.setAttribute('aria-expanded', 'true');
|
|
1316
1352
|
this.element.classList.add('ecl-mega-menu--one-panel');
|
|
1317
1353
|
this.element.classList.remove('ecl-mega-menu--start-panel');
|
|
1318
1354
|
this.open.setAttribute('aria-expanded', 'true');
|
|
@@ -1360,19 +1396,6 @@ export class MegaMenu {
|
|
|
1360
1396
|
};
|
|
1361
1397
|
const details = { panel: 1, item: menuItem };
|
|
1362
1398
|
this.trigger('OnOpenPanel', details);
|
|
1363
|
-
if (this.isDesktop) {
|
|
1364
|
-
const list = queryOne('.ecl-mega-menu__sublist', menuItem);
|
|
1365
|
-
if (list) {
|
|
1366
|
-
// Expand the item in the sublist if it contains children.
|
|
1367
|
-
const firstExpandedChild = Array.from(list.children).find((child) =>
|
|
1368
|
-
child.firstElementChild?.hasAttribute('aria-expanded'),
|
|
1369
|
-
);
|
|
1370
|
-
|
|
1371
|
-
if (firstExpandedChild) {
|
|
1372
|
-
this.handleSecondPanel(firstExpandedChild, 'expand', true);
|
|
1373
|
-
}
|
|
1374
|
-
}
|
|
1375
|
-
}
|
|
1376
1399
|
break;
|
|
1377
1400
|
}
|
|
1378
1401
|
|
|
@@ -1392,7 +1415,7 @@ export class MegaMenu {
|
|
|
1392
1415
|
*
|
|
1393
1416
|
* @fires MegaMenu#onOpenPanel
|
|
1394
1417
|
*/
|
|
1395
|
-
handleSecondPanel(menuItem, op
|
|
1418
|
+
handleSecondPanel(menuItem, op) {
|
|
1396
1419
|
const infoPanel = queryOne(
|
|
1397
1420
|
'.ecl-mega-menu__info',
|
|
1398
1421
|
menuItem.closest('.ecl-container'),
|
|
@@ -1410,13 +1433,16 @@ export class MegaMenu {
|
|
|
1410
1433
|
if (item === menuItem) {
|
|
1411
1434
|
if (itemLink && itemLink.hasAttribute('aria-expanded')) {
|
|
1412
1435
|
itemLink.setAttribute('aria-expanded', 'true');
|
|
1413
|
-
|
|
1436
|
+
const mega = queryOne('.ecl-mega-menu__mega', item);
|
|
1414
1437
|
if (!this.isDesktop) {
|
|
1415
1438
|
// We use this class mainly to recover the default behavior of the link.
|
|
1416
1439
|
itemLink.classList.add('ecl-mega-menu__parent-link');
|
|
1417
1440
|
if (this.back) {
|
|
1418
1441
|
this.back.focus();
|
|
1419
1442
|
}
|
|
1443
|
+
} else {
|
|
1444
|
+
// Hide the panel since it will be resized later.
|
|
1445
|
+
mega.style.opacity = 0;
|
|
1420
1446
|
}
|
|
1421
1447
|
item.classList.add('ecl-mega-menu__subitem--expanded');
|
|
1422
1448
|
}
|
|
@@ -1450,12 +1476,11 @@ export class MegaMenu {
|
|
|
1450
1476
|
});
|
|
1451
1477
|
}
|
|
1452
1478
|
this.positionMenuOverlay();
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
}
|
|
1479
|
+
this.checkDropdownHeight(
|
|
1480
|
+
menuItem.closest('.ecl-mega-menu__item'),
|
|
1481
|
+
false,
|
|
1482
|
+
);
|
|
1483
|
+
|
|
1459
1484
|
const details = { panel: 2, item: menuItem };
|
|
1460
1485
|
this.trigger('OnOpenPanel', details);
|
|
1461
1486
|
break;
|
|
@@ -1573,7 +1598,6 @@ export class MegaMenu {
|
|
|
1573
1598
|
}
|
|
1574
1599
|
}
|
|
1575
1600
|
this.enableScroll();
|
|
1576
|
-
this.element.setAttribute('aria-expanded', 'false');
|
|
1577
1601
|
this.element.removeAttribute('data-expanded');
|
|
1578
1602
|
this.element.classList.remove(
|
|
1579
1603
|
'ecl-mega-menu--start-panel',
|
|
@@ -1660,11 +1684,11 @@ export class MegaMenu {
|
|
|
1660
1684
|
*/
|
|
1661
1685
|
handleFocusOut(e) {
|
|
1662
1686
|
const element = e.target;
|
|
1663
|
-
const menuExpanded = this.element.getAttribute('
|
|
1687
|
+
const menuExpanded = this.element.getAttribute('data-expanded');
|
|
1664
1688
|
|
|
1665
1689
|
// Specific focus action for mobile menu
|
|
1666
1690
|
// Loop through the items and go back to close button
|
|
1667
|
-
if (menuExpanded
|
|
1691
|
+
if (menuExpanded && !this.isDesktop) {
|
|
1668
1692
|
const nextItem = element.parentElement.nextSibling;
|
|
1669
1693
|
|
|
1670
1694
|
if (!nextItem) {
|
package/mega-menu.scss
CHANGED
|
@@ -80,7 +80,7 @@ $mega-menu: null !default;
|
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
.ecl-mega-menu[
|
|
83
|
+
.ecl-mega-menu[data-expanded] .ecl-mega-menu__open {
|
|
84
84
|
background-color: map.get($mega-menu, 'mobile', 'open-background-active');
|
|
85
85
|
|
|
86
86
|
.ecl-icon:first-of-type {
|
|
@@ -164,7 +164,7 @@ $mega-menu: null !default;
|
|
|
164
164
|
}
|
|
165
165
|
|
|
166
166
|
// Expanded
|
|
167
|
-
.ecl-mega-menu[
|
|
167
|
+
.ecl-mega-menu[data-expanded] .ecl-mega-menu__inner {
|
|
168
168
|
display: block;
|
|
169
169
|
right: 0;
|
|
170
170
|
}
|
|
@@ -275,8 +275,7 @@ $mega-menu: null !default;
|
|
|
275
275
|
z-index: -1;
|
|
276
276
|
}
|
|
277
277
|
|
|
278
|
-
.ecl-mega-menu[
|
|
279
|
-
.ecl-mega-menu[data-expanded='true'] {
|
|
278
|
+
.ecl-mega-menu[data-expanded] {
|
|
280
279
|
.ecl-mega-menu__overlay {
|
|
281
280
|
display: block;
|
|
282
281
|
}
|
|
@@ -318,6 +317,7 @@ $mega-menu: null !default;
|
|
|
318
317
|
.ecl-mega-menu__wrapper {
|
|
319
318
|
background: map.get($theme, 'color', 'white');
|
|
320
319
|
display: none;
|
|
320
|
+
font: map.get($mega-menu, 'global', 'font');
|
|
321
321
|
position: absolute;
|
|
322
322
|
height: 100%;
|
|
323
323
|
left: 0;
|
|
@@ -358,12 +358,14 @@ $mega-menu: null !default;
|
|
|
358
358
|
.ecl-mega-menu__featured-list__item .ecl-link {
|
|
359
359
|
align-items: center;
|
|
360
360
|
background: transparent;
|
|
361
|
+
/* stylelint-disable-next-line declaration-property-value-no-unknown */
|
|
361
362
|
border-bottom: 1px solid
|
|
362
363
|
map.get($mega-menu, 'desktop', 'sublink-current-background');
|
|
363
364
|
border-radius: 0;
|
|
364
365
|
box-sizing: border-box;
|
|
365
366
|
color: map.get($mega-menu, 'mobile', 'item-color');
|
|
366
367
|
display: inline-flex;
|
|
368
|
+
font: map.get($mega-menu, 'global', 'font');
|
|
367
369
|
line-height: map.get($theme, 'line-height-ui', 'xs');
|
|
368
370
|
padding: map.get($mega-menu, 'mobile', 'item-padding');
|
|
369
371
|
position: relative;
|
|
@@ -468,7 +470,6 @@ $mega-menu: null !default;
|
|
|
468
470
|
}
|
|
469
471
|
|
|
470
472
|
.ecl-mega-menu__info-content {
|
|
471
|
-
font: var(--f-m);
|
|
472
473
|
max-width: var(--max-w);
|
|
473
474
|
}
|
|
474
475
|
}
|
|
@@ -553,7 +554,6 @@ $mega-menu: null !default;
|
|
|
553
554
|
border-radius: 0;
|
|
554
555
|
color: map.get($mega-menu, 'desktop', 'item-color');
|
|
555
556
|
display: inline-flex;
|
|
556
|
-
font: var(--f-m);
|
|
557
557
|
height: 100%;
|
|
558
558
|
line-height: map.get($mega-menu, 'desktop', 'link-line-height');
|
|
559
559
|
padding: map.get($mega-menu, 'desktop', 'link-padding');
|
|
@@ -686,8 +686,6 @@ $mega-menu: null !default;
|
|
|
686
686
|
background-color: map.get($mega-menu, 'global', 'greysh-background');
|
|
687
687
|
box-shadow: none;
|
|
688
688
|
display: none;
|
|
689
|
-
font: map.get($mega-menu, 'mobile', 'subtitle-font');
|
|
690
|
-
font-weight: map.get($mega-menu, 'mobile', 'subtitle-font-weight');
|
|
691
689
|
}
|
|
692
690
|
}
|
|
693
691
|
|
|
@@ -771,7 +769,6 @@ $mega-menu: null !default;
|
|
|
771
769
|
border-radius: 0;
|
|
772
770
|
box-sizing: border-box;
|
|
773
771
|
color: var(--c-d);
|
|
774
|
-
font: var(--f-m);
|
|
775
772
|
margin: 0 var(--s-l);
|
|
776
773
|
padding: var(--s-xs) 0;
|
|
777
774
|
|
|
@@ -798,10 +795,12 @@ $mega-menu: null !default;
|
|
|
798
795
|
.ecl-mega-menu__sublink {
|
|
799
796
|
background: transparent;
|
|
800
797
|
box-sizing: border-box;
|
|
798
|
+
/* stylelint-disable-next-line declaration-property-value-no-unknown */
|
|
801
799
|
border-bottom: 1.5px solid
|
|
802
800
|
map.get($mega-menu, 'desktop', 'sublink-current-background');
|
|
803
801
|
border-radius: 0;
|
|
804
802
|
color: map.get($mega-menu, 'mobile', 'item-color');
|
|
803
|
+
font: map.get($mega-menu, 'global', 'font');
|
|
805
804
|
padding: map.get($mega-menu, 'mobile', 'subitem-padding');
|
|
806
805
|
position: relative;
|
|
807
806
|
line-height: map.get($theme, 'line-height-ui', 'xs');
|
|
@@ -906,9 +905,11 @@ $mega-menu: null !default;
|
|
|
906
905
|
display: block;
|
|
907
906
|
|
|
908
907
|
.ecl-mega-menu__featured-image {
|
|
909
|
-
|
|
908
|
+
cursor: pointer;
|
|
909
|
+
aspect-ratio: 16/9;
|
|
910
910
|
display: block;
|
|
911
911
|
margin-inline-start: var(--s-l);
|
|
912
|
+
margin-block-start: var(--s-m);
|
|
912
913
|
max-width: 15.25rem;
|
|
913
914
|
}
|
|
914
915
|
}
|
|
@@ -917,7 +918,7 @@ $mega-menu: null !default;
|
|
|
917
918
|
display: block;
|
|
918
919
|
margin: calc(var(--s-xs) + 2px) var(--s-m) calc(var(--s-xs) + 2px)
|
|
919
920
|
var(--s-l);
|
|
920
|
-
font: var(--f-
|
|
921
|
+
font: var(--f-m);
|
|
921
922
|
}
|
|
922
923
|
|
|
923
924
|
.ecl-mega-menu__featured-content {
|
|
@@ -1291,6 +1292,8 @@ $mega-menu: null !default;
|
|
|
1291
1292
|
top: 0;
|
|
1292
1293
|
|
|
1293
1294
|
.ecl-mega-menu__featured-scrollable {
|
|
1295
|
+
height: 100%;
|
|
1296
|
+
|
|
1294
1297
|
@include with-scrollbar;
|
|
1295
1298
|
}
|
|
1296
1299
|
|
|
@@ -1298,8 +1301,9 @@ $mega-menu: null !default;
|
|
|
1298
1301
|
display: block;
|
|
1299
1302
|
|
|
1300
1303
|
.ecl-mega-menu__featured-image {
|
|
1301
|
-
aspect-ratio:
|
|
1304
|
+
aspect-ratio: 16/9;
|
|
1302
1305
|
display: block;
|
|
1306
|
+
margin-block-start: 0;
|
|
1303
1307
|
margin-inline-start: var(--s-s);
|
|
1304
1308
|
max-width: calc(100% - var(--s-s));
|
|
1305
1309
|
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@ecl/mega-menu",
|
|
3
3
|
"author": "European Commission",
|
|
4
4
|
"license": "EUPL-1.2",
|
|
5
|
-
"version": "5.0.0-alpha.
|
|
5
|
+
"version": "5.0.0-alpha.6",
|
|
6
6
|
"description": "ECL Mega Menu",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
@@ -11,12 +11,12 @@
|
|
|
11
11
|
"module": "mega-menu.js",
|
|
12
12
|
"style": "mega-menu.scss",
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@ecl/button": "5.0.0-alpha.
|
|
15
|
-
"@ecl/dom-utils": "5.0.0-alpha.
|
|
16
|
-
"@ecl/event-manager": "5.0.0-alpha.
|
|
17
|
-
"@ecl/link": "5.0.0-alpha.
|
|
18
|
-
"
|
|
19
|
-
"
|
|
14
|
+
"@ecl/button": "5.0.0-alpha.6",
|
|
15
|
+
"@ecl/dom-utils": "5.0.0-alpha.6",
|
|
16
|
+
"@ecl/event-manager": "5.0.0-alpha.6",
|
|
17
|
+
"@ecl/link": "5.0.0-alpha.6",
|
|
18
|
+
"bowser": "2.11.0",
|
|
19
|
+
"focus-trap": "7.6.4"
|
|
20
20
|
},
|
|
21
21
|
"repository": {
|
|
22
22
|
"type": "git",
|
|
@@ -32,5 +32,5 @@
|
|
|
32
32
|
"design-system",
|
|
33
33
|
"twig"
|
|
34
34
|
],
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "3a1f904e4fdd672e374de174cc24a2a92e1268c4"
|
|
36
36
|
}
|