hof 21.0.0-instrumentation-beta.0 → 21.0.1-axios-beta

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 (106) hide show
  1. package/.github/workflows/automate-publish.yml +1 -1
  2. package/.github/workflows/automate-tag.yml +4 -4
  3. package/.nyc_output/4fc007c9-d6c8-4614-89ce-04c7d6ce9fe5.json +1 -0
  4. package/.nyc_output/processinfo/4fc007c9-d6c8-4614-89ce-04c7d6ce9fe5.json +1 -0
  5. package/.nyc_output/processinfo/index.json +1 -1
  6. package/README.md +340 -256
  7. package/build/tasks/sass/index.js +3 -1
  8. package/build/tasks/watch/index.js +1 -1
  9. package/components/combine-and-loop-fields/Readme.md +42 -0
  10. package/components/combine-and-loop-fields/index.js +156 -0
  11. package/components/date/index.js +3 -1
  12. package/components/date/templates/date.html +15 -12
  13. package/components/homeoffice-countries/index.js +22 -0
  14. package/components/index.js +2 -0
  15. package/components/notify/notify.js +2 -2
  16. package/components/summary/index.js +3 -2
  17. package/config/builder-defaults.js +3 -1
  18. package/config/component-defaults.js +13 -0
  19. package/controller/controller.js +57 -1
  20. package/controller/formatting/formatters.js +12 -0
  21. package/controller/validation/index.js +2 -1
  22. package/controller/validation/validators.js +4 -0
  23. package/frontend/govuk-template/build/config.js +2 -2
  24. package/frontend/govuk-template/build/govuk_template.html +104 -0
  25. package/frontend/govuk-template/build/index.js +2 -2
  26. package/frontend/govuk-template/index.js +4 -4
  27. package/frontend/template-mixins/mixins/template-mixins.js +39 -11
  28. package/frontend/template-mixins/partials/forms/checkbox-group.html +47 -0
  29. package/frontend/template-mixins/partials/forms/checkbox.html +4 -4
  30. package/frontend/template-mixins/partials/forms/input-submit.html +1 -1
  31. package/frontend/template-mixins/partials/forms/input-text-date.html +37 -0
  32. package/frontend/template-mixins/partials/forms/input-text-group.html +15 -10
  33. package/frontend/template-mixins/partials/forms/option-group.html +42 -26
  34. package/frontend/template-mixins/partials/forms/select.html +10 -5
  35. package/frontend/template-mixins/partials/forms/textarea-group.html +37 -23
  36. package/frontend/template-mixins/partials/mixins/panel.html +3 -4
  37. package/frontend/template-partials/views/accessibility.html +4 -4
  38. package/frontend/template-partials/views/cookies.html +1 -1
  39. package/frontend/template-partials/views/layout.html +24 -17
  40. package/frontend/template-partials/views/partials/back.html +1 -1
  41. package/frontend/template-partials/views/partials/bullet-list.html +1 -1
  42. package/frontend/template-partials/views/partials/confirmation-alert.html +4 -3
  43. package/frontend/template-partials/views/partials/continue.html +1 -1
  44. package/frontend/template-partials/views/partials/cookie-banner.html +27 -24
  45. package/frontend/template-partials/views/partials/cookie-settings-radio.html +6 -6
  46. package/frontend/template-partials/views/partials/external-link.html +1 -1
  47. package/frontend/template-partials/views/partials/form.html +2 -1
  48. package/frontend/template-partials/views/partials/maincontent-left.html +4 -4
  49. package/frontend/template-partials/views/partials/navigation.html +7 -6
  50. package/frontend/template-partials/views/partials/session-cookies-table.html +6 -6
  51. package/frontend/template-partials/views/partials/summary-table-row.html +2 -2
  52. package/frontend/template-partials/views/partials/table.html +7 -7
  53. package/frontend/template-partials/views/partials/validation-list.html +2 -2
  54. package/frontend/template-partials/views/partials/validation-summary.html +14 -13
  55. package/frontend/template-partials/views/partials/warn.html +7 -0
  56. package/frontend/template-partials/views/session-timeout.html +3 -2
  57. package/frontend/themes/gov-uk/client-js/cookieSettings.js +1 -1
  58. package/frontend/themes/gov-uk/client-js/govuk-cookies.js +121 -0
  59. package/frontend/themes/gov-uk/client-js/index.js +6 -1
  60. package/frontend/themes/gov-uk/client-js/skip-to-main.js +19 -0
  61. package/frontend/themes/gov-uk/styles/_cookie-banner.scss +51 -1
  62. package/frontend/themes/gov-uk/styles/govuk.scss +4 -0
  63. package/frontend/themes/gov-uk/styles/modules/_validation.scss +5 -5
  64. package/frontend/toolkit/assets/javascript/character-count.js +4 -4
  65. package/frontend/toolkit/assets/javascript/progressive-reveal.js +3 -1
  66. package/frontend/toolkit/assets/javascript/validation.js +5 -1
  67. package/frontend/toolkit/assets/stylesheets/modules/_validation.scss +3 -3
  68. package/index.js +15 -2
  69. package/lib/ga-tag.js +1 -1
  70. package/lib/settings.js +18 -2
  71. package/middleware/errors.js +2 -3
  72. package/middleware/not-found.js +0 -3
  73. package/middleware/rate-limiter.js +1 -0
  74. package/model/apis/html-to-pdf-converter.js +9 -8
  75. package/model/index.js +27 -28
  76. package/package.json +16 -14
  77. package/sandbox/README.md +3 -3
  78. package/sandbox/apps/sandbox/fields.js +33 -11
  79. package/sandbox/apps/sandbox/index.js +4 -0
  80. package/sandbox/apps/sandbox/sections/summary-data-sections.js +3 -0
  81. package/sandbox/apps/sandbox/translations/en/default.json +224 -0
  82. package/sandbox/apps/sandbox/translations/src/en/fields.json +11 -4
  83. package/sandbox/apps/sandbox/translations/src/en/journey.json +4 -1
  84. package/sandbox/apps/sandbox/translations/src/en/pages.json +7 -25
  85. package/sandbox/apps/sandbox/translations/src/en/validation.json +5 -1
  86. package/sandbox/assets/js/index.js +1 -1
  87. package/sandbox/assets/scss/app.scss +16 -16
  88. package/sandbox/package.json +6 -1
  89. package/sandbox/public/css/app.css +2793 -0
  90. package/sandbox/public/images/icons/icon-caret-left.png +0 -0
  91. package/sandbox/public/images/icons/icon-complete.png +0 -0
  92. package/sandbox/public/images/icons/icon-cross-remove-sign.png +0 -0
  93. package/sandbox/public/js/bundle.js +32888 -0
  94. package/sandbox/server.js +2 -1
  95. package/sandbox/yarn.lock +243 -1
  96. package/wizard/index.js +0 -13
  97. package/wizard/middleware/check-progress.js +36 -1
  98. package/.nyc_output/4d5a4574-78fc-4fcb-9412-3658f6ce33ff.json +0 -1
  99. package/.nyc_output/processinfo/4d5a4574-78fc-4fcb-9412-3658f6ce33ff.json +0 -1
  100. package/frontend/govuk-template/govuk_template.html +0 -109
  101. package/frontend/themes/gov-uk/views/partials/form.html +0 -9
  102. package/frontend/themes/gov-uk/views/partials/forms/option-group.html +0 -28
  103. package/frontend/themes/gov-uk/views/partials/mixins/panel.html +0 -3
  104. package/frontend/themes/gov-uk/views/partials/validation-summary.html +0 -24
  105. package/middleware/monitor.js +0 -20
  106. package/sandbox/apps/sandbox/views/confirmation.html +0 -15
@@ -1,4 +1,4 @@
1
- <ul class="list-bullet">
1
+ <ul class="govuk-list govuk-list--bullet">
2
2
  {{#items}}
3
3
  <li>
4
4
  {{.}}
@@ -1,5 +1,6 @@
1
- <div class="alert-complete" role="alert">
2
- <div class="alert-message">
3
- <h1>{{#t}}journey.confirmation.message{{/t}}</h1>
1
+ <div class="govuk-panel govuk-panel--confirmation" role="alert">
2
+ <h1 govuk-panel__title>{{#t}}journey.confirmation.message{{/t}}</h1>
3
+ <div class="govuk-panel__body">
4
+ {{#t}}journey.confirmation.details{{/t}}
4
5
  </div>
5
6
  </div>
@@ -1,5 +1,5 @@
1
1
  {{$continue}}
2
2
  {{#continueLink}}
3
- <a class="button" href="{{#url}}{{continueLink}}{{/url}}">{{#t}}buttons.continue{{/t}}</a>
3
+ <a class="govuk-button" href="{{#url}}{{continueLink}}{{/url}}">{{#t}}buttons.continue{{/t}}</a>
4
4
  {{/continueLink}}
5
5
  {{/continue}}
@@ -1,26 +1,29 @@
1
- <div id="cookie-banner" class="grid-row">
2
- <div id="cookie-banner-info" class="column-two-thirds">
3
- <h1 class="heading-medium js-enabled">Cookies on {{#appName}}{{appName}}{{/appName}}{{^appName}}this service{{/appName}}</h1>
4
- <p class="js-enabled">We use some essential cookies to make this website work.</p>
5
- <p class="js-enabled">We'd like to set additional cookies to understand how you use this service, remember your settings and improve government services.</p>
6
- <p class="js-enabled">We also use cookies set by other sites to help us deliver content from their services.</p>
7
- <!--Non-javascript fallback content-->
8
- <h1 class="heading-medium js-disabled">Tell us whether you accept cookies</h1>
9
- <p class="js-disabled">
10
- We use some essential cookies to make this website work.
11
- We'd like to set additional cookies to understand how you use GOV.UK, remember your settings and improve government services.
12
- We also use cookies set by other sites to help us deliver content from their services.
1
+ <div id="cookie-banner" class="govuk-cookie-banner gem-c-cookie-banner govuk-clearfix">
2
+ <div class="gem-c-cookie-banner__message 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">We use some essential cookies to make this website work.</p>
8
+ <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>
9
+ <p class="govuk-body">We also use cookies set by other sites to help us deliver content from their services.</p>
10
+ </div>
11
+ </div>
12
+ </div>
13
+ <div id="cookie-banner-actions" class="govuk-button-group">
14
+ <button id="accept-cookies-button" class="gem-c-button govuk-button" type="submit" data-module="gem-track-click" data-accept-cookies="true" data-track-category="cookieBanner" data-track-action="Cookie banner accepted" data-cookie-types="all">Accept additional cookies</button>
15
+
16
+ <button id="reject-cookies-button" class="gem-c-button govuk-button" type="submit" data-module="gem-track-click" data-reject-cookies="true" data-track-category="cookieBanner" data-track-action="Cookie banner rejected">Reject additional cookies</button>
17
+
18
+ <a class="govuk-link" href="/cookies">View cookies</a>
19
+ </div>
20
+ </div>
21
+ <div class="gem-c-cookie-banner__confirmation govuk-width-container" hidden="" id="cookie-banner-submitted" >
22
+ <p class="gem-c-cookie-banner__confirmation-message" role="alert">
23
+ Your cookie preferences have been saved. You can <a class="govuk-link" data-module="gem-track-click" data-track-category="cookieBanner" data-track-action="Cookie banner settings clicked from confirmation" href="/cookies">change your cookie settings</a> at any time.
13
24
  </p>
14
- </div>
15
- <div id="cookie-banner-actions" class="column-two-thirds">
16
- <button id="accept-cookies-button" class="button js-enabled" type="button" aria-label="Yes, accept cookies that measure website usage">Accept additional cookies</button>
17
- <button id="reject-cookies-button" class="button js-enabled" type="button" aria-label="No, decline cookies that measure website usage">Reject additional cookies</button>
18
- <a href="/cookies" class="js-enabled">View cookies</a>
19
- <!--Non-javascript fallback content-->
20
- <a href="/cookies" role="button" class="button js-disabled">Set cookie preferences</a>
21
- </div>
22
- <div id="cookie-banner-submitted" tabindex="-1">
23
- <p>Your cookie preferences have been saved. You can <a href="/cookies">change your cookie settings</a> at any time.</p>
24
- <button id="hide-cookie-banner" class="button" type="button" aria-label="Hide cookie banner">Hide</button>
25
- </div>
25
+ <div class="govuk-button-group">
26
+ <button class="gem-c-cookie-banner__hide-button govuk-button" id="hide-cookie-banner">Hide this message</button>
27
+ </div>
28
+ </div>
26
29
  </div>
@@ -1,8 +1,8 @@
1
- <div class="multiple-choice">
2
- <input id="radio-1" type="radio" name="radio-group" value="Use cookies that measure my website use">
3
- <label for="radio-1">Use cookies that measure my website use</label>
1
+ <div class="govuk-radios__item">
2
+ <input class="govuk-radios__input" id="radio-1" type="radio" name="radio-group" value="Use cookies that measure my website use">
3
+ <label class="govuk-label govuk-radios__label" for="radio-1">Use cookies that measure my website use</label>
4
4
  </div>
5
- <div class="multiple-choice">
6
- <input id="radio-2" type="radio" name="radio-group" value="Do not use cookies that measure my website use">
7
- <label for="radio-2">Do not use cookies that measure my website use</label>
5
+ <div class="govuk-radios__item">
6
+ <input class="govuk-radios__input" id="radio-2" type="radio" name="radio-group" value="Do not use cookies that measure my website use">
7
+ <label class="govuk-label govuk-radios__label" for="radio-2">Do not use cookies that measure my website use</label>
8
8
  </div>
@@ -1 +1 @@
1
- <p>{{before}}<a href="{{href}}" rel="external">{{link}}</a>{{after}}</p>
1
+ <p class="govuk-body">{{before}}<a class="govuk-link" href="{{href}}" rel="external">{{link}}</a>{{after}}</p>
@@ -1,7 +1,8 @@
1
1
  <form action="" method="POST" {{$encoding}}{{/encoding}} autocomplete="off" novalidate="true" spellcheck="false">
2
2
  {{$intro}}
3
- {{#intro}}<p class="form-block">{{intro}}</p>{{/intro}}
3
+ {{#intro}}<p>{{intro}}</p>{{/intro}}
4
4
  {{/intro}}
5
+
5
6
  {{$form}}{{/form}}
6
7
  {{#csrf-token}}
7
8
  <input type="hidden" name="x-csrf-token" value="{{csrf-token}}" />
@@ -1,10 +1,10 @@
1
1
  {{$content-outer}}
2
2
  {{$preloader}}{{/preloader}}
3
- <div class="column-two-thirds">
3
+ <div class="govuk-grid-column-two-thirds">
4
4
  {{$validationSummary}}{{/validationSummary}}
5
- <header>
6
- <h1>{{$header}}{{/header}}</h1>
7
- </header>
5
+ {{#captionHeading}}<span class="govuk-caption-l">{{captionHeading}}</span>{{/captionHeading}}
6
+ {{#header}}<h1 class="govuk-heading-l">{{header}}</h1>{{/header}}
7
+ {{#subHeading}}<div id="page-header"><h2 class="govuk-heading-m">{{subHeading}}</h2></div>{{/subHeading}}
8
8
  {{$content}}{{/content}}
9
9
  </div>
10
10
  {{/content-outer}}
@@ -1,7 +1,8 @@
1
- <div class="header-proposition">
2
- <div class="content">
3
- <nav id="proposition-menu">
4
- <a href="{{baseUrl}}" id="proposition-name">{{$journeyHeader}}{{/journeyHeader}}</a>
5
- </nav>
6
- </div>
1
+ <div class="govuk-header__content">
2
+ {{#startPageRedirectUrl}}
3
+ <a href="{{startPageRedirectUrl}}" class="govuk-header__link govuk-header__link--service-name" id="proposition-name">{{$journeyHeader}}{{/journeyHeader}}</a>
4
+ {{/startPageRedirectUrl}}
5
+ {{^startPageRedirectUrl}}
6
+ <a href="{{journeyHeaderURL}}" class="govuk-header__link govuk-header__link--service-name" id="proposition-name">{{$journeyHeader}}{{/journeyHeader}}</a>
7
+ {{/startPageRedirectUrl}}
7
8
  </div>
@@ -1,15 +1,15 @@
1
- <table>
2
- <thead>
3
- <tr>
1
+ <table class="govuk-table">
2
+ <thead class="govuk-table__head">
3
+ <tr class="govuk-table__row">
4
4
  {{#headers}}
5
- <th>{{.}}</th>
5
+ <th scope="col" class="govuk-table__header app-custom-class">{{.}}</th>
6
6
  {{/headers}}
7
7
  </tr>
8
8
  </thead>
9
9
  <tbody>
10
- <tr>
10
+ <tr class="govuk-table__row">
11
11
  {{#cookieName}}
12
- <td>{{cookieName}}</td>
12
+ <td scope="row" class="govuk-table__header">{{cookieName}}</td>
13
13
  {{/cookieName}}
14
14
  {{^cookieName}}
15
15
  <td>{{defaultCookieName}}</td>
@@ -5,10 +5,10 @@
5
5
  <dt class="confirm-label">{{label}}</dt>
6
6
  <dd class="confirm-value" data-value="{{value}}">{{value}}</dd>
7
7
  {{#changeLink}}
8
- <dd><span class="link"><a href="{{changeLink}}" id="{{field}}-change-{{index}}">{{#t}}buttons.change{{/t}} <span class="visuallyhidden">{{changeLinkDescription}} from {{value}}</span></a></span></dd>
8
+ <dd><span><a class="govuk-link" href="{{changeLink}}" id="{{field}}-change-{{index}}">{{#t}}buttons.change{{/t}} <span class="visuallyhidden">{{changeLinkDescription}} from {{value}}</span></a></span></dd>
9
9
  {{/changeLink}}
10
10
  {{^changeLink}}
11
- <dd><span class="link"><a href="{{baseUrl}}{{step}}/edit#{{field}}" id="{{field}}-change">{{#t}}buttons.change{{/t}} <span class="visuallyhidden">{{changeLinkDescription}} from {{value}}</span></a></span></dd>
11
+ <dd><span><a class="govuk-link" href="{{baseUrl}}{{step}}/edit#{{field}}" id="{{field}}-change">{{#t}}buttons.change{{/t}} <span class="visuallyhidden">{{changeLinkDescription}} from {{value}}</span></a></span></dd>
12
12
  {{/changeLink}}
13
13
  {{/isSeparator}}
14
14
  </div>
@@ -1,16 +1,16 @@
1
- <table>
2
- <thead>
3
- <tr>
1
+ <table class="govuk-table">
2
+ <thead class="govuk-table__head">
3
+ <tr class="govuk-table__row">
4
4
  {{#headers}}
5
- <th>{{.}}</th>
5
+ <th scope="col" class="govuk-table__header app-custom-class">{{.}}</th>
6
6
  {{/headers}}
7
7
  </tr>
8
8
  </thead>
9
- <tbody>
9
+ <tbody class="govuk-table__body">
10
10
  {{#rows}}
11
- <tr>
11
+ <tr class="govuk-table__row">
12
12
  {{#.}}
13
- <td>{{.}}</td>
13
+ <td class="govuk-table__cell">{{.}}</td>
14
14
  {{/.}}
15
15
  </tr>
16
16
  {{/rows}}
@@ -1,3 +1,3 @@
1
- <ul>
2
- {{$validation-list}}{{/validation-list}}
1
+ <ul class="govuk-list govuk-error-summary__list">
2
+ {{$validation-list}}{{/validation-list}}
3
3
  </ul>
@@ -1,24 +1,25 @@
1
1
  {{#errorlist.length}}
2
- <div class="validation-summary" tabindex="-1">
2
+ <div class="govuk-error-summary" aria-labelledby="error-summary-title" data-module="govuk-error-summary" role="alert" tabindex="-1">
3
3
  {{$errorlist-title}}
4
4
 
5
5
  {{#errorLength.single}}
6
- <h2 id="error-summary-title">{{#t}}errorlist.title.single{{/t}}</h2>
6
+ <h2 class="govuk-error-summary__title" id="error-summary-title">{{#t}}errorlist.title.single{{/t}}</h2>
7
7
  {{/errorLength.single}}
8
8
  {{#errorLength.multiple}}
9
- <h2 id="error-summary-title">{{#t}}errorlist.title.multiple{{/t}}</h2>
9
+ <h2 class="govuk-error-summary__title" id="error-summary-title">{{#t}}errorlist.title.multiple{{/t}}</h2>
10
10
  {{/errorLength.multiple}}
11
11
 
12
12
  {{/errorlist-title}}
13
-
14
- {{<partials-validation-list}}
15
- {{$validation-list}}
16
- {{#errorlist}}
17
- {{#message}}
18
- <li><a href="#{{key}}">{{ message }}</a></li>
19
- {{/message}}
20
- {{/errorlist}}
21
- {{/validation-list}}
22
- {{/partials-validation-list}}
13
+ <div class="govuk-error-summary__body">
14
+ {{<partials-validation-list}}
15
+ {{$validation-list}}
16
+ {{#errorlist}}
17
+ {{#message}}
18
+ <li><a href="#{{errorLinkId}}">{{ message }}</a></li>
19
+ {{/message}}
20
+ {{/errorlist}}
21
+ {{/validation-list}}
22
+ {{/partials-validation-list}}
23
+ </div>
23
24
  </div>
24
25
  {{/errorlist.length}}
@@ -0,0 +1,7 @@
1
+ <div class="govuk-warning-text">
2
+ <span class="govuk-warning-text__icon" aria-hidden="true">!</span>
3
+ <strong class="govuk-warning-text__text">
4
+ <span class="govuk-warning-text__assistive">Warning</span>
5
+ {{warning}}
6
+ </strong>
7
+ </div>
@@ -1,6 +1,7 @@
1
1
  {{<error}}
2
2
  {{$content}}
3
- <p>{{{content.message}}}</p>
4
- <a href="{{startLink}}" class="button" role="button">{{#t}}buttons.start-again{{/t}}</a>
3
+ <h1 class="govuk-heading-l">{{{content.title}}}</h1>
4
+ <h2 class="govuk-heading-m">{{{content.message}}}</h2>
5
+ <a href="{{startLink}}" class="govuk-button" role="button">{{#t}}buttons.start-again{{/t}}</a>
5
6
  {{/content}}
6
7
  {{/error}}
@@ -35,7 +35,7 @@ function showCookieBannerSubmitted() {
35
35
  document.getElementById('cookie-banner-info').style.display = 'none';
36
36
  document.getElementById('cookie-banner-actions').style.display = 'none';
37
37
  var cookieBannerSubmitted = document.getElementById('cookie-banner-submitted');
38
- cookieBannerSubmitted.style.display = 'flex';
38
+ cookieBannerSubmitted.style.display = 'block';
39
39
  cookieBannerSubmitted.focus();
40
40
  }
41
41
 
@@ -0,0 +1,121 @@
1
+ /* eslint-disable no-undef, no-param-reassign, no-unused-vars */
2
+ (function () {
3
+ 'use strict';
4
+ const root = this;
5
+ if(typeof root.GOVUK === 'undefined') { root.GOVUK = {}; }
6
+
7
+ /*
8
+ Cookie methods
9
+ ==============
10
+
11
+ Usage:
12
+
13
+ Setting a cookie:
14
+ GOVUK.cookie('hobnob', 'tasty', { days: 30 });
15
+
16
+ Reading a cookie:
17
+ GOVUK.cookie('hobnob');
18
+
19
+ Deleting a cookie:
20
+ GOVUK.cookie('hobnob', null);
21
+ */
22
+ GOVUK.cookie = function (name, value, options) {
23
+ if(typeof value !== 'undefined') {
24
+ if(value === false || value === null) {
25
+ return GOVUK.setCookie(name, '', { days: -1 });
26
+ }
27
+ return GOVUK.setCookie(name, value, options);
28
+ }
29
+ return GOVUK.getCookie(name);
30
+ };
31
+ GOVUK.setCookie = function (name, value, options) {
32
+ if(typeof options === 'undefined') {
33
+ options = {};
34
+ }
35
+ let cookieString = name + '=' + value + '; path=/';
36
+ if (options.days) {
37
+ const date = new Date();
38
+ date.setTime(date.getTime() + (options.days * 24 * 60 * 60 * 1000));
39
+ cookieString = cookieString + '; expires=' + date.toGMTString();
40
+ }
41
+ if (document.location.protocol === 'https:') {
42
+ cookieString = cookieString + '; Secure';
43
+ }
44
+ document.cookie = cookieString;
45
+ };
46
+ GOVUK.getCookie = function (name) {
47
+ const nameEQ = name + '=';
48
+ const cookies = document.cookie.split(';');
49
+ for(let i = 0, len = cookies.length; i < len; i++) {
50
+ let cookie = cookies[i];
51
+ while (cookie.charAt(0) === ' ') {
52
+ cookie = cookie.substring(1, cookie.length);
53
+ }
54
+ if (cookie.indexOf(nameEQ) === 0) {
55
+ return decodeURIComponent(cookie.substring(nameEQ.length));
56
+ }
57
+ }
58
+ return null;
59
+ };
60
+ }).call(this);
61
+ (function () {
62
+ 'use strict';
63
+ const root = this;
64
+ if (typeof root.GOVUK === 'undefined') { root.GOVUK = {}; }
65
+
66
+ GOVUK.addCookieMessage = function () {
67
+ const message = document.getElementById('global-cookie-message');
68
+
69
+ const hasCookieMessage = (message && GOVUK.cookie('seen_cookie_message') === null);
70
+
71
+ if (hasCookieMessage) {
72
+ message.style.display = 'block';
73
+ GOVUK.cookie('seen_cookie_message', 'yes', { days: 28 });
74
+
75
+ document.addEventListener('DOMContentLoaded', function (event) {
76
+ if (GOVUK.analytics && typeof GOVUK.analytics.trackEvent === 'function') {
77
+ GOVUK.analytics.trackEvent('cookieBanner', 'Cookie banner shown', {
78
+ value: 1,
79
+ nonInteraction: true
80
+ });
81
+ }
82
+ });
83
+ }
84
+ };
85
+ }).call(this)
86
+ ;
87
+ (function () {
88
+ 'use strict';
89
+
90
+ // add cookie message
91
+ if (window.GOVUK && GOVUK.addCookieMessage) {
92
+ GOVUK.addCookieMessage();
93
+ }
94
+
95
+ // header navigation toggle
96
+ if (document.querySelectorAll && document.addEventListener) {
97
+ const els = document.querySelectorAll('.js-header-toggle');
98
+ let i; let _i;
99
+ for(i = 0, _i = els.length; i < _i; i++) {
100
+ els[i].addEventListener('click', function (e) {
101
+ e.preventDefault();
102
+ const target = document.getElementById(this.getAttribute('href').substr(1));
103
+ const targetClass = target.getAttribute('class') || '';
104
+ const sourceClass = this.getAttribute('class') || '';
105
+
106
+ if(targetClass.indexOf('js-visible') !== -1) {
107
+ target.setAttribute('class', targetClass.replace(/(^|\s)js-visible(\s|$)/, ''));
108
+ } else {
109
+ target.setAttribute('class', targetClass + ' js-visible');
110
+ }
111
+ if(sourceClass.indexOf('js-visible') !== -1) {
112
+ this.setAttribute('class', sourceClass.replace(/(^|\s)js-visible(\s|$)/, ''));
113
+ } else {
114
+ this.setAttribute('class', sourceClass + ' js-visible');
115
+ }
116
+ this.setAttribute('aria-expanded', this.getAttribute('aria-expanded') !== 'true');
117
+ target.setAttribute('aria-hidden', target.getAttribute('aria-hidden') === 'false');
118
+ });
119
+ }
120
+ }
121
+ }).call(this);
@@ -1,4 +1,4 @@
1
- /* eslint-disable no-var */
1
+ /* eslint-disable no-var, vars-on-top, no-unused-vars */
2
2
  'use strict';
3
3
 
4
4
  var toolkit = require('../../../toolkit');
@@ -8,6 +8,11 @@ var formFocus = toolkit.formFocus;
8
8
  var characterCount = toolkit.characterCount;
9
9
  var validation = toolkit.validation;
10
10
 
11
+ var GOVUK = require('govuk-frontend');
12
+ GOVUK.initAll();
13
+ window.GOVUK = GOVUK;
14
+ var skipToMain = require('./skip-to-main');
15
+ var cookie = require('./govuk-cookies');
11
16
  var cookieSettings = require('./cookieSettings');
12
17
 
13
18
  toolkit.detailsSummary();
@@ -0,0 +1,19 @@
1
+ const skipToMain = function () {
2
+ const skipToMainLink = document.getElementById('skip-to-main');
3
+ const firstControlId = skipToMainLink.hash.split('#')[1] ? skipToMainLink.hash.split('#')[1] : 'main-content';
4
+ if(firstControlId === 'main-content') {
5
+ skipToMainLink.setAttribute('href', '#main-content');
6
+ }
7
+ if(firstControlId) {
8
+ // eslint-disable-next-line no-unused-vars
9
+ skipToMainLink.onclick = function (e) {
10
+ // here timeout added just to make this functionality asynchronous
11
+ // to focus on form as well as non form contents
12
+ setTimeout(() => {
13
+ const firstControl = document.getElementById(firstControlId);
14
+ firstControl.focus();
15
+ }, 10);
16
+ };
17
+ }
18
+ };
19
+ skipToMain();
@@ -10,7 +10,6 @@
10
10
  }
11
11
 
12
12
  #cookie-banner {
13
- max-width: 960px;
14
13
  margin: 0 15px;
15
14
  p {
16
15
  margin: 0;
@@ -62,3 +61,54 @@
62
61
  height: fit-content;
63
62
  }
64
63
  }
64
+
65
+ // the following are additional hof specific govuk cookie banner styling
66
+ .govuk-banner--success {
67
+ border-color: #00703c;
68
+ color: #00703c;
69
+ }
70
+
71
+ .govuk-banner {
72
+ border: 5px solid #1d70b8;
73
+ font-size: 0;
74
+ margin-bottom: 30px;
75
+ padding: 10px;
76
+ }
77
+
78
+ .govuk-banner__icon{
79
+ display: inline-block;
80
+ }
81
+
82
+ .govuk-banner__message {
83
+ font-family: "GDS Transport", Arial, sans-serif;
84
+ -webkit-font-smoothing: antialiased;
85
+ font-weight: 400;
86
+ font-size: 1rem;
87
+ line-height: 1.25;
88
+ color: #0b0c0c;
89
+ display: block;
90
+ overflow: hidden;
91
+ display: inline-block;
92
+ margin-left: 10px;
93
+ }
94
+
95
+ .govuk-banner__assistive {
96
+ position: absolute !important;
97
+ width: 1px !important;
98
+ height: 1px !important;
99
+ margin: 0 !important;
100
+ padding: 0 !important;
101
+ overflow: hidden !important;
102
+ clip: rect(0 0 0 0) !important;
103
+ clip-path: inset(50%) !important;
104
+ border: 0 !important;
105
+ white-space: nowrap !important;
106
+ }
107
+
108
+ .cookie-table-holder > table > tbody > tr > td:first-child{
109
+ font-weight:bold;
110
+ }
111
+
112
+ .js-enabled #global-cookie-message {
113
+ display: none;
114
+ }
@@ -12,6 +12,10 @@ $path: "/public/images/" !default;
12
12
  // https://github.com/alphagov/govuk_elements/blob/master/packages/govuk-elements-sass/public/sass/_elements.scss
13
13
  @import "govuk-elements-sass/public/sass/elements";
14
14
 
15
+ // Govuk frontend
16
+ // https://github.com/alphagov/govuk-frontend-docs
17
+ @import "govuk-frontend";
18
+
15
19
  // Custom
16
20
  @import "base";
17
21
  @import "layout";
@@ -22,10 +22,10 @@
22
22
  }
23
23
  }
24
24
 
25
- .validation-error {
25
+ .govuk-form-group--error {
26
26
  box-sizing: border-box;
27
27
  padding-left: $gutter-half - $validation-bdr-size;
28
- border-left: $validation-bdr-size-lg solid $error-colour;
28
+ //border-left: $validation-bdr-size-lg solid $error-colour;
29
29
 
30
30
  &:focus {
31
31
  outline: $focus-outline;
@@ -36,16 +36,16 @@
36
36
  }
37
37
  }
38
38
 
39
- .error-message {
39
+ .govuk-error-message {
40
40
  display: block;
41
41
  @include media(tablet) {
42
42
  margin-bottom: 0.5em;
43
43
  }
44
44
  @include bold-19;
45
- color: $error-colour;
45
+ //color: $error-colour;
46
46
  }
47
47
 
48
48
  .invalid-input,
49
- .validation-error .date-input {
49
+ .govuk-form-group--error .date-input {
50
50
  border: $validation-bdr-size solid $error-colour;
51
51
  }
@@ -30,12 +30,12 @@ CharacterCount.prototype.updateCount = function () {
30
30
  this.$maxlengthHint.innerHTML = 'You have ' + number + characterNoun + remainderSuffix;
31
31
 
32
32
  if (currentLength >= this.maxLength + 1) {
33
- helpers.removeClass(this.$maxlengthHint, 'form-hint');
34
- helpers.addClass(this.$maxlengthHint, 'error-message');
33
+ helpers.removeClass(this.$maxlengthHint, 'govuk-hint');
34
+ helpers.addClass(this.$maxlengthHint, 'govuk-error-message');
35
35
  helpers.addClass(this.$textarea, 'textarea-error');
36
36
  } else {
37
- helpers.addClass(this.$maxlengthHint, 'form-hint');
38
- helpers.removeClass(this.$maxlengthHint, 'error-message');
37
+ helpers.addClass(this.$maxlengthHint, 'govuk-hint');
38
+ helpers.removeClass(this.$maxlengthHint, 'govuk-error-message');
39
39
  helpers.removeClass(this.$textarea, 'textarea-error');
40
40
  }
41
41
  };
@@ -7,12 +7,14 @@ var groupBy = require('lodash').groupBy;
7
7
  var helpers = require('./helpers');
8
8
  var inputs; var groups;
9
9
  var toggleAttr = 'data-toggle';
10
- var hiddenClass = 'js-hidden';
10
+ var checkboxHiddenClass = 'govuk-checkboxes__conditional--hidden';
11
+ var radioHiddenClass = 'govuk-radios__conditional--hidden';
11
12
 
12
13
  function inputClicked(e, target) {
13
14
  target = target || helpers.target(e);
14
15
  var shown;
15
16
  each(groups[target.name], function (input) {
17
+ var hiddenClass = (input.type.match(/checkbox/)) ? checkboxHiddenClass : radioHiddenClass;
16
18
  var id = input.getAttribute('aria-controls');
17
19
  var toggle = document.getElementById(id);
18
20
  if (toggle) {
@@ -53,7 +53,11 @@ function setup(summary) {
53
53
  }
54
54
 
55
55
  function validation() {
56
- var summaries = helpers.getElementsByClass(document.getElementById('content'), 'div', 'validation-summary');
56
+ var summaries = [];
57
+
58
+ if (document.getElementById('content')) {
59
+ summaries = helpers.getElementsByClass(document.getElementById('content'), 'div', 'validation-summary');
60
+ }
57
61
 
58
62
  if (summaries.length) {
59
63
  summary = summaries[0];
@@ -22,7 +22,7 @@
22
22
  }
23
23
  }
24
24
 
25
- .validation-error {
25
+ .govuk-form-group--error {
26
26
  box-sizing: border-box;
27
27
  padding-left: $gutter-half - $validation-bdr-size;
28
28
  border-left: $validation-bdr-size-lg solid $error-colour;
@@ -36,7 +36,7 @@
36
36
  }
37
37
  }
38
38
 
39
- .error-message {
39
+ .govuk-error-message {
40
40
  display: block;
41
41
  @include media(tablet) {
42
42
  margin-bottom: 0.5em;
@@ -46,6 +46,6 @@
46
46
  }
47
47
 
48
48
  .invalid-input,
49
- .validation-error .date-input {
49
+ .govuk-form-group--error .date-input {
50
50
  border: $validation-bdr-size solid $error-colour;
51
51
  }