katalyst-govuk-formbuilder 1.7.0 → 1.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/builds/katalyst/govuk/formbuilder.css +56 -103
  3. data/app/assets/builds/katalyst/govuk/formbuilder.js +69 -58
  4. data/app/assets/builds/katalyst/govuk/formbuilder.min.js +12 -12
  5. data/lib/katalyst/govuk/formbuilder/extensions.rb +16 -0
  6. data/vendor/assets/stylesheets/govuk-frontend/dist/govuk/components/accordion/_index.scss +1 -1
  7. data/vendor/assets/stylesheets/govuk-frontend/dist/govuk/components/back-link/_index.scss +1 -1
  8. data/vendor/assets/stylesheets/govuk-frontend/dist/govuk/components/button/_index.scss +1 -1
  9. data/vendor/assets/stylesheets/govuk-frontend/dist/govuk/components/character-count/_index.scss +1 -1
  10. data/vendor/assets/stylesheets/govuk-frontend/dist/govuk/components/checkboxes/_index.scss +46 -53
  11. data/vendor/assets/stylesheets/govuk-frontend/dist/govuk/components/error-summary/_index.scss +1 -1
  12. data/vendor/assets/stylesheets/govuk-frontend/dist/govuk/components/fieldset/_index.scss +3 -3
  13. data/vendor/assets/stylesheets/govuk-frontend/dist/govuk/components/footer/_index.scss +1 -1
  14. data/vendor/assets/stylesheets/govuk-frontend/dist/govuk/components/header/_index.scss +24 -7
  15. data/vendor/assets/stylesheets/govuk-frontend/dist/govuk/components/input/_index.scss +5 -10
  16. data/vendor/assets/stylesheets/govuk-frontend/dist/govuk/components/label/_index.scss +3 -3
  17. data/vendor/assets/stylesheets/govuk-frontend/dist/govuk/components/notification-banner/_index.scss +2 -2
  18. data/vendor/assets/stylesheets/govuk-frontend/dist/govuk/components/panel/_index.scss +2 -2
  19. data/vendor/assets/stylesheets/govuk-frontend/dist/govuk/components/phase-banner/_index.scss +8 -2
  20. data/vendor/assets/stylesheets/govuk-frontend/dist/govuk/components/radios/_index.scss +52 -59
  21. data/vendor/assets/stylesheets/govuk-frontend/dist/govuk/components/skip-link/_index.scss +1 -1
  22. data/vendor/assets/stylesheets/govuk-frontend/dist/govuk/components/summary-list/_index.scss +1 -1
  23. data/vendor/assets/stylesheets/govuk-frontend/dist/govuk/components/table/_index.scss +14 -4
  24. data/vendor/assets/stylesheets/govuk-frontend/dist/govuk/components/tabs/_index.scss +1 -1
  25. data/vendor/assets/stylesheets/govuk-frontend/dist/govuk/core/_all.scss +1 -1
  26. data/vendor/assets/stylesheets/govuk-frontend/dist/govuk/core/_govuk-frontend-properties.scss +12 -0
  27. data/vendor/assets/stylesheets/govuk-frontend/dist/govuk/core/_typography.scss +3 -1
  28. data/vendor/assets/stylesheets/govuk-frontend/dist/govuk/helpers/_typography.scss +102 -24
  29. data/vendor/assets/stylesheets/govuk-frontend/dist/govuk/overrides/_typography.scss +11 -2
  30. data/vendor/assets/stylesheets/govuk-frontend/dist/govuk/settings/_measurements.scss +1 -1
  31. data/vendor/assets/stylesheets/govuk-frontend/dist/govuk/settings/_media-queries.scss +1 -1
  32. data/vendor/assets/stylesheets/govuk-frontend/dist/govuk/settings/_typography-responsive.scss +177 -13
  33. metadata +4 -4
  34. data/vendor/assets/stylesheets/govuk-frontend/dist/govuk/core/_govuk-frontend-version.scss +0 -7
@@ -1,4 +1,4 @@
1
- function t(...t){function e(t){const e={};return function t(s,i){for(const[n,o]of Object.entries(s)){const s=i?`${i}.${n}`:n;o&&"object"==typeof o?t(o,s):e[s]=o}}(t),e}const s={};for(const i of t){const t=e(i);for(const[e,i]of Object.entries(t))s[e]=i}return s}function e(t,e){const s={};for(const[i,n]of Object.entries(t)){const t=i.split(".");if(t[0]===e){t.length>1&&t.shift();s[t.join(".")]=n}}return s}function s(t){if(t.includes("#"))return t.split("#").pop()}function i(t=document.body){return!!t&&t.classList.contains("govuk-frontend-supported")}function n(t){if("string"!=typeof t)return t;const e=t.trim();return"true"===e||"false"!==e&&(e.length>0&&isFinite(Number(e))?Number(e):t)}function o(t){const e={};for(const[s,i]of Object.entries(t))e[s]=n(i);return e}class a extends Error{constructor(...t){super(...t),this.name="GOVUKFrontendError"}}class r extends a{constructor(t=document.body){const e="noModule"in HTMLScriptElement.prototype?'GOV.UK Frontend initialised without `<body class="govuk-frontend-supported">` from template `<script>` snippet':"GOV.UK Frontend is not supported in this browser";super(t?e:'GOV.UK Frontend initialised without `<script type="module">`'),this.name="SupportError"}}class l extends a{constructor(...t){super(...t),this.name="ConfigError"}}class h extends a{constructor(t){let e="string"==typeof t?t:"";if("object"==typeof t){const{componentName:s,identifier:i,element:n,expectedType:o}=t;e=`${s}: ${i}`,e+=n?` is not of type ${null!=o?o:"HTMLElement"}`:" not found"}super(e),this.name="ElementError"}}class c{constructor(){this.checkSupport()}checkSupport(){if(!i())throw new r}}class d{constructor(t={},e={}){var s;this.translations=void 0,this.locale=void 0,this.translations=t,this.locale=null!=(s=e.locale)?s:document.documentElement.lang||"en"}t(t,e){if(!t)throw new Error("i18n: lookup key missing");"number"==typeof(null==e?void 0:e.count)&&(t=`${t}.${this.getPluralSuffix(t,e.count)}`);const s=this.translations[t];if("string"==typeof s){if(s.match(/%{(.\S+)}/)){if(!e)throw new Error("i18n: cannot replace placeholders in string if no option data provided");return this.replacePlaceholders(s,e)}return s}return t}replacePlaceholders(t,e){const s=Intl.NumberFormat.supportedLocalesOf(this.locale).length?new Intl.NumberFormat(this.locale):void 0;return t.replace(/%{(.\S+)}/g,(function(t,i){if(Object.prototype.hasOwnProperty.call(e,i)){const t=e[i];return!1===t||"number"!=typeof t&&"string"!=typeof t?"":"number"==typeof t?s?s.format(t):`${t}`:t}throw new Error(`i18n: no data found to replace ${t} placeholder in string`)}))}hasIntlPluralRulesSupport(){return Boolean("PluralRules"in window.Intl&&Intl.PluralRules.supportedLocalesOf(this.locale).length)}getPluralSuffix(t,e){if(e=Number(e),!isFinite(e))return"other";const s=this.hasIntlPluralRulesSupport()?new Intl.PluralRules(this.locale).select(e):this.selectPluralFormUsingFallbackRules(e);if(`${t}.${s}`in this.translations)return s;if(`${t}.other`in this.translations)return console.warn(`i18n: Missing plural form ".${s}" for "${this.locale}" locale. Falling back to ".other".`),"other";throw new Error(`i18n: Plural form ".other" is required for "${this.locale}" locale`)}selectPluralFormUsingFallbackRules(t){t=Math.abs(Math.floor(t));const e=this.getPluralRulesForLocale();return e?d.pluralRules[e](t):"other"}getPluralRulesForLocale(){const t=this.locale.split("-")[0];for(const e in d.pluralRulesMap){const s=d.pluralRulesMap[e];if(s.includes(this.locale)||s.includes(t))return e}}}d.pluralRulesMap={arabic:["ar"],chinese:["my","zh","id","ja","jv","ko","ms","th","vi"],french:["hy","bn","fr","gu","hi","fa","pa","zu"],german:["af","sq","az","eu","bg","ca","da","nl","en","et","fi","ka","de","el","hu","lb","no","so","sw","sv","ta","te","tr","ur"],irish:["ga"],russian:["ru","uk"],scottish:["gd"],spanish:["pt-PT","it","es"],welsh:["cy"]},d.pluralRules={arabic:t=>0===t?"zero":1===t?"one":2===t?"two":t%100>=3&&t%100<=10?"few":t%100>=11&&t%100<=99?"many":"other",chinese:()=>"other",french:t=>0===t||1===t?"one":"other",german:t=>1===t?"one":"other",irish:t=>1===t?"one":2===t?"two":t>=3&&t<=6?"few":t>=7&&t<=10?"many":"other",russian(t){const e=t%100,s=e%10;return 1===s&&11!==e?"one":s>=2&&s<=4&&!(e>=12&&e<=14)?"few":0===s||s>=5&&s<=9||e>=11&&e<=14?"many":"other"},scottish:t=>1===t||11===t?"one":2===t||12===t?"two":t>=3&&t<=10||t>=13&&t<=19?"few":"other",spanish:t=>1===t?"one":t%1e6==0&&0!==t?"many":"other",welsh:t=>0===t?"zero":1===t?"one":2===t?"two":3===t?"few":6===t?"many":"other"};
1
+ function t(...t){function e(t){const e={};return function t(s,i){for(const[n,o]of Object.entries(s)){const s=i?`${i}.${n}`:n;o&&"object"==typeof o?t(o,s):e[s]=o}}(t),e}const s={};for(const i of t){const t=e(i);for(const[e,i]of Object.entries(t))s[e]=i}return s}function e(t,e){const s={};for(const[i,n]of Object.entries(t)){const t=i.split(".");if(t[0]===e){t.length>1&&t.shift();s[t.join(".")]=n}}return s}function s(t){if(t.includes("#"))return t.split("#").pop()}function i(t){const e=`--govuk-frontend-breakpoint-${t}`;return{property:e,value:window.getComputedStyle(document.documentElement).getPropertyValue(e)||void 0}}function n(t,e={}){var s;const i=t.getAttribute("tabindex");function n(){var s;null==(s=e.onBlur)||s.call(t),i||t.removeAttribute("tabindex")}i||t.setAttribute("tabindex","-1"),t.addEventListener("focus",(function(){t.addEventListener("blur",n,{once:!0})}),{once:!0}),null==(s=e.onBeforeFocus)||s.call(t),t.focus()}function o(t=document.body){return!!t&&t.classList.contains("govuk-frontend-supported")}function a(t){if("string"!=typeof t)return t;const e=t.trim();return"true"===e||"false"!==e&&(e.length>0&&isFinite(Number(e))?Number(e):t)}function r(t){const e={};for(const[s,i]of Object.entries(t))e[s]=a(i);return e}class l extends Error{constructor(...t){super(...t),this.name="GOVUKFrontendError"}}class c extends l{constructor(t=document.body){const e="noModule"in HTMLScriptElement.prototype?'GOV.UK Frontend initialised without `<body class="govuk-frontend-supported">` from template `<script>` snippet':"GOV.UK Frontend is not supported in this browser";super(t?e:'GOV.UK Frontend initialised without `<script type="module">`'),this.name="SupportError"}}class h extends l{constructor(...t){super(...t),this.name="ConfigError"}}class u extends l{constructor(t){let e="string"==typeof t?t:"";if("object"==typeof t){const{componentName:s,identifier:i,element:n,expectedType:o}=t;e=`${s}: ${i}`,e+=n?` is not of type ${null!=o?o:"HTMLElement"}`:" not found"}super(e),this.name="ElementError"}}class d{constructor(){this.checkSupport()}checkSupport(){if(!o())throw new c}}class m{constructor(t={},e={}){var s;this.translations=void 0,this.locale=void 0,this.translations=t,this.locale=null!=(s=e.locale)?s:document.documentElement.lang||"en"}t(t,e){if(!t)throw new Error("i18n: lookup key missing");"number"==typeof(null==e?void 0:e.count)&&(t=`${t}.${this.getPluralSuffix(t,e.count)}`);const s=this.translations[t];if("string"==typeof s){if(s.match(/%{(.\S+)}/)){if(!e)throw new Error("i18n: cannot replace placeholders in string if no option data provided");return this.replacePlaceholders(s,e)}return s}return t}replacePlaceholders(t,e){const s=Intl.NumberFormat.supportedLocalesOf(this.locale).length?new Intl.NumberFormat(this.locale):void 0;return t.replace(/%{(.\S+)}/g,(function(t,i){if(Object.prototype.hasOwnProperty.call(e,i)){const t=e[i];return!1===t||"number"!=typeof t&&"string"!=typeof t?"":"number"==typeof t?s?s.format(t):`${t}`:t}throw new Error(`i18n: no data found to replace ${t} placeholder in string`)}))}hasIntlPluralRulesSupport(){return Boolean("PluralRules"in window.Intl&&Intl.PluralRules.supportedLocalesOf(this.locale).length)}getPluralSuffix(t,e){if(e=Number(e),!isFinite(e))return"other";const s=this.hasIntlPluralRulesSupport()?new Intl.PluralRules(this.locale).select(e):this.selectPluralFormUsingFallbackRules(e);if(`${t}.${s}`in this.translations)return s;if(`${t}.other`in this.translations)return console.warn(`i18n: Missing plural form ".${s}" for "${this.locale}" locale. Falling back to ".other".`),"other";throw new Error(`i18n: Plural form ".other" is required for "${this.locale}" locale`)}selectPluralFormUsingFallbackRules(t){t=Math.abs(Math.floor(t));const e=this.getPluralRulesForLocale();return e?m.pluralRules[e](t):"other"}getPluralRulesForLocale(){const t=this.locale.split("-")[0];for(const e in m.pluralRulesMap){const s=m.pluralRulesMap[e];if(s.includes(this.locale)||s.includes(t))return e}}}m.pluralRulesMap={arabic:["ar"],chinese:["my","zh","id","ja","jv","ko","ms","th","vi"],french:["hy","bn","fr","gu","hi","fa","pa","zu"],german:["af","sq","az","eu","bg","ca","da","nl","en","et","fi","ka","de","el","hu","lb","no","so","sw","sv","ta","te","tr","ur"],irish:["ga"],russian:["ru","uk"],scottish:["gd"],spanish:["pt-PT","it","es"],welsh:["cy"]},m.pluralRules={arabic:t=>0===t?"zero":1===t?"one":2===t?"two":t%100>=3&&t%100<=10?"few":t%100>=11&&t%100<=99?"many":"other",chinese:()=>"other",french:t=>0===t||1===t?"one":"other",german:t=>1===t?"one":"other",irish:t=>1===t?"one":2===t?"two":t>=3&&t<=6?"few":t>=7&&t<=10?"many":"other",russian(t){const e=t%100,s=e%10;return 1===s&&11!==e?"one":s>=2&&s<=4&&!(e>=12&&e<=14)?"few":0===s||s>=5&&s<=9||e>=11&&e<=14?"many":"other"},scottish:t=>1===t||11===t?"one":2===t||12===t?"two":t>=3&&t<=10||t>=13&&t<=19?"few":"other",spanish:t=>1===t?"one":t%1e6==0&&0!==t?"many":"other",welsh:t=>0===t?"zero":1===t?"one":2===t?"two":3===t?"few":6===t?"many":"other"};
2
2
  /**
3
3
  * Accordion component
4
4
  *
@@ -13,13 +13,13 @@ function t(...t){function e(t){const e={};return function t(s,i){for(const[n,o]o
13
13
  *
14
14
  * @preserve
15
15
  */
16
- class u extends c{constructor(s,i={}){if(super(),this.$module=void 0,this.config=void 0,this.i18n=void 0,this.controlsClass="govuk-accordion__controls",this.showAllClass="govuk-accordion__show-all",this.showAllTextClass="govuk-accordion__show-all-text",this.sectionClass="govuk-accordion__section",this.sectionExpandedClass="govuk-accordion__section--expanded",this.sectionButtonClass="govuk-accordion__section-button",this.sectionHeaderClass="govuk-accordion__section-header",this.sectionHeadingClass="govuk-accordion__section-heading",this.sectionHeadingDividerClass="govuk-accordion__section-heading-divider",this.sectionHeadingTextClass="govuk-accordion__section-heading-text",this.sectionHeadingTextFocusClass="govuk-accordion__section-heading-text-focus",this.sectionShowHideToggleClass="govuk-accordion__section-toggle",this.sectionShowHideToggleFocusClass="govuk-accordion__section-toggle-focus",this.sectionShowHideTextClass="govuk-accordion__section-toggle-text",this.upChevronIconClass="govuk-accordion-nav__chevron",this.downChevronIconClass="govuk-accordion-nav__chevron--down",this.sectionSummaryClass="govuk-accordion__section-summary",this.sectionSummaryFocusClass="govuk-accordion__section-summary-focus",this.sectionContentClass="govuk-accordion__section-content",this.$sections=void 0,this.browserSupportsSessionStorage=!1,this.$showAllButton=null,this.$showAllIcon=null,this.$showAllText=null,!(s instanceof HTMLElement))throw new h({componentName:"Accordion",element:s,identifier:"Root element (`$module`)"});this.$module=s,this.config=t(u.defaults,i,o(s.dataset)),this.i18n=new d(e(this.config,"i18n"));const n=this.$module.querySelectorAll(`.${this.sectionClass}`);if(!n.length)throw new h({componentName:"Accordion",identifier:`Sections (\`<div class="${this.sectionClass}">\`)`});this.$sections=n,this.browserSupportsSessionStorage=m.checkForSessionStorage(),this.initControls(),this.initSectionHeaders();const a=this.checkIfAllSectionsOpen();this.updateShowAllButton(a)}initControls(){this.$showAllButton=document.createElement("button"),this.$showAllButton.setAttribute("type","button"),this.$showAllButton.setAttribute("class",this.showAllClass),this.$showAllButton.setAttribute("aria-expanded","false"),this.$showAllIcon=document.createElement("span"),this.$showAllIcon.classList.add(this.upChevronIconClass),this.$showAllButton.appendChild(this.$showAllIcon);const t=document.createElement("div");t.setAttribute("class",this.controlsClass),t.appendChild(this.$showAllButton),this.$module.insertBefore(t,this.$module.firstChild),this.$showAllText=document.createElement("span"),this.$showAllText.classList.add(this.showAllTextClass),this.$showAllButton.appendChild(this.$showAllText),this.$showAllButton.addEventListener("click",(()=>this.onShowOrHideAllToggle())),"onbeforematch"in document&&document.addEventListener("beforematch",(t=>this.onBeforeMatch(t)))}initSectionHeaders(){this.$sections.forEach(((t,e)=>{const s=t.querySelector(`.${this.sectionHeaderClass}`);if(!s)throw new h({componentName:"Accordion",identifier:`Section headers (\`<div class="${this.sectionHeaderClass}">\`)`});this.constructHeaderMarkup(s,e),this.setExpanded(this.isExpanded(t),t),s.addEventListener("click",(()=>this.onSectionToggle(t))),this.setInitialState(t)}))}constructHeaderMarkup(t,e){const s=t.querySelector(`.${this.sectionButtonClass}`),i=t.querySelector(`.${this.sectionHeadingClass}`),n=t.querySelector(`.${this.sectionSummaryClass}`);if(!i)throw new h({componentName:"Accordion",identifier:`Section heading (\`.${this.sectionHeadingClass}\`)`});if(!s)throw new h({componentName:"Accordion",identifier:`Section button placeholder (\`<span class="${this.sectionButtonClass}">\`)`});const o=document.createElement("button");o.setAttribute("type","button"),o.setAttribute("aria-controls",`${this.$module.id}-content-${e+1}`);for(const t of Array.from(s.attributes))"id"!==t.nodeName&&o.setAttribute(t.nodeName,`${t.nodeValue}`);const a=document.createElement("span");a.classList.add(this.sectionHeadingTextClass),a.id=s.id;const r=document.createElement("span");r.classList.add(this.sectionHeadingTextFocusClass),a.appendChild(r),r.innerHTML=s.innerHTML;const l=document.createElement("span");l.classList.add(this.sectionShowHideToggleClass),l.setAttribute("data-nosnippet","");const c=document.createElement("span");c.classList.add(this.sectionShowHideToggleFocusClass),l.appendChild(c);const d=document.createElement("span"),u=document.createElement("span");if(u.classList.add(this.upChevronIconClass),c.appendChild(u),d.classList.add(this.sectionShowHideTextClass),c.appendChild(d),o.appendChild(a),o.appendChild(this.getButtonPunctuationEl()),null!=n&&n.parentNode){const t=document.createElement("span"),e=document.createElement("span");e.classList.add(this.sectionSummaryFocusClass),t.appendChild(e);for(const e of Array.from(n.attributes))t.setAttribute(e.nodeName,`${e.nodeValue}`);e.innerHTML=n.innerHTML,n.parentNode.replaceChild(t,n),o.appendChild(t),o.appendChild(this.getButtonPunctuationEl())}o.appendChild(l),i.removeChild(s),i.appendChild(o)}onBeforeMatch(t){const e=t.target;if(!(e instanceof Element))return;const s=e.closest(`.${this.sectionClass}`);s&&this.setExpanded(!0,s)}onSectionToggle(t){const e=this.isExpanded(t);this.setExpanded(!e,t),this.storeState(t)}onShowOrHideAllToggle(){const t=!this.checkIfAllSectionsOpen();this.$sections.forEach((e=>{this.setExpanded(t,e),this.storeState(e)})),this.updateShowAllButton(t)}setExpanded(t,e){const s=e.querySelector(`.${this.upChevronIconClass}`),i=e.querySelector(`.${this.sectionShowHideTextClass}`),n=e.querySelector(`.${this.sectionButtonClass}`),o=e.querySelector(`.${this.sectionContentClass}`);if(!o)throw new h({componentName:"Accordion",identifier:`Section content (\`<div class="${this.sectionContentClass}">\`)`});if(!s||!i||!n)return;const a=t?this.i18n.t("hideSection"):this.i18n.t("showSection");i.textContent=a,n.setAttribute("aria-expanded",`${t}`);const r=[],l=e.querySelector(`.${this.sectionHeadingTextClass}`);l&&r.push(`${l.textContent}`.trim());const c=e.querySelector(`.${this.sectionSummaryClass}`);c&&r.push(`${c.textContent}`.trim());const d=t?this.i18n.t("hideSectionAriaLabel"):this.i18n.t("showSectionAriaLabel");r.push(d),n.setAttribute("aria-label",r.join(" , ")),t?(o.removeAttribute("hidden"),e.classList.add(this.sectionExpandedClass),s.classList.remove(this.downChevronIconClass)):(o.setAttribute("hidden","until-found"),e.classList.remove(this.sectionExpandedClass),s.classList.add(this.downChevronIconClass));const u=this.checkIfAllSectionsOpen();this.updateShowAllButton(u)}isExpanded(t){return t.classList.contains(this.sectionExpandedClass)}checkIfAllSectionsOpen(){return this.$sections.length===this.$module.querySelectorAll(`.${this.sectionExpandedClass}`).length}updateShowAllButton(t){this.$showAllButton&&this.$showAllText&&this.$showAllIcon&&(this.$showAllButton.setAttribute("aria-expanded",t.toString()),this.$showAllText.textContent=t?this.i18n.t("hideAllSections"):this.i18n.t("showAllSections"),this.$showAllIcon.classList.toggle(this.downChevronIconClass,!t))}storeState(t){if(this.browserSupportsSessionStorage&&this.config.rememberExpanded){const e=t.querySelector(`.${this.sectionButtonClass}`);if(e){const t=e.getAttribute("aria-controls"),s=e.getAttribute("aria-expanded");t&&s&&window.sessionStorage.setItem(t,s)}}}setInitialState(t){if(this.browserSupportsSessionStorage&&this.config.rememberExpanded){const e=t.querySelector(`.${this.sectionButtonClass}`);if(e){const s=e.getAttribute("aria-controls"),i=s?window.sessionStorage.getItem(s):null;null!==i&&this.setExpanded("true"===i,t)}}}getButtonPunctuationEl(){const t=document.createElement("span");return t.classList.add("govuk-visually-hidden",this.sectionHeadingDividerClass),t.innerHTML=", ",t}}u.moduleName="govuk-accordion",u.defaults=Object.freeze({i18n:{hideAllSections:"Hide all sections",hideSection:"Hide",hideSectionAriaLabel:"Hide this section",showAllSections:"Show all sections",showSection:"Show",showSectionAriaLabel:"Show this section"},rememberExpanded:!0});const m={checkForSessionStorage:function(){const t="this is the test string";let e;try{return window.sessionStorage.setItem(t,t),e=window.sessionStorage.getItem(t)===t.toString(),window.sessionStorage.removeItem(t),e}catch(t){return!1}}};
16
+ class p extends d{constructor(s,i={}){if(super(),this.$module=void 0,this.config=void 0,this.i18n=void 0,this.controlsClass="govuk-accordion__controls",this.showAllClass="govuk-accordion__show-all",this.showAllTextClass="govuk-accordion__show-all-text",this.sectionClass="govuk-accordion__section",this.sectionExpandedClass="govuk-accordion__section--expanded",this.sectionButtonClass="govuk-accordion__section-button",this.sectionHeaderClass="govuk-accordion__section-header",this.sectionHeadingClass="govuk-accordion__section-heading",this.sectionHeadingDividerClass="govuk-accordion__section-heading-divider",this.sectionHeadingTextClass="govuk-accordion__section-heading-text",this.sectionHeadingTextFocusClass="govuk-accordion__section-heading-text-focus",this.sectionShowHideToggleClass="govuk-accordion__section-toggle",this.sectionShowHideToggleFocusClass="govuk-accordion__section-toggle-focus",this.sectionShowHideTextClass="govuk-accordion__section-toggle-text",this.upChevronIconClass="govuk-accordion-nav__chevron",this.downChevronIconClass="govuk-accordion-nav__chevron--down",this.sectionSummaryClass="govuk-accordion__section-summary",this.sectionSummaryFocusClass="govuk-accordion__section-summary-focus",this.sectionContentClass="govuk-accordion__section-content",this.$sections=void 0,this.browserSupportsSessionStorage=!1,this.$showAllButton=null,this.$showAllIcon=null,this.$showAllText=null,!(s instanceof HTMLElement))throw new u({componentName:"Accordion",element:s,identifier:"Root element (`$module`)"});this.$module=s,this.config=t(p.defaults,i,r(s.dataset)),this.i18n=new m(e(this.config,"i18n"));const n=this.$module.querySelectorAll(`.${this.sectionClass}`);if(!n.length)throw new u({componentName:"Accordion",identifier:`Sections (\`<div class="${this.sectionClass}">\`)`});this.$sections=n,this.browserSupportsSessionStorage=g.checkForSessionStorage(),this.initControls(),this.initSectionHeaders();const o=this.checkIfAllSectionsOpen();this.updateShowAllButton(o)}initControls(){this.$showAllButton=document.createElement("button"),this.$showAllButton.setAttribute("type","button"),this.$showAllButton.setAttribute("class",this.showAllClass),this.$showAllButton.setAttribute("aria-expanded","false"),this.$showAllIcon=document.createElement("span"),this.$showAllIcon.classList.add(this.upChevronIconClass),this.$showAllButton.appendChild(this.$showAllIcon);const t=document.createElement("div");t.setAttribute("class",this.controlsClass),t.appendChild(this.$showAllButton),this.$module.insertBefore(t,this.$module.firstChild),this.$showAllText=document.createElement("span"),this.$showAllText.classList.add(this.showAllTextClass),this.$showAllButton.appendChild(this.$showAllText),this.$showAllButton.addEventListener("click",(()=>this.onShowOrHideAllToggle())),"onbeforematch"in document&&document.addEventListener("beforematch",(t=>this.onBeforeMatch(t)))}initSectionHeaders(){this.$sections.forEach(((t,e)=>{const s=t.querySelector(`.${this.sectionHeaderClass}`);if(!s)throw new u({componentName:"Accordion",identifier:`Section headers (\`<div class="${this.sectionHeaderClass}">\`)`});this.constructHeaderMarkup(s,e),this.setExpanded(this.isExpanded(t),t),s.addEventListener("click",(()=>this.onSectionToggle(t))),this.setInitialState(t)}))}constructHeaderMarkup(t,e){const s=t.querySelector(`.${this.sectionButtonClass}`),i=t.querySelector(`.${this.sectionHeadingClass}`),n=t.querySelector(`.${this.sectionSummaryClass}`);if(!i)throw new u({componentName:"Accordion",identifier:`Section heading (\`.${this.sectionHeadingClass}\`)`});if(!s)throw new u({componentName:"Accordion",identifier:`Section button placeholder (\`<span class="${this.sectionButtonClass}">\`)`});const o=document.createElement("button");o.setAttribute("type","button"),o.setAttribute("aria-controls",`${this.$module.id}-content-${e+1}`);for(const t of Array.from(s.attributes))"id"!==t.nodeName&&o.setAttribute(t.nodeName,`${t.nodeValue}`);const a=document.createElement("span");a.classList.add(this.sectionHeadingTextClass),a.id=s.id;const r=document.createElement("span");r.classList.add(this.sectionHeadingTextFocusClass),a.appendChild(r),r.innerHTML=s.innerHTML;const l=document.createElement("span");l.classList.add(this.sectionShowHideToggleClass),l.setAttribute("data-nosnippet","");const c=document.createElement("span");c.classList.add(this.sectionShowHideToggleFocusClass),l.appendChild(c);const h=document.createElement("span"),d=document.createElement("span");if(d.classList.add(this.upChevronIconClass),c.appendChild(d),h.classList.add(this.sectionShowHideTextClass),c.appendChild(h),o.appendChild(a),o.appendChild(this.getButtonPunctuationEl()),null!=n&&n.parentNode){const t=document.createElement("span"),e=document.createElement("span");e.classList.add(this.sectionSummaryFocusClass),t.appendChild(e);for(const e of Array.from(n.attributes))t.setAttribute(e.nodeName,`${e.nodeValue}`);e.innerHTML=n.innerHTML,n.parentNode.replaceChild(t,n),o.appendChild(t),o.appendChild(this.getButtonPunctuationEl())}o.appendChild(l),i.removeChild(s),i.appendChild(o)}onBeforeMatch(t){const e=t.target;if(!(e instanceof Element))return;const s=e.closest(`.${this.sectionClass}`);s&&this.setExpanded(!0,s)}onSectionToggle(t){const e=this.isExpanded(t);this.setExpanded(!e,t),this.storeState(t)}onShowOrHideAllToggle(){const t=!this.checkIfAllSectionsOpen();this.$sections.forEach((e=>{this.setExpanded(t,e),this.storeState(e)})),this.updateShowAllButton(t)}setExpanded(t,e){const s=e.querySelector(`.${this.upChevronIconClass}`),i=e.querySelector(`.${this.sectionShowHideTextClass}`),n=e.querySelector(`.${this.sectionButtonClass}`),o=e.querySelector(`.${this.sectionContentClass}`);if(!o)throw new u({componentName:"Accordion",identifier:`Section content (\`<div class="${this.sectionContentClass}">\`)`});if(!s||!i||!n)return;const a=t?this.i18n.t("hideSection"):this.i18n.t("showSection");i.textContent=a,n.setAttribute("aria-expanded",`${t}`);const r=[],l=e.querySelector(`.${this.sectionHeadingTextClass}`);l&&r.push(`${l.textContent}`.trim());const c=e.querySelector(`.${this.sectionSummaryClass}`);c&&r.push(`${c.textContent}`.trim());const h=t?this.i18n.t("hideSectionAriaLabel"):this.i18n.t("showSectionAriaLabel");r.push(h),n.setAttribute("aria-label",r.join(" , ")),t?(o.removeAttribute("hidden"),e.classList.add(this.sectionExpandedClass),s.classList.remove(this.downChevronIconClass)):(o.setAttribute("hidden","until-found"),e.classList.remove(this.sectionExpandedClass),s.classList.add(this.downChevronIconClass));const d=this.checkIfAllSectionsOpen();this.updateShowAllButton(d)}isExpanded(t){return t.classList.contains(this.sectionExpandedClass)}checkIfAllSectionsOpen(){return this.$sections.length===this.$module.querySelectorAll(`.${this.sectionExpandedClass}`).length}updateShowAllButton(t){this.$showAllButton&&this.$showAllText&&this.$showAllIcon&&(this.$showAllButton.setAttribute("aria-expanded",t.toString()),this.$showAllText.textContent=t?this.i18n.t("hideAllSections"):this.i18n.t("showAllSections"),this.$showAllIcon.classList.toggle(this.downChevronIconClass,!t))}storeState(t){if(this.browserSupportsSessionStorage&&this.config.rememberExpanded){const e=t.querySelector(`.${this.sectionButtonClass}`);if(e){const t=e.getAttribute("aria-controls"),s=e.getAttribute("aria-expanded");t&&s&&window.sessionStorage.setItem(t,s)}}}setInitialState(t){if(this.browserSupportsSessionStorage&&this.config.rememberExpanded){const e=t.querySelector(`.${this.sectionButtonClass}`);if(e){const s=e.getAttribute("aria-controls"),i=s?window.sessionStorage.getItem(s):null;null!==i&&this.setExpanded("true"===i,t)}}}getButtonPunctuationEl(){const t=document.createElement("span");return t.classList.add("govuk-visually-hidden",this.sectionHeadingDividerClass),t.innerHTML=", ",t}}p.moduleName="govuk-accordion",p.defaults=Object.freeze({i18n:{hideAllSections:"Hide all sections",hideSection:"Hide",hideSectionAriaLabel:"Hide this section",showAllSections:"Show all sections",showSection:"Show",showSectionAriaLabel:"Show this section"},rememberExpanded:!0});const g={checkForSessionStorage:function(){const t="this is the test string";let e;try{return window.sessionStorage.setItem(t,t),e=window.sessionStorage.getItem(t)===t.toString(),window.sessionStorage.removeItem(t),e}catch(t){return!1}}};
17
17
  /**
18
18
  * JavaScript enhancements for the Button component
19
19
  *
20
20
  * @preserve
21
21
  */
22
- class p extends c{constructor(e,s={}){if(super(),this.$module=void 0,this.config=void 0,this.debounceFormSubmitTimer=null,!(e instanceof HTMLElement))throw new h({componentName:"Button",element:e,identifier:"Root element (`$module`)"});this.$module=e,this.config=t(p.defaults,s,o(e.dataset)),this.$module.addEventListener("keydown",(t=>this.handleKeyDown(t))),this.$module.addEventListener("click",(t=>this.debounce(t)))}handleKeyDown(t){const e=t.target;32===t.keyCode&&e instanceof HTMLElement&&"button"===e.getAttribute("role")&&(t.preventDefault(),e.click())}debounce(t){if(this.config.preventDoubleClick)return this.debounceFormSubmitTimer?(t.preventDefault(),!1):void(this.debounceFormSubmitTimer=window.setTimeout((()=>{this.debounceFormSubmitTimer=null}),1e3))}}function g(t,e){const s=t.closest(`[${e}]`);return s?s.getAttribute(e):null}
22
+ class f extends d{constructor(e,s={}){if(super(),this.$module=void 0,this.config=void 0,this.debounceFormSubmitTimer=null,!(e instanceof HTMLElement))throw new u({componentName:"Button",element:e,identifier:"Root element (`$module`)"});this.$module=e,this.config=t(f.defaults,s,r(e.dataset)),this.$module.addEventListener("keydown",(t=>this.handleKeyDown(t))),this.$module.addEventListener("click",(t=>this.debounce(t)))}handleKeyDown(t){const e=t.target;32===t.keyCode&&e instanceof HTMLElement&&"button"===e.getAttribute("role")&&(t.preventDefault(),e.click())}debounce(t){if(this.config.preventDoubleClick)return this.debounceFormSubmitTimer?(t.preventDefault(),!1):void(this.debounceFormSubmitTimer=window.setTimeout((()=>{this.debounceFormSubmitTimer=null}),1e3))}}function v(t,e){const s=t.closest(`[${e}]`);return s?s.getAttribute(e):null}
23
23
  /**
24
24
  * Character count component
25
25
  *
@@ -31,13 +31,13 @@ class p extends c{constructor(e,s={}){if(super(),this.$module=void 0,this.config
31
31
  * of the available characters/words has been entered.
32
32
  *
33
33
  * @preserve
34
- */p.moduleName="govuk-button",p.defaults=Object.freeze({preventDoubleClick:!1});class f extends c{constructor(s,i={}){var n,a;if(super(),this.$module=void 0,this.$textarea=void 0,this.$visibleCountMessage=void 0,this.$screenReaderCountMessage=void 0,this.lastInputTimestamp=null,this.lastInputValue="",this.valueChecker=null,this.config=void 0,this.i18n=void 0,this.maxLength=void 0,!(s instanceof HTMLElement))throw new h({componentName:"Character count",element:s,identifier:"Root element (`$module`)"});const r=s.querySelector(".govuk-js-character-count");if(!(r instanceof HTMLTextAreaElement||r instanceof HTMLInputElement))throw new h({componentName:"Character count",element:r,expectedType:"HTMLTextareaElement or HTMLInputElement",identifier:"Form field (`.govuk-js-character-count`)"});const c=o(s.dataset);let u={};("maxwords"in c||"maxlength"in c)&&(u={maxlength:void 0,maxwords:void 0}),this.config=t(f.defaults,i,u,c);const m=function(t,e){const s=[];for(const[i,n]of Object.entries(t)){const t=[];for(const{required:s,errorMessage:i}of n)s.every((t=>!!e[t]))||t.push(i);"anyOf"!==i||n.length-t.length>=1||s.push(...t)}return s}(f.schema,this.config);if(m[0])throw new l(`Character count: ${m[0]}`);this.i18n=new d(e(this.config,"i18n"),{locale:g(s,"lang")}),this.maxLength=null!=(n=null!=(a=this.config.maxwords)?a:this.config.maxlength)?n:1/0,this.$module=s,this.$textarea=r;const p=`${this.$textarea.id}-info`,b=document.getElementById(p);if(!b)throw new h({componentName:"Character count",element:b,identifier:`Count message (\`id="${p}"\`)`});`${b.textContent}`.match(/^\s*$/)&&(b.textContent=this.i18n.t("textareaDescription",{count:this.maxLength})),this.$textarea.insertAdjacentElement("afterend",b);const v=document.createElement("div");v.className="govuk-character-count__sr-status govuk-visually-hidden",v.setAttribute("aria-live","polite"),this.$screenReaderCountMessage=v,b.insertAdjacentElement("afterend",v);const w=document.createElement("div");w.className=b.className,w.classList.add("govuk-character-count__status"),w.setAttribute("aria-hidden","true"),this.$visibleCountMessage=w,b.insertAdjacentElement("afterend",w),b.classList.add("govuk-visually-hidden"),this.$textarea.removeAttribute("maxlength"),this.bindChangeEvents(),window.addEventListener("pageshow",(()=>this.updateCountMessage())),this.updateCountMessage()}bindChangeEvents(){this.$textarea.addEventListener("keyup",(()=>this.handleKeyUp())),this.$textarea.addEventListener("focus",(()=>this.handleFocus())),this.$textarea.addEventListener("blur",(()=>this.handleBlur()))}handleKeyUp(){this.updateVisibleCountMessage(),this.lastInputTimestamp=Date.now()}handleFocus(){this.valueChecker=window.setInterval((()=>{(!this.lastInputTimestamp||Date.now()-500>=this.lastInputTimestamp)&&this.updateIfValueChanged()}),1e3)}handleBlur(){this.valueChecker&&window.clearInterval(this.valueChecker)}updateIfValueChanged(){this.$textarea.value!==this.lastInputValue&&(this.lastInputValue=this.$textarea.value,this.updateCountMessage())}updateCountMessage(){this.updateVisibleCountMessage(),this.updateScreenReaderCountMessage()}updateVisibleCountMessage(){const t=this.maxLength-this.count(this.$textarea.value)<0;this.$visibleCountMessage.classList.toggle("govuk-character-count__message--disabled",!this.isOverThreshold()),this.$textarea.classList.toggle("govuk-textarea--error",t),this.$visibleCountMessage.classList.toggle("govuk-error-message",t),this.$visibleCountMessage.classList.toggle("govuk-hint",!t),this.$visibleCountMessage.textContent=this.getCountMessage()}updateScreenReaderCountMessage(){this.isOverThreshold()?this.$screenReaderCountMessage.removeAttribute("aria-hidden"):this.$screenReaderCountMessage.setAttribute("aria-hidden","true"),this.$screenReaderCountMessage.textContent=this.getCountMessage()}count(t){if(this.config.maxwords){var e;return(null!=(e=t.match(/\S+/g))?e:[]).length}return t.length}getCountMessage(){const t=this.maxLength-this.count(this.$textarea.value),e=this.config.maxwords?"words":"characters";return this.formatCountMessage(t,e)}formatCountMessage(t,e){if(0===t)return this.i18n.t(`${e}AtLimit`);const s=t<0?"OverLimit":"UnderLimit";return this.i18n.t(`${e}${s}`,{count:Math.abs(t)})}isOverThreshold(){if(!this.config.threshold)return!0;const t=this.count(this.$textarea.value);return this.maxLength*this.config.threshold/100<=t}}f.moduleName="govuk-character-count",f.defaults=Object.freeze({threshold:0,i18n:{charactersUnderLimit:{one:"You have %{count} character remaining",other:"You have %{count} characters remaining"},charactersAtLimit:"You have 0 characters remaining",charactersOverLimit:{one:"You have %{count} character too many",other:"You have %{count} characters too many"},wordsUnderLimit:{one:"You have %{count} word remaining",other:"You have %{count} words remaining"},wordsAtLimit:"You have 0 words remaining",wordsOverLimit:{one:"You have %{count} word too many",other:"You have %{count} words too many"},textareaDescription:{other:""}}}),f.schema=Object.freeze({anyOf:[{required:["maxwords"],errorMessage:'Either "maxlength" or "maxwords" must be provided'},{required:["maxlength"],errorMessage:'Either "maxlength" or "maxwords" must be provided'}]});
34
+ */f.moduleName="govuk-button",f.defaults=Object.freeze({preventDoubleClick:!1});class b extends d{constructor(s,i={}){var n,o;if(super(),this.$module=void 0,this.$textarea=void 0,this.$visibleCountMessage=void 0,this.$screenReaderCountMessage=void 0,this.lastInputTimestamp=null,this.lastInputValue="",this.valueChecker=null,this.config=void 0,this.i18n=void 0,this.maxLength=void 0,!(s instanceof HTMLElement))throw new u({componentName:"Character count",element:s,identifier:"Root element (`$module`)"});const a=s.querySelector(".govuk-js-character-count");if(!(a instanceof HTMLTextAreaElement||a instanceof HTMLInputElement))throw new u({componentName:"Character count",element:a,expectedType:"HTMLTextareaElement or HTMLInputElement",identifier:"Form field (`.govuk-js-character-count`)"});const l=r(s.dataset);let c={};("maxwords"in l||"maxlength"in l)&&(c={maxlength:void 0,maxwords:void 0}),this.config=t(b.defaults,i,c,l);const d=function(t,e){const s=[];for(const[i,n]of Object.entries(t)){const t=[];for(const{required:s,errorMessage:i}of n)s.every((t=>!!e[t]))||t.push(i);"anyOf"!==i||n.length-t.length>=1||s.push(...t)}return s}(b.schema,this.config);if(d[0])throw new h(`Character count: ${d[0]}`);this.i18n=new m(e(this.config,"i18n"),{locale:v(s,"lang")}),this.maxLength=null!=(n=null!=(o=this.config.maxwords)?o:this.config.maxlength)?n:1/0,this.$module=s,this.$textarea=a;const p=`${this.$textarea.id}-info`,g=document.getElementById(p);if(!g)throw new u({componentName:"Character count",element:g,identifier:`Count message (\`id="${p}"\`)`});`${g.textContent}`.match(/^\s*$/)&&(g.textContent=this.i18n.t("textareaDescription",{count:this.maxLength})),this.$textarea.insertAdjacentElement("afterend",g);const f=document.createElement("div");f.className="govuk-character-count__sr-status govuk-visually-hidden",f.setAttribute("aria-live","polite"),this.$screenReaderCountMessage=f,g.insertAdjacentElement("afterend",f);const w=document.createElement("div");w.className=g.className,w.classList.add("govuk-character-count__status"),w.setAttribute("aria-hidden","true"),this.$visibleCountMessage=w,g.insertAdjacentElement("afterend",w),g.classList.add("govuk-visually-hidden"),this.$textarea.removeAttribute("maxlength"),this.bindChangeEvents(),window.addEventListener("pageshow",(()=>this.updateCountMessage())),this.updateCountMessage()}bindChangeEvents(){this.$textarea.addEventListener("keyup",(()=>this.handleKeyUp())),this.$textarea.addEventListener("focus",(()=>this.handleFocus())),this.$textarea.addEventListener("blur",(()=>this.handleBlur()))}handleKeyUp(){this.updateVisibleCountMessage(),this.lastInputTimestamp=Date.now()}handleFocus(){this.valueChecker=window.setInterval((()=>{(!this.lastInputTimestamp||Date.now()-500>=this.lastInputTimestamp)&&this.updateIfValueChanged()}),1e3)}handleBlur(){this.valueChecker&&window.clearInterval(this.valueChecker)}updateIfValueChanged(){this.$textarea.value!==this.lastInputValue&&(this.lastInputValue=this.$textarea.value,this.updateCountMessage())}updateCountMessage(){this.updateVisibleCountMessage(),this.updateScreenReaderCountMessage()}updateVisibleCountMessage(){const t=this.maxLength-this.count(this.$textarea.value)<0;this.$visibleCountMessage.classList.toggle("govuk-character-count__message--disabled",!this.isOverThreshold()),this.$textarea.classList.toggle("govuk-textarea--error",t),this.$visibleCountMessage.classList.toggle("govuk-error-message",t),this.$visibleCountMessage.classList.toggle("govuk-hint",!t),this.$visibleCountMessage.textContent=this.getCountMessage()}updateScreenReaderCountMessage(){this.isOverThreshold()?this.$screenReaderCountMessage.removeAttribute("aria-hidden"):this.$screenReaderCountMessage.setAttribute("aria-hidden","true"),this.$screenReaderCountMessage.textContent=this.getCountMessage()}count(t){if(this.config.maxwords){var e;return(null!=(e=t.match(/\S+/g))?e:[]).length}return t.length}getCountMessage(){const t=this.maxLength-this.count(this.$textarea.value),e=this.config.maxwords?"words":"characters";return this.formatCountMessage(t,e)}formatCountMessage(t,e){if(0===t)return this.i18n.t(`${e}AtLimit`);const s=t<0?"OverLimit":"UnderLimit";return this.i18n.t(`${e}${s}`,{count:Math.abs(t)})}isOverThreshold(){if(!this.config.threshold)return!0;const t=this.count(this.$textarea.value);return this.maxLength*this.config.threshold/100<=t}}b.moduleName="govuk-character-count",b.defaults=Object.freeze({threshold:0,i18n:{charactersUnderLimit:{one:"You have %{count} character remaining",other:"You have %{count} characters remaining"},charactersAtLimit:"You have 0 characters remaining",charactersOverLimit:{one:"You have %{count} character too many",other:"You have %{count} characters too many"},wordsUnderLimit:{one:"You have %{count} word remaining",other:"You have %{count} words remaining"},wordsAtLimit:"You have 0 words remaining",wordsOverLimit:{one:"You have %{count} word too many",other:"You have %{count} words too many"},textareaDescription:{other:""}}}),b.schema=Object.freeze({anyOf:[{required:["maxwords"],errorMessage:'Either "maxlength" or "maxwords" must be provided'},{required:["maxlength"],errorMessage:'Either "maxlength" or "maxwords" must be provided'}]});
35
35
  /**
36
36
  * Checkboxes component
37
37
  *
38
38
  * @preserve
39
39
  */
40
- class b extends c{constructor(t){if(super(),this.$module=void 0,this.$inputs=void 0,!(t instanceof HTMLElement))throw new h({componentName:"Checkboxes",element:t,identifier:"Root element (`$module`)"});const e=t.querySelectorAll('input[type="checkbox"]');if(!e.length)throw new h({componentName:"Checkboxes",identifier:'Form inputs (`<input type="checkbox">`)'});this.$module=t,this.$inputs=e,this.$inputs.forEach((t=>{const e=t.getAttribute("data-aria-controls");if(e){if(!document.getElementById(e))throw new h({componentName:"Checkboxes",identifier:`Conditional reveal (\`id="${e}"\`)`});t.setAttribute("aria-controls",e),t.removeAttribute("data-aria-controls")}})),window.addEventListener("pageshow",(()=>this.syncAllConditionalReveals())),this.syncAllConditionalReveals(),this.$module.addEventListener("click",(t=>this.handleClick(t)))}syncAllConditionalReveals(){this.$inputs.forEach((t=>this.syncConditionalRevealWithInputState(t)))}syncConditionalRevealWithInputState(t){const e=t.getAttribute("aria-controls");if(!e)return;const s=document.getElementById(e);if(s&&s.classList.contains("govuk-checkboxes__conditional")){const e=t.checked;t.setAttribute("aria-expanded",e.toString()),s.classList.toggle("govuk-checkboxes__conditional--hidden",!e)}}unCheckAllInputsExcept(t){document.querySelectorAll(`input[type="checkbox"][name="${t.name}"]`).forEach((e=>{t.form===e.form&&e!==t&&(e.checked=!1,this.syncConditionalRevealWithInputState(e))}))}unCheckExclusiveInputs(t){document.querySelectorAll(`input[data-behaviour="exclusive"][type="checkbox"][name="${t.name}"]`).forEach((e=>{t.form===e.form&&(e.checked=!1,this.syncConditionalRevealWithInputState(e))}))}handleClick(t){const e=t.target;if(!(e instanceof HTMLInputElement)||"checkbox"!==e.type)return;if(e.getAttribute("aria-controls")&&this.syncConditionalRevealWithInputState(e),!e.checked)return;"exclusive"===e.getAttribute("data-behaviour")?this.unCheckAllInputsExcept(e):this.unCheckExclusiveInputs(e)}}b.moduleName="govuk-checkboxes";
40
+ class w extends d{constructor(t){if(super(),this.$module=void 0,this.$inputs=void 0,!(t instanceof HTMLElement))throw new u({componentName:"Checkboxes",element:t,identifier:"Root element (`$module`)"});const e=t.querySelectorAll('input[type="checkbox"]');if(!e.length)throw new u({componentName:"Checkboxes",identifier:'Form inputs (`<input type="checkbox">`)'});this.$module=t,this.$inputs=e,this.$inputs.forEach((t=>{const e=t.getAttribute("data-aria-controls");if(e){if(!document.getElementById(e))throw new u({componentName:"Checkboxes",identifier:`Conditional reveal (\`id="${e}"\`)`});t.setAttribute("aria-controls",e),t.removeAttribute("data-aria-controls")}})),window.addEventListener("pageshow",(()=>this.syncAllConditionalReveals())),this.syncAllConditionalReveals(),this.$module.addEventListener("click",(t=>this.handleClick(t)))}syncAllConditionalReveals(){this.$inputs.forEach((t=>this.syncConditionalRevealWithInputState(t)))}syncConditionalRevealWithInputState(t){const e=t.getAttribute("aria-controls");if(!e)return;const s=document.getElementById(e);if(s&&s.classList.contains("govuk-checkboxes__conditional")){const e=t.checked;t.setAttribute("aria-expanded",e.toString()),s.classList.toggle("govuk-checkboxes__conditional--hidden",!e)}}unCheckAllInputsExcept(t){document.querySelectorAll(`input[type="checkbox"][name="${t.name}"]`).forEach((e=>{t.form===e.form&&e!==t&&(e.checked=!1,this.syncConditionalRevealWithInputState(e))}))}unCheckExclusiveInputs(t){document.querySelectorAll(`input[data-behaviour="exclusive"][type="checkbox"][name="${t.name}"]`).forEach((e=>{t.form===e.form&&(e.checked=!1,this.syncConditionalRevealWithInputState(e))}))}handleClick(t){const e=t.target;if(!(e instanceof HTMLInputElement)||"checkbox"!==e.type)return;if(e.getAttribute("aria-controls")&&this.syncConditionalRevealWithInputState(e),!e.checked)return;"exclusive"===e.getAttribute("data-behaviour")?this.unCheckAllInputsExcept(e):this.unCheckExclusiveInputs(e)}}w.moduleName="govuk-checkboxes";
41
41
  /**
42
42
  * Error summary component
43
43
  *
@@ -46,40 +46,40 @@ class b extends c{constructor(t){if(super(),this.$module=void 0,this.$inputs=voi
46
46
  *
47
47
  * @preserve
48
48
  */
49
- class v extends c{constructor(e,s={}){if(super(),this.$module=void 0,this.config=void 0,!(e instanceof HTMLElement))throw new h({componentName:"Error summary",element:e,identifier:"Root element (`$module`)"});this.$module=e,this.config=t(v.defaults,s,o(e.dataset)),this.setFocus(),this.$module.addEventListener("click",(t=>this.handleClick(t)))}setFocus(){this.config.disableAutoFocus||(this.$module.setAttribute("tabindex","-1"),this.$module.addEventListener("blur",(()=>{this.$module.removeAttribute("tabindex")})),this.$module.focus())}handleClick(t){const e=t.target;e&&this.focusTarget(e)&&t.preventDefault()}focusTarget(t){if(!(t instanceof HTMLAnchorElement))return!1;const e=s(t.href);if(!e)return!1;const i=document.getElementById(e);if(!i)return!1;const n=this.getAssociatedLegendOrLabel(i);return!!n&&(n.scrollIntoView(),i.focus({preventScroll:!0}),!0)}getAssociatedLegendOrLabel(t){var e;const s=t.closest("fieldset");if(s){const e=s.getElementsByTagName("legend");if(e.length){const s=e[0];if(t instanceof HTMLInputElement&&("checkbox"===t.type||"radio"===t.type))return s;const i=s.getBoundingClientRect().top,n=t.getBoundingClientRect();if(n.height&&window.innerHeight){if(n.top+n.height-i<window.innerHeight/2)return s}}}return null!=(e=document.querySelector(`label[for='${t.getAttribute("id")}']`))?e:t.closest("label")}}v.moduleName="govuk-error-summary",v.defaults=Object.freeze({disableAutoFocus:!1});
49
+ class $ extends d{constructor(e,s={}){if(super(),this.$module=void 0,this.config=void 0,!(e instanceof HTMLElement))throw new u({componentName:"Error summary",element:e,identifier:"Root element (`$module`)"});this.$module=e,this.config=t($.defaults,s,r(e.dataset)),this.config.disableAutoFocus||n(this.$module),this.$module.addEventListener("click",(t=>this.handleClick(t)))}handleClick(t){const e=t.target;e&&this.focusTarget(e)&&t.preventDefault()}focusTarget(t){if(!(t instanceof HTMLAnchorElement))return!1;const e=s(t.href);if(!e)return!1;const i=document.getElementById(e);if(!i)return!1;const n=this.getAssociatedLegendOrLabel(i);return!!n&&(n.scrollIntoView(),i.focus({preventScroll:!0}),!0)}getAssociatedLegendOrLabel(t){var e;const s=t.closest("fieldset");if(s){const e=s.getElementsByTagName("legend");if(e.length){const s=e[0];if(t instanceof HTMLInputElement&&("checkbox"===t.type||"radio"===t.type))return s;const i=s.getBoundingClientRect().top,n=t.getBoundingClientRect();if(n.height&&window.innerHeight){if(n.top+n.height-i<window.innerHeight/2)return s}}}return null!=(e=document.querySelector(`label[for='${t.getAttribute("id")}']`))?e:t.closest("label")}}$.moduleName="govuk-error-summary",$.defaults=Object.freeze({disableAutoFocus:!1});
50
50
  /**
51
51
  * Exit this page component
52
52
  *
53
53
  * @preserve
54
54
  */
55
- class w extends c{constructor(s,i={}){if(super(),this.$module=void 0,this.config=void 0,this.i18n=void 0,this.$button=void 0,this.$skiplinkButton=null,this.$updateSpan=null,this.$indicatorContainer=null,this.$overlay=null,this.keypressCounter=0,this.lastKeyWasModified=!1,this.timeoutTime=5e3,this.keypressTimeoutId=null,this.timeoutMessageId=null,!(s instanceof HTMLElement))throw new h({componentName:"Exit this page",element:s,identifier:"Root element (`$module`)"});const n=s.querySelector(".govuk-exit-this-page__button");if(!(n instanceof HTMLAnchorElement))throw new h({componentName:"Exit this page",element:n,expectedType:"HTMLAnchorElement",identifier:"Button (`.govuk-exit-this-page__button`)"});this.config=t(w.defaults,i,o(s.dataset)),this.i18n=new d(e(this.config,"i18n")),this.$module=s,this.$button=n;const a=document.querySelector(".govuk-js-exit-this-page-skiplink");a instanceof HTMLAnchorElement&&(this.$skiplinkButton=a),this.buildIndicator(),this.initUpdateSpan(),this.initButtonClickHandler(),"govukFrontendExitThisPageKeypress"in document.body.dataset||(document.addEventListener("keyup",this.handleKeypress.bind(this),!0),document.body.dataset.govukFrontendExitThisPageKeypress="true"),window.addEventListener("pageshow",this.resetPage.bind(this))}initUpdateSpan(){this.$updateSpan=document.createElement("span"),this.$updateSpan.setAttribute("role","status"),this.$updateSpan.className="govuk-visually-hidden",this.$module.appendChild(this.$updateSpan)}initButtonClickHandler(){this.$button.addEventListener("click",this.handleClick.bind(this)),this.$skiplinkButton&&this.$skiplinkButton.addEventListener("click",this.handleClick.bind(this))}buildIndicator(){this.$indicatorContainer=document.createElement("div"),this.$indicatorContainer.className="govuk-exit-this-page__indicator",this.$indicatorContainer.setAttribute("aria-hidden","true");for(let t=0;t<3;t++){const t=document.createElement("div");t.className="govuk-exit-this-page__indicator-light",this.$indicatorContainer.appendChild(t)}this.$button.appendChild(this.$indicatorContainer)}updateIndicator(){if(!this.$indicatorContainer)return;this.$indicatorContainer.classList.toggle("govuk-exit-this-page__indicator--visible",this.keypressCounter>0);this.$indicatorContainer.querySelectorAll(".govuk-exit-this-page__indicator-light").forEach(((t,e)=>{t.classList.toggle("govuk-exit-this-page__indicator-light--on",e<this.keypressCounter)}))}exitPage(){this.$updateSpan&&(this.$updateSpan.textContent="",document.body.classList.add("govuk-exit-this-page-hide-content"),this.$overlay=document.createElement("div"),this.$overlay.className="govuk-exit-this-page-overlay",this.$overlay.setAttribute("role","alert"),document.body.appendChild(this.$overlay),this.$overlay.textContent=this.i18n.t("activated"),window.location.href=this.$button.href)}handleClick(t){t.preventDefault(),this.exitPage()}handleKeypress(t){this.$updateSpan&&("Shift"!==t.key&&16!==t.keyCode&&16!==t.which||this.lastKeyWasModified?this.keypressTimeoutId&&this.resetKeypressTimer():(this.keypressCounter+=1,this.updateIndicator(),this.timeoutMessageId&&(window.clearTimeout(this.timeoutMessageId),this.timeoutMessageId=null),this.keypressCounter>=3?(this.keypressCounter=0,this.keypressTimeoutId&&(window.clearTimeout(this.keypressTimeoutId),this.keypressTimeoutId=null),this.exitPage()):1===this.keypressCounter?this.$updateSpan.textContent=this.i18n.t("pressTwoMoreTimes"):this.$updateSpan.textContent=this.i18n.t("pressOneMoreTime"),this.setKeypressTimer()),this.lastKeyWasModified=t.shiftKey)}setKeypressTimer(){this.keypressTimeoutId&&window.clearTimeout(this.keypressTimeoutId),this.keypressTimeoutId=window.setTimeout(this.resetKeypressTimer.bind(this),this.timeoutTime)}resetKeypressTimer(){if(!this.$updateSpan)return;this.keypressTimeoutId&&(window.clearTimeout(this.keypressTimeoutId),this.keypressTimeoutId=null);const t=this.$updateSpan;this.keypressCounter=0,t.textContent=this.i18n.t("timedOut"),this.timeoutMessageId=window.setTimeout((()=>{t.textContent=""}),this.timeoutTime),this.updateIndicator()}resetPage(){document.body.classList.remove("govuk-exit-this-page-hide-content"),this.$overlay&&(this.$overlay.remove(),this.$overlay=null),this.$updateSpan&&(this.$updateSpan.setAttribute("role","status"),this.$updateSpan.textContent=""),this.updateIndicator(),this.keypressTimeoutId&&window.clearTimeout(this.keypressTimeoutId),this.timeoutMessageId&&window.clearTimeout(this.timeoutMessageId)}}w.moduleName="govuk-exit-this-page",w.defaults=Object.freeze({i18n:{activated:"Loading.",timedOut:"Exit this page expired.",pressTwoMoreTimes:"Shift, press 2 more times to exit.",pressOneMoreTime:"Shift, press 1 more time to exit."}});(
55
+ class k extends d{constructor(s,i={}){if(super(),this.$module=void 0,this.config=void 0,this.i18n=void 0,this.$button=void 0,this.$skiplinkButton=null,this.$updateSpan=null,this.$indicatorContainer=null,this.$overlay=null,this.keypressCounter=0,this.lastKeyWasModified=!1,this.timeoutTime=5e3,this.keypressTimeoutId=null,this.timeoutMessageId=null,!(s instanceof HTMLElement))throw new u({componentName:"Exit this page",element:s,identifier:"Root element (`$module`)"});const n=s.querySelector(".govuk-exit-this-page__button");if(!(n instanceof HTMLAnchorElement))throw new u({componentName:"Exit this page",element:n,expectedType:"HTMLAnchorElement",identifier:"Button (`.govuk-exit-this-page__button`)"});this.config=t(k.defaults,i,r(s.dataset)),this.i18n=new m(e(this.config,"i18n")),this.$module=s,this.$button=n;const o=document.querySelector(".govuk-js-exit-this-page-skiplink");o instanceof HTMLAnchorElement&&(this.$skiplinkButton=o),this.buildIndicator(),this.initUpdateSpan(),this.initButtonClickHandler(),"govukFrontendExitThisPageKeypress"in document.body.dataset||(document.addEventListener("keyup",this.handleKeypress.bind(this),!0),document.body.dataset.govukFrontendExitThisPageKeypress="true"),window.addEventListener("pageshow",this.resetPage.bind(this))}initUpdateSpan(){this.$updateSpan=document.createElement("span"),this.$updateSpan.setAttribute("role","status"),this.$updateSpan.className="govuk-visually-hidden",this.$module.appendChild(this.$updateSpan)}initButtonClickHandler(){this.$button.addEventListener("click",this.handleClick.bind(this)),this.$skiplinkButton&&this.$skiplinkButton.addEventListener("click",this.handleClick.bind(this))}buildIndicator(){this.$indicatorContainer=document.createElement("div"),this.$indicatorContainer.className="govuk-exit-this-page__indicator",this.$indicatorContainer.setAttribute("aria-hidden","true");for(let t=0;t<3;t++){const t=document.createElement("div");t.className="govuk-exit-this-page__indicator-light",this.$indicatorContainer.appendChild(t)}this.$button.appendChild(this.$indicatorContainer)}updateIndicator(){if(!this.$indicatorContainer)return;this.$indicatorContainer.classList.toggle("govuk-exit-this-page__indicator--visible",this.keypressCounter>0);this.$indicatorContainer.querySelectorAll(".govuk-exit-this-page__indicator-light").forEach(((t,e)=>{t.classList.toggle("govuk-exit-this-page__indicator-light--on",e<this.keypressCounter)}))}exitPage(){this.$updateSpan&&(this.$updateSpan.textContent="",document.body.classList.add("govuk-exit-this-page-hide-content"),this.$overlay=document.createElement("div"),this.$overlay.className="govuk-exit-this-page-overlay",this.$overlay.setAttribute("role","alert"),document.body.appendChild(this.$overlay),this.$overlay.textContent=this.i18n.t("activated"),window.location.href=this.$button.href)}handleClick(t){t.preventDefault(),this.exitPage()}handleKeypress(t){this.$updateSpan&&("Shift"!==t.key&&16!==t.keyCode&&16!==t.which||this.lastKeyWasModified?this.keypressTimeoutId&&this.resetKeypressTimer():(this.keypressCounter+=1,this.updateIndicator(),this.timeoutMessageId&&(window.clearTimeout(this.timeoutMessageId),this.timeoutMessageId=null),this.keypressCounter>=3?(this.keypressCounter=0,this.keypressTimeoutId&&(window.clearTimeout(this.keypressTimeoutId),this.keypressTimeoutId=null),this.exitPage()):1===this.keypressCounter?this.$updateSpan.textContent=this.i18n.t("pressTwoMoreTimes"):this.$updateSpan.textContent=this.i18n.t("pressOneMoreTime"),this.setKeypressTimer()),this.lastKeyWasModified=t.shiftKey)}setKeypressTimer(){this.keypressTimeoutId&&window.clearTimeout(this.keypressTimeoutId),this.keypressTimeoutId=window.setTimeout(this.resetKeypressTimer.bind(this),this.timeoutTime)}resetKeypressTimer(){if(!this.$updateSpan)return;this.keypressTimeoutId&&(window.clearTimeout(this.keypressTimeoutId),this.keypressTimeoutId=null);const t=this.$updateSpan;this.keypressCounter=0,t.textContent=this.i18n.t("timedOut"),this.timeoutMessageId=window.setTimeout((()=>{t.textContent=""}),this.timeoutTime),this.updateIndicator()}resetPage(){document.body.classList.remove("govuk-exit-this-page-hide-content"),this.$overlay&&(this.$overlay.remove(),this.$overlay=null),this.$updateSpan&&(this.$updateSpan.setAttribute("role","status"),this.$updateSpan.textContent=""),this.updateIndicator(),this.keypressTimeoutId&&window.clearTimeout(this.keypressTimeoutId),this.timeoutMessageId&&window.clearTimeout(this.timeoutMessageId)}}k.moduleName="govuk-exit-this-page",k.defaults=Object.freeze({i18n:{activated:"Loading.",timedOut:"Exit this page expired.",pressTwoMoreTimes:"Shift, press 2 more times to exit.",pressOneMoreTime:"Shift, press 1 more time to exit."}});(
56
56
  /**
57
57
  * Header component
58
58
  *
59
59
  * @preserve
60
60
  */
61
- class extends c{constructor(t){if(super(),this.$module=void 0,this.$menuButton=void 0,this.$menu=void 0,this.menuIsOpen=!1,this.mql=null,!t)throw new h({componentName:"Header",element:t,identifier:"Root element (`$module`)"});this.$module=t;const e=t.querySelector(".govuk-js-header-toggle");if(!e)return this;const s=e.getAttribute("aria-controls");if(!s)throw new h({componentName:"Header",identifier:'Navigation button (`<button class="govuk-js-header-toggle">`) attribute (`aria-controls`)'});const i=document.getElementById(s);if(!i)throw new h({componentName:"Header",element:i,identifier:`Navigation (\`<ul id="${s}">\`)`});this.$menu=i,this.$menuButton=e,this.mql=window.matchMedia("(min-width: 48.0625em)"),"addEventListener"in this.mql?this.mql.addEventListener("change",(()=>this.syncState())):this.mql.addListener((()=>this.syncState())),this.syncState(),this.$menuButton.addEventListener("click",(()=>this.handleMenuButtonClick()))}syncState(){this.mql&&this.$menu&&this.$menuButton&&(this.mql.matches?(this.$menu.removeAttribute("hidden"),this.$menuButton.setAttribute("hidden","")):(this.$menuButton.removeAttribute("hidden"),this.$menuButton.setAttribute("aria-expanded",this.menuIsOpen.toString()),this.menuIsOpen?this.$menu.removeAttribute("hidden"):this.$menu.setAttribute("hidden","")))}handleMenuButtonClick(){this.menuIsOpen=!this.menuIsOpen,this.syncState()}}).moduleName="govuk-header";
61
+ class extends d{constructor(t){if(super(),this.$module=void 0,this.$menuButton=void 0,this.$menu=void 0,this.menuIsOpen=!1,this.mql=null,!t)throw new u({componentName:"Header",element:t,identifier:"Root element (`$module`)"});this.$module=t;const e=t.querySelector(".govuk-js-header-toggle");if(!e)return this;const s=e.getAttribute("aria-controls");if(!s)throw new u({componentName:"Header",identifier:'Navigation button (`<button class="govuk-js-header-toggle">`) attribute (`aria-controls`)'});const i=document.getElementById(s);if(!i)throw new u({componentName:"Header",element:i,identifier:`Navigation (\`<ul id="${s}">\`)`});this.$menu=i,this.$menuButton=e,this.setupResponsiveChecks(),this.$menuButton.addEventListener("click",(()=>this.handleMenuButtonClick()))}setupResponsiveChecks(){const t=i("desktop");if(!t.value)throw new u({componentName:"Header",identifier:`CSS custom property (\`${t.property}\`) on pseudo-class \`:root\``});this.mql=window.matchMedia(`(min-width: ${t.value})`),"addEventListener"in this.mql?this.mql.addEventListener("change",(()=>this.checkMode())):this.mql.addListener((()=>this.checkMode())),this.checkMode()}checkMode(){this.mql&&this.$menu&&this.$menuButton&&(this.mql.matches?(this.$menu.removeAttribute("hidden"),this.$menuButton.setAttribute("hidden","")):(this.$menuButton.removeAttribute("hidden"),this.$menuButton.setAttribute("aria-expanded",this.menuIsOpen.toString()),this.menuIsOpen?this.$menu.removeAttribute("hidden"):this.$menu.setAttribute("hidden","")))}handleMenuButtonClick(){this.menuIsOpen=!this.menuIsOpen,this.checkMode()}}).moduleName="govuk-header";
62
62
  /**
63
63
  * Notification Banner component
64
64
  *
65
65
  * @preserve
66
66
  */
67
- class $ extends c{constructor(e,s={}){if(super(),this.$module=void 0,this.config=void 0,!(e instanceof HTMLElement))throw new h({componentName:"Notification banner",element:e,identifier:"Root element (`$module`)"});this.$module=e,this.config=t($.defaults,s,o(e.dataset)),this.setFocus()}setFocus(){this.config.disableAutoFocus||"alert"===this.$module.getAttribute("role")&&(this.$module.getAttribute("tabindex")||(this.$module.setAttribute("tabindex","-1"),this.$module.addEventListener("blur",(()=>{this.$module.removeAttribute("tabindex")}))),this.$module.focus())}}$.moduleName="govuk-notification-banner",$.defaults=Object.freeze({disableAutoFocus:!1});
67
+ class C extends d{constructor(e,s={}){if(super(),this.$module=void 0,this.config=void 0,!(e instanceof HTMLElement))throw new u({componentName:"Notification banner",element:e,identifier:"Root element (`$module`)"});this.$module=e,this.config=t(C.defaults,s,r(e.dataset)),"alert"!==this.$module.getAttribute("role")||this.config.disableAutoFocus||n(this.$module)}}C.moduleName="govuk-notification-banner",C.defaults=Object.freeze({disableAutoFocus:!1});
68
68
  /**
69
69
  * Radios component
70
70
  *
71
71
  * @preserve
72
72
  */
73
- class k extends c{constructor(t){if(super(),this.$module=void 0,this.$inputs=void 0,!(t instanceof HTMLElement))throw new h({componentName:"Radios",element:t,identifier:"Root element (`$module`)"});const e=t.querySelectorAll('input[type="radio"]');if(!e.length)throw new h({componentName:"Radios",identifier:'Form inputs (`<input type="radio">`)'});this.$module=t,this.$inputs=e,this.$inputs.forEach((t=>{const e=t.getAttribute("data-aria-controls");if(e){if(!document.getElementById(e))throw new h({componentName:"Radios",identifier:`Conditional reveal (\`id="${e}"\`)`});t.setAttribute("aria-controls",e),t.removeAttribute("data-aria-controls")}})),window.addEventListener("pageshow",(()=>this.syncAllConditionalReveals())),this.syncAllConditionalReveals(),this.$module.addEventListener("click",(t=>this.handleClick(t)))}syncAllConditionalReveals(){this.$inputs.forEach((t=>this.syncConditionalRevealWithInputState(t)))}syncConditionalRevealWithInputState(t){const e=t.getAttribute("aria-controls");if(!e)return;const s=document.getElementById(e);if(null!=s&&s.classList.contains("govuk-radios__conditional")){const e=t.checked;t.setAttribute("aria-expanded",e.toString()),s.classList.toggle("govuk-radios__conditional--hidden",!e)}}handleClick(t){const e=t.target;if(!(e instanceof HTMLInputElement)||"radio"!==e.type)return;const s=document.querySelectorAll('input[type="radio"][aria-controls]'),i=e.form,n=e.name;s.forEach((t=>{const e=t.form===i;t.name===n&&e&&this.syncConditionalRevealWithInputState(t)}))}}k.moduleName="govuk-radios";(
73
+ class y extends d{constructor(t){if(super(),this.$module=void 0,this.$inputs=void 0,!(t instanceof HTMLElement))throw new u({componentName:"Radios",element:t,identifier:"Root element (`$module`)"});const e=t.querySelectorAll('input[type="radio"]');if(!e.length)throw new u({componentName:"Radios",identifier:'Form inputs (`<input type="radio">`)'});this.$module=t,this.$inputs=e,this.$inputs.forEach((t=>{const e=t.getAttribute("data-aria-controls");if(e){if(!document.getElementById(e))throw new u({componentName:"Radios",identifier:`Conditional reveal (\`id="${e}"\`)`});t.setAttribute("aria-controls",e),t.removeAttribute("data-aria-controls")}})),window.addEventListener("pageshow",(()=>this.syncAllConditionalReveals())),this.syncAllConditionalReveals(),this.$module.addEventListener("click",(t=>this.handleClick(t)))}syncAllConditionalReveals(){this.$inputs.forEach((t=>this.syncConditionalRevealWithInputState(t)))}syncConditionalRevealWithInputState(t){const e=t.getAttribute("aria-controls");if(!e)return;const s=document.getElementById(e);if(null!=s&&s.classList.contains("govuk-radios__conditional")){const e=t.checked;t.setAttribute("aria-expanded",e.toString()),s.classList.toggle("govuk-radios__conditional--hidden",!e)}}handleClick(t){const e=t.target;if(!(e instanceof HTMLInputElement)||"radio"!==e.type)return;const s=document.querySelectorAll('input[type="radio"][aria-controls]'),i=e.form,n=e.name;s.forEach((t=>{const e=t.form===i;t.name===n&&e&&this.syncConditionalRevealWithInputState(t)}))}}y.moduleName="govuk-radios";(
74
74
  /**
75
75
  * Skip link component
76
76
  *
77
77
  * @preserve
78
78
  */
79
- class extends c{constructor(t){var e;if(super(),this.$module=void 0,this.$linkedElement=void 0,this.linkedElementListener=!1,!(t instanceof HTMLAnchorElement))throw new h({componentName:"Skip link",element:t,expectedType:"HTMLAnchorElement",identifier:"Root element (`$module`)"});this.$module=t;const i=this.$module.hash,n=null!=(e=this.$module.getAttribute("href"))?e:"";let o;try{o=new window.URL(this.$module.href)}catch(t){throw new h(`Skip link: Target link (\`href="${n}"\`) is invalid`)}if(o.origin!==window.location.origin||o.pathname!==window.location.pathname)return;const a=s(i);if(!a)throw new h(`Skip link: Target link (\`href="${n}"\`) has no hash fragment`);const r=document.getElementById(a);if(!r)throw new h({componentName:"Skip link",element:r,identifier:`Target content (\`id="${a}"\`)`});this.$linkedElement=r,this.$module.addEventListener("click",(()=>this.focusLinkedElement()))}focusLinkedElement(){this.$linkedElement&&(this.$linkedElement.getAttribute("tabindex")||(this.$linkedElement.setAttribute("tabindex","-1"),this.$linkedElement.classList.add("govuk-skip-link-focused-element"),this.linkedElementListener||(this.$linkedElement.addEventListener("blur",(()=>this.removeFocusProperties())),this.linkedElementListener=!0)),this.$linkedElement.focus())}removeFocusProperties(){this.$linkedElement&&(this.$linkedElement.removeAttribute("tabindex"),this.$linkedElement.classList.remove("govuk-skip-link-focused-element"))}}).moduleName="govuk-skip-link";function C(t){let e;if(t=void 0!==t?t:{},!i())return void console.log(new r);const s=[[p,t.button],[f,t.characterCount],[b],[v,t.errorSummary],[k]],n=null!=(e=t.scope)?e:document;s.forEach((([t,e])=>{n.querySelectorAll(`[data-module="${t.moduleName}"]`).forEach((s=>{try{"defaults"in t?new t(s,e):new t(s)}catch(t){console.log(t)}}))}))}(
79
+ class extends d{constructor(t){var e;if(super(),this.$module=void 0,!(t instanceof HTMLAnchorElement))throw new u({componentName:"Skip link",element:t,expectedType:"HTMLAnchorElement",identifier:"Root element (`$module`)"});this.$module=t;const i=this.$module.hash,o=null!=(e=this.$module.getAttribute("href"))?e:"";let a;try{a=new window.URL(this.$module.href)}catch(t){throw new u(`Skip link: Target link (\`href="${o}"\`) is invalid`)}if(a.origin!==window.location.origin||a.pathname!==window.location.pathname)return;const r=s(i);if(!r)throw new u(`Skip link: Target link (\`href="${o}"\`) has no hash fragment`);const l=document.getElementById(r);if(!l)throw new u({componentName:"Skip link",element:l,identifier:`Target content (\`id="${r}"\`)`});this.$module.addEventListener("click",(()=>n(l,{onBeforeFocus(){l.classList.add("govuk-skip-link-focused-element")},onBlur(){l.classList.remove("govuk-skip-link-focused-element")}})))}}).moduleName="govuk-skip-link";function x(t){let e;if(t=void 0!==t?t:{},!o())return void console.log(new c);const s=[[f,t.button],[b,t.characterCount],[w],[$,t.errorSummary],[y]],i=null!=(e=t.scope)?e:document;s.forEach((([t,e])=>{i.querySelectorAll(`[data-module="${t.moduleName}"]`).forEach((s=>{try{"defaults"in t?new t(s,e):new t(s)}catch(t){console.log(t)}}))}))}(
80
80
  /**
81
81
  * Tabs component
82
82
  *
83
83
  * @preserve
84
84
  */
85
- class extends c{constructor(t){if(super(),this.$module=void 0,this.$tabs=void 0,this.$tabList=void 0,this.$tabListItems=void 0,this.keys={left:37,right:39,up:38,down:40},this.jsHiddenClass="govuk-tabs__panel--hidden",this.changingHash=!1,this.boundTabClick=void 0,this.boundTabKeydown=void 0,this.boundOnHashChange=void 0,this.mql=null,!t)throw new h({componentName:"Tabs",element:t,identifier:"Root element (`$module`)"});const e=t.querySelectorAll("a.govuk-tabs__tab");if(!e.length)throw new h({componentName:"Tabs",identifier:'Links (`<a class="govuk-tabs__tab">`)'});this.$module=t,this.$tabs=e,this.boundTabClick=this.onTabClick.bind(this),this.boundTabKeydown=this.onTabKeydown.bind(this),this.boundOnHashChange=this.onHashChange.bind(this);const s=this.$module.querySelector(".govuk-tabs__list"),i=this.$module.querySelectorAll("li.govuk-tabs__list-item");if(!s)throw new h({componentName:"Tabs",identifier:'List (`<ul class="govuk-tabs__list">`)'});if(!i.length)throw new h({componentName:"Tabs",identifier:'List items (`<li class="govuk-tabs__list-item">`)'});this.$tabList=s,this.$tabListItems=i,this.setupResponsiveChecks()}setupResponsiveChecks(){this.mql=window.matchMedia("(min-width: 40.0625em)"),"addEventListener"in this.mql?this.mql.addEventListener("change",(()=>this.checkMode())):this.mql.addListener((()=>this.checkMode())),this.checkMode()}checkMode(){var t;null!=(t=this.mql)&&t.matches?this.setup():this.teardown()}setup(){var t;this.$tabList.setAttribute("role","tablist"),this.$tabListItems.forEach((t=>{t.setAttribute("role","presentation")})),this.$tabs.forEach((t=>{this.setAttributes(t),t.addEventListener("click",this.boundTabClick,!0),t.addEventListener("keydown",this.boundTabKeydown,!0),this.hideTab(t)}));const e=null!=(t=this.getTab(window.location.hash))?t:this.$tabs[0];this.showTab(e),window.addEventListener("hashchange",this.boundOnHashChange,!0)}teardown(){this.$tabList.removeAttribute("role"),this.$tabListItems.forEach((t=>{t.removeAttribute("role")})),this.$tabs.forEach((t=>{t.removeEventListener("click",this.boundTabClick,!0),t.removeEventListener("keydown",this.boundTabKeydown,!0),this.unsetAttributes(t)})),window.removeEventListener("hashchange",this.boundOnHashChange,!0)}onHashChange(){const t=window.location.hash,e=this.getTab(t);if(!e)return;if(this.changingHash)return void(this.changingHash=!1);const s=this.getCurrentTab();s&&(this.hideTab(s),this.showTab(e),e.focus())}hideTab(t){this.unhighlightTab(t),this.hidePanel(t)}showTab(t){this.highlightTab(t),this.showPanel(t)}getTab(t){return this.$module.querySelector(`a.govuk-tabs__tab[href="${t}"]`)}setAttributes(t){const e=s(t.href);if(!e)return;t.setAttribute("id",`tab_${e}`),t.setAttribute("role","tab"),t.setAttribute("aria-controls",e),t.setAttribute("aria-selected","false"),t.setAttribute("tabindex","-1");const i=this.getPanel(t);i&&(i.setAttribute("role","tabpanel"),i.setAttribute("aria-labelledby",t.id),i.classList.add(this.jsHiddenClass))}unsetAttributes(t){t.removeAttribute("id"),t.removeAttribute("role"),t.removeAttribute("aria-controls"),t.removeAttribute("aria-selected"),t.removeAttribute("tabindex");const e=this.getPanel(t);e&&(e.removeAttribute("role"),e.removeAttribute("aria-labelledby"),e.classList.remove(this.jsHiddenClass))}onTabClick(t){const e=this.getCurrentTab(),s=t.currentTarget;e&&s instanceof HTMLAnchorElement&&(t.preventDefault(),this.hideTab(e),this.showTab(s),this.createHistoryEntry(s))}createHistoryEntry(t){const e=this.getPanel(t);if(!e)return;const s=e.id;e.id="",this.changingHash=!0,window.location.hash=s,e.id=s}onTabKeydown(t){switch(t.keyCode){case this.keys.left:case this.keys.up:this.activatePreviousTab(),t.preventDefault();break;case this.keys.right:case this.keys.down:this.activateNextTab(),t.preventDefault()}}activateNextTab(){const t=this.getCurrentTab();if(null==t||!t.parentElement)return;const e=t.parentElement.nextElementSibling;if(!e)return;const s=e.querySelector("a.govuk-tabs__tab");s&&(this.hideTab(t),this.showTab(s),s.focus(),this.createHistoryEntry(s))}activatePreviousTab(){const t=this.getCurrentTab();if(null==t||!t.parentElement)return;const e=t.parentElement.previousElementSibling;if(!e)return;const s=e.querySelector("a.govuk-tabs__tab");s&&(this.hideTab(t),this.showTab(s),s.focus(),this.createHistoryEntry(s))}getPanel(t){const e=s(t.href);return e?this.$module.querySelector(`#${e}`):null}showPanel(t){const e=this.getPanel(t);e&&e.classList.remove(this.jsHiddenClass)}hidePanel(t){const e=this.getPanel(t);e&&e.classList.add(this.jsHiddenClass)}unhighlightTab(t){t.parentElement&&(t.setAttribute("aria-selected","false"),t.parentElement.classList.remove("govuk-tabs__list-item--selected"),t.setAttribute("tabindex","-1"))}highlightTab(t){t.parentElement&&(t.setAttribute("aria-selected","true"),t.parentElement.classList.add("govuk-tabs__list-item--selected"),t.setAttribute("tabindex","0"))}getCurrentTab(){return this.$module.querySelector(".govuk-tabs__list-item--selected a.govuk-tabs__tab")}}).moduleName="govuk-tabs";export{p as Button,f as CharacterCount,b as Checkboxes,v as ErrorSummary,k as Radios,C as initAll};
85
+ class extends d{constructor(t){if(super(),this.$module=void 0,this.$tabs=void 0,this.$tabList=void 0,this.$tabListItems=void 0,this.keys={left:37,right:39,up:38,down:40},this.jsHiddenClass="govuk-tabs__panel--hidden",this.changingHash=!1,this.boundTabClick=void 0,this.boundTabKeydown=void 0,this.boundOnHashChange=void 0,this.mql=null,!t)throw new u({componentName:"Tabs",element:t,identifier:"Root element (`$module`)"});const e=t.querySelectorAll("a.govuk-tabs__tab");if(!e.length)throw new u({componentName:"Tabs",identifier:'Links (`<a class="govuk-tabs__tab">`)'});this.$module=t,this.$tabs=e,this.boundTabClick=this.onTabClick.bind(this),this.boundTabKeydown=this.onTabKeydown.bind(this),this.boundOnHashChange=this.onHashChange.bind(this);const s=this.$module.querySelector(".govuk-tabs__list"),i=this.$module.querySelectorAll("li.govuk-tabs__list-item");if(!s)throw new u({componentName:"Tabs",identifier:'List (`<ul class="govuk-tabs__list">`)'});if(!i.length)throw new u({componentName:"Tabs",identifier:'List items (`<li class="govuk-tabs__list-item">`)'});this.$tabList=s,this.$tabListItems=i,this.setupResponsiveChecks()}setupResponsiveChecks(){const t=i("tablet");if(!t.value)throw new u({componentName:"Tabs",identifier:`CSS custom property (\`${t.property}\`) on pseudo-class \`:root\``});this.mql=window.matchMedia(`(min-width: ${t.value})`),"addEventListener"in this.mql?this.mql.addEventListener("change",(()=>this.checkMode())):this.mql.addListener((()=>this.checkMode())),this.checkMode()}checkMode(){var t;null!=(t=this.mql)&&t.matches?this.setup():this.teardown()}setup(){var t;this.$tabList.setAttribute("role","tablist"),this.$tabListItems.forEach((t=>{t.setAttribute("role","presentation")})),this.$tabs.forEach((t=>{this.setAttributes(t),t.addEventListener("click",this.boundTabClick,!0),t.addEventListener("keydown",this.boundTabKeydown,!0),this.hideTab(t)}));const e=null!=(t=this.getTab(window.location.hash))?t:this.$tabs[0];this.showTab(e),window.addEventListener("hashchange",this.boundOnHashChange,!0)}teardown(){this.$tabList.removeAttribute("role"),this.$tabListItems.forEach((t=>{t.removeAttribute("role")})),this.$tabs.forEach((t=>{t.removeEventListener("click",this.boundTabClick,!0),t.removeEventListener("keydown",this.boundTabKeydown,!0),this.unsetAttributes(t)})),window.removeEventListener("hashchange",this.boundOnHashChange,!0)}onHashChange(){const t=window.location.hash,e=this.getTab(t);if(!e)return;if(this.changingHash)return void(this.changingHash=!1);const s=this.getCurrentTab();s&&(this.hideTab(s),this.showTab(e),e.focus())}hideTab(t){this.unhighlightTab(t),this.hidePanel(t)}showTab(t){this.highlightTab(t),this.showPanel(t)}getTab(t){return this.$module.querySelector(`a.govuk-tabs__tab[href="${t}"]`)}setAttributes(t){const e=s(t.href);if(!e)return;t.setAttribute("id",`tab_${e}`),t.setAttribute("role","tab"),t.setAttribute("aria-controls",e),t.setAttribute("aria-selected","false"),t.setAttribute("tabindex","-1");const i=this.getPanel(t);i&&(i.setAttribute("role","tabpanel"),i.setAttribute("aria-labelledby",t.id),i.classList.add(this.jsHiddenClass))}unsetAttributes(t){t.removeAttribute("id"),t.removeAttribute("role"),t.removeAttribute("aria-controls"),t.removeAttribute("aria-selected"),t.removeAttribute("tabindex");const e=this.getPanel(t);e&&(e.removeAttribute("role"),e.removeAttribute("aria-labelledby"),e.classList.remove(this.jsHiddenClass))}onTabClick(t){const e=this.getCurrentTab(),s=t.currentTarget;e&&s instanceof HTMLAnchorElement&&(t.preventDefault(),this.hideTab(e),this.showTab(s),this.createHistoryEntry(s))}createHistoryEntry(t){const e=this.getPanel(t);if(!e)return;const s=e.id;e.id="",this.changingHash=!0,window.location.hash=s,e.id=s}onTabKeydown(t){switch(t.keyCode){case this.keys.left:case this.keys.up:this.activatePreviousTab(),t.preventDefault();break;case this.keys.right:case this.keys.down:this.activateNextTab(),t.preventDefault()}}activateNextTab(){const t=this.getCurrentTab();if(null==t||!t.parentElement)return;const e=t.parentElement.nextElementSibling;if(!e)return;const s=e.querySelector("a.govuk-tabs__tab");s&&(this.hideTab(t),this.showTab(s),s.focus(),this.createHistoryEntry(s))}activatePreviousTab(){const t=this.getCurrentTab();if(null==t||!t.parentElement)return;const e=t.parentElement.previousElementSibling;if(!e)return;const s=e.querySelector("a.govuk-tabs__tab");s&&(this.hideTab(t),this.showTab(s),s.focus(),this.createHistoryEntry(s))}getPanel(t){const e=s(t.href);return e?this.$module.querySelector(`#${e}`):null}showPanel(t){const e=this.getPanel(t);e&&e.classList.remove(this.jsHiddenClass)}hidePanel(t){const e=this.getPanel(t);e&&e.classList.add(this.jsHiddenClass)}unhighlightTab(t){t.parentElement&&(t.setAttribute("aria-selected","false"),t.parentElement.classList.remove("govuk-tabs__list-item--selected"),t.setAttribute("tabindex","-1"))}highlightTab(t){t.parentElement&&(t.setAttribute("aria-selected","true"),t.parentElement.classList.add("govuk-tabs__list-item--selected"),t.setAttribute("tabindex","0"))}getCurrentTab(){return this.$module.querySelector(".govuk-tabs__list-item--selected a.govuk-tabs__tab")}}).moduleName="govuk-tabs";export{f as Button,b as CharacterCount,w as Checkboxes,$ as ErrorSummary,y as Radios,x as initAll};
@@ -152,6 +152,22 @@ module GOVUKDesignSystemFormBuilder
152
152
  @builder.object.class.human_attribute_name(@attribute_name)
153
153
  end
154
154
  end
155
+
156
+ class Legend
157
+ def retrieve_text(supplied_text)
158
+ supplied_text.presence ||
159
+ localised_text(:legend).presence ||
160
+ human_attribute_name.presence ||
161
+ @attribute_name.to_s.humanize.capitalize.presence
162
+ end
163
+
164
+ def human_attribute_name
165
+ return unless @object_name.present? && @attribute_name.present?
166
+ return unless @builder.object&.class.respond_to?(:human_attribute_name)
167
+
168
+ @builder.object.class.human_attribute_name(@attribute_name)
169
+ end
170
+ end
155
171
  end
156
172
 
157
173
  module Containers
@@ -294,7 +294,7 @@
294
294
 
295
295
  // Add toggle link with Chevron icon on left.
296
296
  .govuk-accordion__section-toggle {
297
- @include govuk-typography-responsive($size: 19);
297
+ @include govuk-font-size($size: 19);
298
298
  @include govuk-typography-weight-regular;
299
299
  color: $govuk-link-colour;
300
300
  }
@@ -13,7 +13,7 @@
13
13
  $chevron-border-colour: $govuk-secondary-text-colour;
14
14
 
15
15
  .govuk-back-link {
16
- @include govuk-typography-responsive($size: $font-size);
16
+ @include govuk-font-size($size: $font-size);
17
17
  @include govuk-link-common;
18
18
  @include govuk-link-style-text;
19
19
 
@@ -236,7 +236,7 @@ $govuk-inverse-button-text-colour: $govuk-brand-colour !default;
236
236
 
237
237
  .govuk-button--start {
238
238
  @include govuk-typography-weight-bold;
239
- @include govuk-typography-responsive($size: 24, $override-line-height: 1);
239
+ @include govuk-font-size($size: 24, $line-height: 1);
240
240
 
241
241
  display: inline-flex;
242
242
  min-height: auto;
@@ -14,7 +14,7 @@
14
14
  }
15
15
 
16
16
  .govuk-character-count__message {
17
- @include govuk-font($size: false, $tabular: true);
17
+ @include govuk-font-tabular-numbers;
18
18
  margin-top: 0;
19
19
  margin-bottom: 0;
20
20
 
@@ -4,21 +4,18 @@
4
4
  @import "../label/index";
5
5
 
6
6
  @include govuk-exports("govuk/component/checkboxes") {
7
- $govuk-touch-target-size: 44px;
7
+ $govuk-touch-target-gutter: 4px;
8
8
  $govuk-checkboxes-size: 40px;
9
+ $govuk-touch-target-size: ($govuk-checkboxes-size + $govuk-touch-target-gutter);
9
10
  $govuk-small-checkboxes-size: 24px;
10
11
  $govuk-checkboxes-label-padding-left-right: govuk-spacing(3);
12
+ $govuk-checkbox-check-horizontal-position: 10px;
11
13
 
12
14
  .govuk-checkboxes__item {
13
- display: block;
15
+ display: flex;
16
+ flex-wrap: wrap;
14
17
  position: relative;
15
-
16
- min-height: $govuk-checkboxes-size;
17
-
18
18
  margin-bottom: govuk-spacing(2);
19
- padding-left: $govuk-checkboxes-size;
20
-
21
- clear: left;
22
19
  }
23
20
 
24
21
  .govuk-checkboxes__item:last-child,
@@ -27,27 +24,26 @@
27
24
  }
28
25
 
29
26
  .govuk-checkboxes__input {
30
- $input-offset: ($govuk-touch-target-size - $govuk-checkboxes-size) / 2;
31
-
32
- position: absolute;
33
-
27
+ // Allow the input to sit above the label, enabling its proper detection
28
+ // when exploring by touch or using automation tools like Selenium
34
29
  z-index: 1;
35
- top: $input-offset * -1;
36
- left: $input-offset * -1;
37
-
38
30
  width: $govuk-touch-target-size;
39
31
  height: $govuk-touch-target-size;
40
32
  margin: 0;
41
-
42
33
  opacity: 0;
43
-
44
34
  cursor: pointer;
45
35
  }
46
36
 
47
37
  .govuk-checkboxes__label {
48
- display: inline-block;
38
+ align-self: center;
39
+
40
+ // Ensure that the width of the label is never more than the width of the
41
+ // container minus the input width minus the padding on either side of
42
+ // the label. This prevents the label from going onto the next line due to
43
+ // __item using flex-wrap because we want hints on a separate line.
44
+ max-width: calc(100% - #{(($govuk-checkboxes-label-padding-left-right * 2) + $govuk-touch-target-size)});
49
45
  margin-bottom: 0;
50
- padding: 8px $govuk-checkboxes-label-padding-left-right govuk-spacing(1);
46
+ padding: (govuk-spacing(1) + $govuk-border-width-form-element) govuk-spacing(3);
51
47
  cursor: pointer;
52
48
  // remove 300ms pause on mobile
53
49
  touch-action: manipulation;
@@ -58,8 +54,8 @@
58
54
  content: "";
59
55
  box-sizing: border-box;
60
56
  position: absolute;
61
- top: 0;
62
- left: 0;
57
+ top: ($govuk-touch-target-gutter / 2);
58
+ left: ($govuk-touch-target-gutter / 2);
63
59
  width: $govuk-checkboxes-size;
64
60
  height: $govuk-checkboxes-size;
65
61
  border: $govuk-border-width-form-element solid currentcolor;
@@ -73,29 +69,37 @@
73
69
  .govuk-checkboxes__label::after {
74
70
  content: "";
75
71
  box-sizing: border-box;
76
-
77
72
  position: absolute;
78
- top: 11px;
79
- left: 9px;
73
+
74
+ // Use "magic numbers" to define shape and position of check mark because
75
+ // the complexity of the shape makes it difficult to calculate dynamically.
76
+ top: 13px;
77
+ left: $govuk-checkbox-check-horizontal-position;
80
78
  width: 23px;
81
79
  height: 12px;
82
-
83
80
  transform: rotate(-45deg);
84
81
  border: solid;
85
82
  border-width: 0 0 5px 5px;
86
83
  // Fix bug in IE11 caused by transform rotate (-45deg).
87
84
  // See: alphagov/govuk_elements/issues/518
88
85
  border-top-color: transparent;
89
-
90
86
  opacity: 0;
91
-
92
87
  background: transparent;
93
88
  }
94
89
 
95
90
  .govuk-checkboxes__hint {
96
91
  display: block;
92
+ width: 100%;
93
+ margin-top: govuk-spacing(-1);
97
94
  padding-right: $govuk-checkboxes-label-padding-left-right;
98
- padding-left: $govuk-checkboxes-label-padding-left-right;
95
+ padding-left: ($govuk-checkboxes-label-padding-left-right + $govuk-touch-target-size);
96
+ }
97
+
98
+ // This is to bypass govuk-hint's specificity on hints following labels having
99
+ // a margin bottom of 10px (govuk-spacing(2)). Because checkboxes are flexbox,
100
+ // the margin doesn't collapse so we have to do this manually.
101
+ .govuk-label:not(.govuk-label--m):not(.govuk-label--l):not(.govuk-label--xl) + .govuk-checkboxes__hint {
102
+ margin-bottom: 0;
99
103
  }
100
104
 
101
105
  // Focused state
@@ -182,14 +186,9 @@
182
186
 
183
187
  .govuk-checkboxes--small {
184
188
  $input-offset: ($govuk-touch-target-size - $govuk-small-checkboxes-size) / 2;
185
- $label-offset: $govuk-touch-target-size - $input-offset;
186
189
 
187
190
  .govuk-checkboxes__item {
188
- @include govuk-clearfix;
189
- min-height: 0;
190
191
  margin-bottom: 0;
191
- padding-left: $label-offset;
192
- float: left;
193
192
  }
194
193
 
195
194
  // Shift the touch target into the left margin so that the visible edge of
@@ -202,30 +201,23 @@
202
201
  // ▲┆└─ Check box pseudo element, aligned with margin
203
202
  // └─── Touch target (invisible input), shifted into the margin
204
203
  .govuk-checkboxes__input {
205
- left: $input-offset * -1;
204
+ margin-left: $input-offset * -1;
206
205
  }
207
206
 
208
- // Adjust the size and position of the label.
209
- //
210
- // Unlike larger checkboxes, we also have to float the label in order to
211
- // 'shrink' it, preventing the hover state from kicking in across the full
212
- // width of the parent element.
213
207
  .govuk-checkboxes__label {
214
- margin-top: -2px;
215
- padding: 13px govuk-spacing(3) 13px 1px;
216
- float: left;
217
-
218
- @include govuk-media-query($from: tablet) {
219
- padding: 11px govuk-spacing(3) 10px 1px;
220
- }
208
+ // Create a tiny space between the small checkbox hover state so that it
209
+ // doesn't clash with the label
210
+ padding-left: 1px;
221
211
  }
222
212
 
223
213
  // [ ] Check box
224
214
  //
225
215
  // Reduce the size of the check box [1], vertically center it within the
226
216
  // touch target [2]
217
+ // Left here is 0 because we've shifted the input into the left margin
227
218
  .govuk-checkboxes__label::before {
228
- top: $input-offset - $govuk-border-width-form-element; // 2
219
+ top: $input-offset; // 2
220
+ left: 0;
229
221
  width: $govuk-small-checkboxes-size; // 1
230
222
  height: $govuk-small-checkboxes-size; // 1
231
223
  }
@@ -234,8 +226,11 @@
234
226
  //
235
227
  // Reduce the size of the check mark and re-align within the checkbox
236
228
  .govuk-checkboxes__label::after {
237
- top: 15px;
238
- left: 6px;
229
+ top: 17px;
230
+
231
+ // Horizontal position is just the normal sized left value accounting for
232
+ // the new width of the smaller checkbox
233
+ left: (16px - $govuk-checkbox-check-horizontal-position);
239
234
  width: 12px;
240
235
  height: 6.5px;
241
236
  border-width: 0 0 3px 3px;
@@ -250,16 +245,14 @@
250
245
  // (If you do use them, they won't look completely broken... but seriously,
251
246
  // don't use them)
252
247
  .govuk-checkboxes__hint {
253
- padding: 0;
254
- clear: both;
248
+ padding-left: ($govuk-small-checkboxes-size + $input-offset);
255
249
  }
256
250
 
257
251
  // Align conditional reveals with small checkboxes
258
252
  .govuk-checkboxes__conditional {
259
253
  $margin-left: ($govuk-small-checkboxes-size / 2) - ($conditional-border-width / 2);
260
254
  margin-left: $margin-left;
261
- padding-left: $label-offset - ($margin-left + $conditional-border-width);
262
- clear: both;
255
+ padding-left: ($govuk-touch-target-size - $input-offset) - ($margin-left + $conditional-border-width);
263
256
  }
264
257
 
265
258
  // Hover state for small checkboxes.
@@ -15,7 +15,7 @@
15
15
  }
16
16
 
17
17
  .govuk-error-summary__title {
18
- @include govuk-typography-responsive($size: 24);
18
+ @include govuk-font-size($size: 24);
19
19
  @include govuk-typography-weight-bold;
20
20
 
21
21
  margin-top: 0;
@@ -43,15 +43,15 @@
43
43
  }
44
44
 
45
45
  .govuk-fieldset__legend--xl {
46
- @include govuk-typography-responsive($size: 48);
46
+ @include govuk-font-size($size: 48);
47
47
  }
48
48
 
49
49
  .govuk-fieldset__legend--l {
50
- @include govuk-typography-responsive($size: 36);
50
+ @include govuk-font-size($size: 36);
51
51
  }
52
52
 
53
53
  .govuk-fieldset__legend--m {
54
- @include govuk-typography-responsive($size: 24);
54
+ @include govuk-font-size($size: 24);
55
55
  }
56
56
 
57
57
  .govuk-fieldset__legend--s {
@@ -11,7 +11,7 @@
11
11
  $govuk-footer-crest-image-height: ($govuk-footer-crest-image-height-2x / 2);
12
12
 
13
13
  .govuk-footer {
14
- @include govuk-font($size: 16);
14
+ @include govuk-font($size: if($govuk-new-typography-scale, 19, 16));
15
15
  @include govuk-responsive-padding(7, "top");
16
16
  @include govuk-responsive-padding(5, "bottom");
17
17