@cagovweb/state-template 6.5.2 → 6.5.3
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 +122 -125
- package/dist/css/cagov.core.flat.css +122 -125
- package/dist/css/cagov.core.min.css +1 -1
- package/dist/js/cagov.core.js +93 -130
- package/dist/js/cagov.core.min.js +4 -4
- package/dist/readme.md +2 -2
- package/package.json +2 -2
package/dist/js/cagov.core.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var StateTemplateNpmPackageVersion="6.5.
|
|
1
|
+
var StateTemplateNpmPackageVersion="6.5.3";
|
|
2
2
|
/*!
|
|
3
|
-
* Bootstrap v5.3.
|
|
4
|
-
* Copyright 2011-
|
|
3
|
+
* Bootstrap v5.3.8 (https://getbootstrap.com/)
|
|
4
|
+
* Copyright 2011-2025 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
|
5
5
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
6
6
|
*/
|
|
7
7
|
(function (global, factory) {
|
|
@@ -205,7 +205,7 @@ var StateTemplateNpmPackageVersion="6.5.2";
|
|
|
205
205
|
* @param {HTMLElement} element
|
|
206
206
|
* @return void
|
|
207
207
|
*
|
|
208
|
-
* @see https://www.
|
|
208
|
+
* @see https://www.harrytheo.com/blog/2021/02/restart-a-css-animation-with-javascript/#restarting-a-css-animation
|
|
209
209
|
*/
|
|
210
210
|
const reflow = element => {
|
|
211
211
|
element.offsetHeight; // eslint-disable-line no-unused-expressions
|
|
@@ -250,7 +250,7 @@ var StateTemplateNpmPackageVersion="6.5.2";
|
|
|
250
250
|
});
|
|
251
251
|
};
|
|
252
252
|
const execute = (possibleCallback, args = [], defaultValue = possibleCallback) => {
|
|
253
|
-
return typeof possibleCallback === 'function' ? possibleCallback(...args) : defaultValue;
|
|
253
|
+
return typeof possibleCallback === 'function' ? possibleCallback.call(...args) : defaultValue;
|
|
254
254
|
};
|
|
255
255
|
const executeAfterTransition = (callback, transitionElement, waitForTransition = true) => {
|
|
256
256
|
if (!waitForTransition) {
|
|
@@ -572,7 +572,7 @@ var StateTemplateNpmPackageVersion="6.5.2";
|
|
|
572
572
|
const bsKeys = Object.keys(element.dataset).filter(key => key.startsWith('bs') && !key.startsWith('bsConfig'));
|
|
573
573
|
for (const key of bsKeys) {
|
|
574
574
|
let pureKey = key.replace(/^bs/, '');
|
|
575
|
-
pureKey = pureKey.charAt(0).toLowerCase() + pureKey.slice(1
|
|
575
|
+
pureKey = pureKey.charAt(0).toLowerCase() + pureKey.slice(1);
|
|
576
576
|
attributes[pureKey] = normalizeData(element.dataset[key]);
|
|
577
577
|
}
|
|
578
578
|
return attributes;
|
|
@@ -647,7 +647,7 @@ var StateTemplateNpmPackageVersion="6.5.2";
|
|
|
647
647
|
* Constants
|
|
648
648
|
*/
|
|
649
649
|
|
|
650
|
-
const VERSION = '5.3.
|
|
650
|
+
const VERSION = '5.3.8';
|
|
651
651
|
|
|
652
652
|
/**
|
|
653
653
|
* Class definition
|
|
@@ -673,6 +673,8 @@ var StateTemplateNpmPackageVersion="6.5.2";
|
|
|
673
673
|
this[propertyName] = null;
|
|
674
674
|
}
|
|
675
675
|
}
|
|
676
|
+
|
|
677
|
+
// Private
|
|
676
678
|
_queueCallback(callback, element, isAnimated = true) {
|
|
677
679
|
executeAfterTransition(callback, element, isAnimated);
|
|
678
680
|
}
|
|
@@ -1604,11 +1606,11 @@ var StateTemplateNpmPackageVersion="6.5.2";
|
|
|
1604
1606
|
this._element.style[dimension] = '';
|
|
1605
1607
|
this._queueCallback(complete, this._element, true);
|
|
1606
1608
|
}
|
|
1609
|
+
|
|
1610
|
+
// Private
|
|
1607
1611
|
_isShown(element = this._element) {
|
|
1608
1612
|
return element.classList.contains(CLASS_NAME_SHOW$7);
|
|
1609
1613
|
}
|
|
1610
|
-
|
|
1611
|
-
// Private
|
|
1612
1614
|
_configAfterMerge(config) {
|
|
1613
1615
|
config.toggle = Boolean(config.toggle); // Coerce string values
|
|
1614
1616
|
config.parent = getElement(config.parent);
|
|
@@ -2666,7 +2668,6 @@ var StateTemplateNpmPackageVersion="6.5.2";
|
|
|
2666
2668
|
var popperOffsets = computeOffsets({
|
|
2667
2669
|
reference: referenceClientRect,
|
|
2668
2670
|
element: popperRect,
|
|
2669
|
-
strategy: 'absolute',
|
|
2670
2671
|
placement: placement
|
|
2671
2672
|
});
|
|
2672
2673
|
var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets));
|
|
@@ -2994,7 +2995,6 @@ var StateTemplateNpmPackageVersion="6.5.2";
|
|
|
2994
2995
|
state.modifiersData[name] = computeOffsets({
|
|
2995
2996
|
reference: state.rects.reference,
|
|
2996
2997
|
element: state.rects.popper,
|
|
2997
|
-
strategy: 'absolute',
|
|
2998
2998
|
placement: state.placement
|
|
2999
2999
|
});
|
|
3000
3000
|
} // eslint-disable-next-line import/no-unused-modules
|
|
@@ -3701,7 +3701,7 @@ var StateTemplateNpmPackageVersion="6.5.2";
|
|
|
3701
3701
|
}
|
|
3702
3702
|
_createPopper() {
|
|
3703
3703
|
if (typeof Popper === 'undefined') {
|
|
3704
|
-
throw new TypeError('Bootstrap\'s dropdowns require Popper (https://popper.js.org)');
|
|
3704
|
+
throw new TypeError('Bootstrap\'s dropdowns require Popper (https://popper.js.org/docs/v2/)');
|
|
3705
3705
|
}
|
|
3706
3706
|
let referenceElement = this._element;
|
|
3707
3707
|
if (this._config.reference === 'parent') {
|
|
@@ -3780,7 +3780,7 @@ var StateTemplateNpmPackageVersion="6.5.2";
|
|
|
3780
3780
|
}
|
|
3781
3781
|
return {
|
|
3782
3782
|
...defaultBsPopperConfig,
|
|
3783
|
-
...execute(this._config.popperConfig, [defaultBsPopperConfig])
|
|
3783
|
+
...execute(this._config.popperConfig, [undefined, defaultBsPopperConfig])
|
|
3784
3784
|
};
|
|
3785
3785
|
}
|
|
3786
3786
|
_selectMenuItem({
|
|
@@ -4802,7 +4802,6 @@ var StateTemplateNpmPackageVersion="6.5.2";
|
|
|
4802
4802
|
*
|
|
4803
4803
|
* Shout-out to Angular https://github.com/angular/angular/blob/15.2.8/packages/core/src/sanitization/url_sanitizer.ts#L38
|
|
4804
4804
|
*/
|
|
4805
|
-
// eslint-disable-next-line unicorn/better-regex
|
|
4806
4805
|
const SAFE_URL_PATTERN = /^(?!javascript:)(?:[a-z0-9+.-]+:|[^&:/?#]*(?:[/?#]|$))/i;
|
|
4807
4806
|
const allowedAttribute = (attribute, allowedAttributeList) => {
|
|
4808
4807
|
const attributeName = attribute.nodeName.toLowerCase();
|
|
@@ -4967,7 +4966,7 @@ var StateTemplateNpmPackageVersion="6.5.2";
|
|
|
4967
4966
|
return this._config.sanitize ? sanitizeHtml(arg, this._config.allowList, this._config.sanitizeFn) : arg;
|
|
4968
4967
|
}
|
|
4969
4968
|
_resolvePossibleFunction(arg) {
|
|
4970
|
-
return execute(arg, [this]);
|
|
4969
|
+
return execute(arg, [undefined, this]);
|
|
4971
4970
|
}
|
|
4972
4971
|
_putElementInTemplate(element, templateElement) {
|
|
4973
4972
|
if (this._config.html) {
|
|
@@ -5066,7 +5065,7 @@ var StateTemplateNpmPackageVersion="6.5.2";
|
|
|
5066
5065
|
class Tooltip extends BaseComponent {
|
|
5067
5066
|
constructor(element, config) {
|
|
5068
5067
|
if (typeof Popper === 'undefined') {
|
|
5069
|
-
throw new TypeError('Bootstrap\'s tooltips require Popper (https://popper.js.org)');
|
|
5068
|
+
throw new TypeError('Bootstrap\'s tooltips require Popper (https://popper.js.org/docs/v2/)');
|
|
5070
5069
|
}
|
|
5071
5070
|
super(element, config);
|
|
5072
5071
|
|
|
@@ -5112,7 +5111,6 @@ var StateTemplateNpmPackageVersion="6.5.2";
|
|
|
5112
5111
|
if (!this._isEnabled) {
|
|
5113
5112
|
return;
|
|
5114
5113
|
}
|
|
5115
|
-
this._activeTrigger.click = !this._activeTrigger.click;
|
|
5116
5114
|
if (this._isShown()) {
|
|
5117
5115
|
this._leave();
|
|
5118
5116
|
return;
|
|
@@ -5300,7 +5298,7 @@ var StateTemplateNpmPackageVersion="6.5.2";
|
|
|
5300
5298
|
return offset;
|
|
5301
5299
|
}
|
|
5302
5300
|
_resolvePossibleFunction(arg) {
|
|
5303
|
-
return execute(arg, [this._element]);
|
|
5301
|
+
return execute(arg, [this._element, this._element]);
|
|
5304
5302
|
}
|
|
5305
5303
|
_getPopperConfig(attachment) {
|
|
5306
5304
|
const defaultBsPopperConfig = {
|
|
@@ -5338,7 +5336,7 @@ var StateTemplateNpmPackageVersion="6.5.2";
|
|
|
5338
5336
|
};
|
|
5339
5337
|
return {
|
|
5340
5338
|
...defaultBsPopperConfig,
|
|
5341
|
-
...execute(this._config.popperConfig, [defaultBsPopperConfig])
|
|
5339
|
+
...execute(this._config.popperConfig, [undefined, defaultBsPopperConfig])
|
|
5342
5340
|
};
|
|
5343
5341
|
}
|
|
5344
5342
|
_setListeners() {
|
|
@@ -5347,6 +5345,7 @@ var StateTemplateNpmPackageVersion="6.5.2";
|
|
|
5347
5345
|
if (trigger === 'click') {
|
|
5348
5346
|
EventHandler.on(this._element, this.constructor.eventName(EVENT_CLICK$1), this._config.selector, event => {
|
|
5349
5347
|
const context = this._initializeOnDelegatedTarget(event);
|
|
5348
|
+
context._activeTrigger[TRIGGER_CLICK] = !(context._isShown() && context._activeTrigger[TRIGGER_CLICK]);
|
|
5350
5349
|
context.toggle();
|
|
5351
5350
|
});
|
|
5352
5351
|
} else if (trigger !== TRIGGER_MANUAL) {
|
|
@@ -6212,7 +6211,6 @@ var StateTemplateNpmPackageVersion="6.5.2";
|
|
|
6212
6211
|
}
|
|
6213
6212
|
|
|
6214
6213
|
// Private
|
|
6215
|
-
|
|
6216
6214
|
_maybeScheduleHide() {
|
|
6217
6215
|
if (!this._config.autohide) {
|
|
6218
6216
|
return;
|
|
@@ -6880,12 +6878,15 @@ window.addEventListener("load", () => {
|
|
|
6880
6878
|
* License MIT: https://github.com/nico3333fr/van11y-accessible-accordion-aria/blob/master/LICENSE
|
|
6881
6879
|
*/
|
|
6882
6880
|
(() => {
|
|
6883
|
-
const isDesktopWidth = () =>
|
|
6881
|
+
const isDesktopWidth = () =>
|
|
6882
|
+
getComputedStyle(document.documentElement)
|
|
6883
|
+
.getPropertyValue("--is-mobile")
|
|
6884
|
+
.trim() === "0";
|
|
6884
6885
|
|
|
6885
6886
|
/**
|
|
6886
|
-
* @param {
|
|
6887
|
-
* @param {
|
|
6888
|
-
* @param {
|
|
6887
|
+
* @param {object} obj
|
|
6888
|
+
* @param {string} key
|
|
6889
|
+
* @param {string | number} value
|
|
6889
6890
|
*/
|
|
6890
6891
|
const _defineProperty = (obj, key, value) => {
|
|
6891
6892
|
if (key in obj) {
|
|
@@ -6905,8 +6906,8 @@ window.addEventListener("load", () => {
|
|
|
6905
6906
|
const CACHE = {};
|
|
6906
6907
|
|
|
6907
6908
|
/**
|
|
6908
|
-
* @param {
|
|
6909
|
-
* @param {
|
|
6909
|
+
* @param {string | number} id
|
|
6910
|
+
* @param {object} config
|
|
6910
6911
|
*/
|
|
6911
6912
|
const set = (id, config) => {
|
|
6912
6913
|
CACHE[id] = config;
|
|
@@ -6914,7 +6915,7 @@ window.addEventListener("load", () => {
|
|
|
6914
6915
|
|
|
6915
6916
|
/**
|
|
6916
6917
|
*
|
|
6917
|
-
* @param {
|
|
6918
|
+
* @param {string | number} id
|
|
6918
6919
|
*/
|
|
6919
6920
|
const get = id => {
|
|
6920
6921
|
return CACHE[id];
|
|
@@ -6922,7 +6923,7 @@ window.addEventListener("load", () => {
|
|
|
6922
6923
|
|
|
6923
6924
|
/**
|
|
6924
6925
|
*
|
|
6925
|
-
* @param {
|
|
6926
|
+
* @param {string | number} id
|
|
6926
6927
|
*/
|
|
6927
6928
|
const remove = id => {
|
|
6928
6929
|
return CACHE[id];
|
|
@@ -6939,10 +6940,11 @@ window.addEventListener("load", () => {
|
|
|
6939
6940
|
|
|
6940
6941
|
const pluginConfig = loadConfig();
|
|
6941
6942
|
|
|
6942
|
-
/**
|
|
6943
|
-
*
|
|
6944
|
-
* @param {
|
|
6945
|
-
* @
|
|
6943
|
+
/**
|
|
6944
|
+
* Find an element based on an Id
|
|
6945
|
+
* @param {string} id Id to find
|
|
6946
|
+
* @param {string} hash hash id (not mandatory)
|
|
6947
|
+
* @returns {Element | null} the element with the specified id
|
|
6946
6948
|
*/
|
|
6947
6949
|
const findById = (id, hash) =>
|
|
6948
6950
|
document.querySelector(`#${id}[${DATA_HASH_ID}="${hash}"]`);
|
|
@@ -6957,10 +6959,11 @@ window.addEventListener("load", () => {
|
|
|
6957
6959
|
});
|
|
6958
6960
|
};
|
|
6959
6961
|
|
|
6960
|
-
/**
|
|
6962
|
+
/**
|
|
6963
|
+
* search if element is or is contained in another element with attribute data-nav-id
|
|
6961
6964
|
* @param {Element | null} el element (node)
|
|
6962
|
-
* @param {
|
|
6963
|
-
* @
|
|
6965
|
+
* @param {string} hashId the attribute data-hashtooltip-id
|
|
6966
|
+
* @returns {string | null} the value of attribute data-hashtooltip-id
|
|
6964
6967
|
*/
|
|
6965
6968
|
const searchParentHashId = (el, hashId) => {
|
|
6966
6969
|
let parentElement = el;
|
|
@@ -6976,8 +6979,8 @@ window.addEventListener("load", () => {
|
|
|
6976
6979
|
|
|
6977
6980
|
/**
|
|
6978
6981
|
* @param {Element | null} el
|
|
6979
|
-
* @param {
|
|
6980
|
-
* @param {
|
|
6982
|
+
* @param {string} parentClass
|
|
6983
|
+
* @param {string} hashId
|
|
6981
6984
|
*/
|
|
6982
6985
|
const searchParent = (el, parentClass, hashId) => {
|
|
6983
6986
|
let parentElement = el;
|
|
@@ -6994,16 +6997,6 @@ window.addEventListener("load", () => {
|
|
|
6994
6997
|
return "";
|
|
6995
6998
|
};
|
|
6996
6999
|
|
|
6997
|
-
const mobileView = () => {
|
|
6998
|
-
const mobileElement = document.querySelector(
|
|
6999
|
-
".global-header .mobile-controls"
|
|
7000
|
-
);
|
|
7001
|
-
|
|
7002
|
-
return mobileElement
|
|
7003
|
-
? getComputedStyle(mobileElement)["display"] !== "none"
|
|
7004
|
-
: false;
|
|
7005
|
-
};
|
|
7006
|
-
|
|
7007
7000
|
/**
|
|
7008
7001
|
* @param {...any} pluginArgs
|
|
7009
7002
|
*/
|
|
@@ -7101,7 +7094,7 @@ window.addEventListener("load", () => {
|
|
|
7101
7094
|
// Init attributes accordion
|
|
7102
7095
|
accordion_node.setAttribute(
|
|
7103
7096
|
CONFIG.ATTR_MULTISELECTABLE,
|
|
7104
|
-
|
|
7097
|
+
!isDesktopWidth() ? "true" : "false"
|
|
7105
7098
|
);
|
|
7106
7099
|
|
|
7107
7100
|
accordion_node.setAttribute(DATA_HASH_ID, HASH_ID);
|
|
@@ -7306,7 +7299,7 @@ window.addEventListener("load", () => {
|
|
|
7306
7299
|
);
|
|
7307
7300
|
}
|
|
7308
7301
|
|
|
7309
|
-
if (
|
|
7302
|
+
if (isDesktopWidth()) {
|
|
7310
7303
|
accordionAllHeaders.forEach(header_node => {
|
|
7311
7304
|
//Close all the other panels
|
|
7312
7305
|
|
|
@@ -7452,7 +7445,7 @@ window.addEventListener("load", () => {
|
|
|
7452
7445
|
const toggleSubNav = document.createElement("div");
|
|
7453
7446
|
toggleSubNav.classList.add("rotate");
|
|
7454
7447
|
toggleSubNav.ariaHidden = "true";
|
|
7455
|
-
toggleSubNav.style.display =
|
|
7448
|
+
toggleSubNav.style.display = isDesktopWidth() ? "none" : "block";
|
|
7456
7449
|
|
|
7457
7450
|
el.appendChild(toggleSubNav);
|
|
7458
7451
|
el.appendChild(carrot);
|
|
@@ -7493,6 +7486,11 @@ window.addEventListener("load", () => {
|
|
|
7493
7486
|
----------------------------------------- */
|
|
7494
7487
|
|
|
7495
7488
|
window.addEventListener("load", () => {
|
|
7489
|
+
const isDesktopWidth = () =>
|
|
7490
|
+
getComputedStyle(document.documentElement)
|
|
7491
|
+
.getPropertyValue("--is-mobile")
|
|
7492
|
+
.trim() === "0";
|
|
7493
|
+
|
|
7496
7494
|
const setSearchContainerAriaHidden = () => {
|
|
7497
7495
|
if (searchContainer) {
|
|
7498
7496
|
if (featuredsearch) {
|
|
@@ -7508,18 +7506,6 @@ window.addEventListener("load", () => {
|
|
|
7508
7506
|
}
|
|
7509
7507
|
};
|
|
7510
7508
|
|
|
7511
|
-
const mobileControlVisible = () => {
|
|
7512
|
-
const mobileElement = document.querySelector(
|
|
7513
|
-
".global-header .mobile-controls"
|
|
7514
|
-
);
|
|
7515
|
-
|
|
7516
|
-
if (mobileElement) {
|
|
7517
|
-
return getComputedStyle(mobileElement)["display"] !== "none";
|
|
7518
|
-
} else {
|
|
7519
|
-
return false; // or whatever is supposed to be returned when there is no header
|
|
7520
|
-
}
|
|
7521
|
-
};
|
|
7522
|
-
|
|
7523
7509
|
const removeSearchResults = () => {
|
|
7524
7510
|
document.body.classList.remove("active-search");
|
|
7525
7511
|
if (searchText) searchText.value = "";
|
|
@@ -7548,7 +7534,7 @@ window.addEventListener("load", () => {
|
|
|
7548
7534
|
|
|
7549
7535
|
// document.dispatchEvent('cagov.searchresults.hide'); // ???
|
|
7550
7536
|
|
|
7551
|
-
if (
|
|
7537
|
+
if (!isDesktopWidth()) setSearchContainerAriaHidden();
|
|
7552
7538
|
};
|
|
7553
7539
|
|
|
7554
7540
|
/** @type {HTMLInputElement | null} */
|
|
@@ -7632,7 +7618,7 @@ window.addEventListener("load", () => {
|
|
|
7632
7618
|
if (!searchbox) return;
|
|
7633
7619
|
|
|
7634
7620
|
// calulation search box top position
|
|
7635
|
-
if (
|
|
7621
|
+
if (isDesktopWidth()) {
|
|
7636
7622
|
searchbox.style.top = `${Math.max(getSearchTop(), 55)}px`;
|
|
7637
7623
|
}
|
|
7638
7624
|
};
|
|
@@ -8653,11 +8639,12 @@ cagov-pagination .cagov-pagination__item:has(.cagov-pagination__link-inactive) {
|
|
|
8653
8639
|
//@ts-check
|
|
8654
8640
|
|
|
8655
8641
|
window.addEventListener("load", () => {
|
|
8656
|
-
const isDesktopWidth = () => window.innerWidth > 991; //Maximum px for mobile width
|
|
8657
|
-
|
|
8658
8642
|
/** @type {HTMLButtonElement} */
|
|
8659
8643
|
const navToggleBtn = document.querySelector(".toggle-menu");
|
|
8660
8644
|
if (!navToggleBtn) return;
|
|
8645
|
+
/** @type {HTMLDivElement} */
|
|
8646
|
+
const navSearchCont = document.querySelector(".navigation-search");
|
|
8647
|
+
if (!navSearchCont) return;
|
|
8661
8648
|
/** @type {HTMLElement} */
|
|
8662
8649
|
const mainNav = document.querySelector(".main-navigation");
|
|
8663
8650
|
// create container for drawer mobile nav items
|
|
@@ -8681,16 +8668,6 @@ window.addEventListener("load", () => {
|
|
|
8681
8668
|
navMobileMenuToggleBtn.append(...navCloseBtnSpans);
|
|
8682
8669
|
mobileItemsCont.append(navMobileMenuToggleBtn);
|
|
8683
8670
|
|
|
8684
|
-
// VARIABLES
|
|
8685
|
-
/** @type {HTMLDivElement} */
|
|
8686
|
-
const navSearchCont = document.querySelector(".navigation-search");
|
|
8687
|
-
if (!navSearchCont) return;
|
|
8688
|
-
|
|
8689
|
-
const mobileCntls = document.querySelector(".global-header .mobile-controls");
|
|
8690
|
-
const mobileControlsDisplay = mobileCntls
|
|
8691
|
-
? window.getComputedStyle(mobileCntls).display
|
|
8692
|
-
: "";
|
|
8693
|
-
|
|
8694
8671
|
//Used for hiding/showing main elements
|
|
8695
8672
|
const mainElements = document.querySelectorAll(
|
|
8696
8673
|
".main-content, footer, .site-footer, .utility-header, .branding"
|
|
@@ -8698,6 +8675,11 @@ window.addEventListener("load", () => {
|
|
|
8698
8675
|
|
|
8699
8676
|
const regularHeader = document.querySelector("header");
|
|
8700
8677
|
|
|
8678
|
+
// Begin Function Definitions
|
|
8679
|
+
const isDesktopWidth = () =>
|
|
8680
|
+
getComputedStyle(document.documentElement)
|
|
8681
|
+
.getPropertyValue("--is-mobile")
|
|
8682
|
+
.trim() === "0";
|
|
8701
8683
|
// reset navigation function
|
|
8702
8684
|
const NavReset = () => {
|
|
8703
8685
|
//RESET
|
|
@@ -8741,63 +8723,26 @@ window.addEventListener("load", () => {
|
|
|
8741
8723
|
)
|
|
8742
8724
|
);
|
|
8743
8725
|
|
|
8744
|
-
// Escape key event listener
|
|
8745
|
-
document.addEventListener("keydown", e => {
|
|
8746
|
-
if (navSearchCont.classList.contains("visible")) {
|
|
8747
|
-
if (e.key === "Escape") {
|
|
8748
|
-
e.stopPropagation();
|
|
8749
|
-
closeMenu();
|
|
8750
|
-
}
|
|
8751
|
-
}
|
|
8752
|
-
});
|
|
8753
|
-
|
|
8754
|
-
const checkIfMobileView = () => {
|
|
8755
|
-
const mobileElement = document.querySelector(
|
|
8756
|
-
".global-header .mobile-controls"
|
|
8757
|
-
);
|
|
8758
|
-
return mobileElement
|
|
8759
|
-
? getComputedStyle(mobileElement)["display"] !== "none"
|
|
8760
|
-
: false;
|
|
8761
|
-
};
|
|
8762
|
-
|
|
8763
|
-
// Close menu on focusout (tabbing out) event (if target is outside of mobile menu and ignore if focus target is navToggleBtn button)
|
|
8764
|
-
navSearchCont.addEventListener("focusout", e => {
|
|
8765
|
-
if (checkIfMobileView()) {
|
|
8766
|
-
const child = /** @type {Node} **/ (e.relatedTarget);
|
|
8767
|
-
const parent = /** @type {Node} **/ (e.currentTarget);
|
|
8768
|
-
|
|
8769
|
-
if (child && !parent.contains(child)) {
|
|
8770
|
-
closeMenu();
|
|
8771
|
-
}
|
|
8772
|
-
}
|
|
8773
|
-
});
|
|
8774
|
-
|
|
8775
8726
|
// Button click open menu function
|
|
8776
8727
|
const openMenu = () => {
|
|
8777
8728
|
navSearchCont.classList.add("visible");
|
|
8778
8729
|
navSearchCont.classList.remove("not-visible");
|
|
8779
8730
|
document.body.classList.add("overflow-hidden");
|
|
8780
8731
|
navToggleBtn.ariaExpanded = "true";
|
|
8781
|
-
setOpen();
|
|
8782
|
-
// Hide all the website areas (add aria-hidden)
|
|
8783
|
-
mainElements.forEach(x => (x.ariaHidden = "true"));
|
|
8784
|
-
|
|
8785
|
-
regularHeader?.classList.add("nav-overlay");
|
|
8786
|
-
navMobileMenuToggleBtn.focus();
|
|
8787
|
-
};
|
|
8788
|
-
|
|
8789
|
-
const setOpen = () => {
|
|
8790
8732
|
navMobileMenuToggleBtn.ariaExpanded = "true";
|
|
8791
8733
|
navSearchCont.ariaHidden = null;
|
|
8792
8734
|
// make links focusable
|
|
8793
8735
|
getAllNavLinks().forEach(el => el.removeAttribute("tabindex"));
|
|
8794
8736
|
// desktop
|
|
8795
|
-
|
|
8796
|
-
|
|
8797
|
-
navToggleBtn.ariaExpanded !== "false"
|
|
8798
|
-
) {
|
|
8737
|
+
|
|
8738
|
+
if (isDesktopWidth() && navToggleBtn.ariaExpanded !== "false") {
|
|
8799
8739
|
navToggleBtn.ariaExpanded = "false";
|
|
8800
8740
|
}
|
|
8741
|
+
// Hide all the website areas (add aria-hidden)
|
|
8742
|
+
mainElements.forEach(x => (x.ariaHidden = "true"));
|
|
8743
|
+
|
|
8744
|
+
regularHeader?.classList.add("nav-overlay");
|
|
8745
|
+
navMobileMenuToggleBtn.focus();
|
|
8801
8746
|
};
|
|
8802
8747
|
|
|
8803
8748
|
// Button click close menu function
|
|
@@ -8811,10 +8756,6 @@ window.addEventListener("load", () => {
|
|
|
8811
8756
|
|
|
8812
8757
|
navSearchCont.classList.add("not-visible");
|
|
8813
8758
|
|
|
8814
|
-
setClosed();
|
|
8815
|
-
};
|
|
8816
|
-
|
|
8817
|
-
const setClosed = () => {
|
|
8818
8759
|
if (navToggleBtn.ariaExpanded !== "false") {
|
|
8819
8760
|
navToggleBtn.ariaExpanded = "false";
|
|
8820
8761
|
}
|
|
@@ -8832,11 +8773,6 @@ window.addEventListener("load", () => {
|
|
|
8832
8773
|
NavReset();
|
|
8833
8774
|
};
|
|
8834
8775
|
|
|
8835
|
-
// Button Click event
|
|
8836
|
-
navToggleBtn.addEventListener("click", openMenu);
|
|
8837
|
-
// Button Click event
|
|
8838
|
-
navMobileMenuToggleBtn.addEventListener("click", closeMenu);
|
|
8839
|
-
|
|
8840
8776
|
const mobileCheck = () => {
|
|
8841
8777
|
const searchInput = document.querySelector(".search-textfield");
|
|
8842
8778
|
if (!searchInput) return;
|
|
@@ -8870,10 +8806,37 @@ window.addEventListener("load", () => {
|
|
|
8870
8806
|
}
|
|
8871
8807
|
};
|
|
8872
8808
|
|
|
8809
|
+
// End Function Definitions
|
|
8810
|
+
|
|
8811
|
+
// Escape key event listener
|
|
8812
|
+
document.addEventListener("keydown", e => {
|
|
8813
|
+
if (e.key === "Escape" && navSearchCont.classList.contains("visible")) {
|
|
8814
|
+
e.stopPropagation();
|
|
8815
|
+
closeMenu();
|
|
8816
|
+
}
|
|
8817
|
+
});
|
|
8818
|
+
|
|
8819
|
+
// Close menu on focusout (tabbing out) event (if target is outside of mobile menu and ignore if focus target is navToggleBtn button)
|
|
8820
|
+
navSearchCont.addEventListener("focusout", e => {
|
|
8821
|
+
if (!isDesktopWidth()) {
|
|
8822
|
+
const child = /** @type {Node} **/ (e.relatedTarget);
|
|
8823
|
+
const parent = /** @type {Node} **/ (e.currentTarget);
|
|
8824
|
+
|
|
8825
|
+
if (child && !parent.contains(child)) {
|
|
8826
|
+
closeMenu();
|
|
8827
|
+
}
|
|
8828
|
+
}
|
|
8829
|
+
});
|
|
8830
|
+
|
|
8831
|
+
// Button Click event
|
|
8832
|
+
navToggleBtn.addEventListener("click", openMenu);
|
|
8833
|
+
// Button Click event
|
|
8834
|
+
navMobileMenuToggleBtn.addEventListener("click", closeMenu);
|
|
8835
|
+
|
|
8873
8836
|
// Close mobile nav if click outside of nav
|
|
8874
8837
|
regularHeader.addEventListener("mouseup", e => {
|
|
8875
8838
|
// if the target of the click isn't the navigation container nor a descendant of the navigation
|
|
8876
|
-
if (
|
|
8839
|
+
if (!isDesktopWidth()) {
|
|
8877
8840
|
if (
|
|
8878
8841
|
navSearchCont !== e.target &&
|
|
8879
8842
|
!navSearchCont?.contains(/**@type {Node} */ (e.target))
|