katalyst-govuk-formbuilder 1.8.1 → 1.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f48509e75ef861c12c324ed51921adbc81e5d2308d34957caca939e841e86659
4
- data.tar.gz: b47e2507909211cfba9882558a49c7e497cbf8b98150c1ffa918b6d6185daf39
3
+ metadata.gz: 1410f1442239fc641fda6da3021a483bca381b9057d18bfe10b6ec35684944fd
4
+ data.tar.gz: 9c0b30c979e992dc9438ef0e3abbf033569059843545245970cd05b80a66425d
5
5
  SHA512:
6
- metadata.gz: 570cc99b947633e309c2d7278c0ebf5ecd05717a4d1289302259422f563088b6299f4037d7f11ee44551c50fa7e906fc1ca6f364be99f58d3335f32b7064053a
7
- data.tar.gz: f5ef6396308958dd22dfaff151bec79809b1448dbfebaad384853efde85d785c97a2c7ac865c2af1d102e81a7a681c24ef27c1e6cbecef6cd135b40e9a19bb76
6
+ metadata.gz: a8cbc04a855e37fe7f1e4f8d665dc8337eaa1e69d614b913c0c64b1f0c0454535ebb43e5ecc6d4bb140daca4486a4bb4d96bf51cedf05af103c16bc8a15f5811
7
+ data.tar.gz: 4ba3bc8e477227905bac144c46ec69cac954cacf882834046990eb40fc626ba23f99cc8fcbbe0158450b30639c82ce905ce019e6d754c87cd3ffc5cdda90fed1
@@ -2289,7 +2289,7 @@ function initAll(config) {
2289
2289
  console.log(new SupportError());
2290
2290
  return;
2291
2291
  }
2292
- const components = [[Button, config.button], [CharacterCount, config.characterCount], [Checkboxes], [ErrorSummary, config.errorSummary], [Radios]];
2292
+ const components = [[Button, config.button], [CharacterCount, config.characterCount], [Checkboxes], [ErrorSummary, config.errorSummary], [Radios], [PasswordInput, config.passwordInput]];
2293
2293
  const $scope = (_config$scope = config.scope) != null ? _config$scope : document;
2294
2294
  components.forEach(([Component, config]) => {
2295
2295
  const $elements = $scope.querySelectorAll(`[data-module="${Component.moduleName}"]`);
@@ -2303,4 +2303,4 @@ function initAll(config) {
2303
2303
  });
2304
2304
  }
2305
2305
 
2306
- export { Button, CharacterCount, Checkboxes, ErrorSummary, Radios, initAll };
2306
+ export { Button, CharacterCount, Checkboxes, ErrorSummary, PasswordInput, Radios, initAll };
@@ -82,10 +82,10 @@ class x extends m{constructor(e){if(super(),this.$module=void 0,this.$inputs=voi
82
82
  *
83
83
  * @preserve
84
84
  */
85
- class extends m{constructor(e){var t;if(super(),this.$module=void 0,!(e instanceof HTMLAnchorElement))throw new d({componentName:"Skip link",element:e,expectedType:"HTMLAnchorElement",identifier:"Root element (`$module`)"});this.$module=e;const s=this.$module.hash,n=null!=(t=this.$module.getAttribute("href"))?t:"";let a;try{a=new window.URL(this.$module.href)}catch(e){throw new d(`Skip link: Target link (\`href="${n}"\`) is invalid`)}if(a.origin!==window.location.origin||a.pathname!==window.location.pathname)return;const r=i(s);if(!r)throw new d(`Skip link: Target link (\`href="${n}"\`) has no hash fragment`);const l=document.getElementById(r);if(!l)throw new d({componentName:"Skip link",element:l,identifier:`Target content (\`id="${r}"\`)`});this.$module.addEventListener("click",(()=>o(l,{onBeforeFocus(){l.classList.add("govuk-skip-link-focused-element")},onBlur(){l.classList.remove("govuk-skip-link-focused-element")}})))}}).moduleName="govuk-skip-link";function S(e){let t;if(e=void 0!==e?e:{},!a())return void console.log(new h);const s=[[b,e.button],[w,e.characterCount],[$],[y,e.errorSummary],[x]],i=null!=(t=e.scope)?t:document;s.forEach((([e,t])=>{i.querySelectorAll(`[data-module="${e.moduleName}"]`).forEach((s=>{try{"defaults"in e?new e(s,t):new e(s)}catch(e){console.log(e)}}))}))}(
85
+ class extends m{constructor(e){var t;if(super(),this.$module=void 0,!(e instanceof HTMLAnchorElement))throw new d({componentName:"Skip link",element:e,expectedType:"HTMLAnchorElement",identifier:"Root element (`$module`)"});this.$module=e;const s=this.$module.hash,n=null!=(t=this.$module.getAttribute("href"))?t:"";let a;try{a=new window.URL(this.$module.href)}catch(e){throw new d(`Skip link: Target link (\`href="${n}"\`) is invalid`)}if(a.origin!==window.location.origin||a.pathname!==window.location.pathname)return;const r=i(s);if(!r)throw new d(`Skip link: Target link (\`href="${n}"\`) has no hash fragment`);const l=document.getElementById(r);if(!l)throw new d({componentName:"Skip link",element:l,identifier:`Target content (\`id="${r}"\`)`});this.$module.addEventListener("click",(()=>o(l,{onBeforeFocus(){l.classList.add("govuk-skip-link-focused-element")},onBlur(){l.classList.remove("govuk-skip-link-focused-element")}})))}}).moduleName="govuk-skip-link";function S(e){let t;if(e=void 0!==e?e:{},!a())return void console.log(new h);const s=[[b,e.button],[w,e.characterCount],[$],[y,e.errorSummary],[x],[A,e.passwordInput]],i=null!=(t=e.scope)?t:document;s.forEach((([e,t])=>{i.querySelectorAll(`[data-module="${e.moduleName}"]`).forEach((s=>{try{"defaults"in e?new e(s,t):new e(s)}catch(e){console.log(e)}}))}))}(
86
86
  /**
87
87
  * Tabs component
88
88
  *
89
89
  * @preserve
90
90
  */
91
- class extends m{constructor(e){if(super(),this.$module=void 0,this.$tabs=void 0,this.$tabList=void 0,this.$tabListItems=void 0,this.jsHiddenClass="govuk-tabs__panel--hidden",this.changingHash=!1,this.boundTabClick=void 0,this.boundTabKeydown=void 0,this.boundOnHashChange=void 0,this.mql=null,!e)throw new d({componentName:"Tabs",element:e,identifier:"Root element (`$module`)"});const t=e.querySelectorAll("a.govuk-tabs__tab");if(!t.length)throw new d({componentName:"Tabs",identifier:'Links (`<a class="govuk-tabs__tab">`)'});this.$module=e,this.$tabs=t,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 d({componentName:"Tabs",identifier:'List (`<ul class="govuk-tabs__list">`)'});if(!i.length)throw new d({componentName:"Tabs",identifier:'List items (`<li class="govuk-tabs__list-item">`)'});this.$tabList=s,this.$tabListItems=i,this.setupResponsiveChecks()}setupResponsiveChecks(){const e=n("tablet");if(!e.value)throw new d({componentName:"Tabs",identifier:`CSS custom property (\`${e.property}\`) on pseudo-class \`:root\``});this.mql=window.matchMedia(`(min-width: ${e.value})`),"addEventListener"in this.mql?this.mql.addEventListener("change",(()=>this.checkMode())):this.mql.addListener((()=>this.checkMode())),this.checkMode()}checkMode(){var e;null!=(e=this.mql)&&e.matches?this.setup():this.teardown()}setup(){var e;this.$tabList.setAttribute("role","tablist"),this.$tabListItems.forEach((e=>{e.setAttribute("role","presentation")})),this.$tabs.forEach((e=>{this.setAttributes(e),e.addEventListener("click",this.boundTabClick,!0),e.addEventListener("keydown",this.boundTabKeydown,!0),this.hideTab(e)}));const t=null!=(e=this.getTab(window.location.hash))?e:this.$tabs[0];this.showTab(t),window.addEventListener("hashchange",this.boundOnHashChange,!0)}teardown(){this.$tabList.removeAttribute("role"),this.$tabListItems.forEach((e=>{e.removeAttribute("role")})),this.$tabs.forEach((e=>{e.removeEventListener("click",this.boundTabClick,!0),e.removeEventListener("keydown",this.boundTabKeydown,!0),this.unsetAttributes(e)})),window.removeEventListener("hashchange",this.boundOnHashChange,!0)}onHashChange(){const e=window.location.hash,t=this.getTab(e);if(!t)return;if(this.changingHash)return void(this.changingHash=!1);const s=this.getCurrentTab();s&&(this.hideTab(s),this.showTab(t),t.focus())}hideTab(e){this.unhighlightTab(e),this.hidePanel(e)}showTab(e){this.highlightTab(e),this.showPanel(e)}getTab(e){return this.$module.querySelector(`a.govuk-tabs__tab[href="${e}"]`)}setAttributes(e){const t=i(e.href);if(!t)return;e.setAttribute("id",`tab_${t}`),e.setAttribute("role","tab"),e.setAttribute("aria-controls",t),e.setAttribute("aria-selected","false"),e.setAttribute("tabindex","-1");const s=this.getPanel(e);s&&(s.setAttribute("role","tabpanel"),s.setAttribute("aria-labelledby",e.id),s.classList.add(this.jsHiddenClass))}unsetAttributes(e){e.removeAttribute("id"),e.removeAttribute("role"),e.removeAttribute("aria-controls"),e.removeAttribute("aria-selected"),e.removeAttribute("tabindex");const t=this.getPanel(e);t&&(t.removeAttribute("role"),t.removeAttribute("aria-labelledby"),t.classList.remove(this.jsHiddenClass))}onTabClick(e){const t=this.getCurrentTab(),s=e.currentTarget;t&&s instanceof HTMLAnchorElement&&(e.preventDefault(),this.hideTab(t),this.showTab(s),this.createHistoryEntry(s))}createHistoryEntry(e){const t=this.getPanel(e);if(!t)return;const s=t.id;t.id="",this.changingHash=!0,window.location.hash=s,t.id=s}onTabKeydown(e){switch(e.key){case"ArrowLeft":case"ArrowUp":case"Left":case"Up":this.activatePreviousTab(),e.preventDefault();break;case"ArrowRight":case"ArrowDown":case"Right":case"Down":this.activateNextTab(),e.preventDefault()}}activateNextTab(){const e=this.getCurrentTab();if(null==e||!e.parentElement)return;const t=e.parentElement.nextElementSibling;if(!t)return;const s=t.querySelector("a.govuk-tabs__tab");s&&(this.hideTab(e),this.showTab(s),s.focus(),this.createHistoryEntry(s))}activatePreviousTab(){const e=this.getCurrentTab();if(null==e||!e.parentElement)return;const t=e.parentElement.previousElementSibling;if(!t)return;const s=t.querySelector("a.govuk-tabs__tab");s&&(this.hideTab(e),this.showTab(s),s.focus(),this.createHistoryEntry(s))}getPanel(e){const t=i(e.href);return t?this.$module.querySelector(`#${t}`):null}showPanel(e){const t=this.getPanel(e);t&&t.classList.remove(this.jsHiddenClass)}hidePanel(e){const t=this.getPanel(e);t&&t.classList.add(this.jsHiddenClass)}unhighlightTab(e){e.parentElement&&(e.setAttribute("aria-selected","false"),e.parentElement.classList.remove("govuk-tabs__list-item--selected"),e.setAttribute("tabindex","-1"))}highlightTab(e){e.parentElement&&(e.setAttribute("aria-selected","true"),e.parentElement.classList.add("govuk-tabs__list-item--selected"),e.setAttribute("tabindex","0"))}getCurrentTab(){return this.$module.querySelector(".govuk-tabs__list-item--selected a.govuk-tabs__tab")}}).moduleName="govuk-tabs";export{b as Button,w as CharacterCount,$ as Checkboxes,y as ErrorSummary,x as Radios,S as initAll};
91
+ class extends m{constructor(e){if(super(),this.$module=void 0,this.$tabs=void 0,this.$tabList=void 0,this.$tabListItems=void 0,this.jsHiddenClass="govuk-tabs__panel--hidden",this.changingHash=!1,this.boundTabClick=void 0,this.boundTabKeydown=void 0,this.boundOnHashChange=void 0,this.mql=null,!e)throw new d({componentName:"Tabs",element:e,identifier:"Root element (`$module`)"});const t=e.querySelectorAll("a.govuk-tabs__tab");if(!t.length)throw new d({componentName:"Tabs",identifier:'Links (`<a class="govuk-tabs__tab">`)'});this.$module=e,this.$tabs=t,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 d({componentName:"Tabs",identifier:'List (`<ul class="govuk-tabs__list">`)'});if(!i.length)throw new d({componentName:"Tabs",identifier:'List items (`<li class="govuk-tabs__list-item">`)'});this.$tabList=s,this.$tabListItems=i,this.setupResponsiveChecks()}setupResponsiveChecks(){const e=n("tablet");if(!e.value)throw new d({componentName:"Tabs",identifier:`CSS custom property (\`${e.property}\`) on pseudo-class \`:root\``});this.mql=window.matchMedia(`(min-width: ${e.value})`),"addEventListener"in this.mql?this.mql.addEventListener("change",(()=>this.checkMode())):this.mql.addListener((()=>this.checkMode())),this.checkMode()}checkMode(){var e;null!=(e=this.mql)&&e.matches?this.setup():this.teardown()}setup(){var e;this.$tabList.setAttribute("role","tablist"),this.$tabListItems.forEach((e=>{e.setAttribute("role","presentation")})),this.$tabs.forEach((e=>{this.setAttributes(e),e.addEventListener("click",this.boundTabClick,!0),e.addEventListener("keydown",this.boundTabKeydown,!0),this.hideTab(e)}));const t=null!=(e=this.getTab(window.location.hash))?e:this.$tabs[0];this.showTab(t),window.addEventListener("hashchange",this.boundOnHashChange,!0)}teardown(){this.$tabList.removeAttribute("role"),this.$tabListItems.forEach((e=>{e.removeAttribute("role")})),this.$tabs.forEach((e=>{e.removeEventListener("click",this.boundTabClick,!0),e.removeEventListener("keydown",this.boundTabKeydown,!0),this.unsetAttributes(e)})),window.removeEventListener("hashchange",this.boundOnHashChange,!0)}onHashChange(){const e=window.location.hash,t=this.getTab(e);if(!t)return;if(this.changingHash)return void(this.changingHash=!1);const s=this.getCurrentTab();s&&(this.hideTab(s),this.showTab(t),t.focus())}hideTab(e){this.unhighlightTab(e),this.hidePanel(e)}showTab(e){this.highlightTab(e),this.showPanel(e)}getTab(e){return this.$module.querySelector(`a.govuk-tabs__tab[href="${e}"]`)}setAttributes(e){const t=i(e.href);if(!t)return;e.setAttribute("id",`tab_${t}`),e.setAttribute("role","tab"),e.setAttribute("aria-controls",t),e.setAttribute("aria-selected","false"),e.setAttribute("tabindex","-1");const s=this.getPanel(e);s&&(s.setAttribute("role","tabpanel"),s.setAttribute("aria-labelledby",e.id),s.classList.add(this.jsHiddenClass))}unsetAttributes(e){e.removeAttribute("id"),e.removeAttribute("role"),e.removeAttribute("aria-controls"),e.removeAttribute("aria-selected"),e.removeAttribute("tabindex");const t=this.getPanel(e);t&&(t.removeAttribute("role"),t.removeAttribute("aria-labelledby"),t.classList.remove(this.jsHiddenClass))}onTabClick(e){const t=this.getCurrentTab(),s=e.currentTarget;t&&s instanceof HTMLAnchorElement&&(e.preventDefault(),this.hideTab(t),this.showTab(s),this.createHistoryEntry(s))}createHistoryEntry(e){const t=this.getPanel(e);if(!t)return;const s=t.id;t.id="",this.changingHash=!0,window.location.hash=s,t.id=s}onTabKeydown(e){switch(e.key){case"ArrowLeft":case"ArrowUp":case"Left":case"Up":this.activatePreviousTab(),e.preventDefault();break;case"ArrowRight":case"ArrowDown":case"Right":case"Down":this.activateNextTab(),e.preventDefault()}}activateNextTab(){const e=this.getCurrentTab();if(null==e||!e.parentElement)return;const t=e.parentElement.nextElementSibling;if(!t)return;const s=t.querySelector("a.govuk-tabs__tab");s&&(this.hideTab(e),this.showTab(s),s.focus(),this.createHistoryEntry(s))}activatePreviousTab(){const e=this.getCurrentTab();if(null==e||!e.parentElement)return;const t=e.parentElement.previousElementSibling;if(!t)return;const s=t.querySelector("a.govuk-tabs__tab");s&&(this.hideTab(e),this.showTab(s),s.focus(),this.createHistoryEntry(s))}getPanel(e){const t=i(e.href);return t?this.$module.querySelector(`#${t}`):null}showPanel(e){const t=this.getPanel(e);t&&t.classList.remove(this.jsHiddenClass)}hidePanel(e){const t=this.getPanel(e);t&&t.classList.add(this.jsHiddenClass)}unhighlightTab(e){e.parentElement&&(e.setAttribute("aria-selected","false"),e.parentElement.classList.remove("govuk-tabs__list-item--selected"),e.setAttribute("tabindex","-1"))}highlightTab(e){e.parentElement&&(e.setAttribute("aria-selected","true"),e.parentElement.classList.add("govuk-tabs__list-item--selected"),e.setAttribute("tabindex","0"))}getCurrentTab(){return this.$module.querySelector(".govuk-tabs__list-item--selected a.govuk-tabs__tab")}}).moduleName="govuk-tabs";export{b as Button,w as CharacterCount,$ as Checkboxes,y as ErrorSummary,A as PasswordInput,x as Radios,S as initAll};
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: katalyst-govuk-formbuilder
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.1
4
+ version: 1.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Katalyst Interactive
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-04-02 00:00:00.000000000 Z
11
+ date: 2024-04-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: govuk_design_system_formbuilder