@openeuropa/bcl-mega-menu 0.1057.202502162340

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/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020-2021 Mark Otto
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,111 @@
1
+ {% apply spaceless %}
2
+
3
+ {# Parameters:
4
+ - id (string) (default: dropdown-random(1000))
5
+ - trigger (link or button)
6
+ - content_block (block) (default: '')
7
+ - items (object[])
8
+ format: [
9
+ {
10
+ - link or dropdown
11
+ ! dropdown extra property:
12
+ collapse (render) - to showcase on the last column
13
+ }
14
+ ]
15
+ - back_button_label (string) (default: 'Back')
16
+ - icon_path (string) (default: '')
17
+ #}
18
+
19
+ {% set _id = id|default('dropdown-' ~ random(1000)) %}
20
+ {% set _link = link ?? false %}
21
+ {% set _trigger = trigger|default({}) %}
22
+ {% set _content_block = content_block|default('') %}
23
+ {% set _items = items|default([]) %}
24
+ {% set _back_button_label = back_button_label|default('Back') %}
25
+ {% set _icon_path = icon_path|default('') %}
26
+
27
+ {% if attributes is empty %}
28
+ {% set attributes = create_attribute() %}
29
+ {% endif %}
30
+
31
+ {% set _classes = ['bcl-mega-menu'] %}
32
+
33
+ {% set attributes = attributes.setAttribute('aria-labelledby', _id).addClass(_classes) %}
34
+
35
+ {% if _trigger.attributes is empty %}
36
+ {% set _trigger = _trigger|merge({
37
+ attributes: create_attribute()
38
+ }) %}
39
+ {% endif %}
40
+ {% set _trigger = _trigger|merge({
41
+ attributes: _trigger.attributes.addClass(['dropdown-toggle'])
42
+ .setAttribute('aria-expanded', 'false')
43
+ .setAttribute('data-bs-toggle', 'dropdown')
44
+ .setAttribute('data-bs-auto-close', 'outside')
45
+ .setAttribute('id', _id)
46
+ }) %}
47
+ {% if _link %}
48
+ {% set _trigger = _trigger|merge({
49
+ attributes: _trigger.attributes.setAttribute('role', 'button')
50
+ }) %}
51
+ {% else %}
52
+ {% set _trigger = _trigger|merge({
53
+ attributes: _trigger.attributes.setAttribute('autocomplete', 'off')
54
+ }) %}
55
+ {% endif %}
56
+
57
+ <div {{ attributes }}>
58
+ {% if _link %}
59
+ {% include '@oe-bcl/bcl-link/link.html.twig' with _trigger only %}
60
+ {% else %}
61
+ {% include '@oe-bcl/bcl-button/button.html.twig' with _trigger only %}
62
+ {% endif %}
63
+ <div class="mega-menu-container dropdown-menu" aria-labelledby="{{ _id }}">
64
+ {% include '@oe-bcl/bcl-button/button.html.twig' with {
65
+ label: _back_button_label,
66
+ icon_position: "before",
67
+ variant: 'link',
68
+ icon: {
69
+ path: _icon_path,
70
+ name: "arrow-left",
71
+ },
72
+ attributes: create_attribute().addClass(['back-button'])
73
+ } only %}
74
+ <div class="row position-relative">
75
+ {% if content_block is defined %}
76
+ <div class="col-12 col-lg-4">
77
+ <div class="content-block py-3">
78
+ {%- block content_block -%}
79
+ {{ _content_block }}
80
+ {%- endblock -%}
81
+ </div>
82
+ </div>
83
+ {% endif %}
84
+ <div class="col-12 col-lg-8">
85
+ <div class="navigation-items">
86
+ {% for _item in _items %}
87
+ {% if _item.items is defined %}
88
+ {% set _trigger_attributes = _item.trigger.attributes is defined ? _item.trigger.attributes : create_attribute() %}
89
+ {% include '@oe-bcl/bcl-dropdown/dropdown.html.twig' with _item|merge({
90
+ direction: 'dropend',
91
+ link: true,
92
+ trigger: _item.trigger|merge({
93
+ attributes: _trigger_attributes.setAttribute('data-bs-auto-close', 'outside')
94
+ })
95
+ }) only %}
96
+ {% if _item.collapse is defined %}
97
+ <div class="collapse">
98
+ {{ _item.collapse }}
99
+ </div>
100
+ {% endif %}
101
+ {% else %}
102
+ {% include '@oe-bcl/bcl-link/link.html.twig' with _item only %}
103
+ {% endif %}
104
+ {% endfor %}
105
+ </div>
106
+ </div>
107
+ </div>
108
+ </div>
109
+ </div>
110
+
111
+ {% endapply %}
package/package.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "@openeuropa/bcl-mega-menu",
3
+ "author": "European Commission",
4
+ "license": "EUPL-1.2",
5
+ "version": "0.1057.202502162340",
6
+ "publishConfig": {
7
+ "access": "public"
8
+ },
9
+ "description": "OE - BCL mega menu",
10
+ "dependencies": {
11
+ "@openeuropa/bcl-button": "^0.1057.202502162340",
12
+ "@openeuropa/bcl-dropdown": "^0.1057.202502162340",
13
+ "@openeuropa/bcl-link": "^0.1057.202502162340"
14
+ },
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://github.com/openeuropa/bootstrap-component-library.git"
18
+ },
19
+ "bugs": {
20
+ "url": "https://github.com/openeuropa/bootstrap-component-library.git/issues"
21
+ },
22
+ "homepage": "https://github.com/openeuropa/bootstrap-component-library",
23
+ "keywords": [
24
+ "openeuropa",
25
+ "bootstrap-component-library",
26
+ "design-system",
27
+ "twig"
28
+ ],
29
+ "gitHead": "8b3cc57b8eb31505650731214c11e17c06b35610"
30
+ }