kcc-gem-theme 1.33.15 → 1.34.15

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.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/_data/cache_bust_css.yml +1 -1
  3. data/_data/theme_hash.yml +1 -1
  4. data/_includes/header-global.html +24 -0
  5. data/_includes/nav-global-bottom.html +23 -0
  6. data/_includes/nav-global-local.html +29 -0
  7. data/_includes/nav-global-top.html +14 -0
  8. data/_includes/nav-local.html +3 -3
  9. data/_includes/scripts/kcc-mega-nav.html +2 -0
  10. data/_includes/scripts/kcc-nav.html +2 -0
  11. data/_includes/svg/kcc.html +62 -0
  12. data/_layouts/default-core.html +28 -0
  13. data/_layouts/default.html +1 -0
  14. data/assets/css/kcc-theme.css +1 -1
  15. data/assets/js/theme/dist/kcc-mega-nav.bundle.js +1 -0
  16. data/assets/js/theme/dist/kcc-nav.bundle.js +1 -0
  17. data/assets/js/theme/dist/kcc-theme-landing.bundle.js +1 -1
  18. data/assets/js/theme/dist/kcc-theme.bundle.js +1 -1
  19. data/assets/js/theme/nav/closeMegaNavOnClick.js +50 -0
  20. data/assets/js/theme/{src/closeMenuOnClick.js → nav/closeNavOnClick.js} +4 -0
  21. data/assets/js/theme/nav/googleCustomSearch.js +112 -0
  22. data/assets/js/theme/{src → nav}/highlightCurrentNav.js +0 -0
  23. data/assets/js/theme/nav/megaNav.js +9 -0
  24. data/assets/js/theme/{src → nav}/moveSearchIcon.js +0 -0
  25. data/assets/js/theme/nav/nav.js +13 -0
  26. data/assets/js/theme/nav/searchToggleMegaNav.js +96 -0
  27. data/assets/js/theme/{src/searchToggle.js → nav/searchToggleNav.js} +2 -2
  28. data/assets/js/theme/nav/toggleMenuOnWindowResize.js +26 -0
  29. data/assets/js/theme/nav/toggleSearchDropdownOnWindowResize.js +57 -0
  30. data/assets/js/theme/src/all.js +5 -15
  31. data/assets/scss/0-tools/_bootstrap-overrides.scss +20 -2
  32. data/assets/scss/0-tools/_gsc-overrides.scss +93 -11
  33. data/assets/scss/0-tools/_vars.scss +1 -0
  34. data/assets/scss/1-base/_header-global.scss +410 -0
  35. data/assets/scss/1-base/_links.scss +15 -0
  36. data/assets/scss/1-base/_typography.scss +75 -3
  37. data/assets/scss/3-layout/_padding.scss +12 -0
  38. data/assets/scss/3-layout/_positioning.scss +22 -6
  39. data/assets/scss/kcc-theme.scss +3 -1
  40. metadata +24 -6
File without changes
@@ -0,0 +1,9 @@
1
+ import toggleMenuOnWindowResize from './toggleMenuOnWindowResize.js';
2
+ import googleCustomSearchInit from './googleCustomSearch.js';
3
+ import closeMenuOnClick from './closeMegaNavOnClick.js';
4
+
5
+ document.addEventListener('DOMContentLoaded', function() {
6
+ toggleMenuOnWindowResize();
7
+ googleCustomSearchInit();
8
+ closeMenuOnClick();
9
+ });
File without changes
@@ -0,0 +1,13 @@
1
+ import highlightNav from './highlightCurrentNav.js';
2
+ import closeMenuOnClick from './closeNavOnClick.js';
3
+ import moveSearchIcon from './moveSearchIcon.js';
4
+ import searchToggle from './searchToggleNav.js';
5
+ import toggleSearchDropdownOnWindowResize from './toggleSearchDropdownOnWindowResize.js';
6
+
7
+ document.addEventListener('DOMContentLoaded', function() {
8
+ highlightNav();
9
+ searchToggle();
10
+ moveSearchIcon();
11
+ closeMenuOnClick();
12
+ toggleSearchDropdownOnWindowResize();
13
+ });
@@ -0,0 +1,96 @@
1
+ // Custom JS to toggle the search form
2
+ const FOCUSABLE_GOOGLE_CUSTOM_SEARCH_SELECTORS_ARR = [
3
+ '#gsc-i-id1',
4
+ '#gs_st50 .gsst_a',
5
+ '.gsc-search-button .gsc-search-button.gsc-search-button-v2'
6
+ ]; // Elements that Google Custom Search builds into the page
7
+ const OPEN_SEARCH_BUTTON_ID = 'openSearchButton';
8
+ const OPEN_SEARCH_BUTTON_CLASS = 'header-global__search-icon';
9
+ const CLOSE_SEARCH_BUTTON_ID = 'closeSearchButton';
10
+ const CLOSE_SEARCH_BUTTON_CLASS = 'header-global__close-icon';
11
+ const SEARCH_INPUT_ID = 'gsc-i-id1'; // An element that Google Custom Search builds into the page
12
+ const HEADER_GLOBAL_NAV_ID = 'headerGlobalNavbar';
13
+ const SEARCH_COLLAPSE_ID = 'searchCollapse';
14
+
15
+ function setElementAttribute(selector, attr, val) {
16
+ const el = document.querySelector(selector);
17
+
18
+ el.setAttribute(attr, val);
19
+ }
20
+
21
+ function toggleButtonAttributes(button, removeButtonOption, buttonClass) {
22
+ if ( removeButtonOption ) {
23
+ button.classList.add(buttonClass + '--hidden');
24
+ button.setAttribute('aria-hidden', 'true');
25
+ button.setAttribute('tabindex', '-1');
26
+ } else {
27
+ button.classList.remove(buttonClass + '--hidden');
28
+ button.setAttribute('aria-hidden', 'false');
29
+ button.setAttribute('tabindex', '0');
30
+ }
31
+ }
32
+
33
+ function handleSearchToggle(searchButtonWasClicked) {
34
+ const searchButtonEl = document.getElementById(OPEN_SEARCH_BUTTON_ID);
35
+ const closeButtonEl = document.getElementById(CLOSE_SEARCH_BUTTON_ID);
36
+ const searchInputField = document.getElementById(SEARCH_INPUT_ID);
37
+ let len = FOCUSABLE_GOOGLE_CUSTOM_SEARCH_SELECTORS_ARR.length;
38
+
39
+ if ( searchButtonWasClicked ) {
40
+ toggleButtonAttributes(searchButtonEl, true, OPEN_SEARCH_BUTTON_CLASS);
41
+ toggleButtonAttributes(closeButtonEl, false, CLOSE_SEARCH_BUTTON_CLASS);
42
+ for (var i = 0; i < len; i++) {
43
+ setElementAttribute(FOCUSABLE_GOOGLE_CUSTOM_SEARCH_SELECTORS_ARR[i], 'tabindex', '0');
44
+ }
45
+ searchInputField.focus();
46
+ } else {
47
+ toggleButtonAttributes(searchButtonEl, false, OPEN_SEARCH_BUTTON_CLASS);
48
+ toggleButtonAttributes(closeButtonEl, true, CLOSE_SEARCH_BUTTON_CLASS);
49
+ for (var i = 0; i < len; i++) {
50
+ setElementAttribute(FOCUSABLE_GOOGLE_CUSTOM_SEARCH_SELECTORS_ARR[i], 'tabindex', '-1');
51
+ }
52
+ }
53
+ }
54
+
55
+ function toggleOtherElements() {
56
+ const searchCollapse = document.getElementById(SEARCH_COLLAPSE_ID);
57
+ const headerGlobalNavbar = document.getElementById(HEADER_GLOBAL_NAV_ID);
58
+ const collapseAria = searchCollapse.getAttribute('aria-hidden');
59
+
60
+ searchCollapse.classList.toggle('header-global__search-collapse--visible');
61
+ (collapseAria === "true") ? searchCollapse.setAttribute('aria-hidden', 'false') : searchCollapse.setAttribute('aria-hidden', 'true');
62
+ headerGlobalNavbar.classList.toggle('header-global__navbar--search-toggle');
63
+ }
64
+
65
+ function checkClickedButton(event) {
66
+ let openSearchButtonWasClicked;
67
+
68
+ if ( event.target.closest('#openSearchButton') ) {
69
+ openSearchButtonWasClicked = true;
70
+ } else if ( event.target.closest('#closeSearchButton') ) {
71
+ openSearchButtonWasClicked = false;
72
+ }
73
+ handleSearchToggle(openSearchButtonWasClicked);
74
+ toggleOtherElements();
75
+ }
76
+
77
+ function clickEventHandler(event) {
78
+ if ( event.target.closest('#openSearchButton') || event.target.closest('#closeSearchButton') ) {
79
+ checkClickedButton(event);
80
+ } else {
81
+ return; // Bail-out
82
+ }
83
+ }
84
+
85
+ function addClickEventListener() {
86
+ document.addEventListener('click', clickEventHandler);
87
+ }
88
+
89
+ function initSearchToggle() {
90
+ if ( ! document.getElementById('openSearchButton') )
91
+ return;
92
+
93
+ addClickEventListener();
94
+ }
95
+
96
+ export default initSearchToggle;
@@ -15,13 +15,13 @@ function searchToggle() {
15
15
  function switchToX() {
16
16
  searchIconElement.style.backgroundImage = 'url("/assets/img/x.svg")';
17
17
  searchIconElement.setAttribute('alt', 'Close icon');
18
- searchButton.setAttribute('aria-label', 'Close');
18
+ searchButton.setAttribute('aria-label', 'Toggle Close');
19
19
  }
20
20
 
21
21
  function switchToSearch() {
22
22
  searchIconElement.style.backgroundImage = 'url("/assets/img/search.svg")';
23
23
  searchIconElement.setAttribute('alt', 'Search icon');
24
- searchButton.setAttribute('aria-label', 'Search');
24
+ searchButton.setAttribute('aria-label', 'Toggle Search');
25
25
  searchInputField.focus();
26
26
  }
27
27
 
@@ -0,0 +1,26 @@
1
+ // Custom JS to Close the Navigation menu, if its open, & if the screen goes above 992px wide (Bootstrap 4 'lg' devices)
2
+ const NAVBAR_COLLAPSE_ID = 'headerGlobalNavbarContent'; // ID built into the sites' HTML
3
+
4
+ function collapseElement(el) {
5
+ $(el).collapse('hide'); // Bootstrap 4 `.collapse()` method.
6
+ }
7
+
8
+ function checkNavbarCollapseState(menuEl) {
9
+ if ( menuEl.classList.contains('show') ) { // 'show' is a Bootstrap 4 class that makes `.collapse` items visible. // Checking to see if the Menu is open
10
+ collapseElement(menuEl);
11
+ }
12
+ }
13
+
14
+ function windowResizeHandler() {
15
+ if ( window.innerWidth >= 992 ) {
16
+ const menuCollapseElement = document.getElementById(NAVBAR_COLLAPSE_ID);
17
+
18
+ checkNavbarCollapseState(menuCollapseElement);
19
+ }
20
+ }
21
+
22
+ function toggleMenuOnWindowResize() {
23
+ window.addEventListener('resize', windowResizeHandler);
24
+ }
25
+
26
+ export default toggleMenuOnWindowResize;
@@ -0,0 +1,57 @@
1
+ // Custom JS to Close the Navigation menu, if its open, & if the screen goes above 992px wide (Bootstrap 4 'lg' devices)
2
+ const SEARCH_COLLAPSE_ID = 'searchCollapse'; // ID built into the sites' HTML
3
+ const SEARCH_COLLAPSE_IS_VISIBLE_CLASS = 'nav-global__search-collapse--visible'; // Class in the HTML when the search collapse is open/visible
4
+ const GLOBAL_NAV_ID = 'globalNav';
5
+ const LOCAL_NAV_ID = 'mainNav';
6
+ const GLOBAL_NAV_SEARCH_IS_VISIBLE_CLASS = 'nav-global__search-toggle';
7
+ const LOCAL_NAV_SEARCH_IS_VISIBLE_CLASS = 'nav-local__search-toggle';
8
+ const SEARCH_ICON_ID = 'searchIcon';
9
+ const SEARCH_ICON_SPAN_QUERY_SELECTOR = '#searchImg';
10
+
11
+ function removeClassFromElement(el, classToRemove) {
12
+ el.classList.remove(classToRemove);
13
+ }
14
+
15
+ function checkElementCollapseState(el, classToCheckFor) {
16
+ if ( ! el.classList.contains(classToCheckFor) )
17
+ return;
18
+
19
+ removeClassFromElement(el, classToCheckFor);
20
+ }
21
+
22
+ function toggleSearchIconToX(el) {
23
+ const span = el.querySelector(SEARCH_ICON_SPAN_QUERY_SELECTOR);
24
+
25
+ el.setAttribute('aria-label', 'Toggle Search');
26
+ span.setAttribute('alt', 'Open icon');
27
+ span.setAttribute('style', 'background-image: url("/assets/img/search.svg")');
28
+ }
29
+
30
+ function checkSearchToggleIcon(el) {
31
+ let ariaLabel = el.getAttribute('aria-label');
32
+
33
+ if ( ! ariaLabel === 'Toggle Close' )
34
+ return;
35
+
36
+ toggleSearchIconToX(el)
37
+ }
38
+
39
+ function windowResizeHandler() {
40
+ if ( window.innerWidth >= 992 ) {
41
+ const searchCollapseElement = document.getElementById(SEARCH_COLLAPSE_ID);
42
+ const globalNav = document.getElementById(GLOBAL_NAV_ID);
43
+ const localNav = document.getElementById(LOCAL_NAV_ID);
44
+ const searchIcon = document.getElementById(SEARCH_ICON_ID);
45
+
46
+ checkElementCollapseState(searchCollapseElement, SEARCH_COLLAPSE_IS_VISIBLE_CLASS);
47
+ checkElementCollapseState(globalNav, GLOBAL_NAV_SEARCH_IS_VISIBLE_CLASS);
48
+ checkElementCollapseState(localNav, LOCAL_NAV_SEARCH_IS_VISIBLE_CLASS);
49
+ checkSearchToggleIcon(searchIcon);
50
+ }
51
+ }
52
+
53
+ function toggleSearchDropdownOnWindowResize() {
54
+ window.addEventListener('resize', windowResizeHandler);
55
+ }
56
+
57
+ export default toggleSearchDropdownOnWindowResize;
@@ -1,20 +1,18 @@
1
1
  import footerDate from './footerDate.js';
2
- import searchToggle from './searchToggle.js';
3
2
  import lazyLoad from './lazyLoad.js';
4
3
  import walkText from './walkText.js';
5
4
  import initSliders from './sliders.js';
6
- import moveSearchIcon from './moveSearchIcon.js';
7
- import highlightNav from './highlightCurrentNav.js';
8
5
  import watchForMenuClicks from './translate.js';
9
- import closeMenuOnClick from './closeMenuOnClick.js';
10
6
  import accordion from './accordion.js';
11
7
  import wrapPowerText from './wrapPowerText.js';
12
- //import './babelTest.js';
13
8
  //import test from './test.js';
14
9
 
15
10
  document.addEventListener('DOMContentLoaded', function() {
16
- highlightNav();
17
- moveSearchIcon();
11
+ wrapPowerText();
12
+ initSliders();
13
+ walkText(document.body);
14
+ footerDate();
15
+ lazyLoad();
18
16
  watchForMenuClicks();
19
17
  // polyfill for Element.closest() b/c IE can't handle an anchor.match() when the anchor has another element inside it (Like spans used for BS4 menu toggler)
20
18
  if (!Element.prototype.matches) {
@@ -32,13 +30,5 @@ document.addEventListener('DOMContentLoaded', function() {
32
30
  return null;
33
31
  };
34
32
  }
35
- //test();
36
- wrapPowerText();
37
- initSliders();
38
- walkText(document.body);
39
- footerDate();
40
- lazyLoad();
41
33
  accordion();
42
- searchToggle();
43
- closeMenuOnClick();
44
34
  });
@@ -43,12 +43,30 @@
43
43
  // Modify the Bootstrap 4 dropdown menu's carot to give it an animated/interactice effect using pure CSS
44
44
  // ======================================
45
45
  // .dropdown-toggle::after controls the BS4 dropdown-menu carot symbol's display
46
- .dropdown-toggle::after { // Set starting position & transition Fx
46
+ @media screen and (max-width: 992px) {
47
+ .dropdown-toggle::after { // Set starting position & transition Fx
48
+ transform: rotate(0deg);
49
+ transition: transform 0.3s ease-in-out;
50
+ }
51
+
52
+ .nav-item.dropdown.show .dropdown-toggle::after { // Selectors that are only present when a dropdown is toggled to the open state.
53
+ transform: rotate(-180deg);
54
+ }
55
+ }
56
+
57
+ .dropdown-toggle.btn::after { // Set starting position & transition Fx
47
58
  transform: rotate(0deg);
48
59
  transition: transform 0.3s ease-in-out;
49
60
  }
50
61
 
51
- .nav-item.dropdown.show .dropdown-toggle::after { // Selectors that are only present when a dropdown is toggled to the open state.
62
+ .nav-item.dropdown.show .dropdown-toggle.btn::after { // Selectors that are only present when a dropdown is toggled to the open state.
52
63
  transform: rotate(-180deg);
53
64
  }
65
+
66
+ @media screen and (min-width: 992px) {
67
+ .dropdown-toggle:not(.btn)::after { // Set starting position & transition Fx
68
+ display: none;
69
+ }
70
+ }
71
+
54
72
  // End BS4 dropdown-menu carot modifications.
@@ -1,9 +1,13 @@
1
- #___gcse_0:hover #gsc-iw-id1,
2
- #___gcse_0:focus #gsc-iw-id1 {
1
+ // Custom styling to the Google Custom Search used in `_includes/header-global.html` & `_includes/nav-global.html`
2
+ // ==================================================
3
+ // Styling for the Google Custom Search used in the `_includes/header-global.html` version of the nav
4
+ // ==================================================
5
+ .header-global__search-collapse #___gcse_0:hover #gsc-iw-id1,
6
+ .header-global__search-collapse #___gcse_0:focus #gsc-iw-id1 {
3
7
  filter: drop-shadow(2px 2px 6px rgba(128,128,128, 0.5));
4
8
  }
5
9
 
6
- #gsc-iw-id1 {
10
+ .header-global__search-collapse #gsc-iw-id1 {
7
11
  border-radius: 2rem;
8
12
  padding-left: .5rem;
9
13
  border: solid thin $grey-5;
@@ -12,7 +16,85 @@
12
16
  padding-bottom: 3px;
13
17
  }
14
18
 
15
- .gsc-search-button-v2 {
19
+ .header-global__search-collapse .gsc-search-button-v2 {
20
+ background-color: transparent !important;
21
+ border: none !important;
22
+ pointer-events: auto;
23
+ position: relative;
24
+ right: -0.5rem;
25
+ top: -.25rem;
26
+ transition-property: right;
27
+ transition-duration: .2s;
28
+ }
29
+
30
+ .header-global__search-collapse button.gsc-overrides__clear-x {
31
+ right: .5rem;
32
+ padding-right: 5px !important;
33
+ }
34
+
35
+ @media screen and (min-width: 992px) {
36
+ .header-global__search-collapse .gsc-search-button-v2 {
37
+ top: 0;
38
+ right: .5rem;
39
+ }
40
+
41
+ .header-global__search-collapse button.gsc-overrides__clear-x {
42
+ right: 1.125rem;
43
+ padding-right: 5px !important;
44
+ }
45
+ }
46
+
47
+ .header-global__search-collapse .gsst_a .gscb_a {
48
+ vertical-align: middle;
49
+ }
50
+
51
+ .header-global__search-collapse .gsc-search-button-v2 svg {
52
+ fill: $primary-blue !important;
53
+ height: 1.25rem;
54
+ width: 1.25rem;
55
+ transition-property: fill;
56
+ transition-duration: .2s;
57
+ }
58
+
59
+ .header-global__search-collapse .gsc-search-button-v2:hover svg,
60
+ .header-global__search-collapse .gsc-search-button-v2:focus svg {
61
+ fill: $primary-red !important;
62
+ }
63
+
64
+ .header-global__search-collapse td.gsc-search-button {
65
+ display: inline;
66
+ pointer-events: none;
67
+ position: absolute;
68
+ right: 50px;
69
+ }
70
+
71
+ @media screen and (min-width: 1400px) {
72
+ .header-global__search-collapse td.gsc-search-button {
73
+ right: 44px;
74
+ }
75
+ }
76
+
77
+ .header-global__search-collapse .gsc-search-box-tools .gsc-search-box .gsc-input {
78
+ padding-right: 0 !important;
79
+ }
80
+
81
+ // Similar styling for the Google Custom Search used in the `_includes/nav-global.html` version of the nav
82
+ // ==================================================
83
+ .nav-global__gcse-wrapper #___gcse_0:hover #gsc-iw-id1,
84
+ .nav-global__gcse-wrapper #___gcse_0:focus #gsc-iw-id1 {
85
+ filter: drop-shadow(2px 2px 6px rgba(128,128,128, 0.5));
86
+ }
87
+
88
+ .nav-global__gcse-wrapper #gsc-iw-id1 {
89
+ border-radius: 2rem;
90
+ padding-left: .5rem;
91
+ border: solid thin $grey-5;
92
+ line-height: 1;
93
+ padding-top: 3px;
94
+ padding-bottom: 3px;
95
+ }
96
+
97
+ .nav-global__gcse-wrapper .gsc-search-button-v2 {
16
98
  background-color: transparent !important;
17
99
  border: none !important;
18
100
  pointer-events: auto;
@@ -22,16 +104,16 @@
22
104
  transition-duration: .2s;
23
105
  }
24
106
 
25
- .gsst_a .gscb_a {
107
+ .nav-global__gcse-wrapper .gsst_a .gscb_a {
26
108
  vertical-align: middle;
27
109
  }
28
110
 
29
- button.gsc-overrides__clear-x {
111
+ .nav-global__gcse-wrapper button.gsc-overrides__clear-x {
30
112
  right: 48px;
31
113
  padding-right: 5px !important;
32
114
  }
33
115
 
34
- .gsc-search-button-v2 svg {
116
+ .nav-global__gcse-wrapper .gsc-search-button-v2 svg {
35
117
  fill: $primary-blue !important;
36
118
  height: 1.25rem;
37
119
  width: 1.25rem;
@@ -39,12 +121,12 @@ button.gsc-overrides__clear-x {
39
121
  transition-duration: .2s;
40
122
  }
41
123
 
42
- .gsc-search-button-v2:hover svg,
43
- .gsc-search-button-v2:focus svg {
124
+ .nav-global__gcse-wrapper .gsc-search-button-v2:hover svg,
125
+ .nav-global__gcse-wrapper .gsc-search-button-v2:focus svg {
44
126
  fill: $primary-red !important;
45
127
  }
46
128
 
47
- td.gsc-search-button {
129
+ .nav-global__gcse-wrapper td.gsc-search-button {
48
130
  display: inline;
49
131
  pointer-events: none;
50
132
  position: absolute;
@@ -52,7 +134,7 @@ td.gsc-search-button {
52
134
  }
53
135
 
54
136
  @media screen and (min-width: 1400px) {
55
- td.gsc-search-button {
137
+ .nav-global__gcse-wrapper td.gsc-search-button {
56
138
  right: 44px;
57
139
  }
58
140
  }