@cagovweb/state-template 6.3.1-beta7 → 6.3.1-beta9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/css/cagov.core.css +3 -3
- package/dist/css/cagov.core.min.css +2 -2
- package/dist/js/cagov.core.js +29 -29
- package/dist/js/cagov.core.min.js +2 -2
- package/dist/readme.md +2 -2
- package/package.json +1 -1
package/dist/js/cagov.core.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var StateTemplateNpmPackageVersion="6.3.1-
|
|
1
|
+
var StateTemplateNpmPackageVersion="6.3.1-beta9";
|
|
2
2
|
/*!
|
|
3
3
|
* Bootstrap v5.3.0 (https://getbootstrap.com/)
|
|
4
4
|
* Copyright 2011-2023 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
|
@@ -8702,19 +8702,6 @@ window.addEventListener("load", () => {
|
|
|
8702
8702
|
|
|
8703
8703
|
const regularHeader = document.querySelector("header");
|
|
8704
8704
|
|
|
8705
|
-
/**
|
|
8706
|
-
* True if child is descendant of the parent
|
|
8707
|
-
* @param {HTMLElement} parent
|
|
8708
|
-
* @param {HTMLElement} child
|
|
8709
|
-
* @returns {boolean}
|
|
8710
|
-
*/
|
|
8711
|
-
const checkParent = (parent, child) =>
|
|
8712
|
-
child?.parentElement
|
|
8713
|
-
? child.parentElement === parent
|
|
8714
|
-
? true
|
|
8715
|
-
: checkParent(parent, child.parentElement)
|
|
8716
|
-
: false;
|
|
8717
|
-
|
|
8718
8705
|
// reset navigation function
|
|
8719
8706
|
const NavReset = () => {
|
|
8720
8707
|
//RESET
|
|
@@ -8731,8 +8718,6 @@ window.addEventListener("load", () => {
|
|
|
8731
8718
|
.querySelectorAll(".second-level-link")
|
|
8732
8719
|
.forEach((/**@type {HTMLElement} */ el) => (el.tabIndex = -1));
|
|
8733
8720
|
|
|
8734
|
-
|
|
8735
|
-
|
|
8736
8721
|
document
|
|
8737
8722
|
.querySelectorAll(".rotate")
|
|
8738
8723
|
.forEach(
|
|
@@ -8753,14 +8738,13 @@ window.addEventListener("load", () => {
|
|
|
8753
8738
|
)
|
|
8754
8739
|
);
|
|
8755
8740
|
|
|
8756
|
-
|
|
8741
|
+
const getAllFirstLevelNavLinks = () =>
|
|
8757
8742
|
/** @type { NodeListOf<HTMLElement>} */ (
|
|
8758
8743
|
navSearchCont.querySelectorAll(
|
|
8759
|
-
|
|
8744
|
+
"a.first-level-link, button.first-level-btn"
|
|
8760
8745
|
)
|
|
8761
8746
|
);
|
|
8762
8747
|
|
|
8763
|
-
|
|
8764
8748
|
// Escape key event listener
|
|
8765
8749
|
document.addEventListener("keydown", e => {
|
|
8766
8750
|
if (navSearchCont.classList.contains("visible")) {
|
|
@@ -8783,12 +8767,10 @@ window.addEventListener("load", () => {
|
|
|
8783
8767
|
// Close menu on focusout (tabbing out) event (if target is outside of mobile menu and ignore if focus target is navToggleBtn button)
|
|
8784
8768
|
navSearchCont.addEventListener("focusout", e => {
|
|
8785
8769
|
if (checkIfMobileView()) {
|
|
8786
|
-
|
|
8787
|
-
|
|
8788
|
-
|
|
8789
|
-
|
|
8790
|
-
)
|
|
8791
|
-
) {
|
|
8770
|
+
const child = /** @type {Node} **/ (e.relatedTarget);
|
|
8771
|
+
const parent = /** @type {Node} **/ (e.currentTarget);
|
|
8772
|
+
|
|
8773
|
+
if (child && !parent.contains(child)) {
|
|
8792
8774
|
closeMenu();
|
|
8793
8775
|
}
|
|
8794
8776
|
}
|
|
@@ -8824,12 +8806,16 @@ window.addEventListener("load", () => {
|
|
|
8824
8806
|
|
|
8825
8807
|
// Button click close menu function
|
|
8826
8808
|
const closeMenu = () => {
|
|
8827
|
-
navSearchCont.classList.
|
|
8809
|
+
if (navSearchCont.classList.contains("visible")) {
|
|
8810
|
+
navSearchCont.classList.remove("visible");
|
|
8811
|
+
|
|
8812
|
+
//Set focus only when close actually happens
|
|
8813
|
+
navToggleBtn.focus();
|
|
8814
|
+
}
|
|
8815
|
+
|
|
8828
8816
|
navSearchCont.classList.add("not-visible");
|
|
8829
8817
|
|
|
8830
8818
|
setClosed();
|
|
8831
|
-
|
|
8832
|
-
navToggleBtn.focus();
|
|
8833
8819
|
};
|
|
8834
8820
|
|
|
8835
8821
|
const setClosed = () => {
|
|
@@ -8855,8 +8841,9 @@ window.addEventListener("load", () => {
|
|
|
8855
8841
|
// Button Click event
|
|
8856
8842
|
navMobileMenuToggleBtn.addEventListener("click", closeMenu);
|
|
8857
8843
|
|
|
8858
|
-
const mobileCheck = () => {
|
|
8844
|
+
const mobileCheck = () => {
|
|
8859
8845
|
NavReset();
|
|
8846
|
+
|
|
8860
8847
|
// desktop
|
|
8861
8848
|
if (isDesktopWidth()) {
|
|
8862
8849
|
getAllFirstLevelNavLinks().forEach(el => el.removeAttribute("tabindex"));
|
|
@@ -8868,6 +8855,19 @@ window.addEventListener("load", () => {
|
|
|
8868
8855
|
}
|
|
8869
8856
|
};
|
|
8870
8857
|
|
|
8858
|
+
// Close mobile nav if click outside of nav
|
|
8859
|
+
regularHeader.addEventListener("mouseup", e => {
|
|
8860
|
+
// if the target of the click isn't the navigation container nor a descendant of the navigation
|
|
8861
|
+
if (checkIfMobileView()) {
|
|
8862
|
+
if (
|
|
8863
|
+
navSearchCont !== e.target &&
|
|
8864
|
+
!navSearchCont?.contains(/**@type {Node} */ (e.target))
|
|
8865
|
+
) {
|
|
8866
|
+
closeMenu();
|
|
8867
|
+
}
|
|
8868
|
+
}
|
|
8869
|
+
});
|
|
8870
|
+
|
|
8871
8871
|
// on resize function (hide mobile nav)
|
|
8872
8872
|
window.addEventListener("resize", mobileCheck);
|
|
8873
8873
|
|