hmrc-frontend 2.2.0 → 2.4.0
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/README.md +9 -5
- package/check-compatibility.js +1 -1
- package/hmrc/VERSION.txt +1 -1
- package/hmrc/all.js +1 -1
- package/hmrc/components/_all.scss +1 -0
- package/hmrc/components/add-to-a-list/template.njk +23 -25
- package/hmrc/components/character-count/character-count.js +1 -1
- package/hmrc/components/header/_header.scss +29 -0
- package/hmrc/components/header/template.njk +4 -3
- package/hmrc/components/list-with-actions/_list-with-actions.scss +76 -0
- package/hmrc/components/list-with-actions/macro.njk +3 -0
- package/hmrc/components/list-with-actions/template.njk +33 -0
- package/hmrc/components/user-research-banner/template.njk +1 -1
- package/hmrc/{hmrc-frontend-2.2.0.min.css → hmrc-frontend-2.4.0.min.css} +2 -2
- package/hmrc/{hmrc-frontend-2.2.0.min.js → hmrc-frontend-2.4.0.min.js} +1 -1
- package/hmrc/{hmrc-frontend-ie8-2.2.0.min.css → hmrc-frontend-ie8-2.4.0.min.css} +2 -2
- package/hmrc/maps/hmrc-frontend-2.4.0.min.css.map +1 -0
- package/hmrc/maps/{hmrc-frontend-2.2.0.min.js.map → hmrc-frontend-2.4.0.min.js.map} +1 -1
- package/hmrc/maps/hmrc-frontend-ie8-2.4.0.min.css.map +1 -0
- package/package.json +1 -1
- package/hmrc/maps/hmrc-frontend-2.2.0.min.css.map +0 -1
- package/hmrc/maps/hmrc-frontend-ie8-2.2.0.min.css.map +0 -1
package/README.md
CHANGED
|
@@ -2,11 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
HMRC Frontend contains the code and documentation for patterns specifically designed for HMRC.
|
|
4
4
|
|
|
5
|
-
[GOV.UK Frontend](https://github.com/alphagov/govuk-frontend) and the
|
|
5
|
+
[GOV.UK Frontend](https://github.com/alphagov/govuk-frontend) and the
|
|
6
|
+
[GOV.UK Design System](https://design-system.service.gov.uk/) contains the code and documentation for
|
|
7
|
+
design patterns designed to be used by all government departments.
|
|
6
8
|
|
|
7
9
|
The two sets of code and documentation are separate but used together.
|
|
8
10
|
|
|
9
|
-
See [HMRC Design Patterns](https://design.tax.service.gov.uk/hmrc-design-patterns/) for examples
|
|
11
|
+
See [HMRC Design Patterns](https://design.tax.service.gov.uk/hmrc-design-patterns/) for examples
|
|
12
|
+
of what the design patterns look like and guidance on how to use them in your service.
|
|
10
13
|
|
|
11
14
|
## Quick Start
|
|
12
15
|
|
|
@@ -15,13 +18,14 @@ See [HMRC Design Patterns](https://design.tax.service.gov.uk/hmrc-design-pattern
|
|
|
15
18
|
* [Node.js](https://nodejs.org/en/) `>= 10.12.0`
|
|
16
19
|
* [npm](https://www.npmjs.com/) `>= 6.4.1`
|
|
17
20
|
|
|
18
|
-
To install more than one version of Node.js, it may be easier to use a node version manager
|
|
21
|
+
To install more than one version of Node.js, it may be easier to use a node version manager
|
|
22
|
+
like [nvm](https://github.com/creationix/nvm) or [n](https://github.com/tj/n).
|
|
19
23
|
|
|
20
24
|
### How to install
|
|
21
25
|
|
|
22
26
|
Clone this repository and install its dependencies.
|
|
23
27
|
|
|
24
|
-
```
|
|
28
|
+
```shell script
|
|
25
29
|
git clone https://github.com/hmrc/hmrc-frontend.git
|
|
26
30
|
cd hmrc-frontend
|
|
27
31
|
npm install
|
|
@@ -30,7 +34,7 @@ npm install
|
|
|
30
34
|
### How to run
|
|
31
35
|
|
|
32
36
|
1. Run `npm start`
|
|
33
|
-
2. Components are available at http://localhost:3000
|
|
37
|
+
2. Components are available at [http://localhost:3000]()
|
|
34
38
|
|
|
35
39
|
## Using HMRC Frontend locally
|
|
36
40
|
|
package/check-compatibility.js
CHANGED
|
@@ -14,7 +14,7 @@ if (!knownPrototypeKitNames.includes(consumerPackageJson.name)) {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
const compatibility = {
|
|
17
|
-
2.
|
|
17
|
+
2.4: {
|
|
18
18
|
'prototype-kit': ['9.14', '9.13', '9.12', '9.11', '9.10', '9.9', '9.8', '9.7', '9.6', '9.5', '9.4', '9.3', '9.2', '9.1', '9.0'],
|
|
19
19
|
},
|
|
20
20
|
1.38: {
|
package/hmrc/VERSION.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.
|
|
1
|
+
2.4.0
|
package/hmrc/all.js
CHANGED
|
@@ -2902,7 +2902,7 @@
|
|
|
2902
2902
|
});
|
|
2903
2903
|
});
|
|
2904
2904
|
|
|
2905
|
-
// https://github.com/alphagov/govuk-frontend/blob/
|
|
2905
|
+
// https://github.com/alphagov/govuk-frontend/blob/main/src/govuk/components/character-count/character-count.js
|
|
2906
2906
|
// with the change to support Welsh language messages. At the moment, there is no ability to pass
|
|
2907
2907
|
// in custom messages to the component for the dynamic count. If GDS release a version supporting
|
|
2908
2908
|
// custom dynamic count messages, this version should be removed.
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
@import "header/header";
|
|
8
8
|
@import "internal-header/internal-header";
|
|
9
9
|
@import "add-to-a-list/add-to-a-list";
|
|
10
|
+
@import "list-with-actions/list-with-actions";
|
|
10
11
|
@import "timeout-dialog/timeout-dialog";
|
|
11
12
|
@import "status-tags-in-task-list-pages/status-tags-in-task-list-pages";
|
|
12
13
|
@import "user-research-banner/user-research-banner";
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
{% from "govuk/components/button/macro.njk" import govukButton with context %}
|
|
2
2
|
{% from "govuk/components/radios/macro.njk" import govukRadios with context %}
|
|
3
|
+
{% from "../list-with-actions/macro.njk" import hmrcListWithActions with context %}
|
|
4
|
+
|
|
3
5
|
{% if params.language == 'cy' %}
|
|
4
6
|
{% set messages = {
|
|
5
7
|
itemTypeDefault: {singular: 'eitem', plural: 'o eitemau'},
|
|
@@ -27,6 +29,26 @@
|
|
|
27
29
|
no: 'No'
|
|
28
30
|
} %}
|
|
29
31
|
{% endif %}
|
|
32
|
+
{% set items = [] %}
|
|
33
|
+
{% for item in params.itemList %}
|
|
34
|
+
{% set items = (items.push({ name: { text: item.name }, actions: [{
|
|
35
|
+
text: messages.change,
|
|
36
|
+
visuallyHiddenText: messages.change + ' ' +item.name,
|
|
37
|
+
href: item.changeUrl
|
|
38
|
+
}, {
|
|
39
|
+
text: messages.remove,
|
|
40
|
+
visuallyHiddenText: messages.aria.before + ' ' + item.name + ' ' + messages.aria.after,
|
|
41
|
+
href: item.removeUrl
|
|
42
|
+
}] }), items) %}
|
|
43
|
+
{% endfor %}
|
|
44
|
+
|
|
45
|
+
{%- set listWithActionsClasses = '' -%}
|
|
46
|
+
{% if params.itemSize == 'long' %}
|
|
47
|
+
{% set listWithActionsClasses = 'hmrc-list-with-actions--long' %}
|
|
48
|
+
{% else %}
|
|
49
|
+
{% set listWithActionsClasses = 'hmrc-list-with-actions--short' %}
|
|
50
|
+
{% endif -%}
|
|
51
|
+
|
|
30
52
|
<h1 class="govuk-heading-xl">{%- if params.itemList | length === 0 -%}
|
|
31
53
|
{{ messages.emptyList }}
|
|
32
54
|
{%- else -%}
|
|
@@ -37,31 +59,7 @@
|
|
|
37
59
|
{%- endif -%}
|
|
38
60
|
</h1>
|
|
39
61
|
<div class="govuk-form-group">
|
|
40
|
-
|
|
41
|
-
{# loop through items in the itemList #}
|
|
42
|
-
{% for item in params.itemList %}
|
|
43
|
-
<div class="hmrc-add-to-a-list__contents">
|
|
44
|
-
<dt class="hmrc-add-to-a-list__identifier hmrc-add-to-a-list__identifier--light">
|
|
45
|
-
{{ item.name }}
|
|
46
|
-
</dt>
|
|
47
|
-
<dd class="hmrc-add-to-a-list__change">
|
|
48
|
-
<a class="govuk-link" href="{{ item.changeUrl }}">
|
|
49
|
-
<span aria-hidden="true">{{messages.change}}</span>
|
|
50
|
-
<span class="govuk-visually-hidden">{{messages.change}} {{ item.name }}</span>
|
|
51
|
-
</a>
|
|
52
|
-
</dd>
|
|
53
|
-
<dd class="hmrc-add-to-a-list__remove">
|
|
54
|
-
<a class="govuk-link" href="{{ item.removeUrl }}">
|
|
55
|
-
<span aria-hidden="true">{{messages.remove}}</span>
|
|
56
|
-
<span class="govuk-visually-hidden">{{messages.aria.before}} {{ item.name }} {{messages.aria.after}}</span>
|
|
57
|
-
</a>
|
|
58
|
-
</dd>
|
|
59
|
-
</div>
|
|
60
|
-
{% else %}
|
|
61
|
-
{# empty list stuff goes here #}
|
|
62
|
-
{% endfor %}
|
|
63
|
-
{# end loop #}
|
|
64
|
-
</dl>
|
|
62
|
+
{{ hmrcListWithActions({ items: items, classes: listWithActionsClasses }) }}
|
|
65
63
|
</div>
|
|
66
64
|
<form method="post" novalidate action="{{ params.formAction }}">
|
|
67
65
|
{{ govukRadios({
|
|
@@ -3,7 +3,7 @@ import 'govuk-frontend/govuk/vendor/polyfills/Event'; // addEventListener and ev
|
|
|
3
3
|
import 'govuk-frontend/govuk/vendor/polyfills/Element/prototype/classList';
|
|
4
4
|
|
|
5
5
|
// This CharacterCount is a direct copy from govuk-frontend:
|
|
6
|
-
// https://github.com/alphagov/govuk-frontend/blob/
|
|
6
|
+
// https://github.com/alphagov/govuk-frontend/blob/main/src/govuk/components/character-count/character-count.js
|
|
7
7
|
// with the change to support Welsh language messages. At the moment, there is no ability to pass
|
|
8
8
|
// in custom messages to the component for the dynamic count. If GDS release a version supporting
|
|
9
9
|
// custom dynamic count messages, this version should be removed.
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
$govuk-header-link-underline-thickness: 3px;
|
|
2
|
+
|
|
1
3
|
.hmrc-header.hmrc-header--with-additional-navigation {
|
|
2
4
|
.govuk-header__link--service-name {
|
|
3
5
|
float: left;
|
|
@@ -53,6 +55,33 @@
|
|
|
53
55
|
}
|
|
54
56
|
}
|
|
55
57
|
|
|
58
|
+
.hmrc-header__service-name {
|
|
59
|
+
display: inline-block;
|
|
60
|
+
margin-bottom: govuk-spacing(2);
|
|
61
|
+
|
|
62
|
+
@include govuk-font($size: 24, $weight: bold);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.hmrc-header__service-name--linked {
|
|
66
|
+
@include govuk-typography-common;
|
|
67
|
+
@include govuk-link-style-inverse;
|
|
68
|
+
|
|
69
|
+
text-decoration: none;
|
|
70
|
+
|
|
71
|
+
&:hover {
|
|
72
|
+
text-decoration: underline;
|
|
73
|
+
text-decoration-thickness: $govuk-header-link-underline-thickness;
|
|
74
|
+
|
|
75
|
+
@if ($govuk-link-underline-offset) {
|
|
76
|
+
text-underline-offset: $govuk-link-underline-offset;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
&:focus {
|
|
81
|
+
@include govuk-focused-text;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
56
85
|
// Shift user research banner up 10px to compensate for govuk header border
|
|
57
86
|
// only when adjacent to govuk header
|
|
58
87
|
.hmrc-header + .hmrc-user-research-banner {
|
|
@@ -61,9 +61,10 @@
|
|
|
61
61
|
{% if params.serviceName or params.navigation | length or params.signOutHref or params.languageToggle %}
|
|
62
62
|
<div class="govuk-header__content">
|
|
63
63
|
{% if params.serviceName %}
|
|
64
|
-
|
|
65
|
-
{{ params.
|
|
66
|
-
|
|
64
|
+
{% set serviceNameTag = 'a' if params.serviceUrl else 'span' %}
|
|
65
|
+
<{{ serviceNameTag }} {% if (serviceNameTag == 'a') %}href="{{ params.serviceUrl }}" {% endif %} class="hmrc-header__service-name {% if (serviceNameTag == 'a') %}hmrc-header__service-name--linked{% endif %}">
|
|
66
|
+
{{ params.serviceName }}
|
|
67
|
+
</{{ serviceNameTag }}>
|
|
67
68
|
{% endif %}
|
|
68
69
|
{% if params.navigation | length %}
|
|
69
70
|
<button type="button" class="govuk-header__menu-button govuk-js-header-toggle" aria-controls="navigation" aria-label="Show or hide Top Level Navigation">Menu</button>
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
@import "../../../../govuk-frontend/govuk/settings/all";
|
|
2
|
+
@import "../../../../govuk-frontend/govuk/tools/all";
|
|
3
|
+
@import "../../../../govuk-frontend/govuk/helpers/all";
|
|
4
|
+
|
|
5
|
+
.hmrc-list-with-actions {
|
|
6
|
+
@include govuk-font($size: 19);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
// Kept for backward compatibility with add-to-a-list
|
|
10
|
+
.hmrc-list-with-actions--short {
|
|
11
|
+
@include govuk-media-query($from: desktop) {
|
|
12
|
+
.hmrc-list-with-actions__name {
|
|
13
|
+
width: 30%;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// Kept for backward compatibility with add-to-a-list
|
|
19
|
+
.hmrc-list-with-actions--long {
|
|
20
|
+
@include govuk-media-query($from: desktop) {
|
|
21
|
+
.hmrc-list-with-actions__name {
|
|
22
|
+
width: 50%;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.hmrc-list-with-actions__item {
|
|
28
|
+
display: -webkit-box;
|
|
29
|
+
display: -ms-flexbox;
|
|
30
|
+
display: flex;
|
|
31
|
+
-webkit-box-pack: justify;
|
|
32
|
+
-ms-flex-pack: justify;
|
|
33
|
+
justify-content: space-between;
|
|
34
|
+
padding: govuk-spacing(3) 0;
|
|
35
|
+
border-bottom: 1px solid $govuk-border-colour;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.hmrc-list-with-actions__name {
|
|
39
|
+
font-weight: normal;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.hmrc-list-with-actions__actions {
|
|
43
|
+
display: -webkit-box;
|
|
44
|
+
display: -ms-flexbox;
|
|
45
|
+
display: flex;
|
|
46
|
+
-webkit-box-orient: vertical;
|
|
47
|
+
-webkit-box-direction: normal;
|
|
48
|
+
-ms-flex-direction: column;
|
|
49
|
+
flex-direction: column;
|
|
50
|
+
-ms-flex-wrap: wrap;
|
|
51
|
+
flex-wrap: wrap;
|
|
52
|
+
|
|
53
|
+
@include govuk-media-query($from: desktop) {
|
|
54
|
+
-webkit-box-orient: horizontal;
|
|
55
|
+
-webkit-box-direction: normal;
|
|
56
|
+
-ms-flex-direction: row;
|
|
57
|
+
flex-direction: row;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.hmrc-list-with-actions__action {
|
|
62
|
+
margin-bottom: govuk-spacing(2);
|
|
63
|
+
text-align: right;
|
|
64
|
+
|
|
65
|
+
@include govuk-media-query($from: desktop) {
|
|
66
|
+
margin-bottom: 0;
|
|
67
|
+
-webkit-box-orient: horizontal;
|
|
68
|
+
-webkit-box-direction: normal;
|
|
69
|
+
-ms-flex-direction: row;
|
|
70
|
+
flex-direction: row;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.hmrc-list-with-actions__action:last-of-type {
|
|
75
|
+
margin-bottom: 0;
|
|
76
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{%- macro _actionLink(action) %}
|
|
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 %}
|
|
13
|
+
</a>
|
|
14
|
+
{% endmacro -%}
|
|
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>
|
|
31
|
+
{% endfor %}
|
|
32
|
+
</dl>
|
|
33
|
+
{% endif -%}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
Help improve HMRC services
|
|
9
9
|
{% endif %}
|
|
10
10
|
</div>
|
|
11
|
-
<a class="govuk-link hmrc-user-research-banner__link" href="{{ params.url }}" target="_blank">
|
|
11
|
+
<a class="govuk-link hmrc-user-research-banner__link" rel="noopener noreferrer" href="{{ params.url }}" target="_blank">
|
|
12
12
|
{% if params.language == 'cy' %}
|
|
13
13
|
Cofrestrwch i gymryd rhan mewn ymchwil defnyddwyr (yn agor tab newydd)
|
|
14
14
|
{% else %}
|