@openeuropa/bcl-dropdown 1.10.9 → 1.10.11
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/dropdown.html.twig +48 -52
- package/package.json +4 -4
package/dropdown.html.twig
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
{% apply spaceless %}
|
|
2
|
-
|
|
3
1
|
{# Parameters:
|
|
4
2
|
- id (string) (default: dropdown-random(10000))
|
|
5
3
|
- trigger (link or button)
|
|
@@ -35,7 +33,7 @@
|
|
|
35
33
|
- attributes (drupal attrs)
|
|
36
34
|
#}
|
|
37
35
|
|
|
38
|
-
{
|
|
36
|
+
{%- set _id = id|default('dropdown-' ~ random(1000)) %}
|
|
39
37
|
{% set _trigger = trigger|default({}) %}
|
|
40
38
|
{% set _link = link ?? false %}
|
|
41
39
|
{% set _direction = direction|default('') %}
|
|
@@ -45,27 +43,27 @@
|
|
|
45
43
|
{% set _inside_navigation = inside_navigation ?? false %}
|
|
46
44
|
{% set _items = items|default([]) %}
|
|
47
45
|
|
|
48
|
-
{
|
|
46
|
+
{%- set _class = 'dropdown' %}
|
|
49
47
|
{% set _dropdown_classes = ['dropdown-menu'] %}
|
|
50
48
|
|
|
51
|
-
{
|
|
52
|
-
{
|
|
49
|
+
{%- if _dark %}
|
|
50
|
+
{%- set _dropdown_classes = _dropdown_classes|merge(['dropdown-menu-dark']) %}
|
|
53
51
|
{% endif %}
|
|
54
52
|
{% if _alignment %}
|
|
55
|
-
{
|
|
53
|
+
{%- set _dropdown_classes = _dropdown_classes|merge([_alignment]) %}
|
|
56
54
|
{% endif %}
|
|
57
55
|
{% if _direction %}
|
|
58
|
-
{
|
|
56
|
+
{%- set _class = _class ~ ' ' ~ _direction %}
|
|
59
57
|
{% endif %}
|
|
60
58
|
|
|
61
|
-
{
|
|
62
|
-
{
|
|
59
|
+
{%- if attributes is empty %}
|
|
60
|
+
{%- set attributes = create_attribute() %}
|
|
63
61
|
{% endif %}
|
|
64
62
|
|
|
65
|
-
{
|
|
63
|
+
{%- set attributes = attributes.setAttribute('aria-labelledby', _id).addClass(_dropdown_classes) %}
|
|
66
64
|
|
|
67
|
-
{
|
|
68
|
-
{
|
|
65
|
+
{%- if _trigger.attributes is empty %}
|
|
66
|
+
{%- set _trigger = _trigger|merge({
|
|
69
67
|
attributes: create_attribute()
|
|
70
68
|
}) %}
|
|
71
69
|
{% endif %}
|
|
@@ -76,60 +74,58 @@
|
|
|
76
74
|
.setAttribute('id', _id)
|
|
77
75
|
}) %}
|
|
78
76
|
|
|
79
|
-
{
|
|
80
|
-
{
|
|
81
|
-
{
|
|
82
|
-
attributes: _trigger.attributes.setAttribute('role', 'button')
|
|
77
|
+
{%- if not _inside_navigation %}
|
|
78
|
+
{%- if _link %}
|
|
79
|
+
{%- set _trigger = _trigger|merge({
|
|
80
|
+
attributes: _trigger.attributes.setAttribute('role', 'button')
|
|
83
81
|
}) %}
|
|
84
|
-
{
|
|
85
|
-
{
|
|
86
|
-
attributes: _trigger.attributes.setAttribute('autocomplete', 'off')
|
|
82
|
+
{%- else %}
|
|
83
|
+
{%- set _trigger = _trigger|merge({
|
|
84
|
+
attributes: _trigger.attributes.setAttribute('autocomplete', 'off')
|
|
87
85
|
}) %}
|
|
88
|
-
{
|
|
86
|
+
{%- endif %}
|
|
89
87
|
{% else %}
|
|
90
|
-
{
|
|
88
|
+
{%- set attributes = attributes.setAttribute('aria-hidden', 'true').setAttribute('role', 'presentation') %}
|
|
91
89
|
{% endif %}
|
|
92
90
|
|
|
93
|
-
{
|
|
91
|
+
{%- if not _remove_wrapper -%}
|
|
94
92
|
<div class="{{ _class }}">
|
|
95
|
-
{
|
|
96
|
-
{
|
|
97
|
-
{
|
|
98
|
-
{
|
|
99
|
-
{
|
|
100
|
-
{
|
|
93
|
+
{%- endif %}
|
|
94
|
+
{%- if _link %}
|
|
95
|
+
{%- include '@oe-bcl/bcl-link/link.html.twig' with _trigger only %}
|
|
96
|
+
{%- else %}
|
|
97
|
+
{%- include '@oe-bcl/bcl-button/button.html.twig' with _trigger only %}
|
|
98
|
+
{%- endif -%}
|
|
101
99
|
<ul
|
|
102
100
|
{{ attributes }}
|
|
103
101
|
>
|
|
104
|
-
{
|
|
105
|
-
{
|
|
106
|
-
{
|
|
107
|
-
{
|
|
102
|
+
{%- if _items is not empty and _items is iterable %}
|
|
103
|
+
{%- for _item in _items %}
|
|
104
|
+
{%- if _item.attributes is empty %}
|
|
105
|
+
{%- set _item = _item|merge({
|
|
108
106
|
attributes: create_attribute()
|
|
109
107
|
}) %}
|
|
110
|
-
{
|
|
111
|
-
{
|
|
112
|
-
{
|
|
113
|
-
{
|
|
114
|
-
{
|
|
115
|
-
{
|
|
108
|
+
{%- endif %}
|
|
109
|
+
{%- set _item_classes = ['dropdown-item'] %}
|
|
110
|
+
{%- if _item.active %}
|
|
111
|
+
{%- set _item_classes = _item_classes|merge(['active']) %}
|
|
112
|
+
{%- endif %}
|
|
113
|
+
{%- set _item = _item|merge({
|
|
116
114
|
clean_class: true,
|
|
117
115
|
attributes: _item.attributes.addClass(_item_classes)
|
|
118
|
-
})
|
|
116
|
+
}) -%}
|
|
119
117
|
<li>
|
|
120
|
-
{
|
|
118
|
+
{%- if _item.divider is defined -%}
|
|
121
119
|
<hr class="dropdown-divider">
|
|
122
|
-
{
|
|
123
|
-
{
|
|
124
|
-
{
|
|
125
|
-
{
|
|
126
|
-
{
|
|
120
|
+
{%- elseif _item.button is defined %}
|
|
121
|
+
{%- include '@oe-bcl/bcl-button/button.html.twig' with _item only %}
|
|
122
|
+
{%- else %}
|
|
123
|
+
{%- include '@oe-bcl/bcl-link/link.html.twig' with _item only %}
|
|
124
|
+
{%- endif -%}
|
|
127
125
|
</li>
|
|
128
|
-
{
|
|
129
|
-
{
|
|
126
|
+
{%- endfor %}
|
|
127
|
+
{%- endif -%}
|
|
130
128
|
</ul>
|
|
131
|
-
{
|
|
129
|
+
{%- if not _remove_wrapper -%}
|
|
132
130
|
</div>
|
|
133
|
-
{
|
|
134
|
-
|
|
135
|
-
{% endapply %}
|
|
131
|
+
{%- endif -%}
|
package/package.json
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
"name": "@openeuropa/bcl-dropdown",
|
|
3
3
|
"author": "European Commission",
|
|
4
4
|
"license": "EUPL-1.2",
|
|
5
|
-
"version": "1.10.
|
|
5
|
+
"version": "1.10.11",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
8
8
|
},
|
|
9
9
|
"description": "OE - BCL dropdown",
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@openeuropa/bcl-button": "^1.10.
|
|
12
|
-
"@openeuropa/bcl-link": "^1.10.
|
|
11
|
+
"@openeuropa/bcl-button": "^1.10.11",
|
|
12
|
+
"@openeuropa/bcl-link": "^1.10.11"
|
|
13
13
|
},
|
|
14
14
|
"repository": {
|
|
15
15
|
"type": "git",
|
|
@@ -25,5 +25,5 @@
|
|
|
25
25
|
"design-system",
|
|
26
26
|
"twig"
|
|
27
27
|
],
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "82aecf2f60f8bd8f9afd447ea0d044396f085823"
|
|
29
29
|
}
|