@openeuropa/bcl-form-input 0.4298.202511051800 → 0.4360.202601141610
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/form-input.html.twig +57 -61
- package/package.json +2 -2
package/form-input.html.twig
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
{% apply spaceless %}
|
|
2
|
-
|
|
3
1
|
{#
|
|
4
2
|
Parameters:
|
|
5
3
|
- id (string) (default: '')
|
|
@@ -28,7 +26,7 @@
|
|
|
28
26
|
- attributes (drupal attrs)
|
|
29
27
|
#}
|
|
30
28
|
|
|
31
|
-
{
|
|
29
|
+
{%- set _id = id|default('') %}
|
|
32
30
|
{% set _input_type = input_type|default('text') %}
|
|
33
31
|
{% set _label = label|default('') %}
|
|
34
32
|
{% set _required = required ?? false %}
|
|
@@ -52,70 +50,70 @@
|
|
|
52
50
|
{% set _toggle_variant = toggle_variant|default('primary') %}
|
|
53
51
|
{% set _remove_wrapper = remove_wrapper ?? false %}
|
|
54
52
|
|
|
55
|
-
{
|
|
53
|
+
{%- set _label_block = false %}
|
|
56
54
|
{% set _label_class = 'form-label' %}
|
|
57
55
|
{% set _classes = ['form-control'] %}
|
|
58
56
|
|
|
59
|
-
{
|
|
60
|
-
{
|
|
57
|
+
{%- if input_type == 'range' %}
|
|
58
|
+
{%- set _classes = ['form-range'] %}
|
|
61
59
|
{% endif %}
|
|
62
60
|
{% if _input_type == 'checkbox' or _input_type == 'radio' %}
|
|
63
|
-
{
|
|
64
|
-
{
|
|
61
|
+
{%- set _classes = ['form-check-input'] %}
|
|
62
|
+
{%- set _label_class = 'form-check-label' %}
|
|
65
63
|
{% endif %}
|
|
66
64
|
{% if _invalid is not empty %}
|
|
67
|
-
{
|
|
65
|
+
{%- set _classes = _classes|merge(['is-invalid']) %}
|
|
68
66
|
{% endif %}
|
|
69
67
|
{% if _valid is not empty %}
|
|
70
|
-
{
|
|
68
|
+
{%- set _classes = _classes|merge(['is-valid']) %}
|
|
71
69
|
{% endif %}
|
|
72
70
|
{% if _horizontal %}
|
|
73
|
-
{
|
|
71
|
+
{%- set _label_class = 'col-form-label ' ~ _horizontal_label_class %}
|
|
74
72
|
{% endif %}
|
|
75
73
|
{% if _hidden_label %}
|
|
76
|
-
{
|
|
74
|
+
{%- set _label_class = _label_class ~ ' visually-hidden' %}
|
|
77
75
|
{% endif %}
|
|
78
76
|
{% if _toggle %}
|
|
79
|
-
{
|
|
80
|
-
{
|
|
77
|
+
{%- set _label_class = _label_class ~ ' btn btn-' ~ _toggle_variant %}
|
|
78
|
+
{%- set _classes = _classes|merge(['btn-check']) %}
|
|
81
79
|
{% endif %}
|
|
82
80
|
|
|
83
|
-
{
|
|
84
|
-
{
|
|
81
|
+
{%- if attributes is empty %}
|
|
82
|
+
{%- set attributes = create_attribute() %}
|
|
85
83
|
{% endif %}
|
|
86
84
|
|
|
87
|
-
{
|
|
85
|
+
{%- set attributes = attributes.addClass(_classes).setAttribute('type', _input_type) %}
|
|
88
86
|
|
|
89
|
-
{
|
|
90
|
-
{
|
|
87
|
+
{%- if _id %}
|
|
88
|
+
{%- set attributes = attributes.setAttribute('id', _id) %}
|
|
91
89
|
{% endif %}
|
|
92
90
|
|
|
93
|
-
{
|
|
94
|
-
{
|
|
91
|
+
{%- if _required %}
|
|
92
|
+
{%- set attributes = attributes.setAttribute('required', true) %}
|
|
95
93
|
{% endif %}
|
|
96
94
|
|
|
97
|
-
{
|
|
98
|
-
{
|
|
95
|
+
{%- if _disabled %}
|
|
96
|
+
{%- set attributes = attributes.setAttribute('disabled', true) %}
|
|
99
97
|
{% endif %}
|
|
100
98
|
|
|
101
|
-
{
|
|
102
|
-
{
|
|
99
|
+
{%- if _readonly %}
|
|
100
|
+
{%- set attributes = attributes.setAttribute('readonly', true) %}
|
|
103
101
|
{% endif %}
|
|
104
102
|
|
|
105
|
-
{
|
|
106
|
-
{
|
|
103
|
+
{%- if _checked %}
|
|
104
|
+
{%- set attributes = attributes.setAttribute('checked', true) %}
|
|
107
105
|
{% endif %}
|
|
108
106
|
|
|
109
|
-
{
|
|
110
|
-
{
|
|
107
|
+
{%- if _placeholder is not empty %}
|
|
108
|
+
{%- set attributes = attributes.setAttribute('placeholder', _placeholder) %}
|
|
111
109
|
{% endif %}
|
|
112
110
|
|
|
113
|
-
{
|
|
114
|
-
{
|
|
111
|
+
{%- if _helper_text_id is not empty %}
|
|
112
|
+
{%- set attributes = attributes.setAttribute('aria-describedby', _helper_text_id) %}
|
|
115
113
|
{% endif %}
|
|
116
114
|
|
|
117
|
-
{
|
|
118
|
-
{
|
|
115
|
+
{%- if _label is not empty %}
|
|
116
|
+
{%- set _label_block -%}
|
|
119
117
|
<label
|
|
120
118
|
{% if _id %}
|
|
121
119
|
for="{{ _id }}"
|
|
@@ -124,50 +122,50 @@
|
|
|
124
122
|
>
|
|
125
123
|
{{- label -}}
|
|
126
124
|
</label>
|
|
127
|
-
{
|
|
125
|
+
{%- endset %}
|
|
128
126
|
{% endif %}
|
|
129
127
|
|
|
130
|
-
{
|
|
128
|
+
{%- if (_floating or _horizontal or _input_type == 'checkbox' or _input_type == 'radio') and
|
|
131
129
|
not _toggle and
|
|
132
130
|
not _remove_wrapper
|
|
133
131
|
%}
|
|
134
|
-
{
|
|
132
|
+
{%- set _wrapper_class = _floating ? 'form-floating' : '' %}
|
|
135
133
|
{% if (_input_type == 'checkbox' or _input_type == 'radio') %}
|
|
136
|
-
{
|
|
137
|
-
{
|
|
138
|
-
{
|
|
139
|
-
{
|
|
134
|
+
{%- set _wrapper_class = 'form-check' %}
|
|
135
|
+
{%- if _switch %}
|
|
136
|
+
{%- set _wrapper_class = _wrapper_class ~ ' form-switch' %}
|
|
137
|
+
{%- endif %}
|
|
140
138
|
{% endif %}
|
|
141
|
-
{% if _wrapper_class is not empty
|
|
139
|
+
{% if _wrapper_class is not empty -%}
|
|
142
140
|
<div class="{{ _wrapper_class }}">
|
|
143
|
-
{
|
|
141
|
+
{%- endif %}
|
|
144
142
|
{% endif %}
|
|
145
143
|
{% if _label_block and _floating == false and _input_type != 'checkbox' and _input_type != 'radio' %}
|
|
146
|
-
{{ _label_block|raw }}
|
|
147
|
-
{
|
|
148
|
-
{% if _horizontal and floating == false
|
|
144
|
+
{{- _label_block|raw }}
|
|
145
|
+
{%- endif %}
|
|
146
|
+
{% if _horizontal and floating == false -%}
|
|
149
147
|
<div class="{{ _horizontal_class }}">
|
|
150
|
-
{
|
|
148
|
+
{%- endif -%}
|
|
151
149
|
<input
|
|
152
150
|
{{ attributes }}
|
|
153
151
|
>
|
|
154
|
-
{
|
|
152
|
+
{%- if _horizontal and floating == false -%}
|
|
155
153
|
</div>
|
|
156
|
-
{
|
|
157
|
-
{% if _label_block and (_floating or _input_type == 'checkbox' or _input_type == 'radio')
|
|
158
|
-
{{ _label_block|raw }}
|
|
159
|
-
{
|
|
160
|
-
{% if _invalid_feedback is not empty
|
|
154
|
+
{%- endif %}
|
|
155
|
+
{% if _label_block and (_floating or _input_type == 'checkbox' or _input_type == 'radio') %}
|
|
156
|
+
{{- _label_block|raw }}
|
|
157
|
+
{%- endif %}
|
|
158
|
+
{% if _invalid_feedback is not empty -%}
|
|
161
159
|
<div class="invalid-feedback">
|
|
162
160
|
{{- _invalid_feedback -}}
|
|
163
161
|
</div>
|
|
164
|
-
{
|
|
165
|
-
{% if _valid_feedback is not empty
|
|
162
|
+
{%- endif %}
|
|
163
|
+
{% if _valid_feedback is not empty -%}
|
|
166
164
|
<div class="valid-feedback">
|
|
167
165
|
{{- _valid_feedback -}}
|
|
168
166
|
</div>
|
|
169
|
-
{
|
|
170
|
-
{% if _helper_text is not empty
|
|
167
|
+
{%- endif %}
|
|
168
|
+
{% if _helper_text is not empty -%}
|
|
171
169
|
<div
|
|
172
170
|
class="form-text"
|
|
173
171
|
{%- if _helper_text_id is not empty -%}
|
|
@@ -175,9 +173,7 @@
|
|
|
175
173
|
{%- endif -%}>
|
|
176
174
|
{{- _helper_text -}}
|
|
177
175
|
</div>
|
|
178
|
-
{
|
|
179
|
-
{% if _wrapper_class is not empty
|
|
176
|
+
{%- endif %}
|
|
177
|
+
{% if _wrapper_class is not empty -%}
|
|
180
178
|
</div>
|
|
181
|
-
{
|
|
182
|
-
|
|
183
|
-
{% endapply %}
|
|
179
|
+
{%- endif -%}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@openeuropa/bcl-form-input",
|
|
3
3
|
"author": "European Commission",
|
|
4
4
|
"license": "EUPL-1.2",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.4360.202601141610",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
8
8
|
},
|
|
@@ -21,5 +21,5 @@
|
|
|
21
21
|
"design-system",
|
|
22
22
|
"twig"
|
|
23
23
|
],
|
|
24
|
-
"gitHead": "
|
|
24
|
+
"gitHead": "2caf9255f88587416f6e83e572a1f20e4cf206f5"
|
|
25
25
|
}
|