@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.
Files changed (2) hide show
  1. package/dropdown.html.twig +48 -52
  2. package/package.json +4 -4
@@ -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
- {% set _id = id|default('dropdown-' ~ random(1000)) %}
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
- {% set _class = 'dropdown' %}
46
+ {%- set _class = 'dropdown' %}
49
47
  {% set _dropdown_classes = ['dropdown-menu'] %}
50
48
 
51
- {% if _dark %}
52
- {% set _dropdown_classes = _dropdown_classes|merge(['dropdown-menu-dark']) %}
49
+ {%- if _dark %}
50
+ {%- set _dropdown_classes = _dropdown_classes|merge(['dropdown-menu-dark']) %}
53
51
  {% endif %}
54
52
  {% if _alignment %}
55
- {% set _dropdown_classes = _dropdown_classes|merge([_alignment]) %}
53
+ {%- set _dropdown_classes = _dropdown_classes|merge([_alignment]) %}
56
54
  {% endif %}
57
55
  {% if _direction %}
58
- {% set _class = _class ~ ' ' ~ _direction %}
56
+ {%- set _class = _class ~ ' ' ~ _direction %}
59
57
  {% endif %}
60
58
 
61
- {% if attributes is empty %}
62
- {% set attributes = create_attribute() %}
59
+ {%- if attributes is empty %}
60
+ {%- set attributes = create_attribute() %}
63
61
  {% endif %}
64
62
 
65
- {% set attributes = attributes.setAttribute('aria-labelledby', _id).addClass(_dropdown_classes) %}
63
+ {%- set attributes = attributes.setAttribute('aria-labelledby', _id).addClass(_dropdown_classes) %}
66
64
 
67
- {% if _trigger.attributes is empty %}
68
- {% set _trigger = _trigger|merge({
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
- {% if not _inside_navigation %}
80
- {% if _link %}
81
- {% set _trigger = _trigger|merge({
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
- {% else %}
85
- {% set _trigger = _trigger|merge({
86
- attributes: _trigger.attributes.setAttribute('autocomplete', 'off')
82
+ {%- else %}
83
+ {%- set _trigger = _trigger|merge({
84
+ attributes: _trigger.attributes.setAttribute('autocomplete', 'off')
87
85
  }) %}
88
- {% endif %}
86
+ {%- endif %}
89
87
  {% else %}
90
- {% set attributes = attributes.setAttribute('aria-hidden', 'true').setAttribute('role', 'presentation') %}
88
+ {%- set attributes = attributes.setAttribute('aria-hidden', 'true').setAttribute('role', 'presentation') %}
91
89
  {% endif %}
92
90
 
93
- {% if not _remove_wrapper %}
91
+ {%- if not _remove_wrapper -%}
94
92
  <div class="{{ _class }}">
95
- {% endif %}
96
- {% if _link %}
97
- {% include '@oe-bcl/bcl-link/link.html.twig' with _trigger only %}
98
- {% else %}
99
- {% include '@oe-bcl/bcl-button/button.html.twig' with _trigger only %}
100
- {% endif %}
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
- {% if _items is not empty and _items is iterable %}
105
- {% for _item in _items %}
106
- {% if _item.attributes is empty %}
107
- {% set _item = _item|merge({
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
- {% endif %}
111
- {% set _item_classes = ['dropdown-item'] %}
112
- {% if _item.active %}
113
- {% set _item_classes = _item_classes|merge(['active']) %}
114
- {% endif %}
115
- {% set _item = _item|merge({
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
- {% if _item.divider is defined %}
118
+ {%- if _item.divider is defined -%}
121
119
  <hr class="dropdown-divider">
122
- {% elseif _item.button is defined %}
123
- {% include '@oe-bcl/bcl-button/button.html.twig' with _item only %}
124
- {% else %}
125
- {% include '@oe-bcl/bcl-link/link.html.twig' with _item only %}
126
- {% endif %}
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
- {% endfor %}
129
- {% endif %}
126
+ {%- endfor %}
127
+ {%- endif -%}
130
128
  </ul>
131
- {% if not _remove_wrapper %}
129
+ {%- if not _remove_wrapper -%}
132
130
  </div>
133
- {% endif %}
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.9",
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.9",
12
- "@openeuropa/bcl-link": "^1.10.9"
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": "cb9864341bfc98404071520d61568bd18e17e1fe"
28
+ "gitHead": "82aecf2f60f8bd8f9afd447ea0d044396f085823"
29
29
  }