@cagovweb/state-template 6.3.1 → 6.3.2

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.
@@ -1,7 +1,7 @@
1
- var StateTemplateNpmPackageVersion="6.3.1";
1
+ var StateTemplateNpmPackageVersion="6.3.2";
2
2
  /*!
3
- * Bootstrap v5.3.0 (https://getbootstrap.com/)
4
- * Copyright 2011-2023 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
3
+ * Bootstrap v5.3.3 (https://getbootstrap.com/)
4
+ * Copyright 2011-2024 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) {
@@ -210,7 +210,6 @@ var StateTemplateNpmPackageVersion="6.3.1";
210
210
  const reflow = element => {
211
211
  element.offsetHeight; // eslint-disable-line no-unused-expressions
212
212
  };
213
-
214
213
  const getjQuery = () => {
215
214
  if (window.jQuery && !document.body.hasAttribute('data-bs-no-jquery')) {
216
215
  return window.jQuery;
@@ -648,7 +647,7 @@ var StateTemplateNpmPackageVersion="6.3.1";
648
647
  * Constants
649
648
  */
650
649
 
651
- const VERSION = '5.3.0';
650
+ const VERSION = '5.3.3';
652
651
 
653
652
  /**
654
653
  * Class definition
@@ -731,7 +730,7 @@ var StateTemplateNpmPackageVersion="6.3.1";
731
730
  }
732
731
  selector = hrefAttribute && hrefAttribute !== '#' ? hrefAttribute.trim() : null;
733
732
  }
734
- return parseSelector(selector);
733
+ return selector ? selector.split(',').map(sel => parseSelector(sel)).join(',') : null;
735
734
  };
736
735
  const SelectorEngine = {
737
736
  find(selector, element = document.documentElement) {
@@ -3916,7 +3915,6 @@ var StateTemplateNpmPackageVersion="6.3.1";
3916
3915
  // if false, we use the backdrop helper without adding any element to the dom
3917
3916
  rootElement: 'body' // give the choice to place backdrop under different elements
3918
3917
  };
3919
-
3920
3918
  const DefaultType$8 = {
3921
3919
  className: 'string',
3922
3920
  clickCallback: '(function|null)',
@@ -4041,7 +4039,6 @@ var StateTemplateNpmPackageVersion="6.3.1";
4041
4039
  autofocus: true,
4042
4040
  trapElement: null // The element to trap focus inside of
4043
4041
  };
4044
-
4045
4042
  const DefaultType$7 = {
4046
4043
  autofocus: 'boolean',
4047
4044
  trapElement: 'element'
@@ -4768,7 +4765,10 @@ var StateTemplateNpmPackageVersion="6.3.1";
4768
4765
  br: [],
4769
4766
  col: [],
4770
4767
  code: [],
4768
+ dd: [],
4771
4769
  div: [],
4770
+ dl: [],
4771
+ dt: [],
4772
4772
  em: [],
4773
4773
  hr: [],
4774
4774
  h1: [],
@@ -5858,13 +5858,15 @@ var StateTemplateNpmPackageVersion="6.3.1";
5858
5858
  const ARROW_RIGHT_KEY = 'ArrowRight';
5859
5859
  const ARROW_UP_KEY = 'ArrowUp';
5860
5860
  const ARROW_DOWN_KEY = 'ArrowDown';
5861
+ const HOME_KEY = 'Home';
5862
+ const END_KEY = 'End';
5861
5863
  const CLASS_NAME_ACTIVE = 'active';
5862
5864
  const CLASS_NAME_FADE$1 = 'fade';
5863
5865
  const CLASS_NAME_SHOW$1 = 'show';
5864
5866
  const CLASS_DROPDOWN = 'dropdown';
5865
5867
  const SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle';
5866
5868
  const SELECTOR_DROPDOWN_MENU = '.dropdown-menu';
5867
- const NOT_SELECTOR_DROPDOWN_TOGGLE = ':not(.dropdown-toggle)';
5869
+ const NOT_SELECTOR_DROPDOWN_TOGGLE = `:not(${SELECTOR_DROPDOWN_TOGGLE})`;
5868
5870
  const SELECTOR_TAB_PANEL = '.list-group, .nav, [role="tablist"]';
5869
5871
  const SELECTOR_OUTER = '.nav-item, .list-group-item';
5870
5872
  const SELECTOR_INNER = `.nav-link${NOT_SELECTOR_DROPDOWN_TOGGLE}, .list-group-item${NOT_SELECTOR_DROPDOWN_TOGGLE}, [role="tab"]${NOT_SELECTOR_DROPDOWN_TOGGLE}`;
@@ -5964,13 +5966,19 @@ var StateTemplateNpmPackageVersion="6.3.1";
5964
5966
  this._queueCallback(complete, element, element.classList.contains(CLASS_NAME_FADE$1));
5965
5967
  }
5966
5968
  _keydown(event) {
5967
- if (![ARROW_LEFT_KEY, ARROW_RIGHT_KEY, ARROW_UP_KEY, ARROW_DOWN_KEY].includes(event.key)) {
5969
+ if (![ARROW_LEFT_KEY, ARROW_RIGHT_KEY, ARROW_UP_KEY, ARROW_DOWN_KEY, HOME_KEY, END_KEY].includes(event.key)) {
5968
5970
  return;
5969
5971
  }
5970
5972
  event.stopPropagation(); // stopPropagation/preventDefault both added to support up/down keys without scrolling the page
5971
5973
  event.preventDefault();
5972
- const isNext = [ARROW_RIGHT_KEY, ARROW_DOWN_KEY].includes(event.key);
5973
- const nextActiveElement = getNextActiveElement(this._getChildren().filter(element => !isDisabled(element)), event.target, isNext, true);
5974
+ const children = this._getChildren().filter(element => !isDisabled(element));
5975
+ let nextActiveElement;
5976
+ if ([HOME_KEY, END_KEY].includes(event.key)) {
5977
+ nextActiveElement = children[event.key === HOME_KEY ? 0 : children.length - 1];
5978
+ } else {
5979
+ const isNext = [ARROW_RIGHT_KEY, ARROW_DOWN_KEY].includes(event.key);
5980
+ nextActiveElement = getNextActiveElement(children, event.target, isNext, true);
5981
+ }
5974
5982
  if (nextActiveElement) {
5975
5983
  nextActiveElement.focus({
5976
5984
  preventScroll: true
@@ -7972,12 +7980,12 @@ document.addEventListener("DOMContentLoaded", () => {
7972
7980
 
7973
7981
  item.updateCounter = () => {
7974
7982
  item.counterCount += item.counterStep;
7975
- item.innerText = Math.ceil(item.counterCount).toString();
7983
+ item.innerText = Math.ceil(item.counterCount).toLocaleString();
7976
7984
 
7977
7985
  if (item.counterCount < item.counterTarget) {
7978
7986
  window.setTimeout(item.updateCounter, item.counterSpeed);
7979
7987
  } else {
7980
- item.innerText = item.counterTarget.toString();
7988
+ item.innerText = item.counterTarget.toLocaleString();
7981
7989
  }
7982
7990
  };
7983
7991
  });
@@ -8176,6 +8184,8 @@ window.addEventListener("load", () => {
8176
8184
 
8177
8185
  // DESKTOP Side nav
8178
8186
  const moveSideNavToMainContent = () => {
8187
+ if (sidenavigation === mainContentSideNavCont) return; //Prevents an error if sidenav is not set up correctly
8188
+
8179
8189
  mainContentSideNavCont?.append(sidenavigation);
8180
8190
  sidenavigation.removeAttribute("aria-hidden");
8181
8191
  allSidenavLinks?.forEach(el => {
@@ -8661,7 +8671,8 @@ window.addEventListener("load", () => {
8661
8671
  /** @type {HTMLButtonElement} */
8662
8672
  const navToggleBtn = document.querySelector(".toggle-menu");
8663
8673
  if (!navToggleBtn) return;
8664
-
8674
+ /** @type {HTMLElement} */
8675
+ const mainNav = document.querySelector(".main-navigation");
8665
8676
  // create container for drawer mobile nav items
8666
8677
  const mobileItemsCont = document.createElement("div");
8667
8678
  mobileItemsCont.className = "nav-drawer";
@@ -8682,9 +8693,6 @@ window.addEventListener("load", () => {
8682
8693
  navMobileMenuToggleBtn.append(...navCloseBtnSpans);
8683
8694
  mobileItemsCont.append(navMobileMenuToggleBtn);
8684
8695
 
8685
- /** @type {HTMLElement} */
8686
- const mainNav = document.querySelector(".main-navigation");
8687
-
8688
8696
  // VARIABLES
8689
8697
  /** @type {HTMLDivElement} */
8690
8698
  const navSearchCont = document.querySelector(".navigation-search");
@@ -8842,16 +8850,34 @@ window.addEventListener("load", () => {
8842
8850
  navMobileMenuToggleBtn.addEventListener("click", closeMenu);
8843
8851
 
8844
8852
  const mobileCheck = () => {
8845
- NavReset();
8853
+ const searchInput = document.querySelector(".search-textfield");
8846
8854
 
8847
- // desktop
8848
- if (isDesktopWidth()) {
8849
- getAllFirstLevelNavLinks().forEach(el => el.removeAttribute("tabindex"));
8850
- }
8851
- // mobile
8852
- else {
8853
- getAllFirstLevelNavLinks().forEach(el => (el.tabIndex = -1));
8854
- closeMenu();
8855
+ // Add a focus event listener to add the class on focus
8856
+ searchInput.addEventListener("focus", () => {
8857
+ searchInput.classList.add("is-in-focus");
8858
+ });
8859
+
8860
+ // Add a blur event listener to remove the class on blur
8861
+ searchInput.addEventListener("blur", () => {
8862
+ // Remove the class after a delay
8863
+ setTimeout(() => {
8864
+ searchInput.classList.remove("is-in-focus");
8865
+ }, 500);
8866
+ });
8867
+
8868
+ if (!searchInput.classList.contains("is-in-focus")) {
8869
+ NavReset();
8870
+ // desktop
8871
+ if (isDesktopWidth()) {
8872
+ getAllFirstLevelNavLinks().forEach(el =>
8873
+ el.removeAttribute("tabindex")
8874
+ );
8875
+ }
8876
+ // mobile
8877
+ else {
8878
+ getAllFirstLevelNavLinks().forEach(el => (el.tabIndex = -1));
8879
+ closeMenu();
8880
+ }
8855
8881
  }
8856
8882
  };
8857
8883