@openeuropa/bcl-toasts 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/package.json +2 -2
  2. package/toasts.html.twig +56 -60
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@openeuropa/bcl-toasts",
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
  },
@@ -21,5 +21,5 @@
21
21
  "design-system",
22
22
  "twig"
23
23
  ],
24
- "gitHead": "cb9864341bfc98404071520d61568bd18e17e1fe"
24
+ "gitHead": "82aecf2f60f8bd8f9afd447ea0d044396f085823"
25
25
  }
package/toasts.html.twig CHANGED
@@ -1,5 +1,3 @@
1
- {% apply spaceless %}
2
-
3
1
  {#
4
2
  Parameters:
5
3
  - with_wrapper (boolean) (default: false)
@@ -26,107 +24,105 @@
26
24
  - attributes (drupal attrs)
27
25
  #}
28
26
 
29
- {% set _with_wrapper = with_wrapper ?? false %}
27
+ {%- set _with_wrapper = with_wrapper ?? false %}
30
28
  {% set _wrapper_classes = wrapper_classes|default('') %}
31
29
  {% set _wrapper_aria_live = wrapper_aria_live|default('') %}
32
30
  {% set _with_container = with_container ?? false %}
33
31
  {% set _toasts = toasts|default([]) %}
34
32
 
35
- {% set _container_classes = 'toast-container' %}
33
+ {%- set _container_classes = 'toast-container' %}
36
34
 
37
- {% if container_classes %}
38
- {% set _container_classes = _container_classes ~ ' ' ~ container_classes %}
35
+ {%- if container_classes %}
36
+ {%- set _container_classes = _container_classes ~ ' ' ~ container_classes %}
39
37
  {% endif %}
40
38
 
41
- {% if attributes is empty %}
42
- {% set attributes = create_attribute() %}
39
+ {%- if attributes is empty %}
40
+ {%- set attributes = create_attribute() %}
43
41
  {% endif %}
44
42
 
45
- {# wrapper #}
43
+ {#- wrapper #}
46
44
  {% if _with_wrapper %}
47
- {% set attributes = attributes.setAttribute('aria-atomic', "true") %}
48
- {% if _wrapper_aria_live %}
49
- {% set attributes = attributes.setAttribute('aria-live', _wrapper_aria_live) %}
50
- {% endif %}
51
- {% if _wrapper_classes %}
52
- {% set attributes = attributes.addClass(_wrapper_classes|split(' ')) %}
53
- {% endif %}
45
+ {%- set attributes = attributes.setAttribute('aria-atomic', "true") %}
46
+ {%- if _wrapper_aria_live %}
47
+ {%- set attributes = attributes.setAttribute('aria-live', _wrapper_aria_live) %}
48
+ {%- endif %}
49
+ {%- if _wrapper_classes %}
50
+ {%- set attributes = attributes.addClass(_wrapper_classes|split(' ')) %}
51
+ {%- endif -%}
54
52
 
55
53
  <div {{ attributes }}>
56
54
 
57
- {% endif %}
55
+ {%- endif %}
58
56
  {# container #}
59
- {% if _with_container %}
57
+ {% if _with_container -%}
60
58
  <div class="{{ _container_classes }}">
61
- {% endif %}
59
+ {%- endif %}
62
60
  {# toasts #}
63
61
  {% if _toasts is not empty %}
64
- {% for _toast in _toasts %}
65
- {% set _classes = ['toast'] %}
66
- {% set _body = _toast.body|default('') %}
67
- {% set _role = _toast.role|default('') %}
68
- {% set _with_close = _toast.with_close ?? true %}
69
- {% set _aria_live = _toast.aria_live|default('') %}
70
- {% set _autohide = _toast.autohide ?? true %}
71
- {% set _with_body_wrapper = _toast.with_body_wrapper ?? false %}
72
- {% set _body_wrapper_classes = _toast.body_wrapper_classes|default('') %}
73
- {% set _toast_attributes = _toast.attributes ?: create_attribute() %}
74
- {% set _body_attributes = _toast.body_attributes ?: create_attribute() %}
75
- {% set _header_attributes = _toast.header_attributes ?: create_attribute() %}
76
- {% set _button_attributes = _toast.button_attributes ?: create_attribute() %}
77
- {% set _toast_attributes = _toast_attributes.addClass(_classes).setAttribute('aria-atomic', 'true') %}
78
- {% if _aria_live is not empty %}
79
- {% set _toast_attributes = _toast_attributes.setAttribute('aria-live', _aria_live) %}
80
- {% endif %}
81
- {% if _role is not empty %}
82
- {% set _toast_attributes = _toast_attributes.setAttribute('role', _role) %}
83
- {% endif %}
84
- {% if not _autohide %}
85
- {% set _toast_attributes = _toast_attributes.setAttribute('data-bs-autohide', 'false') %}
86
- {% endif %}
62
+ {%- for _toast in _toasts %}
63
+ {%- set _classes = ['toast'] %}
64
+ {%- set _body = _toast.body|default('') %}
65
+ {%- set _role = _toast.role|default('') %}
66
+ {%- set _with_close = _toast.with_close ?? true %}
67
+ {%- set _aria_live = _toast.aria_live|default('') %}
68
+ {%- set _autohide = _toast.autohide ?? true %}
69
+ {%- set _with_body_wrapper = _toast.with_body_wrapper ?? false %}
70
+ {%- set _body_wrapper_classes = _toast.body_wrapper_classes|default('') %}
71
+ {%- set _toast_attributes = _toast.attributes ?: create_attribute() %}
72
+ {%- set _body_attributes = _toast.body_attributes ?: create_attribute() %}
73
+ {%- set _header_attributes = _toast.header_attributes ?: create_attribute() %}
74
+ {%- set _button_attributes = _toast.button_attributes ?: create_attribute() %}
75
+ {%- set _toast_attributes = _toast_attributes.addClass(_classes).setAttribute('aria-atomic', 'true') %}
76
+ {%- if _aria_live is not empty %}
77
+ {%- set _toast_attributes = _toast_attributes.setAttribute('aria-live', _aria_live) %}
78
+ {%- endif %}
79
+ {%- if _role is not empty %}
80
+ {%- set _toast_attributes = _toast_attributes.setAttribute('role', _role) %}
81
+ {%- endif %}
82
+ {%- if not _autohide %}
83
+ {%- set _toast_attributes = _toast_attributes.setAttribute('data-bs-autohide', 'false') %}
84
+ {%- endif -%}
87
85
  <div
88
86
  {{ _toast_attributes }}
89
87
  >
90
- {% if _with_close or
88
+ {%- if _with_close or
91
89
  (_toast.header is defined and _toast.header is not empty)
92
- %}
90
+ -%}
93
91
  <div{{ _header_attributes.addClass(['toast-header']) }}>
94
92
  {{- _toast.header|default('') -}}
95
93
  {% if _with_close %}
96
- {% if not _button_attributes.hasAttribute('aria-label') %}
97
- {% set _button_attributes = _button_attributes.setAttribute('aria-label', 'Close') %}
98
- {% endif %}
94
+ {%- if not _button_attributes.hasAttribute('aria-label') %}
95
+ {%- set _button_attributes = _button_attributes.setAttribute('aria-label', 'Close') %}
96
+ {%- endif %}
99
97
  {%- include '@oe-bcl/bcl-button/button.html.twig' with {
100
98
  attributes: _button_attributes
101
99
  .addClass(['btn-close'])
102
100
  .setAttribute('data-bs-dismiss', 'toast'),
103
101
  clean_class: true
104
102
  } only -%}
105
- {% endif %}
103
+ {% endif -%}
106
104
  </div>
107
- {% endif %}
108
- {% if _with_body_wrapper %}
105
+ {%- endif %}
106
+ {%- if _with_body_wrapper -%}
109
107
  <div
110
108
  {% if _body_wrapper_classes %}
111
109
  class="{{ _body_wrapper_classes }}"
112
110
  {% endif %}
113
111
  >
114
- {% endif %}
112
+ {%- endif -%}
115
113
  <div{{ _body_attributes.addClass(['toast-body']) }}>
116
114
  {{- _body -}}
117
115
  </div>
118
- {% if _with_body_wrapper %}
116
+ {%- if _with_body_wrapper -%}
119
117
  </div>
120
- {% endif %}
118
+ {%- endif %}
121
119
  {{- _toast.custom_content|default('') -}}
122
120
  </div>
123
- {% endfor %}
121
+ {%- endfor %}
124
122
  {% endif %}
125
- {% if _with_container %}
123
+ {% if _with_container -%}
126
124
  </div>
127
- {% endif %}
128
- {% if _with_wrapper %}
125
+ {%- endif %}
126
+ {% if _with_wrapper -%}
129
127
  </div>
130
- {% endif %}
131
-
132
- {% endapply %}
128
+ {%- endif -%}