@openeuropa/bcl-theme-default 0.4230.202512021730 → 0.4360.202601141610

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.
Files changed (109) hide show
  1. package/css/oe-bcl-ckeditor5.min.css +1 -1
  2. package/css/oe-bcl-ckeditor5.min.css.map +1 -1
  3. package/css/oe-bcl-default.css +61 -48
  4. package/css/oe-bcl-default.css.map +1 -1
  5. package/css/oe-bcl-default.min.css +1 -1
  6. package/css/oe-bcl-default.min.css.map +1 -1
  7. package/js/oe-bcl-default.bundle.js +112 -1
  8. package/js/oe-bcl-default.bundle.js.map +1 -1
  9. package/js/oe-bcl-default.bundle.min.js +1 -1
  10. package/js/oe-bcl-default.bundle.min.js.map +1 -1
  11. package/js/oe-bcl-default.esm.js +111 -1
  12. package/js/oe-bcl-default.esm.js.map +1 -1
  13. package/js/oe-bcl-default.esm.min.js +1 -1
  14. package/js/oe-bcl-default.esm.min.js.map +1 -1
  15. package/js/oe-bcl-default.umd.js +112 -1
  16. package/js/oe-bcl-default.umd.js.map +1 -1
  17. package/js/oe-bcl-default.umd.min.js +1 -1
  18. package/js/oe-bcl-default.umd.min.js.map +1 -1
  19. package/package.json +5 -5
  20. package/src/js/header/header.js +91 -0
  21. package/src/js/index.esm.js +2 -0
  22. package/src/js/index.umd.js +2 -0
  23. package/src/js/mega-menu/mega-menu.js +57 -0
  24. package/src/scss/_header.scss +6 -2
  25. package/src/scss/_mega-menu.scss +57 -58
  26. package/src/scss/base/_colors.scss +1 -0
  27. package/templates/bcl-accordion/accordion.html.twig +42 -43
  28. package/templates/bcl-alert/alert.html.twig +18 -18
  29. package/templates/bcl-badge/badge.html.twig +11 -12
  30. package/templates/bcl-banner/banner.html.twig +34 -34
  31. package/templates/bcl-base-templates/content-type.html.twig +63 -64
  32. package/templates/bcl-base-templates/listing-page.html.twig +31 -31
  33. package/templates/bcl-base-templates/sidebar-search.html.twig +10 -10
  34. package/templates/bcl-blockquote/blockquote.html.twig +17 -17
  35. package/templates/bcl-breadcrumb/breadcrumb.html.twig +24 -25
  36. package/templates/bcl-button/button.html.twig +24 -24
  37. package/templates/bcl-button-group/button-group.html.twig +25 -26
  38. package/templates/bcl-card/card.html.twig +98 -98
  39. package/templates/bcl-card-layout/card-layout.html.twig +34 -34
  40. package/templates/bcl-carousel/carousel.html.twig +64 -64
  41. package/templates/bcl-contact-form/contact-form.html.twig +1 -1
  42. package/templates/bcl-content-banner/content-banner.html.twig +37 -37
  43. package/templates/bcl-date-block/date-block.html.twig +26 -26
  44. package/templates/bcl-description-list/description-list-details.html.twig +6 -6
  45. package/templates/bcl-description-list/description-list-title.html.twig +11 -11
  46. package/templates/bcl-description-list/description-list.html.twig +44 -45
  47. package/templates/bcl-dropdown/dropdown.html.twig +48 -49
  48. package/templates/bcl-event/event.html.twig +7 -7
  49. package/templates/bcl-fact-figures/fact-figures.html.twig +34 -34
  50. package/templates/bcl-featured-media/featured-media.html.twig +42 -43
  51. package/templates/bcl-file/file-translations.html.twig +29 -29
  52. package/templates/bcl-file/file.html.twig +46 -46
  53. package/templates/bcl-footer/footer.html.twig +31 -31
  54. package/templates/bcl-form/form.html.twig +70 -70
  55. package/templates/bcl-form-input/form-input.html.twig +57 -58
  56. package/templates/bcl-gallery/gallery-item.html.twig +20 -20
  57. package/templates/bcl-gallery/gallery.html.twig +62 -63
  58. package/templates/bcl-glossary/glossary-detail.html.twig +19 -19
  59. package/templates/bcl-glossary/glossary-listing.html.twig +6 -6
  60. package/templates/bcl-group/group-landing.html.twig +69 -69
  61. package/templates/bcl-group/group.html.twig +19 -19
  62. package/templates/bcl-header/header.html.twig +71 -79
  63. package/templates/bcl-heading/heading.html.twig +13 -14
  64. package/templates/bcl-icon/icon.html.twig +10 -10
  65. package/templates/bcl-inpage-navigation/inpage-navigation.html.twig +20 -20
  66. package/templates/bcl-landing-page/landing-page.html.twig +33 -33
  67. package/templates/bcl-language-list/language-list-grid.html.twig +25 -25
  68. package/templates/bcl-language-list/language-list-modal.html.twig +52 -52
  69. package/templates/bcl-language-list/language-list.html.twig +33 -34
  70. package/templates/bcl-language-switcher/language-switcher.html.twig +12 -12
  71. package/templates/bcl-link/link.html.twig +24 -24
  72. package/templates/bcl-links-block/links-block.html.twig +29 -30
  73. package/templates/bcl-list-group/list-group.html.twig +43 -44
  74. package/templates/bcl-listing/listing.html.twig +88 -88
  75. package/templates/bcl-mega-menu/mega-menu-items.html.twig +18 -18
  76. package/templates/bcl-mega-menu/mega-menu-submenu.html.twig +27 -22
  77. package/templates/bcl-mega-menu/mega-menu.html.twig +37 -35
  78. package/templates/bcl-modal/modal.html.twig +17 -17
  79. package/templates/bcl-navbar/navbar.html.twig +35 -35
  80. package/templates/bcl-navigation/navigation.html.twig +106 -106
  81. package/templates/bcl-offcanvas/offcanvas.html.twig +33 -33
  82. package/templates/bcl-page/page.html.twig +27 -27
  83. package/templates/bcl-pagination/pagination-item.html.twig +22 -23
  84. package/templates/bcl-pagination/pagination.html.twig +59 -59
  85. package/templates/bcl-pagination-v2/pagination-item.html.twig +31 -32
  86. package/templates/bcl-pagination-v2/pagination.html.twig +79 -79
  87. package/templates/bcl-person/person.html.twig +12 -12
  88. package/templates/bcl-placeholder/placeholder.html.twig +14 -15
  89. package/templates/bcl-progress/progress.html.twig +16 -17
  90. package/templates/bcl-project/project-lists.html.twig +25 -25
  91. package/templates/bcl-project/project.html.twig +35 -35
  92. package/templates/bcl-project-status/project-contributions.html.twig +25 -25
  93. package/templates/bcl-project-status/project-status.html.twig +32 -34
  94. package/templates/bcl-recent-activities/recent-activities.html.twig +13 -13
  95. package/templates/bcl-search/search.html.twig +12 -12
  96. package/templates/bcl-search-form/search-form.html.twig +21 -21
  97. package/templates/bcl-select/select.html.twig +52 -53
  98. package/templates/bcl-spinner/spinner.html.twig +10 -10
  99. package/templates/bcl-subscription/subscription-modal.html.twig +7 -7
  100. package/templates/bcl-subscription/subscription.html.twig +3 -3
  101. package/templates/bcl-subscription-block/subscription-block.html.twig +14 -14
  102. package/templates/bcl-table/table.html.twig +61 -62
  103. package/templates/bcl-textarea/textarea.html.twig +44 -44
  104. package/templates/bcl-timeline/timeline-item.html.twig +12 -12
  105. package/templates/bcl-timeline/timeline.html.twig +42 -42
  106. package/templates/bcl-toasts/toasts.html.twig +56 -57
  107. package/templates/bcl-user/user-compact.html.twig +24 -24
  108. package/templates/bcl-user/user-terms.html.twig +6 -6
  109. package/templates/bcl-user/user.html.twig +117 -117
@@ -2702,12 +2702,27 @@ document.addEventListener("DOMContentLoaded", () => {
2702
2702
  MainNavigation.init(".bcl-navbar-toggler");
2703
2703
  });
2704
2704
 
2705
+ const SUBMENU_HEIGHT_VARIABLE = "--oel-mega-menu-submenu-height";
2706
+ const SUBMENU_BODY_SELECTOR = ".__submenu_body";
2705
2707
  class MegaMenu {
2708
+ scheduleSubmenuHeightUpdate = () => {
2709
+ if (this.submenuHeightFrame) {
2710
+ return;
2711
+ }
2712
+ this.submenuHeightFrame = window.requestAnimationFrame(() => {
2713
+ this.submenuHeightFrame = null;
2714
+ this.updateSubmenuHeight();
2715
+ });
2716
+ };
2706
2717
  constructor(root) {
2707
2718
  this.root = root;
2719
+ this.submenuHeightFrame = null;
2720
+ this.submenuBodies = SelectorEngine.find(SUBMENU_BODY_SELECTOR, this.root);
2708
2721
  this.backButton = SelectorEngine.findOne(".back-button", this.root);
2709
2722
  this.trigger = SelectorEngine.findOne(':scope > .dropdown-toggle[data-bs-toggle="dropdown"]', this.root);
2710
2723
  this.ul = SelectorEngine.findOne('.bcl-mega-menu__items.__level-1', this.root);
2724
+ EventHandler.on(window, "resize", this.scheduleSubmenuHeightUpdate);
2725
+ EventHandler.on(window, "orientationchange", this.scheduleSubmenuHeightUpdate);
2711
2726
  this.addSubmenuTriggerListeners();
2712
2727
  this.addBackButtonListener();
2713
2728
  this.addTriggerListeners();
@@ -2763,6 +2778,7 @@ class MegaMenu {
2763
2778
 
2764
2779
  // When the mega menu is opened, focus the first item in the menu.
2765
2780
  EventHandler.on(this.trigger, 'shown.bs.dropdown', () => {
2781
+ this.scheduleSubmenuHeightUpdate();
2766
2782
  const panelId = this.trigger.getAttribute('aria-controls');
2767
2783
  const panel = panelId ? document.getElementById(panelId) : null;
2768
2784
  const firstFocusable = panel ? this.getFocusableChildren(panel)[0] : null;
@@ -2821,6 +2837,7 @@ class MegaMenu {
2821
2837
  trigger.setAttribute('aria-expanded', 'true');
2822
2838
  const panel = this.getPanelForTrigger(trigger);
2823
2839
  if (panel) panel.hidden = false;
2840
+ this.scheduleSubmenuHeightUpdate();
2824
2841
  }
2825
2842
 
2826
2843
  /**
@@ -2846,6 +2863,33 @@ class MegaMenu {
2846
2863
  const panel = this.getPanelForTrigger(trigger);
2847
2864
  if (panel) panel.hidden = true;
2848
2865
  }
2866
+ updateSubmenuHeight() {
2867
+ if (!this.trigger || this.trigger.getAttribute('aria-expanded') !== 'true') {
2868
+ return;
2869
+ }
2870
+ if (!this.submenuBodies || this.submenuBodies.length === 0) {
2871
+ return;
2872
+ }
2873
+ const viewportHeight = document.documentElement && document.documentElement.clientHeight || window.innerHeight || 0;
2874
+ if (!viewportHeight) {
2875
+ return;
2876
+ }
2877
+ this.submenuBodies.forEach(submenuBody => {
2878
+ if (!submenuBody.isConnected || submenuBody.closest('[hidden]')) {
2879
+ return;
2880
+ }
2881
+ const rect = submenuBody.getBoundingClientRect();
2882
+ const visibleTop = Math.max(rect.top, 0);
2883
+ // Use the distance to the viewport bottom instead of the current element
2884
+ // height. Nested submenus inherit the parent max-height, so relying on
2885
+ // rect.bottom would keep the parent's value and never recalc for children.
2886
+ const availableHeight = Math.max(0, viewportHeight - visibleTop);
2887
+ const value = `${availableHeight}px`;
2888
+ if (submenuBody.style.getPropertyValue(SUBMENU_HEIGHT_VARIABLE) !== value) {
2889
+ submenuBody.style.setProperty(SUBMENU_HEIGHT_VARIABLE, value);
2890
+ }
2891
+ });
2892
+ }
2849
2893
  static init(selector = ".bcl-mega-menu") {
2850
2894
  const megaMenus = SelectorEngine.find(selector);
2851
2895
  megaMenus.forEach(menuEl => new MegaMenu(menuEl));
@@ -5256,5 +5300,71 @@ class AccessibleToggle {
5256
5300
  }
5257
5301
  }
5258
5302
 
5259
- export { AccessibleToggle, AccordionToggle, Alert, Button, Carousel, Collapse, Dropdown, Gallery, MainNavigation, MegaMenu, Modal, Offcanvas, Popover, ScrollSpy, ScrollSpy$1 as ScrollSpyV2, Tab, Toast, Tooltip };
5303
+ const HEADER_SELECTOR = ".bcl-header";
5304
+ const TOGGLER_SELECTOR = ".bcl-navbar-toggler";
5305
+ const OFFSET_VARIABLE = "--oel-mega-menu-offset-top";
5306
+ class Header {
5307
+ scheduleUpdate = () => {
5308
+ if (this.frameRequest) {
5309
+ return;
5310
+ }
5311
+ this.frameRequest = window.requestAnimationFrame(() => {
5312
+ this.frameRequest = null;
5313
+ this.updateOffset();
5314
+ });
5315
+ };
5316
+ constructor(element) {
5317
+ this.element = element;
5318
+ this.frameRequest = null;
5319
+ this.resizeObserver = null;
5320
+ this.init();
5321
+ }
5322
+ init() {
5323
+ this.updateOffset();
5324
+ EventHandler.on(window, "resize", this.scheduleUpdate);
5325
+ EventHandler.on(window, "orientationchange", this.scheduleUpdate);
5326
+ const togglers = SelectorEngine.find(TOGGLER_SELECTOR, this.element);
5327
+ togglers.forEach(toggler => {
5328
+ // Some layouts move the header when the nav toggler expands; keep offset in sync.
5329
+ EventHandler.on(toggler, "click", this.scheduleUpdate);
5330
+ });
5331
+ }
5332
+ updateOffset() {
5333
+ if (!this.element) {
5334
+ return;
5335
+ }
5336
+ const rect = this.element.getBoundingClientRect();
5337
+ const offset = Math.max(0, rect.top);
5338
+ const value = `${offset}px`;
5339
+ if (this.element.style.getPropertyValue(OFFSET_VARIABLE) === value) {
5340
+ return;
5341
+ }
5342
+ this.element.style.setProperty(OFFSET_VARIABLE, value);
5343
+ }
5344
+ static init(root) {
5345
+ if (typeof document === "undefined" || typeof window === "undefined") {
5346
+ return;
5347
+ }
5348
+ const resolvedRoot = root || document;
5349
+ const context = resolvedRoot instanceof Element ? resolvedRoot : resolvedRoot.documentElement || document.documentElement;
5350
+ const headers = SelectorEngine.find(HEADER_SELECTOR, context);
5351
+ headers.forEach(headerElement => {
5352
+ if (headerElement.dataset.headerOffsetInitialized === "true") {
5353
+ return;
5354
+ }
5355
+ headerElement.dataset.headerOffsetInitialized = "true";
5356
+ new Header(headerElement);
5357
+ });
5358
+ }
5359
+ }
5360
+ if (typeof document !== "undefined") {
5361
+ const initializeHeaderOffset = () => Header.init();
5362
+ if (document.readyState === "loading") {
5363
+ document.addEventListener("DOMContentLoaded", initializeHeaderOffset);
5364
+ } else {
5365
+ initializeHeaderOffset();
5366
+ }
5367
+ }
5368
+
5369
+ export { AccessibleToggle, AccordionToggle, Alert, Button, Carousel, Collapse, Dropdown, Gallery, Header, MainNavigation, MegaMenu, Modal, Offcanvas, Popover, ScrollSpy, ScrollSpy$1 as ScrollSpyV2, Tab, Toast, Tooltip };
5260
5370
  //# sourceMappingURL=oe-bcl-default.esm.js.map