@openeuropa/bcl-inpage-navigation 1.4.0 → 1.6.0

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.
@@ -7,7 +7,9 @@ Parameters:
7
7
  - title_link: (link object) (default: {})
8
8
  - title_attributes (drupal attrs)
9
9
  - links: (link[]) (default: [])
10
- - id (string) (default: bcl-inpage-navigation-random(10))
10
+ - id (string) (default: bcl-inpage-navigation-random(100))
11
+ - dropdown_id (string) (default: bcl-inpage-navigation-dropdown-random(100))
12
+ - icon_path (string) (default: '')
11
13
  - attributes (drupal attrs)
12
14
  #}
13
15
 
@@ -16,7 +18,9 @@ Parameters:
16
18
  {% set _title_link = title_link|default({}) %}
17
19
  {% set _title_attributes = title_attributes ?: create_attribute() %}
18
20
  {% set _links = links|default([]) %}
19
- {% set _id = id|default('bcl-inpage-navigation-' ~ random(10)) %}
21
+ {% set _id = id|default('bcl-inpage-navigation-' ~ random(100)) %}
22
+ {% set _icon_path = icon_path|default('') %}
23
+ {% set _dropdown_id = dropdown_id|default('bcl-inpage-navigation-dropdown' ~ random(100)) %}
20
24
 
21
25
  {% if attributes is empty %}
22
26
  {% set attributes = create_attribute() %}
@@ -24,19 +28,36 @@ Parameters:
24
28
 
25
29
  {% set attributes = attributes.addClass(['bcl-inpage-navigation', 'position-sticky']).setAttribute('id', _id) %}
26
30
  {% set title_attributes = _title_attributes.addClass('mb-0') %}
31
+ {% set _title_content %}
32
+ {{ _title }}
33
+ {%- include '@oe-bcl/bcl-icon/icon.html.twig' with {
34
+ name: 'chevron-down',
35
+ size: 's',
36
+ path: _icon_path,
37
+ } only -%}
38
+ {% endset %}
27
39
 
28
40
  <nav {{ attributes }}>
41
+ {% set trigger_attributes = create_attribute()
42
+ .setAttribute('aria-expanded', 'false')
43
+ .setAttribute('type', 'button')
44
+ .setAttribute('id', _dropdown_id)
45
+ .setAttribute('data-bs-toggle', 'dropdown')
46
+ .addClass(['dropdown-toggle']) %}
29
47
  {% include '@oe-bcl/bcl-heading/heading.html.twig' with {
30
- title: _title,
48
+ title: _title_content,
31
49
  title_tag: _title_tag,
32
50
  title_link: _title_link,
33
- attributes: _title_attributes.addClass('mb-0'),
34
- } only %}
35
- {% include '@oe-bcl/bcl-navigation/navigation.html.twig' with {
36
- 'pills': true,
37
- 'vertical': true,
38
- 'items': _links,
51
+ attributes: _title_attributes
52
+ .merge(trigger_attributes),
39
53
  } only %}
54
+ <div class="dropdown-menu" aria-labelledby="{{ _dropdown_id }}">
55
+ {% include '@oe-bcl/bcl-navigation/navigation.html.twig' with {
56
+ 'pills': true,
57
+ 'vertical': true,
58
+ 'items': _links,
59
+ } only %}
60
+ </div>
40
61
  </nav>
41
62
 
42
63
  {% endapply %}
package/package.json CHANGED
@@ -2,13 +2,13 @@
2
2
  "name": "@openeuropa/bcl-inpage-navigation",
3
3
  "author": "European Commission",
4
4
  "license": "EUPL-1.2",
5
- "version": "1.4.0",
5
+ "version": "1.6.0",
6
6
  "description": "OE - BCL inpage navigation",
7
7
  "publishConfig": {
8
8
  "access": "public"
9
9
  },
10
10
  "dependencies": {
11
- "@openeuropa/bcl-navigation": "^1.4.0"
11
+ "@openeuropa/bcl-navigation": "^1.6.0"
12
12
  },
13
13
  "devDependencies": {
14
14
  "lorem-ipsum": "2.0.8"
@@ -27,5 +27,5 @@
27
27
  "design-system",
28
28
  "twig"
29
29
  ],
30
- "gitHead": "0271b344c41999ea181851f229385df1d539047b"
30
+ "gitHead": "f82d4f83aa17cc668a051d1fd26bcbdb0122fddd"
31
31
  }