@openeuropa/bcl-progress 0.1.2 → 0.1.202408021145

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/progress.html.twig +45 -16
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@openeuropa/bcl-progress",
3
3
  "author": "European Commission",
4
4
  "license": "EUPL-1.2",
5
- "version": "0.1.2",
5
+ "version": "0.1.202408021145",
6
6
  "publishConfig": {
7
7
  "access": "public"
8
8
  },
@@ -21,5 +21,5 @@
21
21
  "design-system",
22
22
  "twig"
23
23
  ],
24
- "gitHead": "b242dcb5ed9578fcd212c98cf722eabc845d313b"
24
+ "gitHead": "7ee2013f7f64a70ddfa35228a9a65967dd71eec3"
25
25
  }
@@ -1,4 +1,4 @@
1
- {% spaceless %}
1
+ {% apply spaceless %}
2
2
 
3
3
  {# Parameters:
4
4
  - progress (int) (default: 0)
@@ -6,39 +6,68 @@
6
6
  - max (int) (default: 100)
7
7
  - striped (boolean) (default: false)
8
8
  - animated (boolean) (default: false)
9
+ - hidden_label (boolean) (default: false)
9
10
  - label (string) (default: '')
11
+ - bar_label (string) (default: '')
10
12
  - variant (string) (default: '')
13
+ - message (string) (default: '')
14
+ - attributes (drupal attrs)
11
15
  #}
12
16
 
13
17
  {% set _progress = progress|default(0) %}
14
18
  {% set _min = min|default(0) %}
15
19
  {% set _max = max|default(100) %}
16
- {% set _striped = striped|default(false) %}
17
- {% set _animated = animated|default(false) %}
20
+ {% set _striped = striped ?? false %}
21
+ {% set _animated = animated ?? false %}
22
+ {% set _hidden_label = hidden_label ?? false %}
18
23
  {% set _label = label|default('') %}
24
+ {% set _bar_label = bar_label|default('') %}
19
25
  {% set _variant = variant|default('') %}
20
- {% set _class = 'progress-bar' %}
26
+ {% set _message = message|default('') %}
27
+
28
+ {% set _classes = 'progress-bar' %}
21
29
  {% if _striped is not empty %}
22
- {% set _class = _class ~ ' progress-bar-striped' %}
30
+ {% set _classes = _classes ~ ' progress-bar-striped' %}
23
31
  {% endif %}
24
32
  {% if _animated is not empty %}
25
- {% set _class = _class ~ ' progress-bar-animated' %}
33
+ {% set _classes = _classes ~ ' progress-bar-animated' %}
26
34
  {% endif %}
27
35
  {% if _variant is not empty %}
28
- {% set _class = _class ~ ' bg-' ~ _variant %}
36
+ {% set _classes = _classes ~ ' text-bg-' ~ _variant %}
37
+ {% endif %}
38
+
39
+ {% if attributes is empty %}
40
+ {% set attributes = create_attribute() %}
41
+ {% endif %}
42
+
43
+ {% set attributes = attributes.addClass(['progress']) %}
44
+
45
+ {% if _bar_label is empty %}
46
+ {% set _bar_label = _progress ~ '%' %}
29
47
  {% endif %}
30
48
 
31
- <div class="progress">
32
- <div
33
- class="{{ _class }}"
34
- role="progressbar"
35
- style="width: {{ _progress }}%"
36
- aria-valuenow="{{ _progress }}"
37
- aria-valuemin="{{ _min }}"
49
+ {% if _label is not empty %}
50
+ <label class="progress-bar-label">{{ _label }}</label>
51
+ {% endif %}
52
+ <div
53
+ {{ attributes }}
54
+ >
55
+ <div
56
+ class="{{ _classes }}"
57
+ role="progressbar"
58
+ style="width: {{ _progress }}%"
59
+ aria-valuenow="{{ _progress }}"
60
+ aria-label="{{ _progress }}"
61
+ aria-valuemin="{{ _min }}"
38
62
  aria-valuemax="{{ _max }}"
39
63
  >
40
- {{- _label -}}
64
+ {%- if not _hidden_label -%}
65
+ {{- _bar_label -}}
66
+ {%- endif -%}
41
67
  </div>
42
68
  </div>
69
+ {% if _message is not empty %}
70
+ <small class="form-text text-muted progress-bar-message">{{ _message }}</small>
71
+ {% endif %}
43
72
 
44
- {% endspaceless %}
73
+ {% endapply %}