@cagovweb/state-template 6.3.4 → 6.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Binary file
@@ -1,4 +1,4 @@
1
- var StateTemplateNpmPackageVersion="6.3.4";
1
+ var StateTemplateNpmPackageVersion="6.4.1";
2
2
  /*!
3
3
  * Bootstrap v5.3.3 (https://getbootstrap.com/)
4
4
  * Copyright 2011-2024 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
@@ -6670,9 +6670,9 @@ window.addEventListener("load", () => {
6670
6670
  // provide the heading with a class for styling
6671
6671
  heading.classList.add(widgetHeadingClass);
6672
6672
 
6673
- newButton.setAttribute("type", "button");
6673
+ newButton.type = "button";
6674
6674
  newButton.setAttribute("aria-controls", targetID);
6675
- newButton.setAttribute("id", `${targetID}_trigger`);
6675
+ newButton.id = `${targetID}_trigger`;
6676
6676
  newButton.classList.add(widgetTriggerClass);
6677
6677
 
6678
6678
  /**
@@ -7835,6 +7835,7 @@ window.addEventListener("load", () => {
7835
7835
  }
7836
7836
  // Create a 'copy code' button, insert it after the <pre> tag
7837
7837
  const newDiv = document.createElement("button");
7838
+ newDiv.type = "button";
7838
7839
  newDiv.onclick = function () {
7839
7840
  copyCode(/** @type {HTMLElement} */ (this));
7840
7841
  };
@@ -8107,11 +8108,15 @@ window.addEventListener("load", () => {
8107
8108
 
8108
8109
  window.addEventListener("load", () => {
8109
8110
  const siteHeader = document.querySelector("header");
8110
- const sidenavigation = document.querySelector(".side-navigation");
8111
+ const sidenavigation = /** @type {HTMLElement} */ (
8112
+ document.querySelector(".side-navigation")
8113
+ );
8111
8114
  if (!sidenavigation || !siteHeader) return;
8112
- const allSidenavLinks = sidenavigation.querySelectorAll(".side-navigation a");
8115
+ const allSidenavLinks = /** @type {NodeListOf<HTMLElement>} */ (
8116
+ sidenavigation.querySelectorAll(".side-navigation a")
8117
+ );
8113
8118
  const mainContentSideNavCont = sidenavigation.closest("div");
8114
- sidenavigation.setAttribute("id", "side-navigation");
8119
+ sidenavigation.id = "side-navigation";
8115
8120
  const topposition = localStorage.getItem("sidebar-scroll");
8116
8121
  const mobileCntls = document.querySelector(".global-header .mobile-controls");
8117
8122
  if (!mobileCntls) return;
@@ -8138,20 +8143,21 @@ window.addEventListener("load", () => {
8138
8143
  btnText = btnText.replace(btnTextSpan, "").trim();
8139
8144
  // create button container
8140
8145
  const sidenavMobile = document.createElement("aside");
8141
- sidenavMobile.setAttribute("class", "sidenav-mobile-btn");
8146
+ sidenavMobile.className = "sidenav-mobile-btn";
8142
8147
  const sidenavMobileCont = document.createElement("div");
8143
- sidenavMobileCont.setAttribute("class", "container");
8148
+ sidenavMobileCont.className = "container";
8144
8149
  sidenavMobile.append(sidenavMobileCont);
8145
8150
  // create button
8146
8151
  sidenavToggleBtn = document.createElement("button");
8147
- sidenavToggleBtn.setAttribute("class", "sidenav-toggle");
8148
- sidenavToggleBtn.setAttribute("aria-expanded", "false");
8152
+ sidenavToggleBtn.type = "button";
8153
+ sidenavToggleBtn.className = "sidenav-toggle";
8154
+ sidenavToggleBtn.ariaExpanded = "false";
8149
8155
  sidenavToggleBtn.setAttribute("aria-controls", "side-navigation");
8150
8156
  sidenavToggleBtn.innerText = btnText;
8151
8157
  // create icon
8152
8158
  const arrowIcon = document.createElement("span");
8153
- arrowIcon.setAttribute("aria-hidden", "true");
8154
- arrowIcon.setAttribute("class", "ca-gov-icon-caret-down");
8159
+ arrowIcon.ariaHidden = "true";
8160
+ arrowIcon.className = "ca-gov-icon-caret-down";
8155
8161
  sidenavToggleBtn.append(arrowIcon);
8156
8162
  // append button into the header
8157
8163
  sidenavMobileCont.append(sidenavToggleBtn);
@@ -8163,9 +8169,9 @@ window.addEventListener("load", () => {
8163
8169
 
8164
8170
  const createmobileSideNavDiv = () => {
8165
8171
  mobileSideNavDiv = document.createElement("aside");
8166
- mobileSideNavDiv.setAttribute("class", "mobile-sidenav");
8172
+ mobileSideNavDiv.className = "mobile-sidenav";
8167
8173
  mobileSideNavCont = document.createElement("div");
8168
- mobileSideNavCont.setAttribute("class", "container");
8174
+ mobileSideNavCont.className = "container";
8169
8175
  mobileSideNavDiv.append(mobileSideNavCont);
8170
8176
  siteHeader.after(mobileSideNavDiv);
8171
8177
  };
@@ -8176,9 +8182,9 @@ window.addEventListener("load", () => {
8176
8182
  mobileSideNavCont.append(sidenavigation);
8177
8183
  }
8178
8184
 
8179
- sidenavigation.setAttribute("aria-hidden", "true");
8185
+ sidenavigation.ariaHidden = "true";
8180
8186
  allSidenavLinks?.forEach(el => {
8181
- el.setAttribute("tabindex", "-1");
8187
+ el.tabIndex = -1;
8182
8188
  });
8183
8189
  };
8184
8190
 
@@ -8199,22 +8205,24 @@ window.addEventListener("load", () => {
8199
8205
  // Open
8200
8206
  if (mobileSideNavDiv.classList.contains("visible")) {
8201
8207
  sidenavigation.removeAttribute("aria-hidden");
8202
- sidenavToggleBtn.setAttribute("aria-expanded", "true");
8208
+ sidenavToggleBtn.ariaExpanded = "true";
8203
8209
  allSidenavLinks?.forEach(el => {
8204
8210
  el.removeAttribute("tabindex");
8205
8211
  });
8206
8212
 
8207
8213
  // Closed
8208
8214
  } else {
8209
- sidenavToggleBtn.setAttribute("aria-expanded", "false");
8210
- sidenavigation.setAttribute("aria-hidden", "true");
8215
+ sidenavToggleBtn.ariaExpanded = "false";
8216
+ sidenavigation.ariaHidden = "true";
8211
8217
  allSidenavLinks?.forEach(el => {
8212
- el.setAttribute("tabindex", "-1");
8218
+ el.tabIndex = -1;
8213
8219
  });
8214
8220
  }
8215
8221
  };
8216
8222
 
8217
- // Set active class on nav-heading links
8223
+ /**
8224
+ * Set active class on nav-heading links
8225
+ */
8218
8226
  function addActiveClass() {
8219
8227
  /** @type {NodeListOf<HTMLAnchorElement>} */
8220
8228
  const active_link = document.querySelectorAll("a.nav-heading"),
@@ -8679,6 +8687,7 @@ window.addEventListener("load", () => {
8679
8687
 
8680
8688
  // Create close mobile meu button
8681
8689
  const navMobileMenuToggleBtn = document.createElement("button");
8690
+ navMobileMenuToggleBtn.type = "button";
8682
8691
  navMobileMenuToggleBtn.classList.add("mobile-control", "toggle-menu");
8683
8692
  navMobileMenuToggleBtn.ariaExpanded = "false";
8684
8693
  navMobileMenuToggleBtn.setAttribute("aria-controls", "navigation");
@@ -8705,7 +8714,7 @@ window.addEventListener("load", () => {
8705
8714
 
8706
8715
  //Used for hiding/showing main elements
8707
8716
  const mainElements = document.querySelectorAll(
8708
- ".main-content, footer, .site-footer, .utility-header, .branding, header"
8717
+ ".main-content, footer, .site-footer, .utility-header, .branding"
8709
8718
  );
8710
8719
 
8711
8720
  const regularHeader = document.querySelector("header");