hmrc-frontend 4.9.1 → 5.0.2

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/hmrc/VERSION.txt CHANGED
@@ -1 +1 @@
1
- 4.9.1
1
+ 5.0.2
@@ -4,22 +4,35 @@
4
4
 
5
5
  .hmrc-list-with-actions {
6
6
  @include govuk-font($size: 19);
7
- }
8
7
 
9
- // Kept for backward compatibility with add-to-a-list
10
- .hmrc-list-with-actions--short {
11
8
  @include govuk-media-query($from: desktop) {
9
+ .hmrc-summary-list__key {
10
+ width: 50%;
11
+ }
12
+
13
+ .hmrc-summary-list__actions {
14
+ width: 50%;
15
+ }
16
+
12
17
  .hmrc-list-with-actions__name {
13
- width: 30%;
18
+ width: 50%;
14
19
  }
15
20
  }
16
21
  }
17
22
 
18
23
  // Kept for backward compatibility with add-to-a-list
19
- .hmrc-list-with-actions--long {
24
+ .hmrc-list-with-actions--short {
20
25
  @include govuk-media-query($from: desktop) {
26
+ .hmrc-summary-list__key {
27
+ width: 30%;
28
+ }
29
+
30
+ .hmrc-summary-list__actions {
31
+ width: 70%;
32
+ }
33
+
21
34
  .hmrc-list-with-actions__name {
22
- width: 50%;
35
+ width: 30%;
23
36
  }
24
37
  }
25
38
  }
@@ -1,33 +1,50 @@
1
1
  {%- macro _actionLink(action) %}
2
2
  <a class="govuk-link {%- if action.classes %} {{ action.classes }}{% endif %}" href="{{ action.href }}" {%- for attribute, value in action.attributes %} {{attribute}}="{{value}}"{% endfor %}>
3
- {% if action.html %}
4
- {{ action.html | safe }}
5
- {% else %}
6
- {%- if action.visuallyHiddenText -%}
7
- <span aria-hidden="true">{{ action.text }}</span>
8
- <span class="govuk-visually-hidden">{{ action.visuallyHiddenText }}</span>
9
- {% else %}
10
- {{ action.text }}
11
- {% endif -%}
12
- {% endif %}
3
+ {%- if action.html -%}
4
+ {{ action.html | safe }}
5
+ {%- else -%}
6
+ {%- if action.visuallyHiddenText -%}
7
+ <span aria-hidden="true">{{ action.text }}</span>{#- strip spaces -#}
8
+ <span class="govuk-visually-hidden">{{ action.visuallyHiddenText }}</span>
9
+ {%- else -%}
10
+ {{ action.text }}
11
+ {%- endif -%}
12
+ {%- endif -%}
13
13
  </a>
14
14
  {% endmacro -%}
15
15
 
16
- {% if params.items.length > 0 %}
17
- <dl class="hmrc-list-with-actions {%- if params.classes %} {{ params.classes }}{% endif %}"{% for attribute, value in params.attributes %} {{attribute}}="{{value}}"{% endfor %}>
18
- {% for item in params.items %}
19
- <div class="hmrc-list-with-actions__item">
20
- <dt class="hmrc-list-with-actions__name">
21
- {{ item.name.html | safe if item.name.html else item.name.text }}
22
- </dt>
23
- <div class="hmrc-list-with-actions__actions">
24
- {% for action in item.actions %}
25
- <dd class="hmrc-list-with-actions__action">
26
- {{ _actionLink(action) | indent(6) | trim }}
27
- </dd>
28
- {% endfor %}
29
- </div>
30
- </div>
16
+ {# Determine if we need 2 or 3 columns #}
17
+ {% set anyRowHasActions = false %}
18
+ {% for row in params.items %}
19
+ {% set anyRowHasActions = true if row.actions.length else anyRowHasActions %}
20
+ {% endfor -%}
21
+
22
+ {% if params.items.length %}
23
+ <dl class="govuk-summary-list hmrc-list-with-actions {%- if params.classes %} {{ params.classes }}{% endif %}"{% for attribute, value in params.attributes %} {{attribute}}="{{value}}"{% endfor %}>
24
+ {% for row in params.items %}
25
+ {% if row %}
26
+ <div class="govuk-summary-list__row {%- if anyRowHasActions and not (row.actions | length) %} govuk-summary-list__row--no-actions{% endif %} {%- if row.classes %} {{ row.classes }}{% endif %}">
27
+ <dt class="govuk-summary-list__key govuk-!-font-weight-regular hmrc-summary-list__key">
28
+ {{ row.name.html | safe if row.name.html else row.name.text }}
29
+ </dt>
30
+ {% if row.actions.length %}
31
+ <dd class="govuk-summary-list__actions hmrc-summary-list__actions">
32
+ {% if row.actions.length == 1 %}
33
+ {{ _actionLink(row.actions[0]) | indent(12) | trim }}
34
+ {% else %}
35
+ <ul class="govuk-summary-list__actions-list">
36
+ {% for action in row.actions %}
37
+ <li class="govuk-summary-list__actions-list-item">
38
+ {{ _actionLink(action) | indent(18) | trim }}
39
+ </li>
40
+ {% endfor %}
41
+ </ul>
42
+ {% endif %}
43
+ </dd>
44
+ {% endif %}
45
+ </div>
46
+ {% endif %}
31
47
  {% endfor %}
32
- </dl>
33
- {% endif -%}
48
+ </dl>
49
+ {% endif %}
50
+