@ministryofjustice/frontend 1.3.2 → 1.4.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/moj/all.js +9 -7
- package/moj/components/banner/template.njk +1 -4
- package/moj/components/multi-file-upload/multi-file-upload.js +3 -3
- package/moj/components/pagination/template.njk +6 -8
- package/moj/components/password-reveal/password-reveal.js +3 -3
- package/moj/components/search-toggle/search-toggle.js +3 -1
- package/moj/components/search-toggle/search-toggle.scss +6 -18
- package/moj/components/timeline/_timeline.scss +11 -0
- package/package.json +1 -1
package/moj/all.js
CHANGED
|
@@ -711,11 +711,11 @@ if(MOJFrontend.dragAndDropSupported() && MOJFrontend.formDataSupported() && MOJF
|
|
|
711
711
|
MOJFrontend.MultiFileUpload.prototype.getFileRowHtml = function(file) {
|
|
712
712
|
var html = '';
|
|
713
713
|
html += '<div class="govuk-summary-list__row moj-multi-file-upload__row">';
|
|
714
|
-
html += ' <
|
|
714
|
+
html += ' <div class="govuk-summary-list__value moj-multi-file-upload__message">';
|
|
715
715
|
html += '<span class="moj-multi-file-upload__filename">'+file.name+'</span>';
|
|
716
716
|
html += '<span class="moj-multi-file-upload__progress">0%</span>';
|
|
717
|
-
html += ' </
|
|
718
|
-
html += ' <
|
|
717
|
+
html += ' </div>';
|
|
718
|
+
html += ' <div class="govuk-summary-list__actions moj-multi-file-upload__actions"></div>';
|
|
719
719
|
html += '</div>';
|
|
720
720
|
return html;
|
|
721
721
|
};
|
|
@@ -874,7 +874,7 @@ MOJFrontend.PasswordReveal = function(element) {
|
|
|
874
874
|
};
|
|
875
875
|
|
|
876
876
|
MOJFrontend.PasswordReveal.prototype.createButton = function() {
|
|
877
|
-
this.button = $('<button type="button" class="govuk-button govuk-button--secondary moj-password-reveal__button">Show</button>');
|
|
877
|
+
this.button = $('<button type="button" class="govuk-button govuk-button--secondary moj-password-reveal__button">Show <span class="govuk-visually-hidden">password</span></button>');
|
|
878
878
|
this.container.append(this.button);
|
|
879
879
|
this.button.on('click', $.proxy(this, 'onButtonClick'));
|
|
880
880
|
};
|
|
@@ -882,10 +882,10 @@ MOJFrontend.PasswordReveal.prototype.createButton = function() {
|
|
|
882
882
|
MOJFrontend.PasswordReveal.prototype.onButtonClick = function() {
|
|
883
883
|
if (this.el.type === 'password') {
|
|
884
884
|
this.el.type = 'text';
|
|
885
|
-
this.button.
|
|
885
|
+
this.button.html('Hide <span class="govuk-visually-hidden">password</span>');
|
|
886
886
|
} else {
|
|
887
887
|
this.el.type = 'password';
|
|
888
|
-
this.button.
|
|
888
|
+
this.button.html('Show <span class="govuk-visually-hidden">password</span>');
|
|
889
889
|
}
|
|
890
890
|
};
|
|
891
891
|
|
|
@@ -1038,7 +1038,9 @@ MOJFrontend.SearchToggle = function(options) {
|
|
|
1038
1038
|
|
|
1039
1039
|
this.options.search.container.data('moj-search-toggle-initialised', true);
|
|
1040
1040
|
|
|
1041
|
-
|
|
1041
|
+
const svg = '<svg viewBox="0 0 20 20" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" class="moj-search-toggle__button__icon"><path d="M7.433,12.5790048 C6.06762625,12.5808611 4.75763941,12.0392925 3.79217348,11.0738265 C2.82670755,10.1083606 2.28513891,8.79837375 2.28699522,7.433 C2.28513891,6.06762625 2.82670755,4.75763941 3.79217348,3.79217348 C4.75763941,2.82670755 6.06762625,2.28513891 7.433,2.28699522 C8.79837375,2.28513891 10.1083606,2.82670755 11.0738265,3.79217348 C12.0392925,4.75763941 12.5808611,6.06762625 12.5790048,7.433 C12.5808611,8.79837375 12.0392925,10.1083606 11.0738265,11.0738265 C10.1083606,12.0392925 8.79837375,12.5808611 7.433,12.5790048 L7.433,12.5790048 Z M14.293,12.579 L13.391,12.579 L13.071,12.269 C14.2300759,10.9245158 14.8671539,9.20813198 14.866,7.433 C14.866,3.32786745 11.5381325,-1.65045755e-15 7.433,-1.65045755e-15 C3.32786745,-1.65045755e-15 -1.65045755e-15,3.32786745 -1.65045755e-15,7.433 C-1.65045755e-15,11.5381325 3.32786745,14.866 7.433,14.866 C9.208604,14.8671159 10.9253982,14.2296624 12.27,13.07 L12.579,13.39 L12.579,14.294 L18.296,20 L20,18.296 L14.294,12.579 L14.293,12.579 Z"></path></svg>';
|
|
1042
|
+
|
|
1043
|
+
this.toggleButton = $('<button class="moj-search-toggle__button" type="button" aria-haspopup="true" aria-expanded="false">' + this.options.toggleButton.text + svg + '</button>');
|
|
1042
1044
|
this.toggleButton.on('click', $.proxy(this, 'onToggleButtonClick'));
|
|
1043
1045
|
this.options.toggleButton.container.append(this.toggleButton);
|
|
1044
1046
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<div class="moj-banner{% if params.type == 'success' %} moj-banner--success{% elif params.type == 'warning' %} moj-banner--warning{% else %} {{- ' ' + params.classes if params.classes}}{% endif %}" {%- for attribute, value in params.attributes %} {{ attribute }}="{{ value }}"{% endfor %}>
|
|
1
|
+
<div class="moj-banner{% if params.type == 'success' %} moj-banner--success{% elif params.type == 'warning' %} moj-banner--warning{% else %} {{- ' ' + params.classes if params.classes}}{% endif %}" {%- for attribute, value in params.attributes %} {{ attribute }}="{{ value }}"{% endfor %} role="region" aria-label="{{ params.iconFallbackText | default(params.type) | default("banner") }}">
|
|
2
2
|
|
|
3
3
|
{% if params.type == 'success' %}
|
|
4
4
|
<svg class="moj-banner__icon" fill="currentColor" role="presentation" focusable="false" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 25 25" height="25" width="25"><path d="M25,6.2L8.7,23.2L0,14.1l4-4.2l4.7,4.9L21,2L25,6.2z"/></svg>
|
|
@@ -10,10 +10,7 @@
|
|
|
10
10
|
{% endif %}
|
|
11
11
|
|
|
12
12
|
<div class="moj-banner__message">
|
|
13
|
-
{% if params.iconFallbackText %}<span class="moj-banner__assistive">{{params.iconFallbackText}}</span>{% endif %}
|
|
14
13
|
{{- params.html | safe if params.html else params.text -}}
|
|
15
14
|
</div>
|
|
16
15
|
|
|
17
16
|
</div>
|
|
18
|
-
|
|
19
|
-
|
|
@@ -99,11 +99,11 @@ if(MOJFrontend.dragAndDropSupported() && MOJFrontend.formDataSupported() && MOJF
|
|
|
99
99
|
MOJFrontend.MultiFileUpload.prototype.getFileRowHtml = function(file) {
|
|
100
100
|
var html = '';
|
|
101
101
|
html += '<div class="govuk-summary-list__row moj-multi-file-upload__row">';
|
|
102
|
-
html += ' <
|
|
102
|
+
html += ' <div class="govuk-summary-list__value moj-multi-file-upload__message">';
|
|
103
103
|
html += '<span class="moj-multi-file-upload__filename">'+file.name+'</span>';
|
|
104
104
|
html += '<span class="moj-multi-file-upload__progress">0%</span>';
|
|
105
|
-
html += ' </
|
|
106
|
-
html += ' <
|
|
105
|
+
html += ' </div>';
|
|
106
|
+
html += ' <div class="govuk-summary-list__actions moj-multi-file-upload__actions"></div>';
|
|
107
107
|
html += '</div>';
|
|
108
108
|
return html;
|
|
109
109
|
};
|
|
@@ -1,29 +1,27 @@
|
|
|
1
|
-
<nav class="moj-pagination {{- ' ' + params.classes if params.classes}}" aria-
|
|
2
|
-
|
|
3
|
-
<p class="govuk-visually-hidden" id="pagination-label">Pagination navigation</p>
|
|
1
|
+
<nav class="moj-pagination {{- ' ' + params.classes if params.classes}}" aria-label="Pagination navigation">
|
|
4
2
|
|
|
5
3
|
<ul class="moj-pagination__list">
|
|
6
4
|
{%- if params.previous %}
|
|
7
5
|
<li class="moj-pagination__item moj-pagination__item--prev">
|
|
8
|
-
<a class="moj-pagination__link" href="{{ params.previous.href }}">{{ params.previous.text }}<span class="govuk-visually-hidden">
|
|
6
|
+
<a class="moj-pagination__link" href="{{ params.previous.href }}">{{ params.previous.text }}<span class="govuk-visually-hidden"> page</span></a>
|
|
9
7
|
</li>
|
|
10
8
|
{% endif -%}
|
|
11
9
|
|
|
12
10
|
{%- for item in params.items %}
|
|
13
11
|
{%- if item.type == 'dots' %}
|
|
14
|
-
<li class="moj-pagination__item moj-pagination__item--dots"
|
|
12
|
+
<li class="moj-pagination__item moj-pagination__item--dots">…</li>
|
|
15
13
|
{% else %}
|
|
16
14
|
{%- if item.selected %}
|
|
17
|
-
<li class="moj-pagination__item moj-pagination__item--active">{{ item.text }}</li>
|
|
15
|
+
<li class="moj-pagination__item moj-pagination__item--active" aria-label="Page {{ item.text }} of {{ params.results.count }}" aria-current="page">{{ item.text }}</li>
|
|
18
16
|
{% else %}
|
|
19
|
-
<li class="moj-pagination__item"><a class="moj-pagination__link" href="{{ item.href }}">{{ item.text }}</a></li>
|
|
17
|
+
<li class="moj-pagination__item"><a class="moj-pagination__link" href="{{ item.href }}" aria-label="Page {{ item.text }} of {{ params.results.count }}">{{ item.text }}</a></li>
|
|
20
18
|
{% endif -%}
|
|
21
19
|
{% endif -%}
|
|
22
20
|
{% endfor -%}
|
|
23
21
|
|
|
24
22
|
{%- if params.next %}
|
|
25
23
|
<li class="moj-pagination__item moj-pagination__item--next">
|
|
26
|
-
<a class="moj-pagination__link" href="{{ params.next.href }}">{{ params.next.text }}<span class="govuk-visually-hidden">
|
|
24
|
+
<a class="moj-pagination__link" href="{{ params.next.href }}">{{ params.next.text }}<span class="govuk-visually-hidden"> page</span></a>
|
|
27
25
|
</li>
|
|
28
26
|
{% endif -%}
|
|
29
27
|
</ul>
|
|
@@ -14,7 +14,7 @@ MOJFrontend.PasswordReveal = function(element) {
|
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
MOJFrontend.PasswordReveal.prototype.createButton = function() {
|
|
17
|
-
this.button = $('<button type="button" class="govuk-button govuk-button--secondary moj-password-reveal__button">Show</button>');
|
|
17
|
+
this.button = $('<button type="button" class="govuk-button govuk-button--secondary moj-password-reveal__button">Show <span class="govuk-visually-hidden">password</span></button>');
|
|
18
18
|
this.container.append(this.button);
|
|
19
19
|
this.button.on('click', $.proxy(this, 'onButtonClick'));
|
|
20
20
|
};
|
|
@@ -22,9 +22,9 @@ MOJFrontend.PasswordReveal.prototype.createButton = function() {
|
|
|
22
22
|
MOJFrontend.PasswordReveal.prototype.onButtonClick = function() {
|
|
23
23
|
if (this.el.type === 'password') {
|
|
24
24
|
this.el.type = 'text';
|
|
25
|
-
this.button.
|
|
25
|
+
this.button.html('Hide <span class="govuk-visually-hidden">password</span>');
|
|
26
26
|
} else {
|
|
27
27
|
this.el.type = 'password';
|
|
28
|
-
this.button.
|
|
28
|
+
this.button.html('Show <span class="govuk-visually-hidden">password</span>');
|
|
29
29
|
}
|
|
30
30
|
};
|
|
@@ -7,7 +7,9 @@ MOJFrontend.SearchToggle = function(options) {
|
|
|
7
7
|
|
|
8
8
|
this.options.search.container.data('moj-search-toggle-initialised', true);
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
const svg = '<svg viewBox="0 0 20 20" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" class="moj-search-toggle__button__icon"><path d="M7.433,12.5790048 C6.06762625,12.5808611 4.75763941,12.0392925 3.79217348,11.0738265 C2.82670755,10.1083606 2.28513891,8.79837375 2.28699522,7.433 C2.28513891,6.06762625 2.82670755,4.75763941 3.79217348,3.79217348 C4.75763941,2.82670755 6.06762625,2.28513891 7.433,2.28699522 C8.79837375,2.28513891 10.1083606,2.82670755 11.0738265,3.79217348 C12.0392925,4.75763941 12.5808611,6.06762625 12.5790048,7.433 C12.5808611,8.79837375 12.0392925,10.1083606 11.0738265,11.0738265 C10.1083606,12.0392925 8.79837375,12.5808611 7.433,12.5790048 L7.433,12.5790048 Z M14.293,12.579 L13.391,12.579 L13.071,12.269 C14.2300759,10.9245158 14.8671539,9.20813198 14.866,7.433 C14.866,3.32786745 11.5381325,-1.65045755e-15 7.433,-1.65045755e-15 C3.32786745,-1.65045755e-15 -1.65045755e-15,3.32786745 -1.65045755e-15,7.433 C-1.65045755e-15,11.5381325 3.32786745,14.866 7.433,14.866 C9.208604,14.8671159 10.9253982,14.2296624 12.27,13.07 L12.579,13.39 L12.579,14.294 L18.296,20 L20,18.296 L14.294,12.579 L14.293,12.579 Z"></path></svg>';
|
|
11
|
+
|
|
12
|
+
this.toggleButton = $('<button class="moj-search-toggle__button" type="button" aria-haspopup="true" aria-expanded="false">' + this.options.toggleButton.text + svg + '</button>');
|
|
11
13
|
this.toggleButton.on('click', $.proxy(this, 'onToggleButtonClick'));
|
|
12
14
|
this.options.toggleButton.container.append(this.toggleButton);
|
|
13
15
|
};
|
|
@@ -12,15 +12,17 @@
|
|
|
12
12
|
-webkit-font-smoothing: antialiased;
|
|
13
13
|
-webkit-appearance: none;
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
background-repeat: no-repeat;
|
|
17
|
-
background-image: url(#{$moj-images-path}icon-search-blue.svg);
|
|
18
|
-
content: '';
|
|
15
|
+
&__icon {
|
|
19
16
|
display: inline-block;
|
|
20
17
|
height: 20px;
|
|
21
18
|
margin-left: govuk-spacing(2);
|
|
22
19
|
vertical-align: middle;
|
|
23
20
|
width: 20px;
|
|
21
|
+
fill: currentColor;
|
|
22
|
+
|
|
23
|
+
@media screen and (forced-colors: active) {
|
|
24
|
+
fill: windowText;
|
|
25
|
+
}
|
|
24
26
|
}
|
|
25
27
|
|
|
26
28
|
&:focus {
|
|
@@ -30,43 +32,30 @@
|
|
|
30
32
|
outline: none;
|
|
31
33
|
position: relative;
|
|
32
34
|
z-index: 1;
|
|
33
|
-
|
|
34
|
-
&:after {
|
|
35
|
-
background-image: url(#{$moj-images-path}icon-search-black.svg);
|
|
36
|
-
}
|
|
37
35
|
}
|
|
38
|
-
|
|
39
36
|
}
|
|
40
37
|
|
|
41
|
-
|
|
42
38
|
.moj-search--toggle {
|
|
43
|
-
|
|
44
39
|
padding: govuk-spacing(3);
|
|
45
40
|
|
|
46
41
|
@include govuk-media-query($until: desktop) {
|
|
47
42
|
padding-left: 0 !important;
|
|
48
43
|
padding-right: 0 !important;
|
|
49
44
|
}
|
|
50
|
-
|
|
51
45
|
}
|
|
52
46
|
|
|
53
|
-
|
|
54
47
|
// JS enabled
|
|
55
48
|
.js-enabled .moj-search--toggle {
|
|
56
|
-
|
|
57
49
|
@include govuk-media-query($until: desktop) {
|
|
58
50
|
padding-top: 0 !important;
|
|
59
51
|
}
|
|
60
|
-
|
|
61
52
|
}
|
|
62
53
|
|
|
63
54
|
.js-enabled .moj-search-toggle {
|
|
64
55
|
position: relative;
|
|
65
56
|
}
|
|
66
57
|
|
|
67
|
-
|
|
68
58
|
.js-enabled .moj-search-toggle__search {
|
|
69
|
-
|
|
70
59
|
background-color: govuk-colour("light-grey");
|
|
71
60
|
|
|
72
61
|
@include govuk-media-query($from: desktop) {
|
|
@@ -77,5 +66,4 @@
|
|
|
77
66
|
width: 450px;
|
|
78
67
|
z-index: 10;
|
|
79
68
|
}
|
|
80
|
-
|
|
81
69
|
}
|
|
@@ -85,6 +85,17 @@
|
|
|
85
85
|
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
+
.moj-timeline__document-icon {
|
|
89
|
+
float: left;
|
|
90
|
+
margin-top: 4px;
|
|
91
|
+
margin-right: 4px;
|
|
92
|
+
fill: currentColor;
|
|
93
|
+
|
|
94
|
+
@media screen and (forced-colors: active) {
|
|
95
|
+
fill: linkText;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
88
99
|
.moj-timeline__document-link {
|
|
89
100
|
background-image: url(#{$moj-images-path}icon-document.svg);
|
|
90
101
|
background-repeat: no-repeat;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ministryofjustice/frontend",
|
|
3
3
|
"description": "The MOJ Frontend contains the code you need to start building user interfaces for UK Ministry of Justice government services.",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.4.2",
|
|
5
5
|
"main": "moj/all.js",
|
|
6
6
|
"sass": "moj/all.scss",
|
|
7
7
|
"engines": {
|