@cagovweb/state-template 1.0.0 → 1.1.0-beta.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.
- package/dist/css/cagov.core.css +4 -4
- package/dist/css/cagov.core.min.css +1 -1
- package/dist/js/cagov.core.js +10 -8
- package/dist/js/cagov.core.min.js +1 -1
- package/dist/readme.md +1 -1
- package/index.mjs +7 -0
- package/package.json +11 -6
- package/readme.md +68 -0
- package/README.md +0 -17
- package/dist/fonts/CaGov.svg +0 -528
- package/dist/fonts/CaGov.ttf +0 -0
- package/dist/fonts/CaGov.woff +0 -0
- package/dist/fonts/publicsans-bold-webfont.woff +0 -0
- package/dist/fonts/publicsans-extrabold-webfont.woff +0 -0
- package/dist/fonts/publicsans-extralight-webfont.woff +0 -0
- package/dist/fonts/publicsans-light-webfont.woff +0 -0
- package/dist/fonts/publicsans-medium-webfont.woff +0 -0
- package/dist/fonts/publicsans-regular-webfont.woff +0 -0
- package/dist/fonts/publicsans-semibold-webfont..woff +0 -0
package/dist/js/cagov.core.js
CHANGED
|
@@ -1083,9 +1083,9 @@ window.customElements.define("cagov-accordion", CaGovAccordion);
|
|
|
1083
1083
|
item.replaceWith(newDiv);
|
|
1084
1084
|
});
|
|
1085
1085
|
|
|
1086
|
-
const singleLevel = navigationJS
|
|
1086
|
+
const singleLevel = navigationJS?.classList.contains("singleLevel");
|
|
1087
1087
|
const setActiveLinkByFolder =
|
|
1088
|
-
navigationJS
|
|
1088
|
+
navigationJS?.classList.contains("auto-highlight");
|
|
1089
1089
|
|
|
1090
1090
|
const navItemsJS = document.querySelectorAll(".main-navigation .nav-item");
|
|
1091
1091
|
|
|
@@ -1114,7 +1114,7 @@ window.customElements.define("cagov-accordion", CaGovAccordion);
|
|
|
1114
1114
|
// if the target of the click isn't the navigation container nor a descendant of the navigation
|
|
1115
1115
|
if (
|
|
1116
1116
|
navContainer !== e.target &&
|
|
1117
|
-
!navContainer
|
|
1117
|
+
!navContainer?.contains(/**@type {Node} */ (e.target))
|
|
1118
1118
|
) {
|
|
1119
1119
|
NavReset();
|
|
1120
1120
|
}
|
|
@@ -1222,7 +1222,7 @@ window.customElements.define("cagov-accordion", CaGovAccordion);
|
|
|
1222
1222
|
// header, contains nav, search form, etc, unique
|
|
1223
1223
|
const headerHeight = /** @type {HTMLElement} */ (
|
|
1224
1224
|
document.querySelector(".global-header")
|
|
1225
|
-
)
|
|
1225
|
+
)?.offsetHeight; // header height
|
|
1226
1226
|
|
|
1227
1227
|
/** @type {HTMLElement} */
|
|
1228
1228
|
const utility = document.querySelector(".utility-header"); // utility header, unique
|
|
@@ -1244,7 +1244,7 @@ window.customElements.define("cagov-accordion", CaGovAccordion);
|
|
|
1244
1244
|
// Full width navigation
|
|
1245
1245
|
const navigationHeight = document
|
|
1246
1246
|
.querySelector(".navigation-search")
|
|
1247
|
-
|
|
1247
|
+
?.classList.contains("full-width-nav")
|
|
1248
1248
|
? 82
|
|
1249
1249
|
: 0;
|
|
1250
1250
|
|
|
@@ -1740,7 +1740,7 @@ document.addEventListener("DOMContentLoaded", () => {
|
|
|
1740
1740
|
const returnTop = document.querySelector(".return-top");
|
|
1741
1741
|
|
|
1742
1742
|
// Add on-click event
|
|
1743
|
-
returnTop.addEventListener("click", goToTopFunction);
|
|
1743
|
+
if (returnTop) returnTop.addEventListener("click", goToTopFunction);
|
|
1744
1744
|
|
|
1745
1745
|
function goToTopFunction() {
|
|
1746
1746
|
document.body.scrollTop = 0; // For Safari
|
|
@@ -1823,7 +1823,8 @@ function backToTopFunction(event) {
|
|
|
1823
1823
|
sidenavigation?.setAttribute("id", "side-navigation");
|
|
1824
1824
|
const topposition = localStorage.getItem("sidebar-scroll");
|
|
1825
1825
|
const mobileCntls = document.querySelector(".global-header .mobile-controls");
|
|
1826
|
-
|
|
1826
|
+
if (!mobileCntls) return;
|
|
1827
|
+
let mobileControlsDisplay = window.getComputedStyle(mobileCntls).display; // Side nav height vs viewport
|
|
1827
1828
|
const siteHeaderHeight = siteHeader ? siteHeader.clientHeight : 0;
|
|
1828
1829
|
const mobileView$3 = () =>
|
|
1829
1830
|
getComputedStyle(document.querySelector(".global-header .mobile-controls"))[
|
|
@@ -2381,6 +2382,7 @@ window.customElements.define("cagov-pagination", CAGovPagination);
|
|
|
2381
2382
|
const navButton = document.querySelector(".toggle-menu");
|
|
2382
2383
|
const navSearchCont = document.querySelector(".navigation-search");
|
|
2383
2384
|
const mobileCntls = document.querySelector(".global-header .mobile-controls");
|
|
2385
|
+
if (!mobileCntls) return;
|
|
2384
2386
|
const mainCont = document.querySelector(".main-content");
|
|
2385
2387
|
const footerGlobal = document.querySelector("footer");
|
|
2386
2388
|
const footerSite = document.querySelector(".site-footer");
|
|
@@ -2394,7 +2396,7 @@ window.customElements.define("cagov-pagination", CAGovPagination);
|
|
|
2394
2396
|
);
|
|
2395
2397
|
const siteBranding = document.querySelector(".branding");
|
|
2396
2398
|
const utilityLinks = document.querySelector(".settings-links");
|
|
2397
|
-
let mobileControlsDisplay = getComputedStyle(mobileCntls).display;
|
|
2399
|
+
let mobileControlsDisplay = window.getComputedStyle(mobileCntls).display;
|
|
2398
2400
|
let allNavLinks;
|
|
2399
2401
|
let allUtilityLinks;
|
|
2400
2402
|
// We need timeout here to make sure navigation is created first (becasue naviagion.js is creating button elements dynamicaly) and then we can assign all thise links to our variable
|