@openeuropa/bcl-twig-templates 1.9.0 → 1.9.1

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/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@openeuropa/bcl-twig-templates",
3
3
  "author": "European Commission",
4
4
  "license": "EUPL-1.2",
5
- "version": "1.9.0",
5
+ "version": "1.9.1",
6
6
  "description": "OE Bcl Twig Templates",
7
7
  "publishConfig": {
8
8
  "access": "public"
@@ -11,69 +11,69 @@
11
11
  "hoistingLimits": "workspaces"
12
12
  },
13
13
  "devDependencies": {
14
- "@openeuropa/bcl-accordion": "^1.9.0",
15
- "@openeuropa/bcl-alert": "^1.9.0",
16
- "@openeuropa/bcl-badge": "^1.9.0",
17
- "@openeuropa/bcl-banner": "^1.9.0",
18
- "@openeuropa/bcl-base-templates": "^1.9.0",
19
- "@openeuropa/bcl-blockquote": "^1.9.0",
20
- "@openeuropa/bcl-breadcrumb": "^1.9.0",
21
- "@openeuropa/bcl-button": "^1.9.0",
22
- "@openeuropa/bcl-button-group": "^1.9.0",
23
- "@openeuropa/bcl-card": "^1.9.0",
24
- "@openeuropa/bcl-card-layout": "^1.9.0",
25
- "@openeuropa/bcl-carousel": "^1.9.0",
26
- "@openeuropa/bcl-contact-form": "^1.9.0",
27
- "@openeuropa/bcl-content-banner": "^1.9.0",
28
- "@openeuropa/bcl-date-block": "^1.9.0",
29
- "@openeuropa/bcl-description-list": "^1.9.0",
30
- "@openeuropa/bcl-dropdown": "^1.9.0",
31
- "@openeuropa/bcl-event": "^1.9.0",
32
- "@openeuropa/bcl-fact-figures": "^1.9.0",
33
- "@openeuropa/bcl-featured-media": "^1.9.0",
34
- "@openeuropa/bcl-file": "^1.9.0",
35
- "@openeuropa/bcl-footer": "^1.9.0",
36
- "@openeuropa/bcl-form": "^1.9.0",
37
- "@openeuropa/bcl-form-input": "^1.9.0",
38
- "@openeuropa/bcl-gallery": "^1.9.0",
39
- "@openeuropa/bcl-glossary": "^1.9.0",
40
- "@openeuropa/bcl-group": "^1.9.0",
41
- "@openeuropa/bcl-header": "^1.9.0",
42
- "@openeuropa/bcl-heading": "^1.9.0",
43
- "@openeuropa/bcl-icon": "^1.9.0",
44
- "@openeuropa/bcl-inpage-navigation": "^1.9.0",
45
- "@openeuropa/bcl-landing-page": "^1.9.0",
46
- "@openeuropa/bcl-language-list": "^1.9.0",
47
- "@openeuropa/bcl-language-switcher": "^1.9.0",
48
- "@openeuropa/bcl-link": "^1.9.0",
49
- "@openeuropa/bcl-links-block": "^1.9.0",
50
- "@openeuropa/bcl-list-group": "^1.9.0",
51
- "@openeuropa/bcl-listing": "^1.9.0",
52
- "@openeuropa/bcl-modal": "^1.9.0",
53
- "@openeuropa/bcl-multilingual": "^1.9.0",
54
- "@openeuropa/bcl-navbar": "^1.9.0",
55
- "@openeuropa/bcl-navigation": "^1.9.0",
56
- "@openeuropa/bcl-news": "^1.9.0",
57
- "@openeuropa/bcl-offcanvas": "^1.9.0",
58
- "@openeuropa/bcl-page": "^1.9.0",
59
- "@openeuropa/bcl-pagination": "^1.9.0",
60
- "@openeuropa/bcl-person": "^1.9.0",
61
- "@openeuropa/bcl-placeholder": "^1.9.0",
62
- "@openeuropa/bcl-progress": "^1.9.0",
63
- "@openeuropa/bcl-project": "^1.9.0",
64
- "@openeuropa/bcl-project-status": "^1.9.0",
65
- "@openeuropa/bcl-recent-activities": "^1.9.0",
66
- "@openeuropa/bcl-search": "^1.9.0",
67
- "@openeuropa/bcl-search-form": "^1.9.0",
68
- "@openeuropa/bcl-select": "^1.9.0",
69
- "@openeuropa/bcl-spinner": "^1.9.0",
70
- "@openeuropa/bcl-subscription": "^1.9.0",
71
- "@openeuropa/bcl-subscription-block": "^1.9.0",
72
- "@openeuropa/bcl-table": "^1.9.0",
73
- "@openeuropa/bcl-textarea": "^1.9.0",
74
- "@openeuropa/bcl-timeline": "^1.9.0",
75
- "@openeuropa/bcl-toast": "^1.9.0",
76
- "@openeuropa/bcl-user": "^1.9.0",
14
+ "@openeuropa/bcl-accordion": "^1.9.1",
15
+ "@openeuropa/bcl-alert": "^1.9.1",
16
+ "@openeuropa/bcl-badge": "^1.9.1",
17
+ "@openeuropa/bcl-banner": "^1.9.1",
18
+ "@openeuropa/bcl-base-templates": "^1.9.1",
19
+ "@openeuropa/bcl-blockquote": "^1.9.1",
20
+ "@openeuropa/bcl-breadcrumb": "^1.9.1",
21
+ "@openeuropa/bcl-button": "^1.9.1",
22
+ "@openeuropa/bcl-button-group": "^1.9.1",
23
+ "@openeuropa/bcl-card": "^1.9.1",
24
+ "@openeuropa/bcl-card-layout": "^1.9.1",
25
+ "@openeuropa/bcl-carousel": "^1.9.1",
26
+ "@openeuropa/bcl-contact-form": "^1.9.1",
27
+ "@openeuropa/bcl-content-banner": "^1.9.1",
28
+ "@openeuropa/bcl-date-block": "^1.9.1",
29
+ "@openeuropa/bcl-description-list": "^1.9.1",
30
+ "@openeuropa/bcl-dropdown": "^1.9.1",
31
+ "@openeuropa/bcl-event": "^1.9.1",
32
+ "@openeuropa/bcl-fact-figures": "^1.9.1",
33
+ "@openeuropa/bcl-featured-media": "^1.9.1",
34
+ "@openeuropa/bcl-file": "^1.9.1",
35
+ "@openeuropa/bcl-footer": "^1.9.1",
36
+ "@openeuropa/bcl-form": "^1.9.1",
37
+ "@openeuropa/bcl-form-input": "^1.9.1",
38
+ "@openeuropa/bcl-gallery": "^1.9.1",
39
+ "@openeuropa/bcl-glossary": "^1.9.1",
40
+ "@openeuropa/bcl-group": "^1.9.1",
41
+ "@openeuropa/bcl-header": "^1.9.1",
42
+ "@openeuropa/bcl-heading": "^1.9.1",
43
+ "@openeuropa/bcl-icon": "^1.9.1",
44
+ "@openeuropa/bcl-inpage-navigation": "^1.9.1",
45
+ "@openeuropa/bcl-landing-page": "^1.9.1",
46
+ "@openeuropa/bcl-language-list": "^1.9.1",
47
+ "@openeuropa/bcl-language-switcher": "^1.9.1",
48
+ "@openeuropa/bcl-link": "^1.9.1",
49
+ "@openeuropa/bcl-links-block": "^1.9.1",
50
+ "@openeuropa/bcl-list-group": "^1.9.1",
51
+ "@openeuropa/bcl-listing": "^1.9.1",
52
+ "@openeuropa/bcl-modal": "^1.9.1",
53
+ "@openeuropa/bcl-multilingual": "^1.9.1",
54
+ "@openeuropa/bcl-navbar": "^1.9.1",
55
+ "@openeuropa/bcl-navigation": "^1.9.1",
56
+ "@openeuropa/bcl-news": "^1.9.1",
57
+ "@openeuropa/bcl-offcanvas": "^1.9.1",
58
+ "@openeuropa/bcl-page": "^1.9.1",
59
+ "@openeuropa/bcl-pagination": "^1.9.1",
60
+ "@openeuropa/bcl-person": "^1.9.1",
61
+ "@openeuropa/bcl-placeholder": "^1.9.1",
62
+ "@openeuropa/bcl-progress": "^1.9.1",
63
+ "@openeuropa/bcl-project": "^1.9.1",
64
+ "@openeuropa/bcl-project-status": "^1.9.1",
65
+ "@openeuropa/bcl-recent-activities": "^1.9.1",
66
+ "@openeuropa/bcl-search": "^1.9.1",
67
+ "@openeuropa/bcl-search-form": "^1.9.1",
68
+ "@openeuropa/bcl-select": "^1.9.1",
69
+ "@openeuropa/bcl-spinner": "^1.9.1",
70
+ "@openeuropa/bcl-subscription": "^1.9.1",
71
+ "@openeuropa/bcl-subscription-block": "^1.9.1",
72
+ "@openeuropa/bcl-table": "^1.9.1",
73
+ "@openeuropa/bcl-textarea": "^1.9.1",
74
+ "@openeuropa/bcl-timeline": "^1.9.1",
75
+ "@openeuropa/bcl-toast": "^1.9.1",
76
+ "@openeuropa/bcl-user": "^1.9.1",
77
77
  "copyfiles": "2.4.1",
78
78
  "rimraf": "6.0.1"
79
79
  },
@@ -96,5 +96,5 @@
96
96
  "design-system",
97
97
  "twig"
98
98
  ],
99
- "gitHead": "461de595e5ddda95383ceaf5d02d513aef111246"
99
+ "gitHead": "70554ede8523da73edc3c786661e687a30fb2315"
100
100
  }
@@ -16,6 +16,8 @@
16
16
  stay_open (boolean) (default: false)
17
17
  },
18
18
  ]
19
+ - expand_button: (button object) (default: {})
20
+ - collapse_button: (button object) (default: {})
19
21
  - open_item_id (int) (default: 0)
20
22
  - attributes (drupal attrs)
21
23
  #}
@@ -27,6 +29,8 @@
27
29
  {% set _id = id|default(random(1000)) %}
28
30
  {% set _flush = flush ?? false %}
29
31
  {% set _items = items|default([]) %}
32
+ {% set _expand_button = expand_button|default({}) %}
33
+ {% set _collapse_button = collapse_button|default({}) %}
30
34
  {% set _open_item_id = open_item_id|default(0) %}
31
35
  {% set _classes = ['accordion'] %}
32
36
  {% if _flush %}
@@ -43,57 +47,92 @@
43
47
  <div
44
48
  {{ attributes }}
45
49
  >
46
- {%- if _title is not empty -%}
47
- {% include '@oe-bcl/bcl-heading/heading.html.twig' with {
48
- title: _title,
49
- title_tag: _title_tag,
50
- title_link: _title_link,
51
- attributes: _title_attributes,
52
- } only %}
53
- {%- endif -%}
50
+ {%- if _title is not empty -%}
51
+ {% include '@oe-bcl/bcl-heading/heading.html.twig' with {
52
+ title: _title,
53
+ title_tag: _title_tag,
54
+ title_link: _title_link,
55
+ attributes: _title_attributes,
56
+ } only %}
57
+ {%- endif -%}
54
58
 
55
- {% for _item in _items %}
56
- {% set _open_item = _open_item_id == loop.index %}
57
- {% set _button_classes = ['accordion-button'] %}
58
- {% if not _open_item %}
59
- {% set _button_classes = _button_classes|merge(['collapsed']) %}
60
- {% endif %}
61
- <div class="accordion-item">
62
- {%- set _item_title_tag = _item.title_tag|default('h2') %}
63
- <{{ _item_title_tag }}
64
- class="accordion-header"
65
- id="heading-{{ _id }}-{{ loop.index }}"
59
+ {% if _items|length > 1 and (_expand_button is not empty or _collapse_button is not empty) %}
60
+ {% set wrapper_attributes = create_attribute().addClass(['d-flex', 'justify-content-end', 'gap-3', 'mb-3']) %}
61
+ <div
62
+ {{ wrapper_attributes }}
66
63
  >
67
- {% set button_attributes = create_attribute()
68
- .addClass(_button_classes)
69
- .setAttribute('data-bs-toggle', 'collapse')
70
- .setAttribute('autocomplete', 'off')
71
- .setAttribute('data-bs-target', '#collapse-' ~ _id ~ '-' ~ loop.index)
72
- .setAttribute('aria-controls', 'collapse-' ~ _id ~ '-' ~ loop.index)
73
- .setAttribute('aria-expanded', open_item ? 'true' : 'false')
74
- %}
75
- {% include '@oe-bcl/bcl-button/button.html.twig' with {
76
- label: _item.title,
77
- clean_class: true,
78
- attributes: button_attributes
79
- } only %}
80
- </{{ _item_title_tag }}>
81
- <div
82
- id="collapse-{{ _id }}-{{ loop.index }}"
83
- class="accordion-collapse collapse{{ _open_item ? ' show' }}"
84
- aria-labelledby="heading-{{ _id }}-{{ loop.index }}"
85
- role="region"
86
- {% if not _item.stay_open %}
87
- data-bs-parent="#accordion-{{ _id }}"
64
+ {% if _expand_button is not empty %}
65
+ {% if _expand_button.attributes is empty %}
66
+ {% set _expand_button = _expand_button|merge({
67
+ attributes: create_attribute()
68
+ })
69
+ %}
70
+ {% endif %}
71
+ {% include '@oe-bcl/bcl-button/button.html.twig' with _expand_button|merge({
72
+ attributes: _expand_button.attributes
73
+ .setAttribute('data-target', 'accordion-' ~ _id)
74
+ .setAttribute('data-action', 'expand')
75
+ }) only %}
88
76
  {% endif %}
89
- >
90
- <div class="accordion-body">
91
- {%- set _content = _item.content|default('') %}
92
- {%- block content _content -%}
77
+ {% if _collapse_button is not empty %}
78
+ {% if _collapse_button.attributes is empty %}
79
+ {% set _collapse_button = _collapse_button|merge({
80
+ attributes: create_attribute()
81
+ })
82
+ %}
83
+ {% endif %}
84
+ {% include '@oe-bcl/bcl-button/button.html.twig' with _collapse_button|merge({
85
+ attributes: _collapse_button.attributes
86
+ .setAttribute('data-target', 'accordion-' ~ _id)
87
+ .setAttribute('data-action', 'collapse')
88
+ }) only %}
89
+ {% endif %}
90
+ </div>
91
+ {% endif %}
92
+ <div class="accordion-items-wrapper">
93
+ {% for _item in _items %}
94
+ {% set _open_item = _open_item_id == loop.index %}
95
+ {% set _button_classes = ['accordion-button'] %}
96
+ {% if not _open_item %}
97
+ {% set _button_classes = _button_classes|merge(['collapsed']) %}
98
+ {% endif %}
99
+ <div class="accordion-item">
100
+ {%- set _item_title_tag = _item.title_tag|default('h2') %}
101
+ <{{ _item_title_tag }}
102
+ class="accordion-header"
103
+ id="heading-{{ _id }}-{{ loop.index }}"
104
+ >
105
+ {% set button_attributes = create_attribute()
106
+ .addClass(_button_classes)
107
+ .setAttribute('data-bs-toggle', 'collapse')
108
+ .setAttribute('autocomplete', 'off')
109
+ .setAttribute('data-bs-target', '#collapse-' ~ _id ~ '-' ~ loop.index)
110
+ .setAttribute('aria-controls', 'collapse-' ~ _id ~ '-' ~ loop.index)
111
+ .setAttribute('aria-expanded', open_item ? 'true' : 'false')
112
+ %}
113
+ {% include '@oe-bcl/bcl-button/button.html.twig' with {
114
+ label: _item.title,
115
+ clean_class: true,
116
+ attributes: button_attributes
117
+ } only %}
118
+ </{{ _item_title_tag }}>
119
+ <div
120
+ id="collapse-{{ _id }}-{{ loop.index }}"
121
+ class="accordion-collapse collapse{{ _open_item ? ' show' }}"
122
+ aria-labelledby="heading-{{ _id }}-{{ loop.index }}"
123
+ role="region"
124
+ {% if not _item.stay_open and _expand_button is empty %}
125
+ data-bs-parent="#accordion-{{ _id }}"
126
+ {% endif %}
127
+ >
128
+ <div class="accordion-body">
129
+ {%- set _content = _item.content|default('') %}
130
+ {%- block content _content -%}
131
+ </div>
132
+ </div>
93
133
  </div>
94
- </div>
134
+ {% endfor %}
95
135
  </div>
96
- {% endfor %}
97
136
  </div>
98
137
  {% endif %}
99
138
 
@@ -9,6 +9,7 @@ Parameters:
9
9
  - links: (link[]) (default: [])
10
10
  - id (string) (default: bcl-inpage-navigation-random(100))
11
11
  - dropdown_id (string) (default: bcl-inpage-navigation-dropdown-random(100))
12
+ - dynamic_active: (boolean) (default: false)
12
13
  - icon_path (string) (default: '')
13
14
  - attributes (drupal attrs)
14
15
  #}
@@ -21,6 +22,7 @@ Parameters:
21
22
  {% set _id = id|default('bcl-inpage-navigation-' ~ random(100)) %}
22
23
  {% set _icon_path = icon_path|default('') %}
23
24
  {% set _dropdown_id = dropdown_id|default('bcl-inpage-navigation-dropdown' ~ random(100)) %}
25
+ {% set _dyanmic_active = dynamic_active|default(false) %}
24
26
 
25
27
  {% if attributes is empty %}
26
28
  {% set attributes = create_attribute() %}
@@ -37,7 +39,13 @@ Parameters:
37
39
  } only -%}
38
40
  {% endset %}
39
41
 
40
- <nav {{ attributes }}>
42
+ {% set _classes = [] %}
43
+
44
+ {% if _dyanmic_active %}
45
+ {% set _classes = _classes|merge(['dynamic-active']) %}
46
+ {% endif %}
47
+
48
+ <nav {{ attributes.addClass(_classes) }}>
41
49
  {% set trigger_attributes = create_attribute()
42
50
  .setAttribute('aria-expanded', 'false')
43
51
  .setAttribute('type', 'button')