@ecl/mega-menu 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.
@@ -0,0 +1,387 @@
1
+ {% apply spaceless %}
2
+
3
+ {#
4
+ Parameters:
5
+ - "id" (string) Unique id for this item. Needed for accessibility. Generated automatically
6
+ - "item" (object)
7
+ - "label" (string) Label of the menu link
8
+ - "external" (boolean) External link
9
+ - "one_level_only" (boolean) (default: false)
10
+ - "promotional" (boolean) (default: false) Promotional menu item, styles can be custommized defining:
11
+ --ecl-mega-menu-item-promotional-bg
12
+ --ecl-mega-menu-item-promotional-hover-bg
13
+ --ecl-mega-menu-item-promotional-focus-bg
14
+ --ecl-mega-menu-item-promotional-outline-color
15
+ --ecl-mega-menu-item-promotional-text-color
16
+ --ecl-mega-menu-item-promotional-hover-text-color
17
+ --ecl-mega-menu-item-promotional-focus-text-color
18
+ - "sr_external" (string) (default: '') Additional label for the external icon
19
+ - "path" (string) Href of the menu link
20
+ - "extra_attributes" (optional) (array) (default: []) Extra attributes for link
21
+ - "name" (string) Attribute name, eg. 'data-test'
22
+ - "value" (optional) (string) Attribute value, eg: 'data-test-1'
23
+ - "info" (object) (default: {}) Info column
24
+ - "title" (string) Title of the info panel
25
+ - "content" (string) Content of the info panel
26
+ - "link" (object) Structure for the "discover more" link, following ECL Link
27
+ - "featured": (object) (default({})) Featured column
28
+ - "title" (string) Title of the featured panel
29
+ - "content" (string) Content of the featured panel
30
+ - "items" (associative array) Array of items
31
+ - "picture": (object) (default: {}) Object of type Picture
32
+ - "path" (string) Path or Url for the href
33
+ - "label" (string) Label of the item
34
+ - "description" (string) Description for the item
35
+ - "external" (boolean) Whether the link is external
36
+ - "icon_path" (string) Path to the icons sprite
37
+ - "sr_external" (string) (default: '') Additional label for the external icon
38
+ - "extra_attributes" (array)
39
+ - "name" (string) Attribute name, eg. 'data-test'
40
+ - "value" (optional) (string) Attribute value, eg: 'data-test-1'
41
+ - "container": (string) White panel to be filled at will
42
+ - "see_all": (boolean) (default: false) Whether to show the "view all" link
43
+ - "see_all_label": (string) (default: ''): Label for the "view all" link
44
+ - "see_all_attributes" (optional) (array) Custom attributes for the "view all" link
45
+ - "name" (string) Attribute name, eg. 'data-test'
46
+ - "value" (optional) (string) Attribute value, eg: 'data-test-1'
47
+ - "children" (array of object) Array of sub-items
48
+ - "external": (boolean) External link
49
+ - "sr_external" (string) (default: '') Additional label for the external icon
50
+ - "path" (string) Href of the sub-item link
51
+ - "label" (string) Label of the sub-item link
52
+ - "extra_attributes" (optional) (array) (default: []) Extra attributes for link
53
+ - "name" (string) Attribute name, eg. 'data-test'
54
+ - "value" (optional) (string) Attribute value, eg: 'data-test-1'
55
+ #}
56
+
57
+ {% set _id = id|default('') %}
58
+ {% set _item = item|default({}) %}
59
+ {% set _menu_link_class = 'ecl-mega-menu__link' %}
60
+ {% set _menu_link_attribute = 'data-ecl-mega-menu-link' %}
61
+ {% set _menu_sublink_attribute = 'data-ecl-mega-menu-sublink' %}
62
+ {% set _menu_list_item_attributes = 'data-ecl-mega-menu-item' %}
63
+ {% set _menu_list_item_class = 'ecl-mega-menu__item' %}
64
+ {% set _featured = _item.featured|default({}) %}
65
+ {% set _info = _item.info|default({}) %}
66
+ {% set _one_level_only = _item.one_level_only|default(false) %}
67
+ {% set _promotional = _item.promotional|default(false) %}
68
+ {% set _see_all = see_all|default(false) %}
69
+ {% set _sublist_class = 'ecl-mega-menu__sublist' %}
70
+ {% set _mega_class = 'ecl-mega-menu__mega' %}
71
+ {% set _see_all_label = see_all_label|default('') %}
72
+ {% set _see_all_attributes = see_all_attributes|default([]) %}
73
+ {% set _can_be_external = true %}
74
+ {% set _icon = {} %}
75
+
76
+ {# Internal logic - Process properties #}
77
+
78
+ {% if _item.container is defined and _item.container is not empty %}
79
+ {% set _can_be_external = false %}
80
+ {% set _menu_list_item_class = _menu_list_item_class ~ ' ecl-mega-menu__item--has-container' %}
81
+ {% set _menu_list_item_attributes = _menu_list_item_attributes ~ ' data-ecl-has-container aria-haspopup="true"' %}
82
+ {% endif %}
83
+
84
+ {% if _item.children is defined and _item.children is not empty and _item.children is iterable %}
85
+ {% set _menu_list_item_attributes = _menu_list_item_attributes ~ ' data-ecl-has-children aria-haspopup="true"' %}
86
+ {% set _menu_list_item_class = _menu_list_item_class ~ ' ecl-mega-menu__item--has-children' %}
87
+ {% endif %}
88
+
89
+ {% if _one_level_only %}
90
+ {% set _menu_list_item_class = _menu_list_item_class ~ ' ecl-mega-menu__item--one-level-only' %}
91
+ {% endif %}
92
+
93
+ {% if _item.level|default(0) < 2 and _featured is not empty %}
94
+ {% set _mega_class = _mega_class ~ ' ecl-mega-menu__mega--has-featured' %}
95
+ {% endif %}
96
+
97
+ {% if _info is empty %}
98
+ {% set _mega_class = _mega_class ~ ' ecl-mega-menu__mega--no-info' %}
99
+ {% endif %}
100
+
101
+ {% if _item.level == 2 %}
102
+ {% set _mega_class = _mega_class ~ ' ecl-mega-menu__mega--level-2' %}
103
+ {% if _item.children is empty %}
104
+ {% set _mega_class = _mega_class ~ ' ecl-mega-menu-featured-only' %}
105
+ {% endif %}
106
+ {% endif %}
107
+
108
+ {% if _promotional %}
109
+ {% set _menu_list_item_class = _menu_list_item_class ~ ' ecl-mega-menu__item--promotional' %}
110
+ {% endif %}
111
+
112
+ {% if (_item.children is defined and _item.children is not empty and _item.children is iterable) or _item.container is not empty %}
113
+ {% set _can_be_external = false %}
114
+ {% set _icon = [{
115
+ name: 'corner-arrow',
116
+ transform: 'rotate-90',
117
+ size: '2xs',
118
+ },
119
+ {
120
+ name: 'arrow-left',
121
+ transform: 'flip-horizontal',
122
+ size: 's',
123
+ }] %}
124
+ {% endif %}
125
+
126
+ {%- if _item.label is not empty -%}
127
+ <li class="{{ _menu_list_item_class }}" {{ _menu_list_item_attributes|raw }} id="{{ _id }}">
128
+ {% set _menu_link_attributes = _item.extra_attributes|default([])|merge([
129
+ { name: _menu_link_attribute },
130
+ { name: 'id', value: _id ~ "-link" },
131
+ ]) %}
132
+ {% if (_item.children is defined and _item.children is not empty and _item.children is iterable) or _item.container is not empty %}
133
+ {% set _menu_link_attributes = _menu_link_attributes|merge([
134
+ { name: 'aria-expanded', value: 'false' },
135
+ ]) %}
136
+ {% include '@ecl/button/button.html.twig' with {
137
+ type: 'button',
138
+ label: _item.label,
139
+ icon_position: 'after',
140
+ icon: _icon,
141
+ extra_classes: _menu_link_class,
142
+ extra_attributes: _menu_link_attributes,
143
+ } only %}
144
+ {% else %}
145
+ {% include '@ecl/link/link.html.twig' with {
146
+ link: {
147
+ type: 'standalone',
148
+ label: _item.label,
149
+ path: _item.path,
150
+ external: _can_be_external ? _item.external|default(false),
151
+ sr_external: _item.sr_external|default(''),
152
+ icon_position: 'after',
153
+ },
154
+ icon: _icon,
155
+ extra_classes: _menu_link_class,
156
+ extra_attributes: _menu_link_attributes,
157
+ } only %}
158
+ {% endif %}
159
+ {%- endif -%}
160
+
161
+ {# Container #}
162
+ {%- if _item.container is defined and _item.container is not empty -%}
163
+ <div
164
+ class="{{ _mega_class }} ecl-mega-menu__mega-container"
165
+ data-ecl-mega-menu-mega
166
+ >
167
+ <div class="ecl-container">
168
+ <div class="ecl-mega-menu__mega-container-scrollable">
169
+ {{ _item.container }}
170
+ </div>
171
+ </div>
172
+ </div>
173
+ {# Children #}
174
+ {%- elseif (_item.children is defined and _item.children is not empty and _item.children is iterable) or _featured is not empty -%}
175
+ {% set _sublist_aria_label = '' %}
176
+ {% if _item.level|default(0) < 2 %}
177
+ {% set _sublist_aria_label = second_level_aria_label|default('') %}
178
+ <div class="ecl-mega-menu__wrapper">
179
+ <div class="ecl-container">
180
+ {% else %}
181
+ {% set _sublist_aria_label = third_level_aria_label|default('') %}
182
+ {% endif %}
183
+ {# Info #}
184
+ {% if _info is not empty %}
185
+ {% set _info_classes = 'ecl-mega-menu__info' %}
186
+ {% set _info_title_id = _id ~ '-info-title' %}
187
+ {% if _info.link is not empty %}
188
+ {% set _info_classes = _info_classes ~ ' ecl-mega-menu__info--has-link' %}
189
+ {% endif %}
190
+ <div
191
+ class="{{ _info_classes }}"
192
+ data-ecl-mega-menu-mega
193
+ >
194
+ {% if _info.title is not empty %}
195
+ <span
196
+ class="ecl-mega-menu__info-title"
197
+ id="{{ _info_title_id }}"
198
+ >
199
+ {{- _info.title -}}
200
+ </span>
201
+ {% endif %}
202
+ <div class="ecl-mega-menu__info-scrollable">
203
+ {%- if _info.content is not empty -%}
204
+ <div class="ecl-mega-menu__info-content">{{ _info.content }}</div>
205
+ {%- endif -%}
206
+ </div>
207
+ </div>
208
+ {% endif %}
209
+ <div
210
+ class="{{ _mega_class }}"
211
+ data-ecl-mega-menu-mega
212
+ >
213
+ {% if _item.children is defined and _item.children is not empty and _item.children is iterable %}
214
+ <ul
215
+ class="{{ _sublist_class }}"
216
+ {%- if _sublist_aria_label -%}
217
+ aria-label="{{ _sublist_aria_label }}"
218
+ {%- endif -%}
219
+ >
220
+ {% for child in _item.children %}
221
+ {% set _can_be_external = true %}
222
+ {% set _icon = {} %}
223
+ {% set _subitem_attrs = 'data-ecl-mega-menu-subitem' %}
224
+ {% set _subitem_class = 'ecl-mega-menu__subitem' %}
225
+ {% set _sublink_class = 'ecl-mega-menu__sublink' %}
226
+ {% if loop.last %}
227
+ {% set _sublink_class = _sublink_class ~ ' ecl-mega-menu__sublink--last' %}
228
+ {% endif %}
229
+ {% set _sublink_attrs = child.extra_attributes|default([])|merge([
230
+ { name: _menu_sublink_attribute },
231
+ ]) %}
232
+ {% if (child.children is defined and child.children is not empty) or child.featured is not empty %}
233
+ {% set _sublink_attrs = _sublink_attrs|merge([
234
+ { name: 'aria-expanded', value: 'false' },
235
+ ]) %}
236
+ {% endif %}
237
+ {% if (child.children is defined and child.children is not empty and _item.level|default(0) < 2) or child.featured is not empty %}
238
+ {%- if child.see_all and child.see_all_label is not empty -%}
239
+ {% if child.sublink_id is empty %}
240
+ {% set _sublink_id = 'ecl-mega-menu-sublink-' ~ random() %}
241
+ {% else %}
242
+ {% set _sublink_id = child.sublink_id %}
243
+ {% endif %}
244
+ {% set _sublink_attrs = _sublink_attrs|merge([{ name: 'id', value: _sublink_id }]) %}
245
+ {%- endif -%}
246
+
247
+ {% set _can_be_external = false %}
248
+ {% set _icon = {
249
+ name: 'corner-arrow',
250
+ transform: 'rotate-90',
251
+ size: '2xs',
252
+ } %}
253
+ {% endif %}
254
+ <li
255
+ class="{{ _subitem_class }}"
256
+ {{ ' ' ~ _subitem_attrs|raw }}
257
+ >
258
+ {%- if (child.children is defined and child.children is not empty) or child.featured is not empty -%}
259
+ {# Children, 2nd level #}
260
+ {% include '@ecl/button/button.html.twig' with {
261
+ type: 'button',
262
+ label: child.label,
263
+ icon: _icon,
264
+ extra_classes: _sublink_class,
265
+ extra_attributes: _sublink_attrs,
266
+ } only %}
267
+ {% include '@ecl/mega-menu/mega-menu-item.html.twig' with {
268
+ see_all_label: child.see_all_label|default(''),
269
+ see_all: child.see_all|default(false),
270
+ third_level_aria_label: third_level_aria_label|default(''),
271
+ see_all_attributes: child.see_all_attributes|default([]),
272
+ sublink_id: _sublink_id|default(''),
273
+ item: {
274
+ path: child.path,
275
+ children: child.children,
276
+ level: 2,
277
+ info: child.info|default({}),
278
+ featured: child.featured|default({}),
279
+ },
280
+ } only %}
281
+ {%- else -%}
282
+ {% include '@ecl/link/link.html.twig' with {
283
+ link: {
284
+ type: 'standalone',
285
+ label: child.label,
286
+ path: child.path,
287
+ external: _can_be_external ? child.external|default(false),
288
+ sr_external: child.sr_external|default(''),
289
+ },
290
+ icon: _icon,
291
+ extra_classes: _sublink_class,
292
+ extra_attributes: _sublink_attrs,
293
+ } only %}
294
+ {% endif %}
295
+ </li>
296
+ {% endfor %}
297
+ {%- if _see_all and _see_all_label is not empty -%}
298
+ <li class="ecl-mega-menu__spacer" data-ecl-mega-menu-subitem>&nbsp;</li>
299
+ <li class="ecl-mega-menu__subitem ecl-mega-menu__see-all" data-ecl-mega-menu-subitem>
300
+ {% include '@ecl/link/link.html.twig' with {
301
+ link: {
302
+ type: 'standalone',
303
+ branded: true,
304
+ label: _see_all_label,
305
+ path: _item.path,
306
+ },
307
+ icon: {
308
+ name: 'arrow-left',
309
+ size: 'xs',
310
+ transform: 'rotate-180',
311
+ },
312
+ extra_attributes: [{
313
+ name: 'aria-describedby',
314
+ value: sublink_id,
315
+ }]|merge(_see_all_attributes|default([])),
316
+ } only %}
317
+ </li>
318
+ {%- endif -%}
319
+ {%- if _info.link is not empty -%}
320
+ <li class="ecl-mega-menu__spacer" data-ecl-mega-menu-subitem>&nbsp;</li>
321
+ <li class="ecl-mega-menu__subitem ecl-mega-menu__see-all" data-ecl-mega-menu-subitem>
322
+ {% set _path = (_info.link.link.path is not empty) ? _info.link.link.path : _item.path %}
323
+ {% include '@ecl/link/link.html.twig' with _info.link|merge({
324
+ link: _info.link.link|merge({
325
+ type: 'standalone',
326
+ branded: true,
327
+ path: _path,
328
+ }),
329
+ icon: {
330
+ name: 'arrow-left',
331
+ transform: 'flip-horizontal',
332
+ size: 'xs',
333
+ },
334
+ extra_classes: _info.link.extra_classes|default('') ~ ' ecl-mega-menu__info-link',
335
+ extra_attributes: _info.link.extra_attributes|default([])|merge([{
336
+ name: 'aria-describedby',
337
+ value: _info_title_id,
338
+ }]),
339
+ }) only %}
340
+ </li>
341
+ {%- endif -%}
342
+ </ul>
343
+ {% endif %}
344
+
345
+ {# Featured #}
346
+ {% if _featured is not empty %}
347
+ <div
348
+ class="ecl-mega-menu__featured"
349
+ data-ecl-mega-menu-featured
350
+ >
351
+ <div class="ecl-mega-menu__featured-scrollable">
352
+ {% if _featured.title is not empty %}
353
+ <span
354
+ class="ecl-mega-menu__featured-title"
355
+ id="{{ 'ecl-mega-menu-featured-title-' ~ sublink_id }}"
356
+ >
357
+ {{- _featured.title -}}
358
+ </span>
359
+ {% endif %}
360
+ {%- if _featured.content is not empty -%}
361
+ <div class="ecl-mega-menu__featured-content">{{ _featured.content }}</div>
362
+ {%- endif -%}
363
+ {%- if _featured.items is not empty and _featured.items is iterable -%}
364
+ {% set sublink_id = sublink_id ? sublink_id : _id %}
365
+ {% set labelled_by = _featured.title is not empty ? 'ecl-mega-menu-featured-title-' ~ sublink_id ~ ' ' ~ sublink_id : sublink_id %}
366
+ <ul
367
+ class="ecl-mega-menu__featured-list"
368
+ {% if labelled_by is not empty %}
369
+ aria-labelledby="{{ labelled_by }}"
370
+ {% endif %}
371
+ >
372
+ {% for item in _featured.items %}
373
+ {% include '@ecl/mega-menu/mega-menu-featured-item.html.twig' with item only %}
374
+ {% endfor %}
375
+ </ul>
376
+ {%- endif -%}
377
+ </div>
378
+ </div>
379
+ {% endif %}
380
+ {% if _item.level|default(0) < 2 %}
381
+ </div>
382
+ </div>
383
+ {% endif %}
384
+ {% endif %}
385
+ </li>
386
+
387
+ {% endapply %}
@@ -0,0 +1,8 @@
1
+ /*
2
+ * Mega Menu print
3
+ * @define megaMenu
4
+ */
5
+
6
+ .ecl-mega-menu {
7
+ display: none;
8
+ }
@@ -0,0 +1,189 @@
1
+ {% apply spaceless %}
2
+
3
+ {#
4
+ Parameters:
5
+ - "id": (string) (default: random): Unique id for the menu
6
+ - "toggle": (associative array) (default: {}): Toggle (hamburger) button, using ECL Button structure
7
+ - "close": (associative array) (default: {}): Close button, using ECL Button structure
8
+ - "back_label": (string): (default: ''): Back button label
9
+ - "aria_label" (string) (default: '') Aria label for the main nav
10
+ - "second_level_aria_label" (string) (default: '') Aria label for the sub-lists, second level
11
+ - "third_level_aria_label" (string) (default: '') Aria label for the sub-lists, third level
12
+ - "see_all_label": (string) (default: ''): Label for the "view all" link
13
+ - "featured_priority": (string) (default: secondary) Can be primary otherwise: determines which featured panel will be visible in desktop
14
+ - "items": (array) (default: []): The menu items - format: [
15
+ {
16
+ "label": (string) (default: '')
17
+ "path": (string) (default: '')
18
+ "external": (boolean) (optional),
19
+ "sr_external" (string) (default: '') Additional label for the external icon
20
+ "one_level_only" (boolean) (default: false)
21
+ "extra_attributes" (optional) (array) (default: []) Extra attributes for link,
22
+ - "name" (string) Attribute name, eg. 'data-test'
23
+ - "value" (optional) (string) Attribute value, eg: 'data-test-1'
24
+ "container": (string) Empty container to be filled in with content
25
+ - "info" (object) (default: {}) Info column
26
+ - "title" (string) Title of the info panel
27
+ - "content" (string) Content of the info panel
28
+ - "link" (object) Structure for the "discover more" link, following ECL Link
29
+ "featured" (oject) (optional) {
30
+ - "title": (string) Title of the featured panel
31
+ - "content": (string) Top content of the featured panel
32
+ - "items": (associative array) (optional) Array of items with image, link and description
33
+ }
34
+ "children": (associative array) (optional): [
35
+ {
36
+ "label": (string) (default: '')
37
+ "path": (string) (default: '')
38
+ "external": (boolean),
39
+ "sr_external" (string) (default: '') Additional label for the external icon
40
+ "featured" (oject) (optional) {
41
+ - "title": (string) Title of the featured panel
42
+ - "content": (string) Top content of the featured panel
43
+ - "items": (associative array) (optional) Array of items with image, link and description
44
+ "see_all" (boolean) controls visibility of "View All" button
45
+ "children": (associative array) (optional): [
46
+ {
47
+ "label": (string) (default: '')
48
+ "path": (string) (default: '')
49
+ "external": (boolean),
50
+ "sr_external" (string) (default: '') Additional label for the external icon
51
+ "extra_attributes" (optional) (array) (default: []) Extra attributes for link,
52
+ - "name" (string) Attribute name, eg. 'data-test'
53
+ - "value" (optional) (string) Attribute value, eg: 'data-test-1'
54
+ }
55
+ ]
56
+ "see_all_label" (string)
57
+ "see_all_attributes" (optional) (array) (default: [])
58
+ - "name" (string) Attribute name, eg. 'data-test'
59
+ - "value" (optional) (string) Attribute value, eg: 'data-test-1'
60
+ "extra_attributes" (optional) (array) (default: []) Extra attributes for link,
61
+ - "name" (string) Attribute name, eg. 'data-test'
62
+ - "value" (optional) (string) Attribute value, eg: 'data-test-1'
63
+ }
64
+ ]
65
+ }
66
+ ],
67
+ - "extra_classes" (string) (default: '') Extra classes (space separated) for the nav element
68
+ - "extra_attributes" (optional) (array) (default: []) Extra attributes for the nav element
69
+ - "name" (string) Attribute name, eg. 'data-test'
70
+ - "value" (optional) (string) Attribute value, eg: 'data-test-1'
71
+ #}
72
+
73
+ {# Internal properties #}
74
+
75
+ {% set _id = id|default('ecl-mega-menu-' ~ random()) %}
76
+ {% set _back_label = back_label|default('') %}
77
+ {% set _aria_label = aria_label|default('') %}
78
+ {% set _second_level_aria_label = second_level_aria_label|default('') %}
79
+ {% set _third_level_aria_label = third_level_aria_label|default('') %}
80
+ {% set _toggle = toggle|default({}) %}
81
+ {% set _close = close|default({}) %}
82
+ {% set _items = items|default([{}]) %}
83
+ {% set _featured_priority = featured_priority|default('secondary') %}
84
+ {% set _see_all_label = see_all_label|default('') %}
85
+ {% set _css_class = 'ecl-mega-menu' %}
86
+ {% set _extra_attributes = '' %}
87
+
88
+ {# Internal logic - Process properties #}
89
+
90
+ {% if _featured_priority == 'primary' %}
91
+ {% set _css_class = _css_class ~ ' ecl-mega-menu--featured--primary' %}
92
+ {% endif %}
93
+
94
+ {% if extra_classes is defined and extra_classes is not empty %}
95
+ {% set _css_class = _css_class ~ ' ' ~ extra_classes %}
96
+ {% endif %}
97
+
98
+ {% if extra_attributes is defined and extra_attributes is not empty and extra_attributes is iterable %}
99
+ {% for attr in extra_attributes %}
100
+ {% if attr.value is defined %}
101
+ {% set _extra_attributes = _extra_attributes ~ ' ' ~ attr.name|e('html_attr') ~ '="' ~ attr.value|e('html_attr') ~ '"' %}
102
+ {% else %}
103
+ {% set _extra_attributes = _extra_attributes ~ ' ' ~ attr.name|e('html_attr') %}
104
+ {% endif %}
105
+ {% endfor %}
106
+ {% endif %}
107
+
108
+ <nav
109
+ class="{{ _css_class }}"
110
+ data-ecl-mega-menu
111
+ data-ecl-auto-init="MegaMenu"
112
+ {%- if _toggle is not empty and _toggle.label is not empty -%}
113
+ data-ecl-mega-menu-label-open="{{ _toggle.label }}"
114
+ {%- endif -%}
115
+ {%- if _close is not empty and _close.label is defined and _close.label is not empty -%}
116
+ data-ecl-mega-menu-label-close="{{ _close.label }}"
117
+ {%- endif -%}
118
+ role="navigation"
119
+ id={{ _id }}
120
+ {%- if _aria_label is not empty %}
121
+ aria-label="{{ _aria_label }}"
122
+ {%- endif -%}
123
+ {{- _extra_attributes|raw -}}
124
+ >
125
+ <div class="ecl-mega-menu__overlay">&nbsp;</div>
126
+ <div class="ecl-container ecl-mega-menu__container">
127
+ {% set _toggle_icon = {} %}
128
+ {% if _toggle.icon is defined %}
129
+ {% if _close is not empty and _close.icon is not empty %}
130
+ {% set _toggle_icon = [ _toggle.icon, _close.icon ] %}
131
+ {% else %}
132
+ {% set _toggle_icon = _toggle.icon %}
133
+ {% endif %}
134
+ {% endif %}
135
+ {% include '@ecl/button/button.html.twig' with _toggle|merge({
136
+ type: 'button',
137
+ variant: 'tertiary',
138
+ style: 'neutral',
139
+ icon_position: 'before',
140
+ icon: _toggle_icon,
141
+ hide_label: true,
142
+ extra_classes: 'ecl-mega-menu__open',
143
+ extra_attributes: [
144
+ { name: 'data-ecl-mega-menu-open' },
145
+ { name: 'aria-expanded', value: 'false' }
146
+ ],
147
+ }) only %}
148
+
149
+ <section class="ecl-mega-menu__inner" data-ecl-mega-menu-inner>
150
+ <header class="ecl-mega-menu__inner-header">
151
+ {%- if _back_label is not empty -%}
152
+ {% include '@ecl/button/button.html.twig' with {
153
+ type: 'submit',
154
+ variant: 'tertiary',
155
+ label: _back_label,
156
+ icon: {
157
+ name: 'corner-arrow',
158
+ size: 'xs',
159
+ transform: 'rotate-270',
160
+ },
161
+ icon_position: 'before',
162
+ extra_classes: 'ecl-mega-menu__back',
163
+ extra_attributes: [{
164
+ name: 'data-ecl-mega-menu-back',
165
+ }],
166
+ } only %}
167
+ {%- endif -%}
168
+ </header>
169
+
170
+ <ul class="ecl-mega-menu__list">
171
+ {% if _items is not empty and _items is iterable %}
172
+ {% for key, item in _items %}
173
+ {% if item is defined and item is not empty %}
174
+ {% include '@ecl/mega-menu/mega-menu-item.html.twig' with {
175
+ item: item,
176
+ id: "ecl-mega-menu-item-" ~ _id ~ '-' ~ key,
177
+ see_all_label: _see_all_label,
178
+ second_level_aria_label: _second_level_aria_label,
179
+ third_level_aria_label: _third_level_aria_label,
180
+ } only %}
181
+ {% endif %}
182
+ {% endfor %}
183
+ {% endif %}
184
+ </ul>
185
+ </section>
186
+ </div>
187
+ </nav>
188
+
189
+ {% endapply %}