hof 22.12.0-unit-of-measure-beta.1 → 22.13.0-frontend-v4-beta.1
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/CHANGELOG.md +13 -1
- package/README.md +0 -78
- package/build/tasks/images/index.js +20 -5
- package/build/tasks/watch/index.js +10 -2
- package/components/date/templates/date.html +1 -1
- package/components/index.js +0 -1
- package/config/builder-defaults.js +6 -2
- package/controller/controller.js +3 -5
- package/controller/validation/index.js +1 -1
- package/controller/validation/validators.js +1 -0
- package/frontend/govuk-template/build/config.js +1 -0
- package/frontend/govuk-template/build/govuk_template.html +58 -42
- package/frontend/govuk-template/govuk_template_generated.html +118 -0
- package/frontend/template-mixins/mixins/template-mixins.js +10 -59
- package/frontend/template-mixins/partials/forms/checkbox.html +5 -1
- package/frontend/template-mixins/partials/forms/input-text-date.html +2 -1
- package/frontend/template-mixins/partials/forms/input-text-group.html +1 -1
- package/frontend/template-mixins/partials/forms/textarea-group.html +1 -1
- package/frontend/template-partials/views/layout.html +1 -1
- package/frontend/template-partials/views/partials/cookie-banner.html +50 -32
- package/frontend/template-partials/views/partials/navigation.html +2 -2
- package/frontend/themes/gov-uk/client-js/cookieSettings.js +35 -23
- package/frontend/themes/gov-uk/styles/govuk.scss +0 -1
- package/frontend/toolkit/assets/javascript/form-focus.js +0 -4
- package/frontend/toolkit/assets/rebrand/images/govuk-logo.svg +25 -0
- package/index.js +4 -2
- package/package.json +2 -2
- package/sandbox/apps/sandbox/fields.js +1 -18
- package/sandbox/apps/sandbox/index.js +0 -4
- package/sandbox/apps/sandbox/sections/summary-data-sections.js +1 -7
- package/sandbox/apps/sandbox/translations/en/default.json +0 -33
- package/sandbox/apps/sandbox/translations/src/en/fields.json +0 -10
- package/sandbox/apps/sandbox/translations/src/en/pages.json +0 -3
- package/sandbox/apps/sandbox/translations/src/en/validation.json +0 -12
- package/sandbox/package.json +1 -1
- package/sandbox/public/css/app.css +2996 -1330
- package/sandbox/public/images/govuk-logo.svg +25 -0
- package/sandbox/public/js/bundle.js +4751 -2217
- package/sandbox/yarn.lock +4 -4
- package/components/amount-with-unit-select/amount-with-unit-select.js +0 -107
- package/components/amount-with-unit-select/fields.js +0 -15
- package/components/amount-with-unit-select/hooks.js +0 -168
- package/components/amount-with-unit-select/templates/amount-with-unit-select.html +0 -20
- package/components/amount-with-unit-select/utils.js +0 -191
- package/components/amount-with-unit-select/validation.js +0 -175
- package/frontend/template-mixins/partials/forms/grouped-inputs-select.html +0 -13
- package/frontend/template-mixins/partials/forms/grouped-inputs-text.html +0 -37
- package/frontend/themes/gov-uk/styles/_grouped-input.scss +0 -5
|
@@ -14,8 +14,6 @@ const PARTIALS = [
|
|
|
14
14
|
'partials/forms/input-text-group',
|
|
15
15
|
'partials/forms/input-text-date',
|
|
16
16
|
'partials/forms/input-submit',
|
|
17
|
-
'partials/forms/grouped-inputs-select',
|
|
18
|
-
'partials/forms/grouped-inputs-text',
|
|
19
17
|
'partials/forms/select',
|
|
20
18
|
'partials/forms/checkbox',
|
|
21
19
|
'partials/forms/textarea-group',
|
|
@@ -216,7 +214,6 @@ module.exports = function (options) {
|
|
|
216
214
|
labelClassName: labelClassName ? `govuk-label ${labelClassName}` : 'govuk-label',
|
|
217
215
|
formGroupClassName: classNames(field, 'formGroupClassName') || extension.formGroupClassName || 'govuk-form-group',
|
|
218
216
|
hint: hint,
|
|
219
|
-
amountWithUnitSelectItemClassName: 'grouped-inputs__item',
|
|
220
217
|
hintId: extension.hintId || (hint ? key + '-hint' : null),
|
|
221
218
|
error: this.errors && this.errors[key],
|
|
222
219
|
maxlengthAttribute: field.maxlengthAttribute === true,
|
|
@@ -225,7 +222,6 @@ module.exports = function (options) {
|
|
|
225
222
|
required: required,
|
|
226
223
|
pattern: extension.pattern,
|
|
227
224
|
date: extension.date,
|
|
228
|
-
amountWithUnitSelect: extension.amountWithUnitSelect,
|
|
229
225
|
autocomplete: autocomplete,
|
|
230
226
|
child: field.child,
|
|
231
227
|
isPageHeading: field.isPageHeading,
|
|
@@ -236,7 +232,7 @@ module.exports = function (options) {
|
|
|
236
232
|
});
|
|
237
233
|
}
|
|
238
234
|
|
|
239
|
-
function optionGroup(key, opts
|
|
235
|
+
function optionGroup(key, opts) {
|
|
240
236
|
opts = opts || {};
|
|
241
237
|
const field = Object.assign({}, this.options.fields[key] || options.fields[key]);
|
|
242
238
|
const legend = field.legend;
|
|
@@ -252,7 +248,6 @@ module.exports = function (options) {
|
|
|
252
248
|
legendValue = legend.value;
|
|
253
249
|
}
|
|
254
250
|
}
|
|
255
|
-
|
|
256
251
|
return {
|
|
257
252
|
key: key,
|
|
258
253
|
error: this.errors && this.errors[key],
|
|
@@ -275,16 +270,15 @@ module.exports = function (options) {
|
|
|
275
270
|
|
|
276
271
|
if (typeof obj === 'string') {
|
|
277
272
|
value = obj;
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
optionHint = 'fields.' + pKey + '.options.' + obj + '.hint';
|
|
273
|
+
label = 'fields.' + key + '.options.' + obj + '.label';
|
|
274
|
+
optionHint = 'fields.' + key + '.options.' + obj + '.hint';
|
|
281
275
|
} else {
|
|
282
276
|
value = obj.value;
|
|
283
|
-
label = obj.label || 'fields.' +
|
|
277
|
+
label = obj.label || 'fields.' + key + '.options.' + obj.value + '.label';
|
|
284
278
|
toggle = obj.toggle;
|
|
285
279
|
child = obj.child;
|
|
286
280
|
useHintText = obj.useHintText;
|
|
287
|
-
optionHint = obj.hint || 'fields.' +
|
|
281
|
+
optionHint = obj.hint || 'fields.' + key + '.options.' + obj.value + '.hint';
|
|
288
282
|
}
|
|
289
283
|
|
|
290
284
|
if (this.values && this.values[key] !== undefined) {
|
|
@@ -364,7 +358,8 @@ module.exports = function (options) {
|
|
|
364
358
|
path: 'partials/forms/input-text-group',
|
|
365
359
|
renderWith: inputText,
|
|
366
360
|
options: {
|
|
367
|
-
maxlength: 18
|
|
361
|
+
maxlength: 18,
|
|
362
|
+
className: 'govuk-input govuk-input--extra-letter-spacing'
|
|
368
363
|
}
|
|
369
364
|
},
|
|
370
365
|
'input-file': {
|
|
@@ -465,60 +460,16 @@ module.exports = function (options) {
|
|
|
465
460
|
const parts = [];
|
|
466
461
|
|
|
467
462
|
if (isExact) {
|
|
468
|
-
const dayPart = compiled['partials/forms/input-text-date'].render(inputText.call(this, key + '-day', {
|
|
463
|
+
const dayPart = compiled['partials/forms/input-text-date'].render(inputText.call(this, key + '-day', { inputmode: 'numeric', min: 1, max: 31, maxlength: 2, hintId: key + '-hint', date: true, autocomplete: autocomplete.day, formGroupClassName, className: classNameDay, isThisRequired }));
|
|
469
464
|
parts.push(dayPart);
|
|
470
465
|
}
|
|
471
466
|
|
|
472
|
-
const monthPart = compiled['partials/forms/input-text-date'].render(inputText.call(this, key + '-month', {
|
|
473
|
-
const yearPart = compiled['partials/forms/input-text-date'].render(inputText.call(this, key + '-year', {
|
|
467
|
+
const monthPart = compiled['partials/forms/input-text-date'].render(inputText.call(this, key + '-month', { inputmode: 'numeric', min: 1, max: 12, maxlength: 2, hintId: key + '-hint', date: true, autocomplete: autocomplete.month, formGroupClassName, className: classNameMonth, isThisRequired }));
|
|
468
|
+
const yearPart = compiled['partials/forms/input-text-date'].render(inputText.call(this, key + '-year', { inputmode: 'numeric', maxlength: 4, hintId: key + '-hint', date: true, autocomplete: autocomplete.year, formGroupClassName, className: classNameYear, isThisRequired }));
|
|
474
469
|
|
|
475
470
|
return parts.concat(monthPart, yearPart).join('\n');
|
|
476
471
|
};
|
|
477
472
|
}
|
|
478
|
-
},
|
|
479
|
-
'input-amount-with-unit-select': {
|
|
480
|
-
handler: function () {
|
|
481
|
-
return function (key) {
|
|
482
|
-
key = (key === '{{key}}' || key === '' || key === undefined) ? hoganRender(key, this) : key;
|
|
483
|
-
const field = Object.assign({}, this.options.fields[key] || options.fields[key]);
|
|
484
|
-
|
|
485
|
-
let autocomplete = field.autocomplete || 'off';
|
|
486
|
-
if (autocomplete === 'off') {
|
|
487
|
-
autocomplete = { amount: 'off'};
|
|
488
|
-
} else if (typeof autocomplete === 'string') {
|
|
489
|
-
autocomplete = { amount: autocomplete + '-amount' };
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
const formGroupClassName = (field.formGroup && field.formGroup.className) ? field.formGroup.className : '';
|
|
493
|
-
const classNameAmount = (field.controlsClass && field.controlsClass.amount) ? field.controlsClass.amount : 'govuk-input--width-3';
|
|
494
|
-
const classNameUnit = (field.controlsClass && field.controlsClass.unit) ? field.controlsClass.unit : 'govuk-input--width-5';
|
|
495
|
-
|
|
496
|
-
const parts = [];
|
|
497
|
-
|
|
498
|
-
// basically does the '_.each(mixins, function (mixin, name)' part manually (which renders the HTML
|
|
499
|
-
// for both child components and looks for a 'renderWith' and optional 'Options' method to use)
|
|
500
|
-
const amountPart = compiled['partials/forms/grouped-inputs-text']
|
|
501
|
-
.render(inputText.call(this,
|
|
502
|
-
key + '-amount', {
|
|
503
|
-
formGroupClassName,
|
|
504
|
-
autocomplete: autocomplete.amount,
|
|
505
|
-
className: classNameAmount,
|
|
506
|
-
amountWithUnitSelect: true }
|
|
507
|
-
));
|
|
508
|
-
|
|
509
|
-
const unitPart = compiled['partials/forms/grouped-inputs-select']
|
|
510
|
-
.render(inputText.call(this, key + '-unit',
|
|
511
|
-
optionGroup.call(this,
|
|
512
|
-
key + '-unit', {
|
|
513
|
-
formGroupClassName,
|
|
514
|
-
className: classNameUnit,
|
|
515
|
-
amountWithUnitSelect: true },
|
|
516
|
-
key
|
|
517
|
-
)));
|
|
518
|
-
|
|
519
|
-
return parts.concat(amountPart, unitPart).join('\n');
|
|
520
|
-
};
|
|
521
|
-
}
|
|
522
473
|
}
|
|
523
474
|
};
|
|
524
475
|
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
<div id="{{key}}-group" class="govuk-form-group {{#compound}} form-group-compound{{/compound}}{{#formGroupClassName}} {{formGroupClassName}}{{/formGroupClassName}}{{#error}} govuk-form-group--error{{/error}}">
|
|
2
|
-
{{#error}}
|
|
2
|
+
{{#error}}
|
|
3
|
+
<p class="govuk-error-message" aria-hidden="true">
|
|
4
|
+
<span class="govuk-visually-hidden">Error:</span> {{error.message}}
|
|
5
|
+
</p>
|
|
6
|
+
{{/error}}
|
|
3
7
|
<div class="govuk-checkboxes__item">
|
|
4
8
|
<input class="govuk-checkboxes__input" type="checkbox" id="{{key}}" name="{{key}}" value="true" aria-required="{{required}}"{{#error}} aria-invalid="true"{{/error}}{{^error}}{{#toggle}} data-toggle="{{toggle}}"{{/toggle}}{{#selected}} checked="checked"{{/selected}}{{/error}}>
|
|
5
9
|
<label for="{{key}}" class="{{#className}}{{className}} {{/className}}{{#invalid}}invalid-input{{/invalid}}">
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<label for="{{id}}" class="{{labelClassName}}">
|
|
4
4
|
<span class="label-text">{{{label}}}</span>
|
|
5
5
|
</label>
|
|
6
|
-
{{#hint}}<
|
|
6
|
+
{{#hint}}<div {{$hintId}}id="{{hintId}}" {{/hintId}}class="govuk-hint">{{{hint}}}</div>{{/hint}}
|
|
7
7
|
{{#renderChild}}{{/renderChild}}
|
|
8
8
|
{{#attributes}}
|
|
9
9
|
{{#prefix}}
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
{{#max}} max="{{max}}"{{/max}}
|
|
22
22
|
{{#maxlength}} maxlength="{{maxlength}}"{{/maxlength}}
|
|
23
23
|
{{#pattern}} pattern="{{pattern}}"{{/pattern}}
|
|
24
|
+
{{#inputmode}}inputmode="{{inputmode}}"{{/inputmode}}
|
|
24
25
|
{{#hintId}} aria-describedby="{{hintId}}"{{/hintId}}
|
|
25
26
|
{{#error}} aria-invalid="true"{{/error}}
|
|
26
27
|
{{#autocomplete}} autocomplete="{{autocomplete}}"{{/autocomplete}}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
{{{label}}}
|
|
4
4
|
</label>
|
|
5
5
|
{{#isPageHeading}}</h1>{{/isPageHeading}}
|
|
6
|
-
{{#hint}}<
|
|
6
|
+
{{#hint}}<div {{$hintId}}id="{{hintId}}" {{/hintId}}class="govuk-hint">{{{hint}}}</div>{{/hint}}
|
|
7
7
|
{{#error}}
|
|
8
8
|
<p class="govuk-error-message">
|
|
9
9
|
<span class="govuk-visually-hidden">Error:</span> {{error.message}}
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
{{#error}} aria-invalid="true" aria-describedby="{{id}}-error" {{/error}}
|
|
30
30
|
>{{value}}</textarea>
|
|
31
31
|
{{#isMaxlengthOrMaxword}}
|
|
32
|
-
<div id="{{id}}-info" class=" govuk-hint govuk-character-count__message"
|
|
32
|
+
<div id="{{id}}-info" class=" govuk-hint govuk-character-count__message">You have {{#maxlength}}{{maxlength}} characters{{/maxlength}}{{#maxword}}{{maxword}}
|
|
33
33
|
words{{/maxword}} remaining
|
|
34
34
|
</div>
|
|
35
35
|
{{/isMaxlengthOrMaxword}}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
{{#errorlist.length}}{{#t}}errorlist.prefix{{/t}}{{/errorlist.length}}{{#title}}{{title}}{{/title}}{{^title}}{{$header}}{{/header}}{{/title}}{{#serviceName}} – {{serviceName}}{{/serviceName}} – GOV.UK
|
|
7
7
|
{{/pageTitle}}
|
|
8
8
|
{{$bodyStart}}
|
|
9
|
-
<a href="#{{#skipToMain}}{{skipToMain}}{{/skipToMain}}{{^skipToMain}}main-content{{/skipToMain}}" class="govuk-skip-link" id="skip-to-main">Skip to main content</a>
|
|
9
|
+
<a href="#{{#skipToMain}}{{skipToMain}}{{/skipToMain}}{{^skipToMain}}main-content{{/skipToMain}}" class="govuk-skip-link" data-module="govuk-skip-link" id="skip-to-main">Skip to main content</a>
|
|
10
10
|
{{/bodyStart}}
|
|
11
11
|
{{$headerClass}}govuk-header{{/headerClass}}
|
|
12
12
|
{{$insideHeader}}{{/insideHeader}}
|
|
@@ -1,33 +1,51 @@
|
|
|
1
|
-
<div id="cookie-banner" class="govuk-cookie-banner
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
1
|
+
<div id="cookie-banner" class="govuk-cookie-banner" data-nosnippet="" role="region" aria-label="Cookies on {{#appName}}{{appName}}{{/appName}}{{^appName}}this service{{/appName}}">
|
|
2
|
+
<div class="govuk-cookie-banner__message govuk-width-container">
|
|
3
|
+
<div id="cookie-banner-info" class="govuk-grid-row">
|
|
4
|
+
<div class="govuk-grid-column-two-thirds">
|
|
5
|
+
<h2 class="govuk-cookie-banner__heading govuk-heading-m">Cookies on {{#appName}}{{appName}}{{/appName}}{{^appName}}this service{{/appName}}</h2>
|
|
6
|
+
<div class="govuk-cookie-banner__content">
|
|
7
|
+
<p class="govuk-body">{{#t}}cookies.banner.message{{/t}}</p>
|
|
8
|
+
{{#hasGoogleAnalytics}}
|
|
9
|
+
<p class="govuk-body">We'd like to set additional cookies to understand how you use GOV.UK, remember your settings and improve government services.</p>
|
|
10
|
+
<p class="govuk-body">We also use cookies set by other sites to help us deliver content from their services.</p>
|
|
11
|
+
{{/hasGoogleAnalytics}}
|
|
12
|
+
</div>
|
|
13
|
+
</div>
|
|
14
|
+
</div>
|
|
15
|
+
<div id="cookie-banner-actions" class="govuk-button-group">
|
|
16
|
+
{{#hasGoogleAnalytics}}
|
|
17
|
+
<button id="accept-cookies-button" value="yes" type="submit" name="cookies[additional]" class="govuk-button" data-module="govuk-button" data-accept-cookies="true" data-track-category="cookieBanner" data-track-action="Cookie banner accepted" data-cookie-types="all">Accept additional cookies</button>
|
|
18
|
+
<button id="reject-cookies-button" value="no" type="submit" name="cookies[additional]" class="govuk-button" data-module="govuk-button" data-reject-cookies="true" data-track-category="cookieBanner" data-track-action="Cookie banner rejected">Reject additional cookies</button>
|
|
19
|
+
{{/hasGoogleAnalytics}}
|
|
20
|
+
<a class="govuk-link" href="/cookies">{{#t}}cookies.banner.link{{/t}}</a>
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
|
+
<div id="cookie-banner-submitted-accepted" data-accept-cookies="true" class="govuk-cookie-banner__message govuk-width-container" role="alert" hidden >
|
|
24
|
+
<div class="govuk-grid-row">
|
|
25
|
+
<div class="govuk-grid-column-two-thirds">
|
|
26
|
+
<div class="govuk-cookie-banner__content">
|
|
27
|
+
<p class="govuk-body">You've accepted additional cookies. You can <a class="govuk-link" href="/cookies">change your cookie settings</a> at any time.</p>
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
<div class="govuk-button-group">
|
|
32
|
+
<button id="hide-accept-cookie-banner" value="yes" type="submit" name="cookies[hide]" class="govuk-button" data-module="govuk-button">
|
|
33
|
+
Hide cookie message
|
|
34
|
+
</button>
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
<div id="cookie-banner-submitted-rejected" class="govuk-cookie-banner__message govuk-width-container" role="alert" hidden>
|
|
38
|
+
<div class="govuk-grid-row">
|
|
39
|
+
<div class="govuk-grid-column-two-thirds">
|
|
40
|
+
<div class="govuk-cookie-banner__content">
|
|
41
|
+
<p class="govuk-body">You've rejected additional cookies. You can <a class="govuk-link" href="/cookies">change your cookie settings</a> at any time.</p>
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
<div class="govuk-button-group">
|
|
46
|
+
<button id="hide-reject-cookie-banner" value="yes" type="submit" name="cookies[hide]" class="govuk-button" data-module="govuk-button">
|
|
47
|
+
Hide cookie message
|
|
48
|
+
</button>
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
33
51
|
</div>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<div class="govuk-header__content">
|
|
2
2
|
{{#startPageRedirectUrl}}
|
|
3
|
-
<a href="{{startPageRedirectUrl}}" class="govuk-header__link govuk-
|
|
3
|
+
<a href="{{startPageRedirectUrl}}" class="govuk-header__link govuk-header__service-name" id="proposition-name">{{$journeyHeader}}{{/journeyHeader}}</a>
|
|
4
4
|
{{/startPageRedirectUrl}}
|
|
5
5
|
{{^startPageRedirectUrl}}
|
|
6
|
-
<a href="{{journeyHeaderURL}}" class="govuk-header__link govuk-
|
|
6
|
+
<a href="{{journeyHeaderURL}}" class="govuk-header__link govuk-header__service-name" id="proposition-name">{{$journeyHeader}}{{/journeyHeader}}</a>
|
|
7
7
|
{{/startPageRedirectUrl}}
|
|
8
8
|
</div>
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
/* eslint-disable
|
|
1
|
+
/* eslint-disable no-undef */
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
// TODO: update package.json(s)
|
|
5
5
|
|
|
6
6
|
function hideFallbackContent(containerId) {
|
|
7
|
-
|
|
7
|
+
const container = document.getElementById(containerId);
|
|
8
8
|
if (container === null) return;
|
|
9
|
-
|
|
10
|
-
for (
|
|
9
|
+
const fallbackContent = container.getElementsByClassName('js-disabled');
|
|
10
|
+
for (let i = 0; i < fallbackContent.length; i++) {
|
|
11
11
|
fallbackContent[i].style.display = 'none';
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
function showInteractiveContent(containerId) {
|
|
16
|
-
|
|
16
|
+
const container = document.getElementById(containerId);
|
|
17
17
|
if (container === null) return;
|
|
18
|
-
|
|
19
|
-
for (
|
|
18
|
+
const interactiveContent = container.getElementsByClassName('js-enabled');
|
|
19
|
+
for (let i = 0; i < interactiveContent.length; i++) {
|
|
20
20
|
interactiveContent[i].style.display = 'block';
|
|
21
21
|
}
|
|
22
22
|
}
|
|
@@ -34,12 +34,23 @@ function setCookiePreferences(preferences) {
|
|
|
34
34
|
function showCookieBannerSubmitted() {
|
|
35
35
|
document.getElementById('cookie-banner-info').style.display = 'none';
|
|
36
36
|
document.getElementById('cookie-banner-actions').style.display = 'none';
|
|
37
|
-
|
|
37
|
+
let cookieBannerSubmitted;
|
|
38
|
+
const cookieBannerDiv = document.getElementById('cookie-banner-submitted-accepted');
|
|
39
|
+
if (cookieBannerDiv.dataset.acceptCookies === 'true') {
|
|
40
|
+
cookieBannerSubmitted = document.getElementById('cookie-banner-submitted-accepted');
|
|
41
|
+
} else {
|
|
42
|
+
cookieBannerSubmitted = document.getElementById('cookie-banner-submitted-rejected');
|
|
43
|
+
}
|
|
38
44
|
cookieBannerSubmitted.style.display = 'block';
|
|
39
45
|
cookieBannerSubmitted.focus();
|
|
40
46
|
}
|
|
41
47
|
|
|
48
|
+
function hideCookieBanner() {
|
|
49
|
+
document.getElementById('cookie-banner').style.display = 'none';
|
|
50
|
+
}
|
|
51
|
+
|
|
42
52
|
function initialiseBannerButtons() {
|
|
53
|
+
const acceptedCookieBannerDiv = document.getElementById('cookie-banner-submitted-accepted');
|
|
43
54
|
document.getElementById('accept-cookies-button').addEventListener('click', function () {
|
|
44
55
|
setCookiePreferences({essential: true, usage: true});
|
|
45
56
|
showCookieBannerSubmitted();
|
|
@@ -48,27 +59,28 @@ function initialiseBannerButtons() {
|
|
|
48
59
|
});
|
|
49
60
|
|
|
50
61
|
document.getElementById('reject-cookies-button').addEventListener('click', function () {
|
|
51
|
-
setCookiePreferences({essential: true, usage: false});
|
|
62
|
+
setCookiePreferences({ essential: true, usage: false });
|
|
63
|
+
acceptedCookieBannerDiv.dataset.acceptCookies = 'false';
|
|
52
64
|
showCookieBannerSubmitted();
|
|
53
65
|
});
|
|
54
66
|
|
|
55
|
-
document.getElementById('hide-cookie-banner').addEventListener('click',
|
|
56
|
-
|
|
57
|
-
|
|
67
|
+
document.getElementById('hide-accept-cookie-banner').addEventListener('click', hideCookieBanner);
|
|
68
|
+
|
|
69
|
+
document.getElementById('hide-reject-cookie-banner').addEventListener('click', hideCookieBanner);
|
|
58
70
|
}
|
|
59
71
|
|
|
60
72
|
function initialiseCookieBanner() {
|
|
61
|
-
|
|
73
|
+
const preferences = GOVUK.cookie('cookie_preferences');
|
|
62
74
|
|
|
63
75
|
if (preferences !== null) {
|
|
64
76
|
return;
|
|
65
77
|
}
|
|
66
78
|
|
|
67
79
|
// the default cookie message container from hof-govuk-template
|
|
68
|
-
|
|
80
|
+
const bannerContainer = document.getElementById('global-cookie-message');
|
|
69
81
|
|
|
70
82
|
// the cookie banner that will replace the container's default content if using google analytics
|
|
71
|
-
|
|
83
|
+
const cookieBanner = document.getElementById('cookie-banner');
|
|
72
84
|
|
|
73
85
|
if (bannerContainer !== null && cookieBanner !== null) {
|
|
74
86
|
hideFallbackContent('global-cookie-message');
|
|
@@ -82,8 +94,8 @@ function handleSaveSettings(e) {
|
|
|
82
94
|
e.preventDefault();
|
|
83
95
|
setCookiePreferences({ essential: true, usage: document.getElementById('radio-1').checked });
|
|
84
96
|
|
|
85
|
-
|
|
86
|
-
|
|
97
|
+
const cookieNotification = document.getElementById('cookie-notification');
|
|
98
|
+
const cookieBanner = document.getElementById('cookie-banner');
|
|
87
99
|
|
|
88
100
|
if (cookieBanner !== null) {
|
|
89
101
|
cookieBanner.style.display = 'none';
|
|
@@ -96,8 +108,8 @@ function handleSaveSettings(e) {
|
|
|
96
108
|
}
|
|
97
109
|
|
|
98
110
|
function initialiseFormControls() {
|
|
99
|
-
|
|
100
|
-
|
|
111
|
+
const preferences = JSON.parse(GOVUK.cookie('cookie_preferences'));
|
|
112
|
+
let usage;
|
|
101
113
|
|
|
102
114
|
if (preferences !== null && preferences.usage !== undefined && typeof preferences.usage === 'boolean') {
|
|
103
115
|
usage = preferences.usage;
|
|
@@ -111,7 +123,7 @@ function initialiseFormControls() {
|
|
|
111
123
|
}
|
|
112
124
|
|
|
113
125
|
function initialiseCookiePage() {
|
|
114
|
-
|
|
126
|
+
const shouldDisplayCookieControls = document.getElementById('cookie-settings') !== null;
|
|
115
127
|
|
|
116
128
|
if (shouldDisplayCookieControls) {
|
|
117
129
|
hideFallbackContent('cookie-settings');
|
|
@@ -122,12 +134,12 @@ function initialiseCookiePage() {
|
|
|
122
134
|
|
|
123
135
|
function onLoad() {
|
|
124
136
|
window.onload = function () {
|
|
125
|
-
|
|
137
|
+
const reloading = sessionStorage.getItem('reloading');
|
|
126
138
|
if (reloading) {
|
|
127
139
|
sessionStorage.removeItem('reloading');
|
|
128
140
|
|
|
129
|
-
|
|
130
|
-
|
|
141
|
+
const bannerContainer = document.getElementById('global-cookie-message');
|
|
142
|
+
const cookieBanner = document.getElementById('cookie-banner');
|
|
131
143
|
|
|
132
144
|
if (bannerContainer !== null && cookieBanner !== null) {
|
|
133
145
|
bannerContainer.style.display = 'block';
|
|
@@ -85,10 +85,6 @@ function formFocus() {
|
|
|
85
85
|
document.getElementById(getElementFromSummaryLink + '-day').focus();
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
if (document.getElementById(getElementFromSummaryLink + '-amount') && forms.length === 1 && editMode) {
|
|
89
|
-
document.getElementById(getElementFromSummaryLink + '-amount').focus();
|
|
90
|
-
}
|
|
91
|
-
|
|
92
88
|
if (forms.length > 0) {
|
|
93
89
|
labels = document.getElementsByTagName('label');
|
|
94
90
|
if (labels) {
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<svg
|
|
2
|
+
focusable="false"
|
|
3
|
+
role="img"
|
|
4
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
5
|
+
viewBox="0 0 324 60"
|
|
6
|
+
height="30"
|
|
7
|
+
width="162"
|
|
8
|
+
fill="white"
|
|
9
|
+
class="govuk-header__logotype"
|
|
10
|
+
aria-label="GOV.UK">
|
|
11
|
+
<title>GOV.UK</title>
|
|
12
|
+
<g>
|
|
13
|
+
<circle cx="20" cy="17.6" r="3.7"></circle>
|
|
14
|
+
<circle cx="10.2" cy="23.5" r="3.7"></circle>
|
|
15
|
+
<circle cx="3.7" cy="33.2" r="3.7"></circle>
|
|
16
|
+
<circle cx="31.7" cy="30.6" r="3.7"></circle>
|
|
17
|
+
<circle cx="43.3" cy="17.6" r="3.7"></circle>
|
|
18
|
+
<circle cx="53.2" cy="23.5" r="3.7"></circle>
|
|
19
|
+
<circle cx="59.7" cy="33.2" r="3.7"></circle>
|
|
20
|
+
<circle cx="31.7" cy="30.6" r="3.7"></circle>
|
|
21
|
+
<path d="M33.1,9.8c.2-.1.3-.3.5-.5l4.6,2.4v-6.8l-4.6,1.5c-.1-.2-.3-.3-.5-.5l1.9-5.9h-6.7l1.9,5.9c-.2.1-.3.3-.5.5l-4.6-1.5v6.8l4.6-2.4c.1.2.3.3.5.5l-2.6,8c-.9,2.8,1.2,5.7,4.1,5.7h0c3,0,5.1-2.9,4.1-5.7l-2.6-8ZM37,37.9s-3.4,3.8-4.1,6.1c2.2,0,4.2-.5,6.4-2.8l-.7,8.5c-2-2.8-4.4-4.1-5.7-3.8.1,3.1.5,6.7,5.8,7.2,3.7.3,6.7-1.5,7-3.8.4-2.6-2-4.3-3.7-1.6-1.4-4.5,2.4-6.1,4.9-3.2-1.9-4.5-1.8-7.7,2.4-10.9,3,4,2.6,7.3-1.2,11.1,2.4-1.3,6.2,0,4,4.6-1.2-2.8-3.7-2.2-4.2.2-.3,1.7.7,3.7,3,4.2,1.9.3,4.7-.9,7-5.9-1.3,0-2.4.7-3.9,1.7l2.4-8c.6,2.3,1.4,3.7,2.2,4.5.6-1.6.5-2.8,0-5.3l5,1.8c-2.6,3.6-5.2,8.7-7.3,17.5-7.4-1.1-15.7-1.7-24.5-1.7h0c-8.8,0-17.1.6-24.5,1.7-2.1-8.9-4.7-13.9-7.3-17.5l5-1.8c-.5,2.5-.6,3.7,0,5.3.8-.8,1.6-2.3,2.2-4.5l2.4,8c-1.5-1-2.6-1.7-3.9-1.7,2.3,5,5.2,6.2,7,5.9,2.3-.4,3.3-2.4,3-4.2-.5-2.4-3-3.1-4.2-.2-2.2-4.6,1.6-6,4-4.6-3.7-3.7-4.2-7.1-1.2-11.1,4.2,3.2,4.3,6.4,2.4,10.9,2.5-2.8,6.3-1.3,4.9,3.2-1.8-2.7-4.1-1-3.7,1.6.3,2.3,3.3,4.1,7,3.8,5.4-.5,5.7-4.2,5.8-7.2-1.3-.2-3.7,1-5.7,3.8l-.7-8.5c2.2,2.3,4.2,2.7,6.4,2.8-.7-2.3-4.1-6.1-4.1-6.1h10.6,0Z"></path>
|
|
22
|
+
</g>
|
|
23
|
+
<circle class="govuk-logo-dot" cx="226" cy="36" r="7.3" fill="#00ffe0"></circle>
|
|
24
|
+
<path d="M93.94 41.25c.4 1.81 1.2 3.21 2.21 4.62 1 1.4 2.21 2.41 3.61 3.21s3.21 1.2 5.22 1.2 3.61-.4 4.82-1c1.4-.6 2.41-1.4 3.21-2.41.8-1 1.4-2.01 1.61-3.01s.4-2.01.4-3.01v.14h-10.86v-7.02h20.07v24.08h-8.03v-5.56c-.6.8-1.38 1.61-2.19 2.41-.8.8-1.81 1.2-2.81 1.81-1 .4-2.21.8-3.41 1.2s-2.41.4-3.81.4a18.56 18.56 0 0 1-14.65-6.63c-1.6-2.01-3.01-4.41-3.81-7.02s-1.4-5.62-1.4-8.83.4-6.02 1.4-8.83a20.45 20.45 0 0 1 19.46-13.65c3.21 0 4.01.2 5.82.8 1.81.4 3.61 1.2 5.02 2.01 1.61.8 2.81 2.01 4.01 3.21s2.21 2.61 2.81 4.21l-7.63 4.41c-.4-1-1-1.81-1.61-2.61-.6-.8-1.4-1.4-2.21-2.01-.8-.6-1.81-1-2.81-1.4-1-.4-2.21-.4-3.61-.4-2.01 0-3.81.4-5.22 1.2-1.4.8-2.61 1.81-3.61 3.21s-1.61 2.81-2.21 4.62c-.4 1.81-.6 3.71-.6 5.42s.8 5.22.8 5.22Zm57.8-27.9c3.21 0 6.22.6 8.63 1.81 2.41 1.2 4.82 2.81 6.62 4.82S170.2 24.39 171 27s1.4 5.62 1.4 8.83-.4 6.02-1.4 8.83-2.41 5.02-4.01 7.02-4.01 3.61-6.62 4.82-5.42 1.81-8.63 1.81-6.22-.6-8.63-1.81-4.82-2.81-6.42-4.82-3.21-4.41-4.01-7.02-1.4-5.62-1.4-8.83.4-6.02 1.4-8.83 2.41-5.02 4.01-7.02 4.01-3.61 6.42-4.82 5.42-1.81 8.63-1.81Zm0 36.73c1.81 0 3.61-.4 5.02-1s2.61-1.81 3.61-3.01 1.81-2.81 2.21-4.41c.4-1.81.8-3.61.8-5.62 0-2.21-.2-4.21-.8-6.02s-1.2-3.21-2.21-4.62c-1-1.2-2.21-2.21-3.61-3.01s-3.21-1-5.02-1-3.61.4-5.02 1c-1.4.8-2.61 1.81-3.61 3.01s-1.81 2.81-2.21 4.62c-.4 1.81-.8 3.61-.8 5.62 0 2.41.2 4.21.8 6.02.4 1.81 1.2 3.21 2.21 4.41s2.21 2.21 3.61 3.01c1.4.8 3.21 1 5.02 1Zm36.32 7.96-12.24-44.15h9.83l8.43 32.77h.4l8.23-32.77h9.83L200.3 58.04h-12.24Zm74.14-7.96c2.18 0 3.51-.6 3.51-.6 1.2-.6 2.01-1 2.81-1.81s1.4-1.81 1.81-2.81a13 13 0 0 0 .8-4.01V13.9h8.63v28.15c0 2.41-.4 4.62-1.4 6.62-.8 2.01-2.21 3.61-3.61 5.02s-3.41 2.41-5.62 3.21-4.62 1.2-7.02 1.2-5.02-.4-7.02-1.2c-2.21-.8-4.01-1.81-5.62-3.21s-2.81-3.01-3.61-5.02-1.4-4.21-1.4-6.62V13.9h8.63v26.95c0 1.61.2 3.01.8 4.01.4 1.2 1.2 2.21 2.01 2.81.8.8 1.81 1.4 2.81 1.81 0 0 1.34.6 3.51.6Zm34.22-36.18v18.92l15.65-18.92h10.82l-15.03 17.32 16.03 26.83h-10.21l-11.44-20.21-5.62 6.22v13.99h-8.83V13.9"></path>
|
|
25
|
+
</svg>
|
package/index.js
CHANGED
|
@@ -77,7 +77,8 @@ const getContentSecurityPolicy = (config, res) => {
|
|
|
77
77
|
imgSrc: ["'self'"],
|
|
78
78
|
fontSrc: ["'self'", 'data:', 'https://design-system.service.gov.uk'],
|
|
79
79
|
scriptSrc: ["'self'", `'nonce-${res.locals.nonce}'`],
|
|
80
|
-
'frame-ancestors': ["'none'"]
|
|
80
|
+
'frame-ancestors': ["'none'"],
|
|
81
|
+
manifestSrc: ["'self'"]
|
|
81
82
|
};
|
|
82
83
|
/* eslint-enable quotes */
|
|
83
84
|
|
|
@@ -95,7 +96,8 @@ const getContentSecurityPolicy = (config, res) => {
|
|
|
95
96
|
'https://www.google-analytics.com',
|
|
96
97
|
'https://region1.google-analytics.com',
|
|
97
98
|
'https://region1.analytics.google.com'
|
|
98
|
-
]
|
|
99
|
+
],
|
|
100
|
+
manifestSrc: ["'self'"]
|
|
99
101
|
};
|
|
100
102
|
|
|
101
103
|
if (config.gaTagId) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hof",
|
|
3
3
|
"description": "A bootstrap for HOF projects",
|
|
4
|
-
"version": "22.
|
|
4
|
+
"version": "22.13.0-frontend-v4-beta.1",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"author": "HomeOffice",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"findup": "^0.1.5",
|
|
60
60
|
"glob": "^7.2.3",
|
|
61
61
|
"govuk-elements-sass": "^3.1.3",
|
|
62
|
-
"govuk-frontend": "
|
|
62
|
+
"govuk-frontend": "4.10",
|
|
63
63
|
"govuk_template_mustache": "^0.26.0",
|
|
64
64
|
"helmet": "^3.23.3",
|
|
65
65
|
"hogan-express-strict": "^0.5.4",
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
|
|
4
4
|
const dateComponent = require('../../../').components.date;
|
|
5
5
|
const staticAppealStages = require('./lib/staticAppealStages');
|
|
6
|
-
const amountWithUnitSelectComponent = require('../../../').components.amountWithUnitSelect;
|
|
7
6
|
|
|
8
7
|
module.exports = {
|
|
9
8
|
'landing-page-radio': {
|
|
@@ -125,21 +124,5 @@ module.exports = {
|
|
|
125
124
|
value: '',
|
|
126
125
|
label: 'fields.appealStages.options.null'
|
|
127
126
|
}].concat(staticAppealStages.getstaticAppealStages())
|
|
128
|
-
}
|
|
129
|
-
'amountWithUnitSelect' : amountWithUnitSelectComponent('amountWithUnitSelect', {
|
|
130
|
-
mixin: 'input-amount-with-unit-select',
|
|
131
|
-
amountLabel: "Amount-",
|
|
132
|
-
unitLabel: "Unit-",
|
|
133
|
-
options: [
|
|
134
|
-
{ "null": "Select" },
|
|
135
|
-
{ "label": "non trans option 1", "value": "1" },
|
|
136
|
-
{ "label": "non trans option 2", "value": "2" }
|
|
137
|
-
],
|
|
138
|
-
hint: "E.G: 5 Kilogram",
|
|
139
|
-
legend: 'Enter An Amount',
|
|
140
|
-
isPageHeading: 'true',
|
|
141
|
-
unitOptional: 'false',
|
|
142
|
-
amountOptional: 'true',
|
|
143
|
-
validate: ['alphanum']
|
|
144
|
-
})
|
|
127
|
+
}
|
|
145
128
|
}
|
|
@@ -39,11 +39,5 @@ module.exports = {
|
|
|
39
39
|
],
|
|
40
40
|
whatHappened: [
|
|
41
41
|
'whatHappened'
|
|
42
|
-
]
|
|
43
|
-
amountWithUnitSelect:
|
|
44
|
-
[{
|
|
45
|
-
field: 'amountWithUnitSelect',
|
|
46
|
-
parse: val => val ?
|
|
47
|
-
(val.substring(0, val.lastIndexOf('-')) || '0') + ' ' + val.substring(val.lastIndexOf('-') + 1) : ''
|
|
48
|
-
}]
|
|
42
|
+
]
|
|
49
43
|
};
|
|
@@ -107,24 +107,6 @@
|
|
|
107
107
|
"options": {
|
|
108
108
|
"null": "Select..."
|
|
109
109
|
}
|
|
110
|
-
},
|
|
111
|
-
"amountWithUnitSelect": {
|
|
112
|
-
"label": "Amount",
|
|
113
|
-
"amountLabel": "Amount:",
|
|
114
|
-
"unitLabel": "Unit:",
|
|
115
|
-
"options": [
|
|
116
|
-
{
|
|
117
|
-
"null": "Select..."
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
"label": "Litres",
|
|
121
|
-
"value": "L"
|
|
122
|
-
},
|
|
123
|
-
{
|
|
124
|
-
"label": "Kilograms",
|
|
125
|
-
"value": "KG"
|
|
126
|
-
}
|
|
127
|
-
]
|
|
128
110
|
}
|
|
129
111
|
},
|
|
130
112
|
"journey": {
|
|
@@ -181,9 +163,6 @@
|
|
|
181
163
|
},
|
|
182
164
|
"whatHappened": {
|
|
183
165
|
"header": "What happened"
|
|
184
|
-
},
|
|
185
|
-
"amountWithUnitSelect": {
|
|
186
|
-
"header": "Entered amount"
|
|
187
166
|
}
|
|
188
167
|
}
|
|
189
168
|
},
|
|
@@ -261,18 +240,6 @@
|
|
|
261
240
|
},
|
|
262
241
|
"appealStages": {
|
|
263
242
|
"required": "Select an appeal stage from the list"
|
|
264
|
-
},
|
|
265
|
-
"amountWithUnitSelect": {
|
|
266
|
-
"default": "Enter the amount in the correct format; for example, 10 Litres",
|
|
267
|
-
"alphanum": "The amount must not contain any special characters",
|
|
268
|
-
"required": "Enter an amount and a unit value"
|
|
269
|
-
},
|
|
270
|
-
"amountWithUnitSelect-unit": {
|
|
271
|
-
"default": "A valid value must be selected as the amount unit",
|
|
272
|
-
"required": "A unit must be selected for the amount"
|
|
273
|
-
},
|
|
274
|
-
"amountWithUnitSelect-amount": {
|
|
275
|
-
"required": "An amount must be selected with the unit"
|
|
276
243
|
}
|
|
277
244
|
}
|
|
278
245
|
}
|