@openeuropa/bcl-twig-templates 1.8.2 → 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,77 +2,80 @@
2
2
  "name": "@openeuropa/bcl-twig-templates",
3
3
  "author": "European Commission",
4
4
  "license": "EUPL-1.2",
5
- "version": "1.8.2",
5
+ "version": "1.9.1",
6
6
  "description": "OE Bcl Twig Templates",
7
7
  "publishConfig": {
8
8
  "access": "public"
9
9
  },
10
+ "installConfig": {
11
+ "hoistingLimits": "workspaces"
12
+ },
10
13
  "devDependencies": {
11
- "@openeuropa/bcl-accordion": "^1.8.2",
12
- "@openeuropa/bcl-alert": "^1.8.2",
13
- "@openeuropa/bcl-badge": "^1.8.2",
14
- "@openeuropa/bcl-banner": "^1.8.2",
15
- "@openeuropa/bcl-base-templates": "^1.8.2",
16
- "@openeuropa/bcl-blockquote": "^1.8.2",
17
- "@openeuropa/bcl-breadcrumb": "^1.8.2",
18
- "@openeuropa/bcl-button": "^1.8.2",
19
- "@openeuropa/bcl-button-group": "^1.8.2",
20
- "@openeuropa/bcl-card": "^1.8.2",
21
- "@openeuropa/bcl-card-layout": "^1.8.2",
22
- "@openeuropa/bcl-carousel": "^1.8.2",
23
- "@openeuropa/bcl-contact-form": "^1.8.2",
24
- "@openeuropa/bcl-content-banner": "^1.8.2",
25
- "@openeuropa/bcl-date-block": "^1.8.2",
26
- "@openeuropa/bcl-description-list": "^1.8.2",
27
- "@openeuropa/bcl-dropdown": "^1.8.2",
28
- "@openeuropa/bcl-event": "^1.8.2",
29
- "@openeuropa/bcl-fact-figures": "^1.8.2",
30
- "@openeuropa/bcl-featured-media": "^1.8.2",
31
- "@openeuropa/bcl-file": "^1.8.2",
32
- "@openeuropa/bcl-footer": "^1.8.2",
33
- "@openeuropa/bcl-form": "^1.8.2",
34
- "@openeuropa/bcl-form-input": "^1.8.2",
35
- "@openeuropa/bcl-gallery": "^1.8.2",
36
- "@openeuropa/bcl-glossary": "^1.8.2",
37
- "@openeuropa/bcl-group": "^1.8.2",
38
- "@openeuropa/bcl-header": "^1.8.2",
39
- "@openeuropa/bcl-heading": "^1.8.2",
40
- "@openeuropa/bcl-icon": "^1.8.2",
41
- "@openeuropa/bcl-inpage-navigation": "^1.8.2",
42
- "@openeuropa/bcl-landing-page": "^1.8.2",
43
- "@openeuropa/bcl-language-list": "^1.8.2",
44
- "@openeuropa/bcl-language-switcher": "^1.8.2",
45
- "@openeuropa/bcl-link": "^1.8.2",
46
- "@openeuropa/bcl-links-block": "^1.8.2",
47
- "@openeuropa/bcl-list-group": "^1.8.2",
48
- "@openeuropa/bcl-listing": "^1.8.2",
49
- "@openeuropa/bcl-modal": "^1.8.2",
50
- "@openeuropa/bcl-multilingual": "^1.8.2",
51
- "@openeuropa/bcl-navbar": "^1.8.2",
52
- "@openeuropa/bcl-navigation": "^1.8.2",
53
- "@openeuropa/bcl-news": "^1.8.2",
54
- "@openeuropa/bcl-offcanvas": "^1.8.2",
55
- "@openeuropa/bcl-page": "^1.8.2",
56
- "@openeuropa/bcl-pagination": "^1.8.2",
57
- "@openeuropa/bcl-person": "^1.8.2",
58
- "@openeuropa/bcl-placeholder": "^1.8.2",
59
- "@openeuropa/bcl-progress": "^1.8.2",
60
- "@openeuropa/bcl-project": "^1.8.2",
61
- "@openeuropa/bcl-project-status": "^1.8.2",
62
- "@openeuropa/bcl-recent-activities": "^1.8.2",
63
- "@openeuropa/bcl-search": "^1.8.2",
64
- "@openeuropa/bcl-search-form": "^1.8.2",
65
- "@openeuropa/bcl-select": "^1.8.2",
66
- "@openeuropa/bcl-spinner": "^1.8.2",
67
- "@openeuropa/bcl-subscription": "^1.8.2",
68
- "@openeuropa/bcl-subscription-block": "^1.8.2",
69
- "@openeuropa/bcl-table": "^1.8.2",
70
- "@openeuropa/bcl-textarea": "^1.8.2",
71
- "@openeuropa/bcl-timeline": "^1.8.2",
72
- "@openeuropa/bcl-toast": "^1.8.2",
73
- "@openeuropa/bcl-user": "^1.8.2",
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",
74
77
  "copyfiles": "2.4.1",
75
- "rimraf": "5.0.7"
78
+ "rimraf": "6.0.1"
76
79
  },
77
80
  "scripts": {
78
81
  "clean": "rimraf templates",
@@ -93,5 +96,5 @@
93
96
  "design-system",
94
97
  "twig"
95
98
  ],
96
- "gitHead": "3eb04ddc2c8195e3ad880a8155e6ec108a6ee088"
99
+ "gitHead": "70554ede8523da73edc3c786661e687a30fb2315"
97
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
 
@@ -158,7 +158,7 @@
158
158
  data-bs-target="#{{ _id }}"
159
159
  data-bs-slide="prev"
160
160
  >
161
- <span class="carousel-control-prev-icon" aria-hidden="true"></span>
161
+ <span class="carousel-control-prev-icon"></span>
162
162
  {% if _prev_label is not empty %}
163
163
  <span class="visually-hidden">{{ _prev_label }}</span>
164
164
  {% endif %}
@@ -169,7 +169,7 @@
169
169
  data-bs-target="#{{ _id }}"
170
170
  data-bs-slide="next"
171
171
  >
172
- <span class="carousel-control-next-icon" aria-hidden="true"></span>
172
+ <span class="carousel-control-next-icon"></span>
173
173
  {% if _next_label is not empty %}
174
174
  <span class="visually-hidden">{{ _next_label }}</span>
175
175
  {% endif %}
@@ -62,6 +62,7 @@
62
62
  <div class="container">
63
63
  {% if _project_link is not empty %}
64
64
  <a
65
+ class="d-inline-block"
65
66
  href="{{ _project_link }}"
66
67
  >
67
68
  {% endif %}
@@ -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')