@openeuropa/bcl-twig-templates 0.3791.202505281600 → 0.3880.202510091030

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/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@openeuropa/bcl-twig-templates",
3
3
  "author": "European Commission",
4
4
  "license": "EUPL-1.2",
5
- "version": "0.3791.202505281600",
5
+ "version": "0.3880.202510091030",
6
6
  "description": "OE Bcl Twig Templates",
7
7
  "publishConfig": {
8
8
  "access": "public"
@@ -11,69 +11,70 @@
11
11
  "hoistingLimits": "workspaces"
12
12
  },
13
13
  "devDependencies": {
14
- "@openeuropa/bcl-accordion": "^0.3791.202505281600",
15
- "@openeuropa/bcl-alert": "^0.3791.202505281600",
16
- "@openeuropa/bcl-badge": "^0.3791.202505281600",
17
- "@openeuropa/bcl-banner": "^0.3791.202505281600",
18
- "@openeuropa/bcl-base-templates": "^0.3791.202505281600",
19
- "@openeuropa/bcl-blockquote": "^0.3791.202505281600",
20
- "@openeuropa/bcl-breadcrumb": "^0.3791.202505281600",
21
- "@openeuropa/bcl-button": "^0.3791.202505281600",
22
- "@openeuropa/bcl-button-group": "^0.3791.202505281600",
23
- "@openeuropa/bcl-card": "^0.3791.202505281600",
24
- "@openeuropa/bcl-card-layout": "^0.3791.202505281600",
25
- "@openeuropa/bcl-carousel": "^0.3791.202505281600",
26
- "@openeuropa/bcl-contact-form": "^0.3791.202505281600",
27
- "@openeuropa/bcl-content-banner": "^0.3791.202505281600",
28
- "@openeuropa/bcl-date-block": "^0.3791.202505281600",
29
- "@openeuropa/bcl-description-list": "^0.3791.202505281600",
30
- "@openeuropa/bcl-dropdown": "^0.3791.202505281600",
31
- "@openeuropa/bcl-event": "^0.3791.202505281600",
32
- "@openeuropa/bcl-fact-figures": "^0.3791.202505281600",
33
- "@openeuropa/bcl-featured-media": "^0.3791.202505281600",
34
- "@openeuropa/bcl-file": "^0.3791.202505281600",
35
- "@openeuropa/bcl-footer": "^0.3791.202505281600",
36
- "@openeuropa/bcl-form": "^0.3791.202505281600",
37
- "@openeuropa/bcl-form-input": "^0.3791.202505281600",
38
- "@openeuropa/bcl-gallery": "^0.3791.202505281600",
39
- "@openeuropa/bcl-glossary": "^0.3791.202505281600",
40
- "@openeuropa/bcl-group": "^0.3791.202505281600",
41
- "@openeuropa/bcl-header": "^0.3791.202505281600",
42
- "@openeuropa/bcl-heading": "^0.3791.202505281600",
43
- "@openeuropa/bcl-icon": "^0.3791.202505281600",
44
- "@openeuropa/bcl-inpage-navigation": "^0.3791.202505281600",
45
- "@openeuropa/bcl-landing-page": "^0.3791.202505281600",
46
- "@openeuropa/bcl-language-list": "^0.3791.202505281600",
47
- "@openeuropa/bcl-language-switcher": "^0.3791.202505281600",
48
- "@openeuropa/bcl-link": "^0.3791.202505281600",
49
- "@openeuropa/bcl-links-block": "^0.3791.202505281600",
50
- "@openeuropa/bcl-list-group": "^0.3791.202505281600",
51
- "@openeuropa/bcl-listing": "^0.3791.202505281600",
52
- "@openeuropa/bcl-modal": "^0.3791.202505281600",
53
- "@openeuropa/bcl-multilingual": "^0.3791.202505281600",
54
- "@openeuropa/bcl-navbar": "^0.3791.202505281600",
55
- "@openeuropa/bcl-navigation": "^0.3791.202505281600",
56
- "@openeuropa/bcl-news": "^0.3791.202505281600",
57
- "@openeuropa/bcl-offcanvas": "^0.3791.202505281600",
58
- "@openeuropa/bcl-page": "^0.3791.202505281600",
59
- "@openeuropa/bcl-pagination": "^0.3791.202505281600",
60
- "@openeuropa/bcl-person": "^0.3791.202505281600",
61
- "@openeuropa/bcl-placeholder": "^0.3791.202505281600",
62
- "@openeuropa/bcl-progress": "^0.3791.202505281600",
63
- "@openeuropa/bcl-project": "^0.3791.202505281600",
64
- "@openeuropa/bcl-project-status": "^0.3791.202505281600",
65
- "@openeuropa/bcl-recent-activities": "^0.3791.202505281600",
66
- "@openeuropa/bcl-search": "^0.3791.202505281600",
67
- "@openeuropa/bcl-search-form": "^0.3791.202505281600",
68
- "@openeuropa/bcl-select": "^0.3791.202505281600",
69
- "@openeuropa/bcl-spinner": "^0.3791.202505281600",
70
- "@openeuropa/bcl-subscription": "^0.3791.202505281600",
71
- "@openeuropa/bcl-subscription-block": "^0.3791.202505281600",
72
- "@openeuropa/bcl-table": "^0.3791.202505281600",
73
- "@openeuropa/bcl-textarea": "^0.3791.202505281600",
74
- "@openeuropa/bcl-timeline": "^0.3791.202505281600",
75
- "@openeuropa/bcl-toast": "^0.3791.202505281600",
76
- "@openeuropa/bcl-user": "^0.3791.202505281600",
14
+ "@openeuropa/bcl-accordion": "^0.3880.202510091030",
15
+ "@openeuropa/bcl-alert": "^0.3880.202510091030",
16
+ "@openeuropa/bcl-badge": "^0.3880.202510091030",
17
+ "@openeuropa/bcl-banner": "^0.3880.202510091030",
18
+ "@openeuropa/bcl-base-templates": "^0.3880.202510091030",
19
+ "@openeuropa/bcl-blockquote": "^0.3880.202510091030",
20
+ "@openeuropa/bcl-breadcrumb": "^0.3880.202510091030",
21
+ "@openeuropa/bcl-button": "^0.3880.202510091030",
22
+ "@openeuropa/bcl-button-group": "^0.3880.202510091030",
23
+ "@openeuropa/bcl-card": "^0.3880.202510091030",
24
+ "@openeuropa/bcl-card-layout": "^0.3880.202510091030",
25
+ "@openeuropa/bcl-carousel": "^0.3880.202510091030",
26
+ "@openeuropa/bcl-contact-form": "^0.3880.202510091030",
27
+ "@openeuropa/bcl-content-banner": "^0.3880.202510091030",
28
+ "@openeuropa/bcl-date-block": "^0.3880.202510091030",
29
+ "@openeuropa/bcl-description-list": "^0.3880.202510091030",
30
+ "@openeuropa/bcl-dropdown": "^0.3880.202510091030",
31
+ "@openeuropa/bcl-event": "^0.3880.202510091030",
32
+ "@openeuropa/bcl-fact-figures": "^0.3880.202510091030",
33
+ "@openeuropa/bcl-featured-media": "^0.3880.202510091030",
34
+ "@openeuropa/bcl-file": "^0.3880.202510091030",
35
+ "@openeuropa/bcl-footer": "^0.3880.202510091030",
36
+ "@openeuropa/bcl-form": "^0.3880.202510091030",
37
+ "@openeuropa/bcl-form-input": "^0.3880.202510091030",
38
+ "@openeuropa/bcl-gallery": "^0.3880.202510091030",
39
+ "@openeuropa/bcl-glossary": "^0.3880.202510091030",
40
+ "@openeuropa/bcl-group": "^0.3880.202510091030",
41
+ "@openeuropa/bcl-header": "^0.3880.202510091030",
42
+ "@openeuropa/bcl-heading": "^0.3880.202510091030",
43
+ "@openeuropa/bcl-icon": "^0.3880.202510091030",
44
+ "@openeuropa/bcl-inpage-navigation": "^0.3880.202510091030",
45
+ "@openeuropa/bcl-landing-page": "^0.3880.202510091030",
46
+ "@openeuropa/bcl-language-list": "^0.3880.202510091030",
47
+ "@openeuropa/bcl-language-switcher": "^0.3880.202510091030",
48
+ "@openeuropa/bcl-link": "^0.3880.202510091030",
49
+ "@openeuropa/bcl-links-block": "^0.3880.202510091030",
50
+ "@openeuropa/bcl-list-group": "^0.3880.202510091030",
51
+ "@openeuropa/bcl-listing": "^0.3880.202510091030",
52
+ "@openeuropa/bcl-mega-menu": "^0.3880.202510091030",
53
+ "@openeuropa/bcl-modal": "^0.3880.202510091030",
54
+ "@openeuropa/bcl-multilingual": "^0.3880.202510091030",
55
+ "@openeuropa/bcl-navbar": "^0.3880.202510091030",
56
+ "@openeuropa/bcl-navigation": "^0.3880.202510091030",
57
+ "@openeuropa/bcl-news": "^0.3880.202510091030",
58
+ "@openeuropa/bcl-offcanvas": "^0.3880.202510091030",
59
+ "@openeuropa/bcl-page": "^0.3880.202510091030",
60
+ "@openeuropa/bcl-pagination": "^0.3880.202510091030",
61
+ "@openeuropa/bcl-person": "^0.3880.202510091030",
62
+ "@openeuropa/bcl-placeholder": "^0.3880.202510091030",
63
+ "@openeuropa/bcl-progress": "^0.3880.202510091030",
64
+ "@openeuropa/bcl-project": "^0.3880.202510091030",
65
+ "@openeuropa/bcl-project-status": "^0.3880.202510091030",
66
+ "@openeuropa/bcl-recent-activities": "^0.3880.202510091030",
67
+ "@openeuropa/bcl-search": "^0.3880.202510091030",
68
+ "@openeuropa/bcl-search-form": "^0.3880.202510091030",
69
+ "@openeuropa/bcl-select": "^0.3880.202510091030",
70
+ "@openeuropa/bcl-spinner": "^0.3880.202510091030",
71
+ "@openeuropa/bcl-subscription": "^0.3880.202510091030",
72
+ "@openeuropa/bcl-subscription-block": "^0.3880.202510091030",
73
+ "@openeuropa/bcl-table": "^0.3880.202510091030",
74
+ "@openeuropa/bcl-textarea": "^0.3880.202510091030",
75
+ "@openeuropa/bcl-timeline": "^0.3880.202510091030",
76
+ "@openeuropa/bcl-toast": "^0.3880.202510091030",
77
+ "@openeuropa/bcl-user": "^0.3880.202510091030",
77
78
  "copyfiles": "2.4.1",
78
79
  "rimraf": "6.0.1"
79
80
  },
@@ -96,5 +97,5 @@
96
97
  "design-system",
97
98
  "twig"
98
99
  ],
99
- "gitHead": "82386b23099d054d6be4d12b88414d068e2b94bb"
100
+ "gitHead": "eb2325d947a08af67abe26062ee1229a008581af"
100
101
  }
@@ -1,6 +1,6 @@
1
1
  {% apply spaceless %}
2
2
 
3
- {#
3
+ {#
4
4
  Parameters:
5
5
  - label (string) (default: '')
6
6
  - variant (string) (default: 'primary')
@@ -38,6 +38,7 @@
38
38
  {% set _spinner = spinner|default({}) %}
39
39
  {% set _show_spinner = show_spinner ?? false %}
40
40
  {% set _clean_class = clean_class ?? false %}
41
+ {% set _remove_icon_spacers = remove_icon_spacers ?? false %}
41
42
 
42
43
  {% set _classes = [] %}
43
44
  {% if _clean_class == false %}
@@ -68,7 +69,7 @@
68
69
  size: "fluid",
69
70
  })
70
71
  %}
71
- {% if _label is not empty %}
72
+ {% if _label is not empty and not _remove_icon_spacers %}
72
73
  {% if _icon.attributes is empty %}
73
74
  {% set _icon = _icon|merge({
74
75
  attributes: create_attribute()
@@ -45,13 +45,13 @@
45
45
 
46
46
  <time {{ attributes }}>
47
47
  <div class="d-flex flex-column pt-2">
48
- <div class="d-flex align-item-center bg-white border border-bottom-0 w-100 h-100 text-uppercase justify-content-center gap-3">
48
+ <div class="d-flex align-item-center bg-white border border-bottom-0 w-100 h-100 text-uppercase justify-content-center gap-2">
49
49
  <div class="d-flex flex-column align-item-center justify-content-center">
50
50
  <div class="date-month lh-1">{{- _month -}}</div>
51
51
  <div class="date-day fw-bold fs-4 lh-1">{{- _day -}}</div>
52
52
  </div>
53
53
  {% if _end_day or _end_month %}
54
- <div class="d-flex flex-column align-item-center justify-content-center px-2">
54
+ <div class="d-flex flex-column align-item-center justify-content-center">
55
55
  {%- include '@oe-bcl/bcl-icon/icon.html.twig' with {
56
56
  name: "chevron-right",
57
57
  size: "xs",
@@ -68,7 +68,7 @@
68
68
  </div>
69
69
  {% endif %}
70
70
  </div>
71
- <div class="bg-lighter border w-100 rounded-bottom py-1 d-flex gap-2 justify-content-around">
71
+ <div class="bg-lighter border w-100 rounded-bottom py-1 d-flex gap-4 justify-content-center">
72
72
  <div class="date-year year-start">{{- _year -}}</div>
73
73
  {%- if _end_year is not empty -%}
74
74
  <div class="date-year year-end">{{ _end_year }}</div>
@@ -25,6 +25,7 @@
25
25
  {% set _project_logo = project_logo|default({}) %}
26
26
  {% set _site_name = site_name|default('') %}
27
27
  {% set _project_link = project_link|default('') %}
28
+ {% set _navbar_id = navbar_id|default('header-navbar-' ~ random(100)) %}
28
29
  {% set _head = head|default({}) %}
29
30
  {% set _breadcrumbs = breadcrumbs|default({}) %}
30
31
  {% set _language_modal = language_modal|default({}) %}
@@ -51,10 +52,38 @@
51
52
  <header
52
53
  {{ attributes }}
53
54
  >
54
- <!-- navbar_settings -->
55
- {% if _head is not empty %}
56
- {% include '@oe-bcl/bcl-navbar/navbar.html.twig' with _head only %}
57
- {% endif %}
55
+ <nav
56
+ {{ _head.attributes.addClass(['navbar', 'navbar-expand-lg', 'navbar-light']) }}>
57
+ <div class='container'>
58
+ {% if _head.brand is not empty %}
59
+ <a class='navbar-brand' href='{{ _head.brand.link }}'>
60
+ {% for logo in _head.brand.logos %}
61
+ <img
62
+ src='{{ logo.src }}'
63
+ {% if logo.alt is not empty %}
64
+ alt='{{ logo.alt }}'
65
+ {% endif %}
66
+ {% if logo.class is not empty %}
67
+ class='{{ logo.class }}'
68
+ {% endif %}
69
+ />
70
+ {% endfor %}
71
+ </a>
72
+ {% endif %}
73
+ <button
74
+ class="navbar-toggler bcl-navbar-toggler"
75
+ type="button"
76
+ data-bs-toggle="collapse"
77
+ data-bs-target='#{{ _navbar_id }}'
78
+ aria-controls='{{ _navbar_id }}'
79
+ aria-expanded="false"
80
+ aria-label="Toggle navigation"
81
+ >
82
+ <span class="navbar-toggler-icon"></span>
83
+ </button>
84
+ </div>
85
+ </nav>
86
+
58
87
 
59
88
  <!-- project name -->
60
89
  {% if _project_logo is not empty or _site_name is not empty %}
@@ -62,7 +91,6 @@
62
91
  <div class="container">
63
92
  {% if _project_link is not empty %}
64
93
  <a
65
- class="d-inline-block"
66
94
  href="{{ _project_link }}"
67
95
  >
68
96
  {% endif %}
@@ -93,7 +121,10 @@
93
121
 
94
122
  <!-- navbar -->
95
123
  {% if _navbar is not empty %}
96
- {% include '@oe-bcl/bcl-navbar/navbar.html.twig' with _navbar only %}
124
+ {% include '@oe-bcl/bcl-navbar/navbar.html.twig' with _navbar|merge({
125
+ disable_collapse: true,
126
+ attributes: create_attribute().addClass('bcl-header__navbar collapse navbar-collapse').setAttribute('id', _navbar_id).setAttribute('aria-label', 'Main Navigation'),
127
+ }) only %}
97
128
  {% endif %}
98
129
 
99
130
  <!-- breadcrumbs -->
@@ -29,6 +29,11 @@ Parameters:
29
29
  {% endif %}
30
30
 
31
31
  {% set attributes = attributes.addClass(['bcl-inpage-navigation', 'position-sticky']).setAttribute('id', _id) %}
32
+
33
+ {% if not attributes.hasAttribute('aria-label') and not attributes.hasAttribute('aria-labelledby') %}
34
+ {% set attributes = attributes.setAttribute('aria-labelledby', _dropdown_id) %}
35
+ {% endif %}
36
+
32
37
  {% set title_attributes = _title_attributes.addClass(['mb-0', 'd-none', 'd-md-block']) %}
33
38
  {% set _button_content %}
34
39
  {{ _title }}
@@ -45,7 +50,7 @@ Parameters:
45
50
  {% set _classes = _classes|merge(['dynamic-active']) %}
46
51
  {% endif %}
47
52
 
48
- <nav {{ attributes.addClass(_classes) }}>
53
+ <nav{{ attributes.addClass(_classes) }}>
49
54
  {% set trigger_attributes = create_attribute()
50
55
  .setAttribute('aria-expanded', 'false')
51
56
  .setAttribute('type', 'button')
@@ -63,7 +68,7 @@ Parameters:
63
68
  title_link: _title_link,
64
69
  attributes: _title_attributes,
65
70
  } only %}
66
- <div class="dropdown-menu" aria-labelledby="{{ _dropdown_id }}">
71
+ <div class="dropdown-menu">
67
72
  {% include '@oe-bcl/bcl-navigation/navigation.html.twig' with {
68
73
  'pills': true,
69
74
  'vertical': true,
@@ -0,0 +1,35 @@
1
+ {% apply spaceless %}
2
+
3
+ {% set _label = label ?? null %}
4
+ {% set _items = items ?? [] %}
5
+ {% set _icon_path = icon_path ?? '' %}
6
+ {% set _level = level ?? 1 %}
7
+ {% set _see_all = see_all ?? null %}
8
+
9
+ <ul class="bcl-mega-menu__items __level-{{ _level }}">
10
+ {% for _item in _items %}
11
+ {% set _li_attributes = _item.li_attributes ?? create_attribute() %}
12
+ {% if _item.items is defined and _item.items is not empty %}
13
+ {# This is a parent item. #}
14
+ <li{{ _li_attributes.addClass('__parent') }}>
15
+ {% include '@oe-bcl/bcl-mega-menu/mega-menu-submenu.html.twig' with _item|merge({
16
+ icon_path: _icon_path,
17
+ level: _level + 1,
18
+ }) only %}
19
+ </li>
20
+ {% else %}
21
+ {# This is a leaf item. #}
22
+ <li{{ _li_attributes.addClass('__leaf') }}>
23
+ {% if _item.path is empty %}
24
+ {# This is a nolink item. #}
25
+ <span{{ _item.attributes ?? '' }}>{{ _item.label }}</span>
26
+ {% else %}
27
+ {# This is a link. #}
28
+ {% include '@oe-bcl/bcl-link/link.html.twig' with _item only %}
29
+ {% endif %}
30
+ </li>
31
+ {% endif %}
32
+ {% endfor %}
33
+ </ul>
34
+
35
+ {% endapply %}
@@ -0,0 +1,65 @@
1
+ {% apply spaceless %}
2
+
3
+ {% set _items = items ?? [] %}
4
+ {% set _trigger = trigger ?? null %}
5
+ {% set _icon_path = icon_path ?? '' %}
6
+ {% set _level = level ?? 2 %}
7
+ {% set _see_all = see_all ?? null %}
8
+
9
+ {% set _trigger_id = _trigger.id|default('mm-trigger-' ~ random(10000)) %}
10
+ {% set _panel_id = 'mm-panel-' ~ _trigger_id %}
11
+
12
+ {% set _trigger_attributes = _trigger.attributes ?? create_attribute() %}
13
+ {% set _trigger = _trigger|merge({
14
+ attributes: _trigger_attributes
15
+ .setAttribute('id', _trigger_id)
16
+ .setAttribute('aria-controls', _panel_id)
17
+ .setAttribute('aria-expanded', 'false')
18
+ .setAttribute('aria-haspopup', 'menu'),
19
+ remove_icon_spacers: true,
20
+ clean_class: true,
21
+ }) %}
22
+ {% include '@oe-bcl/bcl-button/button.html.twig' with _trigger only %}
23
+
24
+ {# Add an optional "See all" link as last item. #}
25
+ {% if _see_all is not empty %}
26
+ {# Wrap the label for an ellipsis. #}
27
+ {% set _see_all_label %}
28
+ <span>{{- _see_all.label -}}</span>
29
+ {% endset %}
30
+ {% set _see_all_attr = (_see_all.attributes is defined ? _see_all.attributes : create_attribute()) %}
31
+ {% set _see_all = _see_all|merge({
32
+ label: _see_all_label,
33
+ icon: {
34
+ name: 'arrow-right',
35
+ path: _icon_path,
36
+ },
37
+ li_attributes: create_attribute()
38
+ .addClass('__see_all'),
39
+ attributes: _see_all_attr
40
+ .addClass(['see-all-button'])
41
+ .setAttribute('aria-label', 'See all items in ‘' ~ _trigger.label ~ '’')
42
+ }) %}
43
+ {% set _items = _items|merge([_see_all]) %}
44
+ {% endif %}
45
+ {% set submenu_attributes = create_attribute()
46
+ .setAttribute('id', _panel_id)
47
+ .setAttribute('hidden', '')
48
+ .setAttribute('role', 'group')
49
+ .setAttribute('aria-labelledby', _trigger_id)
50
+ .addClass('bcl-mega-menu__submenu', '__level-' ~ _level)
51
+ %}
52
+ <div{{ submenu_attributes }}>
53
+ {% if _trigger %}
54
+ <div class="__header">
55
+ <p class="__label">{{ _trigger.label }}</p>
56
+ </div>
57
+ {% endif %}
58
+ {% include '@oe-bcl/bcl-mega-menu/mega-menu-items.html.twig' with {
59
+ items: _items,
60
+ icon_path: _icon_path,
61
+ level: _level,
62
+ } only %}
63
+ </div>
64
+
65
+ {% endapply %}
@@ -0,0 +1,115 @@
1
+ {% apply spaceless %}
2
+
3
+ {# Parameters:
4
+ - id (string) (default: dropdown-random(1000))
5
+ - link (boolean) (default: false) - sets trigger to link, default is button
6
+ - trigger (link or button)
7
+ - content_block (block) (default: '')
8
+ - content_link (link)
9
+ - icon_path (string) (default: '')
10
+ - min_height (string) (default: '300px')
11
+ ! set min-height of mega-menu
12
+ - items (object[])
13
+ format: [
14
+ {
15
+ - link or dropdown
16
+ }
17
+ ]
18
+ - back_button_label (string) (default: 'Back')
19
+ - icon_path (string) (default: '')
20
+ #}
21
+
22
+ {% set _id = id|default('dropdown-' ~ random(1000)) %}
23
+ {% set _link = link ?? false %}
24
+ {% set _trigger = trigger|default({}) %}
25
+ {% set _content_block = content_block|default('') %}
26
+ {% set _content_link = content_link|default({}) %}
27
+ {% set _icon_path = icon_path|default('') %}
28
+ {% set _items = items|default([]) %}
29
+ {% set _back_button_label = back_button_label|default('Back') %}
30
+ {% set _icon_path = icon_path|default('') %}
31
+ {% set _menu_id = 'mega-menu-' ~ _id %}
32
+
33
+ {% if attributes is empty %}
34
+ {% set attributes = create_attribute() %}
35
+ {% endif %}
36
+
37
+ {% set _classes = ['bcl-mega-menu'] %}
38
+
39
+ {% set attributes = attributes.addClass(_classes) %}
40
+
41
+ {% if _trigger.attributes is empty %}
42
+ {% set _trigger = _trigger|merge({
43
+ attributes: create_attribute()
44
+ }) %}
45
+ {% endif %}
46
+ {% set _trigger = _trigger|merge({
47
+ attributes: _trigger.attributes.addClass(['dropdown-toggle', 'nav-link'])
48
+ .setAttribute('aria-expanded', 'false')
49
+ .setAttribute('aria-haspopup', 'menu')
50
+ .setAttribute('aria-controls', _menu_id)
51
+ .setAttribute('data-bs-toggle', 'dropdown')
52
+ .setAttribute('data-bs-auto-close', 'outside')
53
+ .setAttribute('id', _id)
54
+ }) %}
55
+
56
+ <div {{ attributes }}>
57
+ {% include '@oe-bcl/bcl-button/button.html.twig' with _trigger|merge({
58
+ variant: 'link',
59
+ clean_class: true,
60
+ }) only %}
61
+ {# Mega menu panel. #}
62
+ <nav id="{{ _menu_id }}" class="bcl-mega-menu__container dropdown-menu" aria-labelledby="{{ _id }}" aria-label="Main mega menu">
63
+ <div class="container">
64
+ {# Mobile back button. #}
65
+ <div class="container d-lg-none bcl-mega-menu__back-button-block">
66
+ {% include '@oe-bcl/bcl-button/button.html.twig' with {
67
+ label: _back_button_label,
68
+ icon_position: "before",
69
+ variant: 'link',
70
+ icon: {
71
+ path: _icon_path,
72
+ name: "arrow-left",
73
+ },
74
+ attributes: create_attribute().addClass(['back-button']).setAttribute('aria-label', 'Back to main menu')
75
+ } only %}
76
+ </div>
77
+ {# Info/summary and submenu columns. #}
78
+ <div class="position-relative">
79
+ <div class="row">
80
+ {# Content / summary column. #}
81
+ {% if content_block is defined %}
82
+ <div class="col-md-12 col-xl-3 position-relative bcl-mega-menu__info">
83
+ <div class="content-block">
84
+ {%- block content_block -%}
85
+ {{ _content_block }}
86
+ {%- endblock -%}
87
+ {% if _content_link.path is not empty %}
88
+ {% set _content_link = _content_link|merge({
89
+ icon: _content_link.icon|default({})|merge({
90
+ path: _icon_path
91
+ }),
92
+ attributes: (_content_link.attributes is defined
93
+ ? _content_link.attributes
94
+ : create_attribute()
95
+ ).addClass('content-link')
96
+ }) %}
97
+ <p class="m-0">{% include '@oe-bcl/bcl-link/link.html.twig' with _content_link only %}</p>
98
+ {% endif %}
99
+ </div>
100
+ <div class="shadow-container">
101
+ <span class="shadow-bg"></span>
102
+ </div>
103
+ </div>
104
+ {% endif %}
105
+ {# Submenu column. #}
106
+ <div class="col-md-12 col-lg-4 col-xl-3 bcl-mega-menu__menu">
107
+ {% include '@oe-bcl/bcl-mega-menu/mega-menu-items.html.twig' %}
108
+ </div>
109
+ </div>
110
+ </div>
111
+ </div>
112
+ </nav>
113
+ </div>
114
+
115
+ {% endapply %}
@@ -14,7 +14,10 @@
14
14
  - body (block) (default: '')
15
15
  - footer (block) (default: '')
16
16
  - attributes (drupal attrs)
17
-
17
+ - header_attributes (drupal attrs)
18
+ - body_attributes (drupal attrs)
19
+ - footer_attributes (drupal attrs)
20
+
18
21
  Blocks
19
22
  - header
20
23
  - messages
@@ -29,9 +32,12 @@
29
32
  {% set _verticaly_centered = verticaly_centered ?? false %}
30
33
  {% set _scrollable = scrollable ?? false %}
31
34
  {% set _header = header|default('') %}
35
+ {% set _header_attributes = header_attributes ?: create_attribute() %}
32
36
  {% set _messages = messages|default('') %}
33
37
  {% set _body = body|default('') %}
38
+ {% set _body_attributes = body_attributes ?: create_attribute() %}
34
39
  {% set _footer = footer|default('') %}
40
+ {% set _footer_attributes = footer_attributes ?: create_attribute() %}
35
41
 
36
42
  {% set _classes = ['modal', 'fade'] %}
37
43
 
@@ -62,16 +68,22 @@
62
68
  >
63
69
  <div class="modal-content">
64
70
  {% if header is not empty %}
65
- <div class="modal-header">
71
+ <div
72
+ {{- _header_attributes.addClass(['modal-header']) -}}
73
+ >
66
74
  {%- block header _header -%}
67
75
  </div>
68
76
  {% endif %}
69
77
  {%- block messages _messages -%}
70
- <div class="modal-body">
78
+ <div
79
+ {{- _body_attributes.addClass(['modal-body']) -}}
80
+ >
71
81
  {%- block body _body -%}
72
82
  </div>
73
83
  {% if footer is not empty %}
74
- <div class="modal-footer">
84
+ <div
85
+ {{- _footer_attributes.addClass(['modal-footer']) -}}
86
+ >
75
87
  {%- block footer _footer -%}
76
88
  </div>
77
89
  {% endif %}
@@ -91,7 +91,7 @@
91
91
  {% set _nav_class = _nav_class ~ ' dropdown' %}
92
92
  {% set _item = _item|merge({remove_wrapper: true}) %}
93
93
  {% endif %}
94
- {% if _item.dropdown %}
94
+ {% if _item.dropdown or _item.mega_menu %}
95
95
  {% set _item_classes = [] %}
96
96
  {% else %}
97
97
  {% set _item_classes = ['nav-link'] %}
@@ -124,6 +124,8 @@
124
124
  {% include '@oe-bcl/bcl-dropdown/dropdown.html.twig' with _item only %}
125
125
  {% elseif _item.button is defined %}
126
126
  {% include '@oe-bcl/bcl-button/button.html.twig' with _item only %}
127
+ {% elseif _item.mega_menu is defined %}
128
+ {% include '@oe-bcl/bcl-mega-menu/mega-menu.html.twig' with _item only %}
127
129
  {% else %}
128
130
  {% include '@oe-bcl/bcl-link/link.html.twig' with _item only %}
129
131
  {% endif %}
@@ -25,7 +25,7 @@
25
25
  {% set _title_link = title_link|default({}) %}
26
26
  {% set _title_attributes = title_attributes ?: create_attribute() %}
27
27
  {% set _placement = placement|default('') %}
28
- {% set _id = id|default('') %}
28
+ {% set _id = id|default('bcl-offcanvas-' ~ random(10000)) %}
29
29
  {% set _body = body|default('') %}
30
30
  {% set _with_body_scroll = with_body_scroll ?? false %}
31
31
  {% set _with_backdrop = with_backdrop ?? true %}
@@ -57,14 +57,12 @@
57
57
  {% set attributes = create_attribute() %}
58
58
  {% endif %}
59
59
 
60
+ {% set attributes = attributes.setAttribute('id', _id) %}
61
+
60
62
  {% if _aria_labelled is defined and _aria_labelled is not empty %}
61
63
  {% set attributes = attributes.setAttribute('aria-labelledby', _aria_labelled) %}
62
64
  {% endif %}
63
65
 
64
- {% if _id is not empty %}
65
- {% set attributes = attributes.setAttribute('id', _id) %}
66
- {% endif %}
67
-
68
66
  {% if _with_body_scroll %}
69
67
  {% set attributes = attributes.setAttribute('data-bs-scroll', 'true') %}
70
68
  {% endif %}
@@ -73,6 +71,10 @@
73
71
  {% set attributes = attributes.setAttribute('data-bs-backdrop', 'false') %}
74
72
  {% endif %}
75
73
 
74
+ {% if _title is not empty %}
75
+ {% set attributes = attributes.setAttribute('aria-labelledby', _id ~ '-title') %}
76
+ {% endif %}
77
+
76
78
  {% set attributes = attributes.setAttribute('tabindex', '-1').addClass(_classes) %}
77
79
 
78
80
  <div
@@ -85,7 +87,7 @@
85
87
  title: _title,
86
88
  title_tag: _title_tag,
87
89
  title_link: _title_link,
88
- attributes: _title_attributes.addClass(['offcanvas-title']),
90
+ attributes: _title_attributes.setAttribute('id', _id ~ '-title').addClass(['offcanvas-title']),
89
91
  } only %}
90
92
  {% endif %}
91
93
  {% if _with_close %}
@@ -94,6 +96,7 @@
94
96
  .setAttribute('data-bs-dismiss', 'offcanvas')
95
97
  .setAttribute('data-bs-target', '#' ~ _id)
96
98
  .setAttribute('aria-label', _close_aria_label)
99
+ .setAttribute('aria-controls', _id)
97
100
  %}
98
101
  {% if _extra_classes_close is not empty %}
99
102
  {% set button_attributes = button_attributes.addClass(_extra_classes_close) %}
@@ -10,6 +10,11 @@
10
10
  - toasts (object[]) format: [
11
11
  {
12
12
  - body (string) (default: '')
13
+ - body_attributes (drupal attrs)
14
+ - header (string) (default: '')
15
+ - header_attributes (drupal attrs)
16
+ - button_attributes (drupal attrs)
17
+ - custom_content (string) (default: '')
13
18
  - role (string) (default: 'alert')
14
19
  - with_close (boolean) (default: true)
15
20
  - autohide (boolean) (default: false)
@@ -66,6 +71,9 @@
66
71
  {% set _with_body_wrapper = _toast.with_body_wrapper ?? false %}
67
72
  {% set _body_wrapper_classes = _toast.body_wrapper_classes|default('') %}
68
73
  {% set _toast_attributes = _toast.attributes ?: create_attribute() %}
74
+ {% set _body_attributes = _toast.body_attributes ?: create_attribute() %}
75
+ {% set _header_attributes = _toast.header_attributes ?: create_attribute() %}
76
+ {% set _button_attributes = _toast.button_attributes ?: create_attribute() %}
69
77
  {% set _toast_attributes = _toast_attributes.addClass(_classes).setAttribute('aria-atomic', 'true') %}
70
78
  {% if _aria_live is not empty %}
71
79
  {% set _toast_attributes = _toast_attributes.setAttribute('aria-live', _aria_live) %}
@@ -82,16 +90,16 @@
82
90
  {% if _with_close or
83
91
  (_toast.header is defined and _toast.header is not empty)
84
92
  %}
85
- <div class="toast-header">
93
+ <div{{ _header_attributes.addClass(['toast-header']) }}>
86
94
  {{- _toast.header|default('') -}}
87
95
  {% if _with_close %}
88
- {% set button_attributes = create_attribute()
96
+ {% set _button_attributes = _button_attributes
89
97
  .addClass(['btn-close'])
90
98
  .setAttribute('aria-label', 'close')
91
99
  .setAttribute('data-bs-dismiss', 'toast')
92
100
  %}
93
101
  {%- include '@oe-bcl/bcl-button/button.html.twig' with {
94
- attributes: button_attributes,
102
+ attributes: _button_attributes,
95
103
  clean_class: true
96
104
  } only -%}
97
105
  {% endif %}
@@ -104,12 +112,13 @@
104
112
  {% endif %}
105
113
  >
106
114
  {% endif %}
107
- <div class="toast-body">
115
+ <div{{ _body_attributes.addClass(['toast-body']) }}>
108
116
  {{- _body -}}
109
117
  </div>
110
118
  {% if _with_body_wrapper %}
111
119
  </div>
112
120
  {% endif %}
121
+ {{- _toast.custom_content|default('') -}}
113
122
  </div>
114
123
  {% endfor %}
115
124
  {% endif %}