diff --git a/global-assets/source/js/global/nds-min.js b/global-assets/source/js/global/nds-min.js index 973dbea2..8823f845 100644 --- a/global-assets/source/js/global/nds-min.js +++ b/global-assets/source/js/global/nds-min.js @@ -1 +1 @@ -"use strict";!function(e){function t(){arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;for(var e=document.querySelectorAll(".input--radio, .input--checkbox"),t=0;t0&&void 0!==arguments[0]?arguments[0]:document;e(".input--date-picker").each(function(){"true"==e(this).find("input").attr("nds-date-picker")&&e(this).find("input").datepicker()})}"undefined"!=typeof Drupal?function(e,n){n.behaviors.initInputDatePicker={attach:function(n){e("body",n).once("nds-input-date-picker").each(function(){t(n)})}}}(jQuery,Drupal):e(document).ready(function(){t()})}(jQuery),function(e){function t(){arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;e('[data-toggle="tooltip"]').tooltip(),e("select").each(function(){"true"==e(this).attr("nds-select")&&(e(this).select2({minimumResultsForSearch:10}),""!=e(this).val()&&e(this).siblings(".select2-container").addClass("no-clear selection-made"))}),e("select").change(function(t,n){"true"==e(this).attr("nds-select")&&(t.target.multiple?e(this).find("option:selected").length>0?e(this).siblings(".select2-container").addClass("selection-made-multi"):e(this).siblings(".select2-container").removeClass("selection-made-multi"):(e(this).siblings(".select2-container").addClass("selection-made"),e(this).siblings(".select2-container").find(".single-clear").length||"true"==e(this).attr("data-select-all-times")||e(this).siblings(".select2-container").append('')))}),e("select").on("select2:open",function(t){e(".select2-container").find(".select2-search__field").attr("aria-label","Search for choices"),e(".select2-container").find(".select2-results__options").attr("aria-label","Available choices")}),e(".select2-selection--single").find(".select2-selection__rendered").attr("aria-label","Click to select option."),e(".select2-selection--multiple").attr("aria-label","Click to select option(s)."),e(document).on("click",".single-clear",function(t){t.stopPropagation();var n=e(this).parent().siblings("select");n.prop("selectedIndex",0);var o=n.attr("data-placeholder");e(this).parent().removeClass("selection-made"),e(this).siblings(".selection").find(".select2-selection__rendered").text(o),e(this).remove()})}"undefined"!=typeof Drupal?function(e,n){n.behaviors.initInputSelect={attach:function(n){e("body",n).once("nds-input-select").each(function(){t(n)})}}}(jQuery,Drupal):e(document).ready(function(){t()})}(jQuery),function(e){function t(){arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;for(var e=document.querySelectorAll("a"),t=0;t-1||n.indexOf("https://")>-1)&&n.indexOf("localhost:3002")<=0){e[t].setAttribute("target","_blank");var a=document.createElement("a");a.setAttribute("href",n),a.setAttribute("class","ext-link-icon"),a.setAttribute("aria-label","External Link"),e[t].insertAdjacentElement("afterend",a)}}}function n(){arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;for(var e=document.querySelectorAll('a[href^="mailto:"]'),t=0;t0&&void 0!==arguments[0]?arguments[0]:document;e("table").each(function(){if("true"==e(this).attr("nds-datatable")){var t={responsive:!0,paging:!1,info:!1,autoWidth:!1,searching:!1};if("true"!=e(this).attr("data-tablesort"))t.ordering=!1;else{var n=[];e(this).find("thead").find("th").each(function(t){"true"==e(this).attr("data-column-num")&&n.push({type:"natural",targets:t})}),t.columnDefs=n}e(this).dataTable(t)}})}"undefined"!=typeof Drupal?function(e,n){n.behaviors.initTableDefault={attach:function(n){e("body",n).once("nds-table-default").each(function(){t(n)})}}}(jQuery,Drupal):e(document).ready(function(){t()})}(jQuery),function(e){function t(){arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;if(document.querySelectorAll(".materialboxed").length){var e=document.querySelectorAll(".materialboxed");M.Materialbox.init(e)}}"undefined"!=typeof Drupal?function(e,n){n.behaviors.initComponentMedia={attach:function(n){e("body",n).once("nds-component-media").each(function(){t(n)})}}}(jQuery,Drupal):e(document).ready(function(){t()})}(jQuery),function(e){function t(){arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;if(document.querySelectorAll(".component--modal").length)for(var e='button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])',t=document.getElementsByClassName("component--modal"),n=function(){var n=t[o].querySelectorAll(e)[0],a=t[o].querySelectorAll(e),i=a[a.length-1];document.addEventListener("keydown",function(e){("Tab"===e.key||9===e.keyCode)&&(e.shiftKey?document.activeElement===n&&(i.focus(),e.preventDefault()):document.activeElement===i&&(n.focus(),e.preventDefault()))}),n.focus()},o=0;o0&&document.querySelector("#uswds-banner-toggle").addEventListener("click",function(e){"true"==document.getElementById("uswds-banner-toggle").getAttribute("aria-expanded")?(document.getElementById("uswds-banner-toggle").setAttribute("aria-expanded","false"),document.getElementById("uswds-banner-content").style.display="none"):(document.getElementById("uswds-banner-toggle").setAttribute("aria-expanded","true"),document.getElementById("uswds-banner-content").style.display="block")})}"undefined"!=typeof Drupal?function(e,n){n.behaviors.initComponentUSWDSBanner={attach:function(n){e("body",n).once("nds-component-uswds-banner").each(function(){t()})}}}(jQuery,Drupal):e(document).ready(function(){t()})}(jQuery),function(e){function t(){for(var e=document.getElementsByClassName("component--accordion__card"),t=0;t a"),"data-nav","header-nav-"+m+"-")}else o(h,"data-nav","header-nav-")}var g=document.getElementsByClassName("global--footer");for(t=0;t0&&void 0!==e)for(var i=0;i0&&void 0!==arguments[0]?arguments[0]:document;if(document.querySelectorAll(".parallax").length){var e=document.querySelectorAll(".parallax");M.Parallax.init(e)}}"undefined"!=typeof Drupal?function(e,n){n.behaviors.initBlockHero={attach:function(n){e("body",n).once("nds-block-hero").each(function(){t(n)})}}}(jQuery,Drupal):e(document).ready(function(){t()})}(jQuery),function(e){function t(){arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;e(".navigation--dropdown.hover").on("mouseover",function(){n(e(this))}),e(".navigation--dropdown.hover").on("mouseout",function(){o(e(this))}),e(".navigation--dropdown").on("focusin",function(t){n(e(this))}),e(".navigation--dropdown").on("focusout",function(t){this.contains(t.relatedTarget)||o(e(this))})}function n(e){e.addClass("is-open"),e.find(".navigation--dropdown__toggle").attr("aria-expanded","true")}function o(e){e.removeClass("is-open"),e.find(".navigation--dropdown__toggle").attr("aria-expanded","false")}"undefined"!=typeof Drupal?function(e,n){n.behaviors.initNavigationDropdown={attach:function(n){e("body",n).once("nds-navigation-dropdown").each(function(){t(n)})}}}(jQuery,Drupal):e(document).ready(function(){t()})}(jQuery),function(e){function t(){arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;if(document.querySelectorAll(".navigation--drawer").length>0){var e=windowWidth();document.querySelector("#global-mobile-menu").addEventListener("click",function(e){document.querySelector("#main-navigation-mobile").classList.add("drawer--open"),getNextSibling(document.querySelector("#main-navigation-mobile"),".navigation--drawer--overlay").style.display="block",document.querySelector(".navigation--drawer__top__button-close").focus();for(var t=document.querySelector("#main-navigation-mobile").querySelectorAll("button, a"),n=0;n0&&void 0!==arguments[0]?arguments[0]:document;for(var e=document.querySelectorAll(".navigation--tabs__tab"),t=0;t0&&void 0!==arguments[0]?arguments[0]:document;for(var e=document.querySelectorAll(".input--radio, .input--checkbox"),t=0;t0&&void 0!==arguments[0]?arguments[0]:document;e(".input--date-picker").each(function(){"true"==e(this).find("input").attr("nds-date-picker")&&e(this).find("input").datepicker()})}"undefined"!=typeof Drupal?function(e,n){n.behaviors.initInputDatePicker={attach:function(n){e("body",n).once("nds-input-date-picker").each(function(){t(n)})}}}(jQuery,Drupal):e(document).ready(function(){t()})}(jQuery),function(e){function t(){arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;e('[data-toggle="tooltip"]').tooltip(),e("select").each(function(){"true"==e(this).attr("nds-select")&&(e(this).select2({minimumResultsForSearch:10}),""!=e(this).val()&&e(this).siblings(".select2-container").addClass("no-clear selection-made"))}),e("select").change(function(t,n){"true"==e(this).attr("nds-select")&&(t.target.multiple?e(this).find("option:selected").length>0?e(this).siblings(".select2-container").addClass("selection-made-multi"):e(this).siblings(".select2-container").removeClass("selection-made-multi"):(e(this).siblings(".select2-container").addClass("selection-made"),e(this).siblings(".select2-container").find(".single-clear").length||"true"==e(this).attr("data-select-all-times")||e(this).siblings(".select2-container").append('')))}),e("select").on("select2:open",function(t){e(".select2-container").find(".select2-search__field").attr("aria-label","Search for choices"),e(".select2-container").find(".select2-results__options").attr("aria-label","Available choices")}),e(".select2-selection--single").find(".select2-selection__rendered").attr("aria-label","Click to select option."),e(".select2-selection--multiple").attr("aria-label","Click to select option(s)."),e(document).on("click",".single-clear",function(t){t.stopPropagation();var n=e(this).parent().siblings("select");n.prop("selectedIndex",0);var o=n.attr("data-placeholder");e(this).parent().removeClass("selection-made"),e(this).siblings(".selection").find(".select2-selection__rendered").text(o),e(this).remove()})}"undefined"!=typeof Drupal?function(e,n){n.behaviors.initInputSelect={attach:function(n){e("body",n).once("nds-input-select").each(function(){t(n)})}}}(jQuery,Drupal):e(document).ready(function(){t()})}(jQuery),function(e){function t(){arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;for(var e=document.querySelectorAll("a"),t=0;t-1||n.indexOf("https://")>-1)&&n.indexOf("localhost:3002")<=0){e[t].setAttribute("target","_blank");var a=document.createElement("a");a.setAttribute("href",n),a.setAttribute("class","ext-link-icon"),a.setAttribute("aria-label","External Link"),e[t].insertAdjacentElement("afterend",a)}}}function n(){arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;for(var e=document.querySelectorAll('a[href^="mailto:"]'),t=0;t0&&void 0!==arguments[0]?arguments[0]:document;e("table").each(function(){if("true"==e(this).attr("nds-datatable")){var t={responsive:!0,paging:!1,info:!1,autoWidth:!1,searching:!1};if("true"!=e(this).attr("data-tablesort"))t.ordering=!1;else{var n=[];e(this).find("thead").find("th").each(function(t){"true"==e(this).attr("data-column-num")&&n.push({type:"natural",targets:t})}),t.columnDefs=n}e(this).dataTable(t)}})}"undefined"!=typeof Drupal?function(e,n){n.behaviors.initTableDefault={attach:function(n){e("body",n).once("nds-table-default").each(function(){t(n)})}}}(jQuery,Drupal):e(document).ready(function(){t()})}(jQuery),function(e){function t(){for(var e=document.getElementsByClassName("component--accordion__card"),t=0;t a"),"data-nav","header-nav-"+m+"-")}else o(h,"data-nav","header-nav-")}var g=document.getElementsByClassName("global--footer");for(t=0;t0&&void 0!==e)for(var i=0;i0&&void 0!==arguments[0]?arguments[0]:document;if(document.querySelectorAll(".parallax").length){var e=document.querySelectorAll(".parallax");M.Parallax.init(e)}}"undefined"!=typeof Drupal?function(e,n){n.behaviors.initBlockHero={attach:function(n){e("body",n).once("nds-block-hero").each(function(){t(n)})}}}(jQuery,Drupal):e(document).ready(function(){t()})}(jQuery),function(e){function t(){arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;if(document.querySelectorAll(".materialboxed").length){var e=document.querySelectorAll(".materialboxed");M.Materialbox.init(e)}}"undefined"!=typeof Drupal?function(e,n){n.behaviors.initComponentMedia={attach:function(n){e("body",n).once("nds-component-media").each(function(){t(n)})}}}(jQuery,Drupal):e(document).ready(function(){t()})}(jQuery),function(e){function t(){arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;if(document.querySelectorAll(".component--modal").length)for(var e='button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])',t=document.getElementsByClassName("component--modal"),n=function(){var n=t[o].querySelectorAll(e)[0],a=t[o].querySelectorAll(e),i=a[a.length-1];document.addEventListener("keydown",function(e){("Tab"===e.key||9===e.keyCode)&&(e.shiftKey?document.activeElement===n&&(i.focus(),e.preventDefault()):document.activeElement===i&&(n.focus(),e.preventDefault()))}),n.focus()},o=0;o0&&document.querySelector("#uswds-banner-toggle").addEventListener("click",function(e){"true"==document.getElementById("uswds-banner-toggle").getAttribute("aria-expanded")?(document.getElementById("uswds-banner-toggle").setAttribute("aria-expanded","false"),document.getElementById("uswds-banner-content").style.display="none"):(document.getElementById("uswds-banner-toggle").setAttribute("aria-expanded","true"),document.getElementById("uswds-banner-content").style.display="block")})}"undefined"!=typeof Drupal?function(e,n){n.behaviors.initComponentUSWDSBanner={attach:function(n){e("body",n).once("nds-component-uswds-banner").each(function(){t()})}}}(jQuery,Drupal):e(document).ready(function(){t()})}(jQuery),function(e){function t(){arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;if(document.querySelectorAll(".navigation--drawer").length>0){var e=windowWidth();document.querySelector("#global-mobile-menu").addEventListener("click",function(e){document.querySelector("#main-navigation-mobile").classList.add("drawer--open"),getNextSibling(document.querySelector("#main-navigation-mobile"),".navigation--drawer--overlay").style.display="block",document.querySelector(".navigation--drawer__top__button-close").focus();for(var t=document.querySelector("#main-navigation-mobile").querySelectorAll("button, a"),n=0;n0&&void 0!==arguments[0]?arguments[0]:document;e(".navigation--dropdown.hover").on("mouseover",function(){n(e(this))}),e(".navigation--dropdown.hover").on("mouseout",function(){o(e(this))}),e(".navigation--dropdown").on("focusin",function(t){n(e(this))}),e(".navigation--dropdown").on("focusout",function(t){this.contains(t.relatedTarget)||o(e(this))})}function n(e){e.addClass("is-open"),e.find(".navigation--dropdown__toggle").attr("aria-expanded","true")}function o(e){e.removeClass("is-open"),e.find(".navigation--dropdown__toggle").attr("aria-expanded","false")}"undefined"!=typeof Drupal?function(e,n){n.behaviors.initNavigationDropdown={attach:function(n){e("body",n).once("nds-navigation-dropdown").each(function(){t(n)})}}}(jQuery,Drupal):e(document).ready(function(){t()})}(jQuery),function(e){function t(){arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;for(var e=document.querySelectorAll(".navigation--tabs__tab"),t=0;t 0 && arguments[0] !== undefined ? arguments[0] : document; - - if (document.querySelectorAll('.materialboxed').length) { - var elems = document.querySelectorAll('.materialboxed'); - var instances = M.Materialbox.init(elems); - } - } - - if (typeof Drupal !== 'undefined') { - // Define Drupal behavior. - (function ($, Drupal) { - Drupal.behaviors.initComponentMedia = { - attach: function attach(context) { - $("body", context).once('nds-component-media').each(function () { - initComponentMedia(context); - }); - } - }; - })(jQuery, Drupal); - } else { - // If Drupal isn't loaded, add JS for Pattern Lab. - $(document).ready(function () { - initComponentMedia(); - }); - } -})(jQuery); - -(function ($) { - function initComponentModal() { - var context = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document; - - if (document.querySelectorAll('.component--modal').length) { - var focusableElements = 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'; - var modalsList = document.getElementsByClassName("component--modal"); - - var _loop = function _loop() { - var firstFocusableElement = modalsList[i].querySelectorAll(focusableElements)[0]; - var focusableContent = modalsList[i].querySelectorAll(focusableElements); - var lastFocusableElement = focusableContent[focusableContent.length - 1]; - document.addEventListener('keydown', function (e) { - var isTabPressed = e.key === 'Tab' || e.keyCode === 9; - - if (!isTabPressed) { - return; - } - - if (e.shiftKey) { - if (document.activeElement === firstFocusableElement) { - lastFocusableElement.focus(); - e.preventDefault(); - } - } else { - if (document.activeElement === lastFocusableElement) { - firstFocusableElement.focus(); - e.preventDefault(); - } - } - }); - firstFocusableElement.focus(); - }; - - for (var i = 0; i < modalsList.length; i++) { - _loop(); - } - } - } - - if (typeof Drupal !== 'undefined') { - // Define Drupal behavior. - (function ($, Drupal) { - Drupal.behaviors.initComponentModal = { - attach: function attach(context) { - $("body", context).once('nds-component-modal').each(function () { - initComponentModal(context); - }); - } - }; - })(jQuery, Drupal); - } else { - // If Drupal isn't loaded, add JS for Pattern Lab. - $(document).ready(function () { - initComponentModal(); - }); - } -})(jQuery); // Part of NDS Lite - - -(function ($) { - // initComponentUSWDSBanner - Toggles the USWDS Banner Component open and closed. - function initComponentUSWDSBanner() { - if (document.querySelectorAll('#uswds-banner-toggle').length > 0) { - document.querySelector('#uswds-banner-toggle').addEventListener("click", function (e) { - if (document.getElementById("uswds-banner-toggle").getAttribute('aria-expanded') == 'true') { - document.getElementById("uswds-banner-toggle").setAttribute('aria-expanded', 'false'); - document.getElementById("uswds-banner-content").style.display = 'none'; - } else { - document.getElementById("uswds-banner-toggle").setAttribute('aria-expanded', 'true'); - document.getElementById("uswds-banner-content").style.display = 'block'; - } - }); - } - } - - if (typeof Drupal !== 'undefined') { - // Define Drupal behavior. - (function ($, Drupal) { - Drupal.behaviors.initComponentUSWDSBanner = { - attach: function attach(context) { - $("body", context).once('nds-component-uswds-banner').each(function () { - initComponentUSWDSBanner(context); - }); - } - }; - })(jQuery, Drupal); - } else { - // If Drupal isn't loaded, add JS for Pattern Lab. - $(document).ready(function () { - initComponentUSWDSBanner(); - }); - } })(jQuery); // Part of NDS Lite @@ -579,43 +455,117 @@ })(jQuery); (function ($) { - function initNavigationDropdown() { + function initComponentMedia() { var context = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document; - $(".navigation--dropdown.hover").on('mouseover', function () { - openDropdown($(this)); - }); - $(".navigation--dropdown.hover").on('mouseout', function () { - closeDropdown($(this)); - }); - $(".navigation--dropdown").on('focusin', function (e) { - openDropdown($(this)); + + if (document.querySelectorAll('.materialboxed').length) { + var elems = document.querySelectorAll('.materialboxed'); + var instances = M.Materialbox.init(elems); + } + } + + if (typeof Drupal !== 'undefined') { + // Define Drupal behavior. + (function ($, Drupal) { + Drupal.behaviors.initComponentMedia = { + attach: function attach(context) { + $("body", context).once('nds-component-media').each(function () { + initComponentMedia(context); + }); + } + }; + })(jQuery, Drupal); + } else { + // If Drupal isn't loaded, add JS for Pattern Lab. + $(document).ready(function () { + initComponentMedia(); }); - $(".navigation--dropdown").on('focusout', function (e) { - if (this.contains(e.relatedTarget)) { - return; + } +})(jQuery); + +(function ($) { + function initComponentModal() { + var context = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document; + + if (document.querySelectorAll('.component--modal').length) { + var focusableElements = 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'; + var modalsList = document.getElementsByClassName("component--modal"); + + var _loop = function _loop() { + var firstFocusableElement = modalsList[i].querySelectorAll(focusableElements)[0]; + var focusableContent = modalsList[i].querySelectorAll(focusableElements); + var lastFocusableElement = focusableContent[focusableContent.length - 1]; + document.addEventListener('keydown', function (e) { + var isTabPressed = e.key === 'Tab' || e.keyCode === 9; + + if (!isTabPressed) { + return; + } + + if (e.shiftKey) { + if (document.activeElement === firstFocusableElement) { + lastFocusableElement.focus(); + e.preventDefault(); + } + } else { + if (document.activeElement === lastFocusableElement) { + firstFocusableElement.focus(); + e.preventDefault(); + } + } + }); + firstFocusableElement.focus(); + }; + + for (var i = 0; i < modalsList.length; i++) { + _loop(); } + } + } - closeDropdown($(this)); + if (typeof Drupal !== 'undefined') { + // Define Drupal behavior. + (function ($, Drupal) { + Drupal.behaviors.initComponentModal = { + attach: function attach(context) { + $("body", context).once('nds-component-modal').each(function () { + initComponentModal(context); + }); + } + }; + })(jQuery, Drupal); + } else { + // If Drupal isn't loaded, add JS for Pattern Lab. + $(document).ready(function () { + initComponentModal(); }); } +})(jQuery); // Part of NDS Lite - function openDropdown($el) { - $el.addClass('is-open'); - $el.find('.navigation--dropdown__toggle').attr('aria-expanded', 'true'); - } - function closeDropdown($el) { - $el.removeClass('is-open'); - $el.find('.navigation--dropdown__toggle').attr('aria-expanded', 'false'); +(function ($) { + // initComponentUSWDSBanner - Toggles the USWDS Banner Component open and closed. + function initComponentUSWDSBanner() { + if (document.querySelectorAll('#uswds-banner-toggle').length > 0) { + document.querySelector('#uswds-banner-toggle').addEventListener("click", function (e) { + if (document.getElementById("uswds-banner-toggle").getAttribute('aria-expanded') == 'true') { + document.getElementById("uswds-banner-toggle").setAttribute('aria-expanded', 'false'); + document.getElementById("uswds-banner-content").style.display = 'none'; + } else { + document.getElementById("uswds-banner-toggle").setAttribute('aria-expanded', 'true'); + document.getElementById("uswds-banner-content").style.display = 'block'; + } + }); + } } if (typeof Drupal !== 'undefined') { // Define Drupal behavior. (function ($, Drupal) { - Drupal.behaviors.initNavigationDropdown = { + Drupal.behaviors.initComponentUSWDSBanner = { attach: function attach(context) { - $("body", context).once('nds-navigation-dropdown').each(function () { - initNavigationDropdown(context); + $("body", context).once('nds-component-uswds-banner').each(function () { + initComponentUSWDSBanner(context); }); } }; @@ -623,7 +573,7 @@ } else { // If Drupal isn't loaded, add JS for Pattern Lab. $(document).ready(function () { - initNavigationDropdown(); + initComponentUSWDSBanner(); }); } })(jQuery); // Part of NDS Lite @@ -709,6 +659,56 @@ } })(jQuery); +(function ($) { + function initNavigationDropdown() { + var context = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document; + $(".navigation--dropdown.hover").on('mouseover', function () { + openDropdown($(this)); + }); + $(".navigation--dropdown.hover").on('mouseout', function () { + closeDropdown($(this)); + }); + $(".navigation--dropdown").on('focusin', function (e) { + openDropdown($(this)); + }); + $(".navigation--dropdown").on('focusout', function (e) { + if (this.contains(e.relatedTarget)) { + return; + } + + closeDropdown($(this)); + }); + } + + function openDropdown($el) { + $el.addClass('is-open'); + $el.find('.navigation--dropdown__toggle').attr('aria-expanded', 'true'); + } + + function closeDropdown($el) { + $el.removeClass('is-open'); + $el.find('.navigation--dropdown__toggle').attr('aria-expanded', 'false'); + } + + if (typeof Drupal !== 'undefined') { + // Define Drupal behavior. + (function ($, Drupal) { + Drupal.behaviors.initNavigationDropdown = { + attach: function attach(context) { + $("body", context).once('nds-navigation-dropdown').each(function () { + initNavigationDropdown(context); + }); + } + }; + })(jQuery, Drupal); + } else { + // If Drupal isn't loaded, add JS for Pattern Lab. + $(document).ready(function () { + initNavigationDropdown(); + }); + } +})(jQuery); + (function ($) { function initNavigationTabs() { var context = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document; diff --git a/nds-documentation-site/public_html/assets/nds-bundled-js.zip b/nds-documentation-site/public_html/assets/nds-bundled-js.zip index d98c9b13..de936a73 100644 Binary files a/nds-documentation-site/public_html/assets/nds-bundled-js.zip and b/nds-documentation-site/public_html/assets/nds-bundled-js.zip differ diff --git a/nds-documentation-site/public_html/assets/nds-drupal-theme.zip b/nds-documentation-site/public_html/assets/nds-drupal-theme.zip index a32cd015..316fa069 100644 Binary files a/nds-documentation-site/public_html/assets/nds-drupal-theme.zip and b/nds-documentation-site/public_html/assets/nds-drupal-theme.zip differ diff --git a/nds-documentation-site/public_html/assets/nds-lite-js.zip b/nds-documentation-site/public_html/assets/nds-lite-js.zip index cf10c80a..d6352742 100644 Binary files a/nds-documentation-site/public_html/assets/nds-lite-js.zip and b/nds-documentation-site/public_html/assets/nds-lite-js.zip differ diff --git a/nds-documentation-site/public_html/assets/nds-min.js b/nds-documentation-site/public_html/assets/nds-min.js index 973dbea2..8823f845 100644 --- a/nds-documentation-site/public_html/assets/nds-min.js +++ b/nds-documentation-site/public_html/assets/nds-min.js @@ -1 +1 @@ -"use strict";!function(e){function t(){arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;for(var e=document.querySelectorAll(".input--radio, .input--checkbox"),t=0;t0&&void 0!==arguments[0]?arguments[0]:document;e(".input--date-picker").each(function(){"true"==e(this).find("input").attr("nds-date-picker")&&e(this).find("input").datepicker()})}"undefined"!=typeof Drupal?function(e,n){n.behaviors.initInputDatePicker={attach:function(n){e("body",n).once("nds-input-date-picker").each(function(){t(n)})}}}(jQuery,Drupal):e(document).ready(function(){t()})}(jQuery),function(e){function t(){arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;e('[data-toggle="tooltip"]').tooltip(),e("select").each(function(){"true"==e(this).attr("nds-select")&&(e(this).select2({minimumResultsForSearch:10}),""!=e(this).val()&&e(this).siblings(".select2-container").addClass("no-clear selection-made"))}),e("select").change(function(t,n){"true"==e(this).attr("nds-select")&&(t.target.multiple?e(this).find("option:selected").length>0?e(this).siblings(".select2-container").addClass("selection-made-multi"):e(this).siblings(".select2-container").removeClass("selection-made-multi"):(e(this).siblings(".select2-container").addClass("selection-made"),e(this).siblings(".select2-container").find(".single-clear").length||"true"==e(this).attr("data-select-all-times")||e(this).siblings(".select2-container").append('')))}),e("select").on("select2:open",function(t){e(".select2-container").find(".select2-search__field").attr("aria-label","Search for choices"),e(".select2-container").find(".select2-results__options").attr("aria-label","Available choices")}),e(".select2-selection--single").find(".select2-selection__rendered").attr("aria-label","Click to select option."),e(".select2-selection--multiple").attr("aria-label","Click to select option(s)."),e(document).on("click",".single-clear",function(t){t.stopPropagation();var n=e(this).parent().siblings("select");n.prop("selectedIndex",0);var o=n.attr("data-placeholder");e(this).parent().removeClass("selection-made"),e(this).siblings(".selection").find(".select2-selection__rendered").text(o),e(this).remove()})}"undefined"!=typeof Drupal?function(e,n){n.behaviors.initInputSelect={attach:function(n){e("body",n).once("nds-input-select").each(function(){t(n)})}}}(jQuery,Drupal):e(document).ready(function(){t()})}(jQuery),function(e){function t(){arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;for(var e=document.querySelectorAll("a"),t=0;t-1||n.indexOf("https://")>-1)&&n.indexOf("localhost:3002")<=0){e[t].setAttribute("target","_blank");var a=document.createElement("a");a.setAttribute("href",n),a.setAttribute("class","ext-link-icon"),a.setAttribute("aria-label","External Link"),e[t].insertAdjacentElement("afterend",a)}}}function n(){arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;for(var e=document.querySelectorAll('a[href^="mailto:"]'),t=0;t0&&void 0!==arguments[0]?arguments[0]:document;e("table").each(function(){if("true"==e(this).attr("nds-datatable")){var t={responsive:!0,paging:!1,info:!1,autoWidth:!1,searching:!1};if("true"!=e(this).attr("data-tablesort"))t.ordering=!1;else{var n=[];e(this).find("thead").find("th").each(function(t){"true"==e(this).attr("data-column-num")&&n.push({type:"natural",targets:t})}),t.columnDefs=n}e(this).dataTable(t)}})}"undefined"!=typeof Drupal?function(e,n){n.behaviors.initTableDefault={attach:function(n){e("body",n).once("nds-table-default").each(function(){t(n)})}}}(jQuery,Drupal):e(document).ready(function(){t()})}(jQuery),function(e){function t(){arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;if(document.querySelectorAll(".materialboxed").length){var e=document.querySelectorAll(".materialboxed");M.Materialbox.init(e)}}"undefined"!=typeof Drupal?function(e,n){n.behaviors.initComponentMedia={attach:function(n){e("body",n).once("nds-component-media").each(function(){t(n)})}}}(jQuery,Drupal):e(document).ready(function(){t()})}(jQuery),function(e){function t(){arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;if(document.querySelectorAll(".component--modal").length)for(var e='button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])',t=document.getElementsByClassName("component--modal"),n=function(){var n=t[o].querySelectorAll(e)[0],a=t[o].querySelectorAll(e),i=a[a.length-1];document.addEventListener("keydown",function(e){("Tab"===e.key||9===e.keyCode)&&(e.shiftKey?document.activeElement===n&&(i.focus(),e.preventDefault()):document.activeElement===i&&(n.focus(),e.preventDefault()))}),n.focus()},o=0;o0&&document.querySelector("#uswds-banner-toggle").addEventListener("click",function(e){"true"==document.getElementById("uswds-banner-toggle").getAttribute("aria-expanded")?(document.getElementById("uswds-banner-toggle").setAttribute("aria-expanded","false"),document.getElementById("uswds-banner-content").style.display="none"):(document.getElementById("uswds-banner-toggle").setAttribute("aria-expanded","true"),document.getElementById("uswds-banner-content").style.display="block")})}"undefined"!=typeof Drupal?function(e,n){n.behaviors.initComponentUSWDSBanner={attach:function(n){e("body",n).once("nds-component-uswds-banner").each(function(){t()})}}}(jQuery,Drupal):e(document).ready(function(){t()})}(jQuery),function(e){function t(){for(var e=document.getElementsByClassName("component--accordion__card"),t=0;t a"),"data-nav","header-nav-"+m+"-")}else o(h,"data-nav","header-nav-")}var g=document.getElementsByClassName("global--footer");for(t=0;t0&&void 0!==e)for(var i=0;i0&&void 0!==arguments[0]?arguments[0]:document;if(document.querySelectorAll(".parallax").length){var e=document.querySelectorAll(".parallax");M.Parallax.init(e)}}"undefined"!=typeof Drupal?function(e,n){n.behaviors.initBlockHero={attach:function(n){e("body",n).once("nds-block-hero").each(function(){t(n)})}}}(jQuery,Drupal):e(document).ready(function(){t()})}(jQuery),function(e){function t(){arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;e(".navigation--dropdown.hover").on("mouseover",function(){n(e(this))}),e(".navigation--dropdown.hover").on("mouseout",function(){o(e(this))}),e(".navigation--dropdown").on("focusin",function(t){n(e(this))}),e(".navigation--dropdown").on("focusout",function(t){this.contains(t.relatedTarget)||o(e(this))})}function n(e){e.addClass("is-open"),e.find(".navigation--dropdown__toggle").attr("aria-expanded","true")}function o(e){e.removeClass("is-open"),e.find(".navigation--dropdown__toggle").attr("aria-expanded","false")}"undefined"!=typeof Drupal?function(e,n){n.behaviors.initNavigationDropdown={attach:function(n){e("body",n).once("nds-navigation-dropdown").each(function(){t(n)})}}}(jQuery,Drupal):e(document).ready(function(){t()})}(jQuery),function(e){function t(){arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;if(document.querySelectorAll(".navigation--drawer").length>0){var e=windowWidth();document.querySelector("#global-mobile-menu").addEventListener("click",function(e){document.querySelector("#main-navigation-mobile").classList.add("drawer--open"),getNextSibling(document.querySelector("#main-navigation-mobile"),".navigation--drawer--overlay").style.display="block",document.querySelector(".navigation--drawer__top__button-close").focus();for(var t=document.querySelector("#main-navigation-mobile").querySelectorAll("button, a"),n=0;n0&&void 0!==arguments[0]?arguments[0]:document;for(var e=document.querySelectorAll(".navigation--tabs__tab"),t=0;t0&&void 0!==arguments[0]?arguments[0]:document;for(var e=document.querySelectorAll(".input--radio, .input--checkbox"),t=0;t0&&void 0!==arguments[0]?arguments[0]:document;e(".input--date-picker").each(function(){"true"==e(this).find("input").attr("nds-date-picker")&&e(this).find("input").datepicker()})}"undefined"!=typeof Drupal?function(e,n){n.behaviors.initInputDatePicker={attach:function(n){e("body",n).once("nds-input-date-picker").each(function(){t(n)})}}}(jQuery,Drupal):e(document).ready(function(){t()})}(jQuery),function(e){function t(){arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;e('[data-toggle="tooltip"]').tooltip(),e("select").each(function(){"true"==e(this).attr("nds-select")&&(e(this).select2({minimumResultsForSearch:10}),""!=e(this).val()&&e(this).siblings(".select2-container").addClass("no-clear selection-made"))}),e("select").change(function(t,n){"true"==e(this).attr("nds-select")&&(t.target.multiple?e(this).find("option:selected").length>0?e(this).siblings(".select2-container").addClass("selection-made-multi"):e(this).siblings(".select2-container").removeClass("selection-made-multi"):(e(this).siblings(".select2-container").addClass("selection-made"),e(this).siblings(".select2-container").find(".single-clear").length||"true"==e(this).attr("data-select-all-times")||e(this).siblings(".select2-container").append('')))}),e("select").on("select2:open",function(t){e(".select2-container").find(".select2-search__field").attr("aria-label","Search for choices"),e(".select2-container").find(".select2-results__options").attr("aria-label","Available choices")}),e(".select2-selection--single").find(".select2-selection__rendered").attr("aria-label","Click to select option."),e(".select2-selection--multiple").attr("aria-label","Click to select option(s)."),e(document).on("click",".single-clear",function(t){t.stopPropagation();var n=e(this).parent().siblings("select");n.prop("selectedIndex",0);var o=n.attr("data-placeholder");e(this).parent().removeClass("selection-made"),e(this).siblings(".selection").find(".select2-selection__rendered").text(o),e(this).remove()})}"undefined"!=typeof Drupal?function(e,n){n.behaviors.initInputSelect={attach:function(n){e("body",n).once("nds-input-select").each(function(){t(n)})}}}(jQuery,Drupal):e(document).ready(function(){t()})}(jQuery),function(e){function t(){arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;for(var e=document.querySelectorAll("a"),t=0;t-1||n.indexOf("https://")>-1)&&n.indexOf("localhost:3002")<=0){e[t].setAttribute("target","_blank");var a=document.createElement("a");a.setAttribute("href",n),a.setAttribute("class","ext-link-icon"),a.setAttribute("aria-label","External Link"),e[t].insertAdjacentElement("afterend",a)}}}function n(){arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;for(var e=document.querySelectorAll('a[href^="mailto:"]'),t=0;t0&&void 0!==arguments[0]?arguments[0]:document;e("table").each(function(){if("true"==e(this).attr("nds-datatable")){var t={responsive:!0,paging:!1,info:!1,autoWidth:!1,searching:!1};if("true"!=e(this).attr("data-tablesort"))t.ordering=!1;else{var n=[];e(this).find("thead").find("th").each(function(t){"true"==e(this).attr("data-column-num")&&n.push({type:"natural",targets:t})}),t.columnDefs=n}e(this).dataTable(t)}})}"undefined"!=typeof Drupal?function(e,n){n.behaviors.initTableDefault={attach:function(n){e("body",n).once("nds-table-default").each(function(){t(n)})}}}(jQuery,Drupal):e(document).ready(function(){t()})}(jQuery),function(e){function t(){for(var e=document.getElementsByClassName("component--accordion__card"),t=0;t a"),"data-nav","header-nav-"+m+"-")}else o(h,"data-nav","header-nav-")}var g=document.getElementsByClassName("global--footer");for(t=0;t0&&void 0!==e)for(var i=0;i0&&void 0!==arguments[0]?arguments[0]:document;if(document.querySelectorAll(".parallax").length){var e=document.querySelectorAll(".parallax");M.Parallax.init(e)}}"undefined"!=typeof Drupal?function(e,n){n.behaviors.initBlockHero={attach:function(n){e("body",n).once("nds-block-hero").each(function(){t(n)})}}}(jQuery,Drupal):e(document).ready(function(){t()})}(jQuery),function(e){function t(){arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;if(document.querySelectorAll(".materialboxed").length){var e=document.querySelectorAll(".materialboxed");M.Materialbox.init(e)}}"undefined"!=typeof Drupal?function(e,n){n.behaviors.initComponentMedia={attach:function(n){e("body",n).once("nds-component-media").each(function(){t(n)})}}}(jQuery,Drupal):e(document).ready(function(){t()})}(jQuery),function(e){function t(){arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;if(document.querySelectorAll(".component--modal").length)for(var e='button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])',t=document.getElementsByClassName("component--modal"),n=function(){var n=t[o].querySelectorAll(e)[0],a=t[o].querySelectorAll(e),i=a[a.length-1];document.addEventListener("keydown",function(e){("Tab"===e.key||9===e.keyCode)&&(e.shiftKey?document.activeElement===n&&(i.focus(),e.preventDefault()):document.activeElement===i&&(n.focus(),e.preventDefault()))}),n.focus()},o=0;o0&&document.querySelector("#uswds-banner-toggle").addEventListener("click",function(e){"true"==document.getElementById("uswds-banner-toggle").getAttribute("aria-expanded")?(document.getElementById("uswds-banner-toggle").setAttribute("aria-expanded","false"),document.getElementById("uswds-banner-content").style.display="none"):(document.getElementById("uswds-banner-toggle").setAttribute("aria-expanded","true"),document.getElementById("uswds-banner-content").style.display="block")})}"undefined"!=typeof Drupal?function(e,n){n.behaviors.initComponentUSWDSBanner={attach:function(n){e("body",n).once("nds-component-uswds-banner").each(function(){t()})}}}(jQuery,Drupal):e(document).ready(function(){t()})}(jQuery),function(e){function t(){arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;if(document.querySelectorAll(".navigation--drawer").length>0){var e=windowWidth();document.querySelector("#global-mobile-menu").addEventListener("click",function(e){document.querySelector("#main-navigation-mobile").classList.add("drawer--open"),getNextSibling(document.querySelector("#main-navigation-mobile"),".navigation--drawer--overlay").style.display="block",document.querySelector(".navigation--drawer__top__button-close").focus();for(var t=document.querySelector("#main-navigation-mobile").querySelectorAll("button, a"),n=0;n0&&void 0!==arguments[0]?arguments[0]:document;e(".navigation--dropdown.hover").on("mouseover",function(){n(e(this))}),e(".navigation--dropdown.hover").on("mouseout",function(){o(e(this))}),e(".navigation--dropdown").on("focusin",function(t){n(e(this))}),e(".navigation--dropdown").on("focusout",function(t){this.contains(t.relatedTarget)||o(e(this))})}function n(e){e.addClass("is-open"),e.find(".navigation--dropdown__toggle").attr("aria-expanded","true")}function o(e){e.removeClass("is-open"),e.find(".navigation--dropdown__toggle").attr("aria-expanded","false")}"undefined"!=typeof Drupal?function(e,n){n.behaviors.initNavigationDropdown={attach:function(n){e("body",n).once("nds-navigation-dropdown").each(function(){t(n)})}}}(jQuery,Drupal):e(document).ready(function(){t()})}(jQuery),function(e){function t(){arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;for(var e=document.querySelectorAll(".navigation--tabs__tab"),t=0;t 0 && arguments[0] !== undefined ? arguments[0] : document; - - if (document.querySelectorAll('.materialboxed').length) { - var elems = document.querySelectorAll('.materialboxed'); - var instances = M.Materialbox.init(elems); - } - } - - if (typeof Drupal !== 'undefined') { - // Define Drupal behavior. - (function ($, Drupal) { - Drupal.behaviors.initComponentMedia = { - attach: function attach(context) { - $("body", context).once('nds-component-media').each(function () { - initComponentMedia(context); - }); - } - }; - })(jQuery, Drupal); - } else { - // If Drupal isn't loaded, add JS for Pattern Lab. - $(document).ready(function () { - initComponentMedia(); - }); - } -})(jQuery); - -(function ($) { - function initComponentModal() { - var context = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document; - - if (document.querySelectorAll('.component--modal').length) { - var focusableElements = 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'; - var modalsList = document.getElementsByClassName("component--modal"); - - var _loop = function _loop() { - var firstFocusableElement = modalsList[i].querySelectorAll(focusableElements)[0]; - var focusableContent = modalsList[i].querySelectorAll(focusableElements); - var lastFocusableElement = focusableContent[focusableContent.length - 1]; - document.addEventListener('keydown', function (e) { - var isTabPressed = e.key === 'Tab' || e.keyCode === 9; - - if (!isTabPressed) { - return; - } - - if (e.shiftKey) { - if (document.activeElement === firstFocusableElement) { - lastFocusableElement.focus(); - e.preventDefault(); - } - } else { - if (document.activeElement === lastFocusableElement) { - firstFocusableElement.focus(); - e.preventDefault(); - } - } - }); - firstFocusableElement.focus(); - }; - - for (var i = 0; i < modalsList.length; i++) { - _loop(); - } - } - } - - if (typeof Drupal !== 'undefined') { - // Define Drupal behavior. - (function ($, Drupal) { - Drupal.behaviors.initComponentModal = { - attach: function attach(context) { - $("body", context).once('nds-component-modal').each(function () { - initComponentModal(context); - }); - } - }; - })(jQuery, Drupal); - } else { - // If Drupal isn't loaded, add JS for Pattern Lab. - $(document).ready(function () { - initComponentModal(); - }); - } -})(jQuery); // Part of NDS Lite - - -(function ($) { - // initComponentUSWDSBanner - Toggles the USWDS Banner Component open and closed. - function initComponentUSWDSBanner() { - if (document.querySelectorAll('#uswds-banner-toggle').length > 0) { - document.querySelector('#uswds-banner-toggle').addEventListener("click", function (e) { - if (document.getElementById("uswds-banner-toggle").getAttribute('aria-expanded') == 'true') { - document.getElementById("uswds-banner-toggle").setAttribute('aria-expanded', 'false'); - document.getElementById("uswds-banner-content").style.display = 'none'; - } else { - document.getElementById("uswds-banner-toggle").setAttribute('aria-expanded', 'true'); - document.getElementById("uswds-banner-content").style.display = 'block'; - } - }); - } - } - - if (typeof Drupal !== 'undefined') { - // Define Drupal behavior. - (function ($, Drupal) { - Drupal.behaviors.initComponentUSWDSBanner = { - attach: function attach(context) { - $("body", context).once('nds-component-uswds-banner').each(function () { - initComponentUSWDSBanner(context); - }); - } - }; - })(jQuery, Drupal); - } else { - // If Drupal isn't loaded, add JS for Pattern Lab. - $(document).ready(function () { - initComponentUSWDSBanner(); - }); - } })(jQuery); // Part of NDS Lite @@ -579,43 +455,117 @@ })(jQuery); (function ($) { - function initNavigationDropdown() { + function initComponentMedia() { var context = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document; - $(".navigation--dropdown.hover").on('mouseover', function () { - openDropdown($(this)); - }); - $(".navigation--dropdown.hover").on('mouseout', function () { - closeDropdown($(this)); - }); - $(".navigation--dropdown").on('focusin', function (e) { - openDropdown($(this)); + + if (document.querySelectorAll('.materialboxed').length) { + var elems = document.querySelectorAll('.materialboxed'); + var instances = M.Materialbox.init(elems); + } + } + + if (typeof Drupal !== 'undefined') { + // Define Drupal behavior. + (function ($, Drupal) { + Drupal.behaviors.initComponentMedia = { + attach: function attach(context) { + $("body", context).once('nds-component-media').each(function () { + initComponentMedia(context); + }); + } + }; + })(jQuery, Drupal); + } else { + // If Drupal isn't loaded, add JS for Pattern Lab. + $(document).ready(function () { + initComponentMedia(); }); - $(".navigation--dropdown").on('focusout', function (e) { - if (this.contains(e.relatedTarget)) { - return; + } +})(jQuery); + +(function ($) { + function initComponentModal() { + var context = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document; + + if (document.querySelectorAll('.component--modal').length) { + var focusableElements = 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'; + var modalsList = document.getElementsByClassName("component--modal"); + + var _loop = function _loop() { + var firstFocusableElement = modalsList[i].querySelectorAll(focusableElements)[0]; + var focusableContent = modalsList[i].querySelectorAll(focusableElements); + var lastFocusableElement = focusableContent[focusableContent.length - 1]; + document.addEventListener('keydown', function (e) { + var isTabPressed = e.key === 'Tab' || e.keyCode === 9; + + if (!isTabPressed) { + return; + } + + if (e.shiftKey) { + if (document.activeElement === firstFocusableElement) { + lastFocusableElement.focus(); + e.preventDefault(); + } + } else { + if (document.activeElement === lastFocusableElement) { + firstFocusableElement.focus(); + e.preventDefault(); + } + } + }); + firstFocusableElement.focus(); + }; + + for (var i = 0; i < modalsList.length; i++) { + _loop(); } + } + } - closeDropdown($(this)); + if (typeof Drupal !== 'undefined') { + // Define Drupal behavior. + (function ($, Drupal) { + Drupal.behaviors.initComponentModal = { + attach: function attach(context) { + $("body", context).once('nds-component-modal').each(function () { + initComponentModal(context); + }); + } + }; + })(jQuery, Drupal); + } else { + // If Drupal isn't loaded, add JS for Pattern Lab. + $(document).ready(function () { + initComponentModal(); }); } +})(jQuery); // Part of NDS Lite - function openDropdown($el) { - $el.addClass('is-open'); - $el.find('.navigation--dropdown__toggle').attr('aria-expanded', 'true'); - } - function closeDropdown($el) { - $el.removeClass('is-open'); - $el.find('.navigation--dropdown__toggle').attr('aria-expanded', 'false'); +(function ($) { + // initComponentUSWDSBanner - Toggles the USWDS Banner Component open and closed. + function initComponentUSWDSBanner() { + if (document.querySelectorAll('#uswds-banner-toggle').length > 0) { + document.querySelector('#uswds-banner-toggle').addEventListener("click", function (e) { + if (document.getElementById("uswds-banner-toggle").getAttribute('aria-expanded') == 'true') { + document.getElementById("uswds-banner-toggle").setAttribute('aria-expanded', 'false'); + document.getElementById("uswds-banner-content").style.display = 'none'; + } else { + document.getElementById("uswds-banner-toggle").setAttribute('aria-expanded', 'true'); + document.getElementById("uswds-banner-content").style.display = 'block'; + } + }); + } } if (typeof Drupal !== 'undefined') { // Define Drupal behavior. (function ($, Drupal) { - Drupal.behaviors.initNavigationDropdown = { + Drupal.behaviors.initComponentUSWDSBanner = { attach: function attach(context) { - $("body", context).once('nds-navigation-dropdown').each(function () { - initNavigationDropdown(context); + $("body", context).once('nds-component-uswds-banner').each(function () { + initComponentUSWDSBanner(context); }); } }; @@ -623,7 +573,7 @@ } else { // If Drupal isn't loaded, add JS for Pattern Lab. $(document).ready(function () { - initNavigationDropdown(); + initComponentUSWDSBanner(); }); } })(jQuery); // Part of NDS Lite @@ -709,6 +659,56 @@ } })(jQuery); +(function ($) { + function initNavigationDropdown() { + var context = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document; + $(".navigation--dropdown.hover").on('mouseover', function () { + openDropdown($(this)); + }); + $(".navigation--dropdown.hover").on('mouseout', function () { + closeDropdown($(this)); + }); + $(".navigation--dropdown").on('focusin', function (e) { + openDropdown($(this)); + }); + $(".navigation--dropdown").on('focusout', function (e) { + if (this.contains(e.relatedTarget)) { + return; + } + + closeDropdown($(this)); + }); + } + + function openDropdown($el) { + $el.addClass('is-open'); + $el.find('.navigation--dropdown__toggle').attr('aria-expanded', 'true'); + } + + function closeDropdown($el) { + $el.removeClass('is-open'); + $el.find('.navigation--dropdown__toggle').attr('aria-expanded', 'false'); + } + + if (typeof Drupal !== 'undefined') { + // Define Drupal behavior. + (function ($, Drupal) { + Drupal.behaviors.initNavigationDropdown = { + attach: function attach(context) { + $("body", context).once('nds-navigation-dropdown').each(function () { + initNavigationDropdown(context); + }); + } + }; + })(jQuery, Drupal); + } else { + // If Drupal isn't loaded, add JS for Pattern Lab. + $(document).ready(function () { + initNavigationDropdown(); + }); + } +})(jQuery); + (function ($) { function initNavigationTabs() { var context = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document; diff --git a/nds-documentation-site/public_html/js/global/nds-min.js b/nds-documentation-site/public_html/js/global/nds-min.js index 93c00575..c7f22477 100644 --- a/nds-documentation-site/public_html/js/global/nds-min.js +++ b/nds-documentation-site/public_html/js/global/nds-min.js @@ -1 +1 @@ -"use strict";function ownKeys(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,o)}return n}function _objectSpread(e){for(var t=1;t=0&&n.item(t)!==o;);}while(t<0&&(o=o.parentElement));return o})});var getNextSibling=function(e,t){for(var n=e.nextElementSibling;n;){if(n.matches(t))return n;n=n.nextElementSibling}};function windowWidth(){var e=window.document.documentElement.clientWidth,t=window.document.body;return"CSS1Compat"===window.document.compatMode&&e||t&&t.clientWidth||e}function hasClass(e,t){return(" "+e.className+" ").indexOf(" "+t+" ")>-1}$(document).ready(function(){var e=window.matchMedia("all and (min-width: 992px)"),t=$(window).width();$(".fixed-left").each(function(){e.matches&&stickybits($(this).find(".navigation--mobile-rail"))}),$(window).on("resize",function(){t!=$(this).width()&&(t=$(this).width(),$(".fixed-left").each(function(){e.matches?stickybits($(this).find(".navigation--mobile-rail")):(stickybits($(this).find(".navigation--mobile-rail")).cleanup(),$(this).find(".navigation--mobile-rail").css("position","relative"))}))})}),function(e){function t(t){e("#tab--mockup").attr("tabindex","-1")}"undefined"!=typeof Drupal?function(e,n){n.behaviors.layoutsTabs={attach:function(e){t()}}}(jQuery,Drupal):e(document).ready(function(){t()})}(jQuery),function(e){function t(){for(var e=document.getElementsByClassName("component--accordion__card"),t=0;t a"),"data-nav","header-nav-"+f+"-")}else o(h,"data-nav","header-nav-")}var m=document.getElementsByClassName("global--footer");for(t=0;t0&&void 0!==e)for(var a=0;a=0&&n.item(t)!==o;);}while(t<0&&(o=o.parentElement));return o}),"undefined"!=typeof Drupal?function(e,n){n.behaviors.initDataAttributes={attach:function(n){e("body",n).once("nds-data-attributes").each(function(){t()})}}}(jQuery,Drupal):e(document).ready(function(){t()})}(jQuery),function(e){function t(){arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;e(".scrollspy").length&&e(".scrollspy").scrollSpy()}"undefined"!=typeof Drupal?function(e,n){n.behaviors.initComponentScrollspySection={attach:function(n){e("body",n).once("nds-component-scrollspy-section").each(function(){t(n)})}}}(jQuery,Drupal):e(document).ready(function(){t()})}(jQuery),function(e){function t(){arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;e(".component--snippet__block__code__wrapper__snippet").each(function(){if(e("#components").length||e("#migration-guide").length){var t=e(this).html().replace(/ "/g,'"').replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'").replace(/(^[ \t]*\n)/gm,"");e(this).empty(),e(this).append(t),e(this).wrapInner('
');var n=e(this).find("code");Prism.highlightElement(n[0]),e(".component--snippet__block__code__wrapper").show(),e(".component--snippet__block__code__loader").hide()}else{n=e(this).find("code");Prism.highlightElement(n[0]),e(".component--snippet__block__code__wrapper").show(),e(".component--snippet__block__code__loader").hide()}}),e(".component--snippet").find(".component--snippet__block__code__wrapper__button__copy").on("click",function(){var t,n,o,i=e(this).siblings(".component--snippet__block__code__wrapper__button__copied");i.css("opacity",0),t=e(this).parentsUntil(".component--snippet").parent().find("pre"),n=t.text(),(o=document.createElement("textarea")).classList.add("hidden-textarea"),o.textContent=n,document.body.append(o),o.select(),document.execCommand("copy"),o.remove(),i.css("opacity",1),setTimeout(function(){i.css("opacity",0)},2e3)}),e(".component--snippet__block__pattern__toggle").on("click",function(){e(this).siblings(".component--snippet__block__pattern__content").toggleClass("open"),e(this).toggleClass("open")}),e(".component--snippet").find(".component--uswds-banner__toggle").on("click",function(){"true"==e(this).attr("aria-expanded")?(e(this).attr("aria-expanded","false"),e(this).siblings(".component--uswds-banner__content").hide()):(e(this).attr("aria-expanded","true"),e(this).siblings(".component--uswds-banner__content").show())})}"undefined"!=typeof Drupal?function(e,n){n.behaviors.initComponentSnippet={attach:function(n){e("body",n).once("nds-component-snippet").each(function(){t(n)})}}}(jQuery,Drupal):e(document).ready(function(){t()})}(jQuery),function(e){function t(){arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;var t=window.matchMedia("all and (max-width: 992px)"),n=e(window).width();t.matches?e("#custom-styles-toggle").hide():e("#custom-styles-toggle").show(),e(window).on("resize",function(){n!=e(this).width()&&(n=e(this).width(),t.matches?(e("#custom-styles-toggle").hide(),e(".component--style-controls").removeClass("component--style-controls--open"),e("body").css("padding-top",0),e(".component--style-controls").find(".select2-selection--single").attr("tabindex","-1")):(e("#custom-styles-toggle").show(),e(".component--style-controls").find(".select2-selection--single").attr("tabindex","0"),e(".component--style-controls").find(".select2-selection--single")[0].focus()))}),e("#custom-styles-toggle").on("click",function(){e(".component--style-controls").toggleClass("component--style-controls--open"),e(".component--style-controls").hasClass("component--style-controls--open")?(e("body").css("padding-top",e(".component--style-controls").outerHeight()+"px"),e(".component--style-controls").find(".select2-selection--single").attr("tabindex","0"),e(".component--style-controls").find(".select2-selection--single")[0].focus()):(e("body").css("padding-top",0),e(".component--style-controls").find(".select2-selection--single").attr("tabindex","-1"))}),e(".skip-to--close").on("focus",function(){e("#custom-styles-toggle").focus()});var o={headings:"public-sans",body:"public-sans",colors:"theme-1",shadows:"false",corners:"semirounded"};function i(t,n,o){var i=t.val();e("body").removeClass("style--"+n+"--"+o[n]),e("body").addClass("style--"+n+"--"+i);var a,c,r="NDS_DOC_SITE_PROP--"+n;return e.cookie(r,i,{expires:30,path:"/"}),a=o,c=_defineProperty({},n,i),_objectSpread({},a,{},c)}o=function(t){var n=t;e.cookie("NDS_DOC_SITE_PROP--shadows")&&(e("body").addClass("style--shadows"),e.cookie("NDS_DOC_SITE_PROP--shadows",!0,{expires:30,path:"/"}),e('#shadows option[value="shadows"]').prop("selected",!0));for(var o in n){var a="NDS_DOC_SITE_PROP--"+o;if(e.cookie(a))switch(o){case"headings":e("#text-heading option[value="+e.cookie(a)+"]").prop("selected",!0),n=i(e("#text-heading"),o,n);break;case"body":e("#text-body option[value="+e.cookie(a)+"]").prop("selected",!0),n=i(e("#text-body"),o,n);break;case"colors":e("#color-select option[value="+e.cookie(a)+"]").prop("selected",!0),n=i(e("#color-select"),o,n);break;case"corners":e("#corners option[value="+e.cookie(a)+"]").prop("selected",!0),n=i(e("#corners"),o,n)}}return n}(o),e("#text-heading").on("change",function(){o=i(e(this),"headings",o)}),e("#text-body").on("change",function(){o=i(e(this),"body",o)}),e("#color-select").on("change",function(){o=i(e(this),"colors",o)}),e("#shadows").on("change",function(){"shadows"==e(this).val()?(e("body").addClass("style--shadows"),e.cookie("NDS_DOC_SITE_PROP--shadows",!0,{expires:30,path:"/"})):(e("body").removeClass("style--shadows"),e.removeCookie("NDS_DOC_SITE_PROP--shadows",{path:"/"}))}),e("#corners").on("change",function(){o=i(e(this),"corners",o)})}"undefined"!=typeof Drupal?function(e,n){n.behaviors.init_style_controls={attach:function(n){e(".page",n).once("nds-style-controls").each(function(){t(n)})}}}(jQuery,Drupal):e(document).ready(function(){e("#builder").length||t()})}(jQuery),function(e){function t(t){window.matchMedia("all and (max-width: 991px)");var c={tab:"mockup",heading:"roboto",body:"roboto",colors:"theme-1",shadows:"false",corners:"semirounded",hero:"false",productIDTop:"",productIDBottom:""},r=a(window.location.href);function s(t){var o=e("input[name='headings']:checked").val();return e("body").removeClass("style--headings--"+t.heading),e("body").addClass("style--headings--"+o),n(t,{heading:o})}function l(t){var o=e("input[name='body']:checked").val();return e("body").removeClass("style--body--"+t.body),e("body").addClass("style--body--"+o),n(t,{body:o})}function d(t){var o=e("input[name='colors']:checked").val();return e("body").removeClass("style--colors--"+t.colors),e("body").addClass("style--colors--"+o),i(o),n(t,{colors:o})}function u(t){return"shadows"==e("input[name='shadow']:checked").val()?(e("body").addClass("style--shadows"),n(t,{shadows:"true"})):(e("body").removeClass("style--shadows"),n(t,{shadows:"false"}))}function p(t){var o=e("input[name='corners']:checked").val();return"rounded"==o?(e("body").removeClass("style--corners--semirounded").addClass("style--corners--rounded"),n(t,{corners:"rounded"})):"semirounded"==o?(e("body").removeClass("style--corners--rounded").addClass("style--corners--semirounded"),n(t,{corners:"semirounded"})):(e("body").removeClass("style--corners--rounded style--corners--semirounded"),n(t,{corners:"straight"}))}function h(t){return"yes"==e("input[name='hero']:checked").val()?(e("#block--hero").show(),e("body").addClass("style--hero"),n(t,{hero:"true"})):(e("#block--hero").hide(),e("body").removeClass("style--hero"),n(t,{hero:"false"}))}function f(t,o,i){return e(".layouts--tabs__tab").each(function(){e(this).removeClass("active-tab"),e(this).attr("tabindex","0")}),e(".layouts--tabs__window").each(function(){e(this).hide()}),"mockup"==i?e("#layouts--tabs__mockup").show():e("#layouts--tabs__style-tile").show(),e(o).addClass("active-tab"),e(o).attr("tabindex","-1"),e("table").each(function(){e(this).hasClass("dataTable")&&e(this).DataTable().columns.adjust().responsive.recalc()}),n(t,{tab:i})}(function(t){e(".layouts--tabs__tab").each(function(){e(this).removeClass("active-tab"),e(this).attr("tabindex","0")}),e(".layouts--tabs__window").each(function(){e(this).hide()}),"st"==t.tab?(e("#tab--style-tile").addClass("active-tab"),e("#tab--style-tile").attr("tabindex","-1"),e("#layouts--tabs__style-tile").show()):(e("#tab--mockup").addClass("active-tab"),e("#tab--mockup").attr("tabindex","-1"),e("#layouts--tabs__mockup").show());e(".form--controls--headings input[value="+t.heading+"]").click(),e(".form--controls--body input[value="+t.body+"]").click(),e(".form--controls--colors input[value="+t.colors+"]").click(),i(t.colors),"true"==t.shadows?(e("body").addClass("style--shadows"),e(".form--controls--shadows input[value=shadows]").click()):(e("body").removeClass("style--shadows"),e(".form--controls--shadows input[value=no_shadows]").click());"rounded"==t.corners?(e("body").removeClass("style--corners--semirounded").addClass("style--corners--rounded"),e(".form--controls--corners input[value=rounded]").click()):"semirounded"==t.corners?(e("body").removeClass("style--corners--rounded").addClass("style--corners--semirounded"),e(".form--controls--corners input[value=semirounded]").click()):(e("body").removeClass("style--corners--rounded style--corners--semirounded"),e(".form--controls--corners input[value=straight]").click());"true"==t.hero?(e("#block--hero").show(),e("#block--header").hide(),e("body").addClass("style--hero"),e(".form--controls--hero input[value=yes]").click()):(e("#block--hero").hide(),e("#block--header").show(),e("body").removeClass("style--hero"),e(".form--controls--hero input[value=no]").click());""!=t.productIDTop&&(e("#form--product-identity__inputs__top").val(t.productIDTop),e(".main").find(".text--product-identity__top").text(t.productIDTop));""!=t.productIDBottom&&(e("#form--product-identity__inputs__bottom").val(t.productIDBottom),e(".main").find(".text--product-identity__bottom").text(t.productIDBottom));""==t.productIDTop&&""==t.productIDBottom||e(".main").find(".component--branding__vertical-bar").css("display","inline-block")})(c=n(c,r)),e("body").addClass("style--headings--"+c.heading),e(".form--controls--headings input[type='radio']").click(function(){c=s(c)}),e(".form--controls--headings label",t).keypress(function(t){13==t.which&&(e(this).siblings("input").prop("checked",!0),c=s(c))}),e("body").addClass("style--body--"+c.body),e(".form--controls--body input[type='radio']").click(function(){c=l(c)}),e(".form--controls--body label",t).keypress(function(t){13==t.which&&(e(this).siblings("input").prop("checked",!0),c=l(c))}),e("body").addClass("style--colors--"+c.colors),e(".form--controls--colors input[type='radio']").click(function(){c=d(c)}),e(".block--palette").click(function(){var t=e(this).attr("class").split(" "),o=t[t.length-1];e("input[name='colors'][value="+o+"]").prop("checked",!0),e("body").removeClass("style--colors--"+c.colors),e("body").addClass("style--colors--"+o),i(o),c=n(c,{colors:o})}),e(".form--controls--colors label",t).keypress(function(t){13==t.which&&(e(this).siblings("input").prop("checked",!0),c=d(c))}),e(".form--controls--shadows input[type='radio']").click(function(){c=u(c)}),e(".form--controls--shadows label",t).keypress(function(t){13==t.which&&(e(this).siblings("input").prop("checked",!0),c=u(c))}),e(".form--controls--corners input[type='radio']").click(function(){c=p(c)}),e(".form--controls--corners label",t).keypress(function(t){13==t.which&&(e(this).siblings("input").prop("checked",!0),c=p(c))}),e(".form--controls--hero input[type='radio']").click(function(){c=h(c)}),e(".form--controls--hero label",t).keypress(function(t){13==t.which&&(e(this).siblings("input").prop("checked",!0),c=h(c))}),e("#tab--mockup",t).click(function(){c=f(c,this,"mockup")}),e("#tab--style-tile",t).click(function(){c=f(c,this,"st")}),e("#tab--mockup",t).keypress(function(e){13==e.which&&(c=f(c,this,"mockup"))}),e("#tab--style-tile",t).keypress(function(e){13==e.which&&(c=f(c,this,"st"))}),e("#form--product-identity__inputs__top").on("input",function(){c=o(c,this)}),e("#form--product-identity__inputs__bottom").on("input",function(){c=o(c,this)}),e(".button--use-theme").on("click",function(){var t='"bodyClass": "';t+="style--headings--"+c.heading,t+=" style--body--"+c.body,t+=" style--colors--"+c.colors,"true"==c.shadows?t+=" style--shadows":t+="","true"==c.hero?t+=" style--hero":t+="",t+=" style--corners--"+c.corners,t+='"',e("#selected-choices").text(t)}),e(".button--share-theme").click(function(){var t,n;e(".builder--side-drawer__copied").css("opacity",0),function(t){var n="?",o=!0;Object.keys(t).forEach(function(e){t[e]&&(o?(n+=e+"="+t[e],o=!1):"undefined"!=t[e]&&(n+="&"+e+"="+t[e]))});var i=window.location.href.split("?")[0];e(".builder--side-drawer__link").text(i+n)}(c),t=".builder--side-drawer__link",n=e(""),e("body").append(n),n.val(e(t).text()).select(),document.execCommand("copy"),n.remove(),e(".builder--side-drawer__copied").css("opacity",1),setTimeout(function(){e(".builder--side-drawer__copied").css("opacity",0)},2e3)})}function n(e,t){return _objectSpread({},e,{},t)}function o(t,o){if(""==e("#form--product-identity__inputs__top").val()&&""==e("#form--product-identity__inputs__bottom").val())e(".main").find(".component--branding__vertical-bar").css("display","none"),e(".main").find(".text--product-identity__top").text(""),e(".main").find(".text--product-identity__bottom").text("");else{if(e(".main").find(".component--branding__vertical-bar").css("display","inline-block"),"form--product-identity__inputs__top"==o.name)return e(".main").find(".text--product-identity__top").text(o.value),n(t,{productIDTop:o.value});if("form--product-identity__inputs__bottom"==o.name)return e(".main").find(".text--product-identity__bottom").text(o.value),n(t,{productIDBottom:o.value})}}function i(t){e(".block--palette."+t).find(".block--palette__color").each(function(t){if(4!=t){var n=(i=(i=e(this).css("background-color")).match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i))&&4===i.length?"#"+("0"+parseInt(i[1],10).toString(16)).slice(-2)+("0"+parseInt(i[2],10).toString(16)).slice(-2)+("0"+parseInt(i[3],10).toString(16)).slice(-2):"",o=".indicator-color--"+(t+1);e(o).find(".global--color-indicator__color").css("background",n),e(o).find(".global--color-indicator__hex").text(n.toUpperCase())}var i})}var a=function(e){var t={},n=document.createElement("a");n.href=e;for(var o=n.search.substring(1).split("&"),i=0;i0&&void 0!==arguments[0]?arguments[0]:document;for(var e=document.querySelectorAll(".input--radio, .input--checkbox"),t=0;t0&&void 0!==arguments[0]?arguments[0]:document;e(".input--date-picker").each(function(){"true"==e(this).find("input").attr("nds-date-picker")&&e(this).find("input").datepicker()})}"undefined"!=typeof Drupal?function(e,n){n.behaviors.initInputDatePicker={attach:function(n){e("body",n).once("nds-input-date-picker").each(function(){t(n)})}}}(jQuery,Drupal):e(document).ready(function(){t()})}(jQuery),function(e){function t(){arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;e('[data-toggle="tooltip"]').tooltip(),e("select").each(function(){"true"==e(this).attr("nds-select")&&(e(this).select2({minimumResultsForSearch:10}),""!=e(this).val()&&e(this).siblings(".select2-container").addClass("no-clear selection-made"))}),e("select").change(function(t,n){"true"==e(this).attr("nds-select")&&(t.target.multiple?e(this).find("option:selected").length>0?e(this).siblings(".select2-container").addClass("selection-made-multi"):e(this).siblings(".select2-container").removeClass("selection-made-multi"):(e(this).siblings(".select2-container").addClass("selection-made"),e(this).siblings(".select2-container").find(".single-clear").length||"true"==e(this).attr("data-select-all-times")||e(this).siblings(".select2-container").append('')))}),e("select").on("select2:open",function(t){e(".select2-container").find(".select2-search__field").attr("aria-label","Search for choices"),e(".select2-container").find(".select2-results__options").attr("aria-label","Available choices")}),e(".select2-selection--single").find(".select2-selection__rendered").attr("aria-label","Click to select option."),e(".select2-selection--multiple").attr("aria-label","Click to select option(s)."),e(document).on("click",".single-clear",function(t){t.stopPropagation();var n=e(this).parent().siblings("select");n.prop("selectedIndex",0);var o=n.attr("data-placeholder");e(this).parent().removeClass("selection-made"),e(this).siblings(".selection").find(".select2-selection__rendered").text(o),e(this).remove()})}"undefined"!=typeof Drupal?function(e,n){n.behaviors.initInputSelect={attach:function(n){e("body",n).once("nds-input-select").each(function(){t(n)})}}}(jQuery,Drupal):e(document).ready(function(){t()})}(jQuery),function(e){function t(){arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;for(var e=document.querySelectorAll("a"),t=0;t-1||n.indexOf("https://")>-1)&&n.indexOf("localhost:3002")<=0){e[t].setAttribute("target","_blank");var i=document.createElement("a");i.setAttribute("href",n),i.setAttribute("class","ext-link-icon"),i.setAttribute("aria-label","External Link"),e[t].insertAdjacentElement("afterend",i)}}}function n(){arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;for(var e=document.querySelectorAll('a[href^="mailto:"]'),t=0;t0&&void 0!==arguments[0]?arguments[0]:document;e("table").each(function(){if("true"==e(this).attr("nds-datatable")){var t={responsive:!0,paging:!1,info:!1,autoWidth:!1,searching:!1};if("true"!=e(this).attr("data-tablesort"))t.ordering=!1;else{var n=[];e(this).find("thead").find("th").each(function(t){"true"==e(this).attr("data-column-num")&&n.push({type:"natural",targets:t})}),t.columnDefs=n}e(this).dataTable(t)}})}"undefined"!=typeof Drupal?function(e,n){n.behaviors.initTableDefault={attach:function(n){e("body",n).once("nds-table-default").each(function(){t(n)})}}}(jQuery,Drupal):e(document).ready(function(){t()})}(jQuery),function(e){function t(){arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;if(document.querySelectorAll(".parallax").length){var e=document.querySelectorAll(".parallax");M.Parallax.init(e)}}"undefined"!=typeof Drupal?function(e,n){n.behaviors.initBlockHero={attach:function(n){e("body",n).once("nds-block-hero").each(function(){t(n)})}}}(jQuery,Drupal):e(document).ready(function(){t()})}(jQuery),function(e){function t(){arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;if(document.querySelectorAll(".materialboxed").length){var e=document.querySelectorAll(".materialboxed");M.Materialbox.init(e)}}"undefined"!=typeof Drupal?function(e,n){n.behaviors.initComponentMedia={attach:function(n){e("body",n).once("nds-component-media").each(function(){t(n)})}}}(jQuery,Drupal):e(document).ready(function(){t()})}(jQuery),function(e){function t(){arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;if(document.querySelectorAll(".component--modal").length)for(var e='button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])',t=document.getElementsByClassName("component--modal"),n=function(){var n=t[o].querySelectorAll(e)[0],i=t[o].querySelectorAll(e),a=i[i.length-1];document.addEventListener("keydown",function(e){("Tab"===e.key||9===e.keyCode)&&(e.shiftKey?document.activeElement===n&&(a.focus(),e.preventDefault()):document.activeElement===a&&(n.focus(),e.preventDefault()))}),n.focus()},o=0;o0&&document.querySelector("#uswds-banner-toggle").addEventListener("click",function(e){"true"==document.getElementById("uswds-banner-toggle").getAttribute("aria-expanded")?(document.getElementById("uswds-banner-toggle").setAttribute("aria-expanded","false"),document.getElementById("uswds-banner-content").style.display="none"):(document.getElementById("uswds-banner-toggle").setAttribute("aria-expanded","true"),document.getElementById("uswds-banner-content").style.display="block")})}"undefined"!=typeof Drupal?function(e,n){n.behaviors.initComponentUSWDSBanner={attach:function(n){e("body",n).once("nds-component-uswds-banner").each(function(){t()})}}}(jQuery,Drupal):e(document).ready(function(){t()})}(jQuery),function(e){function t(){arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;e(".navigation--dropdown.hover").on("mouseover",function(){n(e(this))}),e(".navigation--dropdown.hover").on("mouseout",function(){o(e(this))}),e(".navigation--dropdown").on("focusin",function(t){n(e(this))}),e(".navigation--dropdown").on("focusout",function(t){this.contains(t.relatedTarget)||o(e(this))})}function n(e){e.addClass("is-open"),e.find(".navigation--dropdown__toggle").attr("aria-expanded","true")}function o(e){e.removeClass("is-open"),e.find(".navigation--dropdown__toggle").attr("aria-expanded","false")}"undefined"!=typeof Drupal?function(e,n){n.behaviors.initNavigationDropdown={attach:function(n){e("body",n).once("nds-navigation-dropdown").each(function(){t(n)})}}}(jQuery,Drupal):e(document).ready(function(){t()})}(jQuery),function(e){function t(){arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;if(document.querySelectorAll(".navigation--drawer").length>0){var e=windowWidth();document.querySelector("#global-mobile-menu").addEventListener("click",function(e){document.querySelector("#main-navigation-mobile").classList.add("drawer--open"),getNextSibling(document.querySelector("#main-navigation-mobile"),".navigation--drawer--overlay").style.display="block",document.querySelector(".navigation--drawer__top__button-close").focus();for(var t=document.querySelector("#main-navigation-mobile").querySelectorAll("button, a"),n=0;n0&&void 0!==arguments[0]?arguments[0]:document;for(var e=document.querySelectorAll(".navigation--tabs__tab"),t=0;t=0&&n.item(t)!==o;);}while(t<0&&(o=o.parentElement));return o})});var getNextSibling=function(e,t){for(var n=e.nextElementSibling;n;){if(n.matches(t))return n;n=n.nextElementSibling}};function windowWidth(){var e=window.document.documentElement.clientWidth,t=window.document.body;return"CSS1Compat"===window.document.compatMode&&e||t&&t.clientWidth||e}function hasClass(e,t){return(" "+e.className+" ").indexOf(" "+t+" ")>-1}!function(e){function t(){for(var e=document.getElementsByClassName("component--accordion__card"),t=0;t a"),"data-nav","header-nav-"+f+"-")}else o(h,"data-nav","header-nav-")}var m=document.getElementsByClassName("global--footer");for(t=0;t0&&void 0!==e)for(var a=0;a=0&&n.item(t)!==o;);}while(t<0&&(o=o.parentElement));return o}),"undefined"!=typeof Drupal?function(e,n){n.behaviors.initDataAttributes={attach:function(n){e("body",n).once("nds-data-attributes").each(function(){t()})}}}(jQuery,Drupal):e(document).ready(function(){t()})}(jQuery),function(e){function t(){arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;e(".scrollspy").length&&e(".scrollspy").scrollSpy()}"undefined"!=typeof Drupal?function(e,n){n.behaviors.initComponentScrollspySection={attach:function(n){e("body",n).once("nds-component-scrollspy-section").each(function(){t(n)})}}}(jQuery,Drupal):e(document).ready(function(){t()})}(jQuery),function(e){function t(){arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;e(".component--snippet__block__code__wrapper__snippet").each(function(){if(e("#components").length||e("#migration-guide").length){var t=e(this).html().replace(/ "/g,'"').replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'").replace(/(^[ \t]*\n)/gm,"");e(this).empty(),e(this).append(t),e(this).wrapInner('
');var n=e(this).find("code");Prism.highlightElement(n[0]),e(".component--snippet__block__code__wrapper").show(),e(".component--snippet__block__code__loader").hide()}else{n=e(this).find("code");Prism.highlightElement(n[0]),e(".component--snippet__block__code__wrapper").show(),e(".component--snippet__block__code__loader").hide()}}),e(".component--snippet").find(".component--snippet__block__code__wrapper__button__copy").on("click",function(){var t,n,o,i=e(this).siblings(".component--snippet__block__code__wrapper__button__copied");i.css("opacity",0),t=e(this).parentsUntil(".component--snippet").parent().find("pre"),n=t.text(),(o=document.createElement("textarea")).classList.add("hidden-textarea"),o.textContent=n,document.body.append(o),o.select(),document.execCommand("copy"),o.remove(),i.css("opacity",1),setTimeout(function(){i.css("opacity",0)},2e3)}),e(".component--snippet__block__pattern__toggle").on("click",function(){e(this).siblings(".component--snippet__block__pattern__content").toggleClass("open"),e(this).toggleClass("open")}),e(".component--snippet").find(".component--uswds-banner__toggle").on("click",function(){"true"==e(this).attr("aria-expanded")?(e(this).attr("aria-expanded","false"),e(this).siblings(".component--uswds-banner__content").hide()):(e(this).attr("aria-expanded","true"),e(this).siblings(".component--uswds-banner__content").show())})}"undefined"!=typeof Drupal?function(e,n){n.behaviors.initComponentSnippet={attach:function(n){e("body",n).once("nds-component-snippet").each(function(){t(n)})}}}(jQuery,Drupal):e(document).ready(function(){t()})}(jQuery),function(e){function t(){arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;var t=window.matchMedia("all and (max-width: 992px)"),n=e(window).width();t.matches?e("#custom-styles-toggle").hide():e("#custom-styles-toggle").show(),e(window).on("resize",function(){n!=e(this).width()&&(n=e(this).width(),t.matches?(e("#custom-styles-toggle").hide(),e(".component--style-controls").removeClass("component--style-controls--open"),e("body").css("padding-top",0),e(".component--style-controls").find(".select2-selection--single").attr("tabindex","-1")):(e("#custom-styles-toggle").show(),e(".component--style-controls").find(".select2-selection--single").attr("tabindex","0"),e(".component--style-controls").find(".select2-selection--single")[0].focus()))}),e("#custom-styles-toggle").on("click",function(){e(".component--style-controls").toggleClass("component--style-controls--open"),e(".component--style-controls").hasClass("component--style-controls--open")?(e("body").css("padding-top",e(".component--style-controls").outerHeight()+"px"),e(".component--style-controls").find(".select2-selection--single").attr("tabindex","0"),e(".component--style-controls").find(".select2-selection--single")[0].focus()):(e("body").css("padding-top",0),e(".component--style-controls").find(".select2-selection--single").attr("tabindex","-1"))}),e(".skip-to--close").on("focus",function(){e("#custom-styles-toggle").focus()});var o={headings:"public-sans",body:"public-sans",colors:"theme-1",shadows:"false",corners:"semirounded"};function i(t,n,o){var i=t.val();e("body").removeClass("style--"+n+"--"+o[n]),e("body").addClass("style--"+n+"--"+i);var a,c,r="NDS_DOC_SITE_PROP--"+n;return e.cookie(r,i,{expires:30,path:"/"}),a=o,c=_defineProperty({},n,i),_objectSpread({},a,{},c)}o=function(t){var n=t;e.cookie("NDS_DOC_SITE_PROP--shadows")&&(e("body").addClass("style--shadows"),e.cookie("NDS_DOC_SITE_PROP--shadows",!0,{expires:30,path:"/"}),e('#shadows option[value="shadows"]').prop("selected",!0));for(var o in n){var a="NDS_DOC_SITE_PROP--"+o;if(e.cookie(a))switch(o){case"headings":e("#text-heading option[value="+e.cookie(a)+"]").prop("selected",!0),n=i(e("#text-heading"),o,n);break;case"body":e("#text-body option[value="+e.cookie(a)+"]").prop("selected",!0),n=i(e("#text-body"),o,n);break;case"colors":e("#color-select option[value="+e.cookie(a)+"]").prop("selected",!0),n=i(e("#color-select"),o,n);break;case"corners":e("#corners option[value="+e.cookie(a)+"]").prop("selected",!0),n=i(e("#corners"),o,n)}}return n}(o),e("#text-heading").on("change",function(){o=i(e(this),"headings",o)}),e("#text-body").on("change",function(){o=i(e(this),"body",o)}),e("#color-select").on("change",function(){o=i(e(this),"colors",o)}),e("#shadows").on("change",function(){"shadows"==e(this).val()?(e("body").addClass("style--shadows"),e.cookie("NDS_DOC_SITE_PROP--shadows",!0,{expires:30,path:"/"})):(e("body").removeClass("style--shadows"),e.removeCookie("NDS_DOC_SITE_PROP--shadows",{path:"/"}))}),e("#corners").on("change",function(){o=i(e(this),"corners",o)})}"undefined"!=typeof Drupal?function(e,n){n.behaviors.init_style_controls={attach:function(n){e(".page",n).once("nds-style-controls").each(function(){t(n)})}}}(jQuery,Drupal):e(document).ready(function(){e("#builder").length||t()})}(jQuery),function(e){function t(t){e("#tab--mockup").attr("tabindex","-1")}"undefined"!=typeof Drupal?function(e,n){n.behaviors.layoutsTabs={attach:function(e){t()}}}(jQuery,Drupal):e(document).ready(function(){t()})}(jQuery),$(document).ready(function(){var e=window.matchMedia("all and (min-width: 992px)"),t=$(window).width();$(".fixed-left").each(function(){e.matches&&stickybits($(this).find(".navigation--mobile-rail"))}),$(window).on("resize",function(){t!=$(this).width()&&(t=$(this).width(),$(".fixed-left").each(function(){e.matches?stickybits($(this).find(".navigation--mobile-rail")):(stickybits($(this).find(".navigation--mobile-rail")).cleanup(),$(this).find(".navigation--mobile-rail").css("position","relative"))}))})}),function(e){function t(t){window.matchMedia("all and (max-width: 991px)");var c={tab:"mockup",heading:"roboto",body:"roboto",colors:"theme-1",shadows:"false",corners:"semirounded",hero:"false",productIDTop:"",productIDBottom:""},r=a(window.location.href);function s(t){var o=e("input[name='headings']:checked").val();return e("body").removeClass("style--headings--"+t.heading),e("body").addClass("style--headings--"+o),n(t,{heading:o})}function l(t){var o=e("input[name='body']:checked").val();return e("body").removeClass("style--body--"+t.body),e("body").addClass("style--body--"+o),n(t,{body:o})}function d(t){var o=e("input[name='colors']:checked").val();return e("body").removeClass("style--colors--"+t.colors),e("body").addClass("style--colors--"+o),i(o),n(t,{colors:o})}function u(t){return"shadows"==e("input[name='shadow']:checked").val()?(e("body").addClass("style--shadows"),n(t,{shadows:"true"})):(e("body").removeClass("style--shadows"),n(t,{shadows:"false"}))}function p(t){var o=e("input[name='corners']:checked").val();return"rounded"==o?(e("body").removeClass("style--corners--semirounded").addClass("style--corners--rounded"),n(t,{corners:"rounded"})):"semirounded"==o?(e("body").removeClass("style--corners--rounded").addClass("style--corners--semirounded"),n(t,{corners:"semirounded"})):(e("body").removeClass("style--corners--rounded style--corners--semirounded"),n(t,{corners:"straight"}))}function h(t){return"yes"==e("input[name='hero']:checked").val()?(e("#block--hero").show(),e("body").addClass("style--hero"),n(t,{hero:"true"})):(e("#block--hero").hide(),e("body").removeClass("style--hero"),n(t,{hero:"false"}))}function f(t,o,i){return e(".layouts--tabs__tab").each(function(){e(this).removeClass("active-tab"),e(this).attr("tabindex","0")}),e(".layouts--tabs__window").each(function(){e(this).hide()}),"mockup"==i?e("#layouts--tabs__mockup").show():e("#layouts--tabs__style-tile").show(),e(o).addClass("active-tab"),e(o).attr("tabindex","-1"),e("table").each(function(){e(this).hasClass("dataTable")&&e(this).DataTable().columns.adjust().responsive.recalc()}),n(t,{tab:i})}(function(t){e(".layouts--tabs__tab").each(function(){e(this).removeClass("active-tab"),e(this).attr("tabindex","0")}),e(".layouts--tabs__window").each(function(){e(this).hide()}),"st"==t.tab?(e("#tab--style-tile").addClass("active-tab"),e("#tab--style-tile").attr("tabindex","-1"),e("#layouts--tabs__style-tile").show()):(e("#tab--mockup").addClass("active-tab"),e("#tab--mockup").attr("tabindex","-1"),e("#layouts--tabs__mockup").show());e(".form--controls--headings input[value="+t.heading+"]").click(),e(".form--controls--body input[value="+t.body+"]").click(),e(".form--controls--colors input[value="+t.colors+"]").click(),i(t.colors),"true"==t.shadows?(e("body").addClass("style--shadows"),e(".form--controls--shadows input[value=shadows]").click()):(e("body").removeClass("style--shadows"),e(".form--controls--shadows input[value=no_shadows]").click());"rounded"==t.corners?(e("body").removeClass("style--corners--semirounded").addClass("style--corners--rounded"),e(".form--controls--corners input[value=rounded]").click()):"semirounded"==t.corners?(e("body").removeClass("style--corners--rounded").addClass("style--corners--semirounded"),e(".form--controls--corners input[value=semirounded]").click()):(e("body").removeClass("style--corners--rounded style--corners--semirounded"),e(".form--controls--corners input[value=straight]").click());"true"==t.hero?(e("#block--hero").show(),e("#block--header").hide(),e("body").addClass("style--hero"),e(".form--controls--hero input[value=yes]").click()):(e("#block--hero").hide(),e("#block--header").show(),e("body").removeClass("style--hero"),e(".form--controls--hero input[value=no]").click());""!=t.productIDTop&&(e("#form--product-identity__inputs__top").val(t.productIDTop),e(".main").find(".text--product-identity__top").text(t.productIDTop));""!=t.productIDBottom&&(e("#form--product-identity__inputs__bottom").val(t.productIDBottom),e(".main").find(".text--product-identity__bottom").text(t.productIDBottom));""==t.productIDTop&&""==t.productIDBottom||e(".main").find(".component--branding__vertical-bar").css("display","inline-block")})(c=n(c,r)),e("body").addClass("style--headings--"+c.heading),e(".form--controls--headings input[type='radio']").click(function(){c=s(c)}),e(".form--controls--headings label",t).keypress(function(t){13==t.which&&(e(this).siblings("input").prop("checked",!0),c=s(c))}),e("body").addClass("style--body--"+c.body),e(".form--controls--body input[type='radio']").click(function(){c=l(c)}),e(".form--controls--body label",t).keypress(function(t){13==t.which&&(e(this).siblings("input").prop("checked",!0),c=l(c))}),e("body").addClass("style--colors--"+c.colors),e(".form--controls--colors input[type='radio']").click(function(){c=d(c)}),e(".block--palette").click(function(){var t=e(this).attr("class").split(" "),o=t[t.length-1];e("input[name='colors'][value="+o+"]").prop("checked",!0),e("body").removeClass("style--colors--"+c.colors),e("body").addClass("style--colors--"+o),i(o),c=n(c,{colors:o})}),e(".form--controls--colors label",t).keypress(function(t){13==t.which&&(e(this).siblings("input").prop("checked",!0),c=d(c))}),e(".form--controls--shadows input[type='radio']").click(function(){c=u(c)}),e(".form--controls--shadows label",t).keypress(function(t){13==t.which&&(e(this).siblings("input").prop("checked",!0),c=u(c))}),e(".form--controls--corners input[type='radio']").click(function(){c=p(c)}),e(".form--controls--corners label",t).keypress(function(t){13==t.which&&(e(this).siblings("input").prop("checked",!0),c=p(c))}),e(".form--controls--hero input[type='radio']").click(function(){c=h(c)}),e(".form--controls--hero label",t).keypress(function(t){13==t.which&&(e(this).siblings("input").prop("checked",!0),c=h(c))}),e("#tab--mockup",t).click(function(){c=f(c,this,"mockup")}),e("#tab--style-tile",t).click(function(){c=f(c,this,"st")}),e("#tab--mockup",t).keypress(function(e){13==e.which&&(c=f(c,this,"mockup"))}),e("#tab--style-tile",t).keypress(function(e){13==e.which&&(c=f(c,this,"st"))}),e("#form--product-identity__inputs__top").on("input",function(){c=o(c,this)}),e("#form--product-identity__inputs__bottom").on("input",function(){c=o(c,this)}),e(".button--use-theme").on("click",function(){var t='"bodyClass": "';t+="style--headings--"+c.heading,t+=" style--body--"+c.body,t+=" style--colors--"+c.colors,"true"==c.shadows?t+=" style--shadows":t+="","true"==c.hero?t+=" style--hero":t+="",t+=" style--corners--"+c.corners,t+='"',e("#selected-choices").text(t)}),e(".button--share-theme").click(function(){var t,n;e(".builder--side-drawer__copied").css("opacity",0),function(t){var n="?",o=!0;Object.keys(t).forEach(function(e){t[e]&&(o?(n+=e+"="+t[e],o=!1):"undefined"!=t[e]&&(n+="&"+e+"="+t[e]))});var i=window.location.href.split("?")[0];e(".builder--side-drawer__link").text(i+n)}(c),t=".builder--side-drawer__link",n=e(""),e("body").append(n),n.val(e(t).text()).select(),document.execCommand("copy"),n.remove(),e(".builder--side-drawer__copied").css("opacity",1),setTimeout(function(){e(".builder--side-drawer__copied").css("opacity",0)},2e3)})}function n(e,t){return _objectSpread({},e,{},t)}function o(t,o){if(""==e("#form--product-identity__inputs__top").val()&&""==e("#form--product-identity__inputs__bottom").val())e(".main").find(".component--branding__vertical-bar").css("display","none"),e(".main").find(".text--product-identity__top").text(""),e(".main").find(".text--product-identity__bottom").text("");else{if(e(".main").find(".component--branding__vertical-bar").css("display","inline-block"),"form--product-identity__inputs__top"==o.name)return e(".main").find(".text--product-identity__top").text(o.value),n(t,{productIDTop:o.value});if("form--product-identity__inputs__bottom"==o.name)return e(".main").find(".text--product-identity__bottom").text(o.value),n(t,{productIDBottom:o.value})}}function i(t){e(".block--palette."+t).find(".block--palette__color").each(function(t){if(4!=t){var n=(i=(i=e(this).css("background-color")).match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i))&&4===i.length?"#"+("0"+parseInt(i[1],10).toString(16)).slice(-2)+("0"+parseInt(i[2],10).toString(16)).slice(-2)+("0"+parseInt(i[3],10).toString(16)).slice(-2):"",o=".indicator-color--"+(t+1);e(o).find(".global--color-indicator__color").css("background",n),e(o).find(".global--color-indicator__hex").text(n.toUpperCase())}var i})}var a=function(e){var t={},n=document.createElement("a");n.href=e;for(var o=n.search.substring(1).split("&"),i=0;i0&&void 0!==arguments[0]?arguments[0]:document;if(document.querySelectorAll(".component--modal").length)for(var e='button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])',t=document.getElementsByClassName("component--modal"),n=function(){var n=t[o].querySelectorAll(e)[0],i=t[o].querySelectorAll(e),a=i[i.length-1];document.addEventListener("keydown",function(e){("Tab"===e.key||9===e.keyCode)&&(e.shiftKey?document.activeElement===n&&(a.focus(),e.preventDefault()):document.activeElement===a&&(n.focus(),e.preventDefault()))}),n.focus()},o=0;o0&&void 0!==arguments[0]?arguments[0]:document;if(document.querySelectorAll(".materialboxed").length){var e=document.querySelectorAll(".materialboxed");M.Materialbox.init(e)}}"undefined"!=typeof Drupal?function(e,n){n.behaviors.initComponentMedia={attach:function(n){e("body",n).once("nds-component-media").each(function(){t(n)})}}}(jQuery,Drupal):e(document).ready(function(){t()})}(jQuery),function(e){function t(){document.querySelectorAll("#uswds-banner-toggle").length>0&&document.querySelector("#uswds-banner-toggle").addEventListener("click",function(e){"true"==document.getElementById("uswds-banner-toggle").getAttribute("aria-expanded")?(document.getElementById("uswds-banner-toggle").setAttribute("aria-expanded","false"),document.getElementById("uswds-banner-content").style.display="none"):(document.getElementById("uswds-banner-toggle").setAttribute("aria-expanded","true"),document.getElementById("uswds-banner-content").style.display="block")})}"undefined"!=typeof Drupal?function(e,n){n.behaviors.initComponentUSWDSBanner={attach:function(n){e("body",n).once("nds-component-uswds-banner").each(function(){t()})}}}(jQuery,Drupal):e(document).ready(function(){t()})}(jQuery),function(e){function t(){arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;if(document.querySelectorAll(".parallax").length){var e=document.querySelectorAll(".parallax");M.Parallax.init(e)}}"undefined"!=typeof Drupal?function(e,n){n.behaviors.initBlockHero={attach:function(n){e("body",n).once("nds-block-hero").each(function(){t(n)})}}}(jQuery,Drupal):e(document).ready(function(){t()})}(jQuery),function(e){function t(){arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;if(document.querySelectorAll(".navigation--drawer").length>0){var e=windowWidth();document.querySelector("#global-mobile-menu").addEventListener("click",function(e){document.querySelector("#main-navigation-mobile").classList.add("drawer--open"),getNextSibling(document.querySelector("#main-navigation-mobile"),".navigation--drawer--overlay").style.display="block",document.querySelector(".navigation--drawer__top__button-close").focus();for(var t=document.querySelector("#main-navigation-mobile").querySelectorAll("button, a"),n=0;n0&&void 0!==arguments[0]?arguments[0]:document;e(".navigation--dropdown.hover").on("mouseover",function(){n(e(this))}),e(".navigation--dropdown.hover").on("mouseout",function(){o(e(this))}),e(".navigation--dropdown").on("focusin",function(t){n(e(this))}),e(".navigation--dropdown").on("focusout",function(t){this.contains(t.relatedTarget)||o(e(this))})}function n(e){e.addClass("is-open"),e.find(".navigation--dropdown__toggle").attr("aria-expanded","true")}function o(e){e.removeClass("is-open"),e.find(".navigation--dropdown__toggle").attr("aria-expanded","false")}"undefined"!=typeof Drupal?function(e,n){n.behaviors.initNavigationDropdown={attach:function(n){e("body",n).once("nds-navigation-dropdown").each(function(){t(n)})}}}(jQuery,Drupal):e(document).ready(function(){t()})}(jQuery),function(e){function t(){arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;for(var e=document.querySelectorAll(".navigation--tabs__tab"),t=0;t0&&void 0!==arguments[0]?arguments[0]:document;for(var e=document.querySelectorAll(".input--radio, .input--checkbox"),t=0;t0&&void 0!==arguments[0]?arguments[0]:document;e(".input--date-picker").each(function(){"true"==e(this).find("input").attr("nds-date-picker")&&e(this).find("input").datepicker()})}"undefined"!=typeof Drupal?function(e,n){n.behaviors.initInputDatePicker={attach:function(n){e("body",n).once("nds-input-date-picker").each(function(){t(n)})}}}(jQuery,Drupal):e(document).ready(function(){t()})}(jQuery),function(e){function t(){arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;e('[data-toggle="tooltip"]').tooltip(),e("select").each(function(){"true"==e(this).attr("nds-select")&&(e(this).select2({minimumResultsForSearch:10}),""!=e(this).val()&&e(this).siblings(".select2-container").addClass("no-clear selection-made"))}),e("select").change(function(t,n){"true"==e(this).attr("nds-select")&&(t.target.multiple?e(this).find("option:selected").length>0?e(this).siblings(".select2-container").addClass("selection-made-multi"):e(this).siblings(".select2-container").removeClass("selection-made-multi"):(e(this).siblings(".select2-container").addClass("selection-made"),e(this).siblings(".select2-container").find(".single-clear").length||"true"==e(this).attr("data-select-all-times")||e(this).siblings(".select2-container").append('')))}),e("select").on("select2:open",function(t){e(".select2-container").find(".select2-search__field").attr("aria-label","Search for choices"),e(".select2-container").find(".select2-results__options").attr("aria-label","Available choices")}),e(".select2-selection--single").find(".select2-selection__rendered").attr("aria-label","Click to select option."),e(".select2-selection--multiple").attr("aria-label","Click to select option(s)."),e(document).on("click",".single-clear",function(t){t.stopPropagation();var n=e(this).parent().siblings("select");n.prop("selectedIndex",0);var o=n.attr("data-placeholder");e(this).parent().removeClass("selection-made"),e(this).siblings(".selection").find(".select2-selection__rendered").text(o),e(this).remove()})}"undefined"!=typeof Drupal?function(e,n){n.behaviors.initInputSelect={attach:function(n){e("body",n).once("nds-input-select").each(function(){t(n)})}}}(jQuery,Drupal):e(document).ready(function(){t()})}(jQuery),function(e){function t(){arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;for(var e=document.querySelectorAll("a"),t=0;t-1||n.indexOf("https://")>-1)&&n.indexOf("localhost:3002")<=0){e[t].setAttribute("target","_blank");var i=document.createElement("a");i.setAttribute("href",n),i.setAttribute("class","ext-link-icon"),i.setAttribute("aria-label","External Link"),e[t].insertAdjacentElement("afterend",i)}}}function n(){arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;for(var e=document.querySelectorAll('a[href^="mailto:"]'),t=0;t0&&void 0!==arguments[0]?arguments[0]:document;e("table").each(function(){if("true"==e(this).attr("nds-datatable")){var t={responsive:!0,paging:!1,info:!1,autoWidth:!1,searching:!1};if("true"!=e(this).attr("data-tablesort"))t.ordering=!1;else{var n=[];e(this).find("thead").find("th").each(function(t){"true"==e(this).attr("data-column-num")&&n.push({type:"natural",targets:t})}),t.columnDefs=n}e(this).dataTable(t)}})}"undefined"!=typeof Drupal?function(e,n){n.behaviors.initTableDefault={attach:function(n){e("body",n).once("nds-table-default").each(function(){t(n)})}}}(jQuery,Drupal):e(document).ready(function(){t()})}(jQuery); \ No newline at end of file diff --git a/nds-documentation-site/public_html/js/global/nds.js b/nds-documentation-site/public_html/js/global/nds.js index 4aa4108b..72dd5efb 100644 --- a/nds-documentation-site/public_html/js/global/nds.js +++ b/nds-documentation-site/public_html/js/global/nds.js @@ -45,52 +45,7 @@ function windowWidth() { function hasClass(element, className) { return (' ' + element.className + ' ').indexOf(' ' + className + ' ') > -1; -} - -$(document).ready(function () { - var mql = window.matchMedia('all and (min-width: 992px)'); - var wWidth = $(window).width(); - $('.fixed-left').each(function () { - if (mql.matches) { - stickybits($(this).find('.navigation--mobile-rail')); - } - }); - $(window).on('resize', function () { - if (wWidth != $(this).width()) { - wWidth = $(this).width(); - $('.fixed-left').each(function () { - if (mql.matches) { - stickybits($(this).find('.navigation--mobile-rail')); - } else { - stickybits($(this).find('.navigation--mobile-rail')).cleanup(); - $(this).find('.navigation--mobile-rail').css('position', 'relative'); - } - }); - } - }); -}); - -(function ($) { - function init_layouts_tabs(context) { - $('#tab--mockup').attr('tabindex', '-1'); - } - - if (typeof Drupal !== 'undefined') { - // Define Drupal behavior. - (function ($, Drupal) { - Drupal.behaviors.layoutsTabs = { - attach: function attach(context) { - init_layouts_tabs(context); - } - }; - })(jQuery, Drupal); - } else { - // If Drupal isn't loaded, add JS for Pattern Lab. - $(document).ready(function () { - init_layouts_tabs(); - }); - } -})(jQuery); // Part of NDS Lite +} // Part of NDS Lite (function ($) { @@ -550,6 +505,51 @@ $(document).ready(function () { } })(jQuery); +(function ($) { + function init_layouts_tabs(context) { + $('#tab--mockup').attr('tabindex', '-1'); + } + + if (typeof Drupal !== 'undefined') { + // Define Drupal behavior. + (function ($, Drupal) { + Drupal.behaviors.layoutsTabs = { + attach: function attach(context) { + init_layouts_tabs(context); + } + }; + })(jQuery, Drupal); + } else { + // If Drupal isn't loaded, add JS for Pattern Lab. + $(document).ready(function () { + init_layouts_tabs(); + }); + } +})(jQuery); + +$(document).ready(function () { + var mql = window.matchMedia('all and (min-width: 992px)'); + var wWidth = $(window).width(); + $('.fixed-left').each(function () { + if (mql.matches) { + stickybits($(this).find('.navigation--mobile-rail')); + } + }); + $(window).on('resize', function () { + if (wWidth != $(this).width()) { + wWidth = $(this).width(); + $('.fixed-left').each(function () { + if (mql.matches) { + stickybits($(this).find('.navigation--mobile-rail')); + } else { + stickybits($(this).find('.navigation--mobile-rail')).cleanup(); + $(this).find('.navigation--mobile-rail').css('position', 'relative'); + } + }); + } + }); +}); + (function ($) { function init_build_controls(context) { var mql = window.matchMedia('all and (max-width: 991px)'); @@ -1062,31 +1062,55 @@ $(document).ready(function () { } }); } -})(jQuery); // Part of NDS Lite - +})(jQuery); (function ($) { - // initInputNDS - Functionality to support keyboard accessibility on radio and checkbox inputs. - function initInputNDS() { + function initComponentModal() { var context = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document; - var inputElements = document.querySelectorAll('.input--radio, .input--checkbox'); - for (var i = 0; i < inputElements.length; i++) { - inputElements[i].addEventListener('keydown', function (e) { - if (e.code === "Enter" || e.keyCode === "13" || e.code === "Space" || e.keyCode === "23") { - e.target.querySelector('input').click(); - } - }); + if (document.querySelectorAll('.component--modal').length) { + var focusableElements = 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'; + var modalsList = document.getElementsByClassName("component--modal"); + + var _loop = function _loop() { + var firstFocusableElement = modalsList[i].querySelectorAll(focusableElements)[0]; + var focusableContent = modalsList[i].querySelectorAll(focusableElements); + var lastFocusableElement = focusableContent[focusableContent.length - 1]; + document.addEventListener('keydown', function (e) { + var isTabPressed = e.key === 'Tab' || e.keyCode === 9; + + if (!isTabPressed) { + return; + } + + if (e.shiftKey) { + if (document.activeElement === firstFocusableElement) { + lastFocusableElement.focus(); + e.preventDefault(); + } + } else { + if (document.activeElement === lastFocusableElement) { + firstFocusableElement.focus(); + e.preventDefault(); + } + } + }); + firstFocusableElement.focus(); + }; + + for (var i = 0; i < modalsList.length; i++) { + _loop(); + } } } if (typeof Drupal !== 'undefined') { // Define Drupal behavior. (function ($, Drupal) { - Drupal.behaviors.initInputNDS = { + Drupal.behaviors.initComponentModal = { attach: function attach(context) { - $("body", context).once('nds-input').each(function () { - initInputNDS(context); + $("body", context).once('nds-component-modal').each(function () { + initComponentModal(context); }); } }; @@ -1094,31 +1118,28 @@ $(document).ready(function () { } else { // If Drupal isn't loaded, add JS for Pattern Lab. $(document).ready(function () { - initInputNDS(); + initComponentModal(); }); } -})(jQuery); // Dependencies -// - Bootstrap Datepicker -// - jQuery - +})(jQuery); (function ($) { - function initInputDatePicker() { + function initComponentMedia() { var context = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document; - $('.input--date-picker').each(function () { - if ($(this).find('input').attr('nds-date-picker') == 'true') { - $(this).find('input').datepicker(); - } - }); + + if (document.querySelectorAll('.materialboxed').length) { + var elems = document.querySelectorAll('.materialboxed'); + var instances = M.Materialbox.init(elems); + } } if (typeof Drupal !== 'undefined') { // Define Drupal behavior. (function ($, Drupal) { - Drupal.behaviors.initInputDatePicker = { + Drupal.behaviors.initComponentMedia = { attach: function attach(context) { - $('body', context).once('nds-input-date-picker').each(function () { - initInputDatePicker(context); + $("body", context).once('nds-component-media').each(function () { + initComponentMedia(context); }); } }; @@ -1126,69 +1147,35 @@ $(document).ready(function () { } else { // If Drupal isn't loaded, add JS for Pattern Lab. $(document).ready(function () { - initInputDatePicker(); + initComponentMedia(); }); } -})(jQuery); // Dependencies -// - Select2 -// - jQuery +})(jQuery); // Part of NDS Lite (function ($) { - function initInputSelect() { - var context = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document; - $('[data-toggle="tooltip"]').tooltip(); - $('select').each(function () { - if ($(this).attr('nds-select') == 'true') { - $(this).select2({ - minimumResultsForSearch: 10 - }); - - if ($(this).val() != "") { - $(this).siblings('.select2-container').addClass('no-clear selection-made'); - } - } - }); - $('select').change(function (e, p) { - if ($(this).attr('nds-select') == 'true') { - if (!e.target.multiple) { - $(this).siblings('.select2-container').addClass('selection-made'); - - if (!$(this).siblings('.select2-container').find('.single-clear').length && $(this).attr('data-select-all-times') != "true") { - $(this).siblings('.select2-container').append(''); - } + // initComponentUSWDSBanner - Toggles the USWDS Banner Component open and closed. + function initComponentUSWDSBanner() { + if (document.querySelectorAll('#uswds-banner-toggle').length > 0) { + document.querySelector('#uswds-banner-toggle').addEventListener("click", function (e) { + if (document.getElementById("uswds-banner-toggle").getAttribute('aria-expanded') == 'true') { + document.getElementById("uswds-banner-toggle").setAttribute('aria-expanded', 'false'); + document.getElementById("uswds-banner-content").style.display = 'none'; } else { - $(this).find('option:selected').length > 0 ? $(this).siblings('.select2-container').addClass('selection-made-multi') : $(this).siblings('.select2-container').removeClass('selection-made-multi'); + document.getElementById("uswds-banner-toggle").setAttribute('aria-expanded', 'true'); + document.getElementById("uswds-banner-content").style.display = 'block'; } - } - }); // Listener to Add Accessibility Compliance to Open Modals - - $('select').on('select2:open', function (e) { - $('.select2-container').find('.select2-search__field').attr('aria-label', 'Search for choices'); - $('.select2-container').find('.select2-results__options').attr('aria-label', 'Available choices'); - }); // Add Accessibility Compliane to Loaded Select Field - - $('.select2-selection--single').find('.select2-selection__rendered').attr('aria-label', 'Click to select option.'); - $('.select2-selection--multiple').attr('aria-label', 'Click to select option(s).'); // Remove selection on click of "X" - - $(document).on('click', '.single-clear', function (e) { - e.stopPropagation(); - var $selectField = $(this).parent().siblings('select'); - $selectField.prop('selectedIndex', 0); - var placeholder = $selectField.attr("data-placeholder"); - $(this).parent().removeClass('selection-made'); - $(this).siblings('.selection').find('.select2-selection__rendered').text(placeholder); - $(this).remove(); - }); + }); + } } if (typeof Drupal !== 'undefined') { // Define Drupal behavior. (function ($, Drupal) { - Drupal.behaviors.initInputSelect = { + Drupal.behaviors.initComponentUSWDSBanner = { attach: function attach(context) { - $('body', context).once('nds-input-select').each(function () { - initInputSelect(context); + $("body", context).once('nds-component-uswds-banner').each(function () { + initComponentUSWDSBanner(context); }); } }; @@ -1196,57 +1183,28 @@ $(document).ready(function () { } else { // If Drupal isn't loaded, add JS for Pattern Lab. $(document).ready(function () { - initInputSelect(); + initComponentUSWDSBanner(); }); } -})(jQuery); // Part of NDS Lite - +})(jQuery); (function ($) { - // initLinkExternal - Adds external link icons to links that qualify as external. - function initLinkExternal() { + function initBlockHero() { var context = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document; - var externalLinks = document.querySelectorAll('a'); - - for (var i = 0; i < externalLinks.length; i++) { - if (externalLinks[i].innerHTML != "") { - var url = externalLinks[i].getAttribute('href'); - var hostname = externalLinks[i].hostname; - if (url && hostname !== location.hostname) { - url = url.toLowerCase(); - - if ((url.indexOf('http://') > -1 || url.indexOf('https://') > -1) && url.indexOf('localhost:3002') <= 0) { - externalLinks[i].setAttribute('target', '_blank'); - var linkIcon = document.createElement('a'); - linkIcon.setAttribute('href', url); - linkIcon.setAttribute('class', "ext-link-icon"); - linkIcon.setAttribute('aria-label', "External Link"); - externalLinks[i].insertAdjacentElement('afterend', linkIcon); - } - } - } - } - } // initLinkExternalMailto - Adds envelope icons to mailto links. - - - function initLinkExternalMailto() { - var context = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document; - var mailtoLinks = document.querySelectorAll('a[href^="mailto:"]'); - - for (var i = 0; i < mailtoLinks.length; i++) { - mailtoLinks[i].classList.add('link--external--mail'); - } - } + if (document.querySelectorAll('.parallax').length) { + var elems = document.querySelectorAll('.parallax'); + var instances = M.Parallax.init(elems); + } + } if (typeof Drupal !== 'undefined') { // Define Drupal behavior. (function ($, Drupal) { - Drupal.behaviors.initLinks = { + Drupal.behaviors.initBlockHero = { attach: function attach(context) { - $("body", context).once('nds-links').each(function () { - initLinkExternal(context); - initLinkExternalMailto(context); + $('body', context).once('nds-block-hero').each(function () { + initBlockHero(context); }); } }; @@ -1254,61 +1212,80 @@ $(document).ready(function () { } else { // If Drupal isn't loaded, add JS for Pattern Lab. $(document).ready(function () { - initLinkExternal(); - initLinkExternalMailto(); + initBlockHero(); }); } -})(jQuery); // Dependencies -// - DataTables -// - jQuery +})(jQuery); // Part of NDS Lite (function ($) { - function initTableDefault() { + // initNavigationDrawer - Functionality to support the NDS mobile drawer. + function initNavigationDrawer() { var context = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document; - /* KEY - Sorting: Add data-tablesort="true" to the tag. - Numeric Sort Support for a Column: Add data-column-num="true" to the
tag of the appropriate column. - */ - $("table").each(function () { - if ($(this).attr('nds-datatable') == 'true') { - var defaultConfigs = { - "responsive": true, - "paging": false, - "info": false, - "autoWidth": false, - "searching": false - }; + if (document.querySelectorAll('.navigation--drawer').length > 0) { + var wWidth = windowWidth(); + document.querySelector('#global-mobile-menu').addEventListener("click", function (e) { + document.querySelector('#main-navigation-mobile').classList.add("drawer--open"); + var overlay = getNextSibling(document.querySelector('#main-navigation-mobile'), '.navigation--drawer--overlay'); + overlay.style.display = 'block'; + document.querySelector('.navigation--drawer__top__button-close').focus(); + var tabElements = document.querySelector('#main-navigation-mobile').querySelectorAll('button, a'); - if (!($(this).attr('data-tablesort') == "true")) { - defaultConfigs['ordering'] = false; + for (var i = 0; i < tabElements.length; i++) { + tabElements[i].setAttribute('tabindex', '0'); + } + }); + document.querySelector('.navigation--drawer--overlay').addEventListener("click", function (e) { + closeMenu(); + }); + document.querySelector('.navigation--drawer__top__button-close').addEventListener("click", function (e) { + closeMenu(); + }); + + window.onresize = function (e) { + if (wWidth != windowWidth()) { + wWidth = windowWidth(); + closeMenu(); + } + }; // 508 Compliance Focus Helpers + + + document.querySelector('.skip-to--top').addEventListener("focus", function (e) { + document.querySelector('.navigation--drawer__top__button-close').focus(); + }); + document.querySelector('.skip-to--back').addEventListener("focus", function (e) { + var tabElements = document.querySelector('.navigation--drawer__inner').querySelectorAll('button, a'); + + if (hasClass(tabElements[tabElements.length - 1], "ext-link-icon")) { + tabElements[tabElements.length - 2].focus(); } else { - // Determine Column Type - var columns = []; - $(this).find('thead').find('th').each(function (i) { - if ($(this).attr('data-column-num') == "true") { - columns.push({ - "type": "natural", - "targets": i - }); - } - }); - defaultConfigs['columnDefs'] = columns; + tabElements[tabElements.length - 1].focus(); } + }); + } + } // closeMenu - Helper function to close the mobile drawer. - $(this).dataTable(defaultConfigs); - } - }); + + function closeMenu() { + document.querySelector('#global-mobile-menu').focus(); + document.querySelector('#main-navigation-mobile').classList.remove("drawer--open"); + var overlay = getNextSibling(document.querySelector('#main-navigation-mobile'), '.navigation--drawer--overlay'); + overlay.style.display = 'none'; + var tabElements = document.querySelector('#main-navigation-mobile').querySelectorAll('button, a'); + + for (var i = 0; i < tabElements.length; i++) { + tabElements[i].setAttribute('tabindex', '-1'); + } } if (typeof Drupal !== 'undefined') { // Define Drupal behavior. (function ($, Drupal) { - Drupal.behaviors.initTableDefault = { + Drupal.behaviors.initNavigationDrawer = { attach: function attach(context) { - $("body", context).once('nds-table-default').each(function () { - initTableDefault(context); + $("body", context).once('nds-navigation-drawer').each(function () { + initNavigationDrawer(context); }); } }; @@ -1316,28 +1293,49 @@ $(document).ready(function () { } else { // If Drupal isn't loaded, add JS for Pattern Lab. $(document).ready(function () { - initTableDefault(); + initNavigationDrawer(); }); } })(jQuery); (function ($) { - function initBlockHero() { + function initNavigationDropdown() { var context = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document; + $(".navigation--dropdown.hover").on('mouseover', function () { + openDropdown($(this)); + }); + $(".navigation--dropdown.hover").on('mouseout', function () { + closeDropdown($(this)); + }); + $(".navigation--dropdown").on('focusin', function (e) { + openDropdown($(this)); + }); + $(".navigation--dropdown").on('focusout', function (e) { + if (this.contains(e.relatedTarget)) { + return; + } - if (document.querySelectorAll('.parallax').length) { - var elems = document.querySelectorAll('.parallax'); - var instances = M.Parallax.init(elems); - } + closeDropdown($(this)); + }); + } + + function openDropdown($el) { + $el.addClass('is-open'); + $el.find('.navigation--dropdown__toggle').attr('aria-expanded', 'true'); + } + + function closeDropdown($el) { + $el.removeClass('is-open'); + $el.find('.navigation--dropdown__toggle').attr('aria-expanded', 'false'); } if (typeof Drupal !== 'undefined') { // Define Drupal behavior. (function ($, Drupal) { - Drupal.behaviors.initBlockHero = { + Drupal.behaviors.initNavigationDropdown = { attach: function attach(context) { - $('body', context).once('nds-block-hero').each(function () { - initBlockHero(context); + $("body", context).once('nds-navigation-dropdown').each(function () { + initNavigationDropdown(context); }); } }; @@ -1345,28 +1343,42 @@ $(document).ready(function () { } else { // If Drupal isn't loaded, add JS for Pattern Lab. $(document).ready(function () { - initBlockHero(); + initNavigationDropdown(); }); } })(jQuery); (function ($) { - function initComponentMedia() { + function initNavigationTabs() { var context = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document; + var tabs = document.querySelectorAll('.navigation--tabs__tab'); - if (document.querySelectorAll('.materialboxed').length) { - var elems = document.querySelectorAll('.materialboxed'); - var instances = M.Materialbox.init(elems); + for (var i = 0; i < tabs.length; i++) { + tabs[i].addEventListener('click', function () { + var activeClass = 'active'; + var tabParent = this.closest('.navigation--tabs'); + var relatedTabs = tabParent.querySelectorAll('.navigation--tabs__tab'); + + if (!hasClass(this, activeClass)) { + for (var j = 0; j < relatedTabs.length; j++) { + if (hasClass(relatedTabs[j], activeClass)) { + relatedTabs[j].classList.remove(activeClass); + } + } + + this.classList.add(activeClass); + } + }); } } if (typeof Drupal !== 'undefined') { // Define Drupal behavior. (function ($, Drupal) { - Drupal.behaviors.initComponentMedia = { + Drupal.behaviors.initNavigationTabs = { attach: function attach(context) { - $("body", context).once('nds-component-media').each(function () { - initComponentMedia(context); + $("body", context).once('nds-navigation-tabs').each(function () { + initNavigationTabs(context); }); } }; @@ -1374,58 +1386,34 @@ $(document).ready(function () { } else { // If Drupal isn't loaded, add JS for Pattern Lab. $(document).ready(function () { - initComponentMedia(); + initNavigationTabs(); }); } -})(jQuery); +})(jQuery); // Part of NDS Lite + (function ($) { - function initComponentModal() { + // initInputNDS - Functionality to support keyboard accessibility on radio and checkbox inputs. + function initInputNDS() { var context = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document; + var inputElements = document.querySelectorAll('.input--radio, .input--checkbox'); - if (document.querySelectorAll('.component--modal').length) { - var focusableElements = 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'; - var modalsList = document.getElementsByClassName("component--modal"); - - var _loop = function _loop() { - var firstFocusableElement = modalsList[i].querySelectorAll(focusableElements)[0]; - var focusableContent = modalsList[i].querySelectorAll(focusableElements); - var lastFocusableElement = focusableContent[focusableContent.length - 1]; - document.addEventListener('keydown', function (e) { - var isTabPressed = e.key === 'Tab' || e.keyCode === 9; - - if (!isTabPressed) { - return; - } - - if (e.shiftKey) { - if (document.activeElement === firstFocusableElement) { - lastFocusableElement.focus(); - e.preventDefault(); - } - } else { - if (document.activeElement === lastFocusableElement) { - firstFocusableElement.focus(); - e.preventDefault(); - } - } - }); - firstFocusableElement.focus(); - }; - - for (var i = 0; i < modalsList.length; i++) { - _loop(); - } + for (var i = 0; i < inputElements.length; i++) { + inputElements[i].addEventListener('keydown', function (e) { + if (e.code === "Enter" || e.keyCode === "13" || e.code === "Space" || e.keyCode === "23") { + e.target.querySelector('input').click(); + } + }); } } if (typeof Drupal !== 'undefined') { // Define Drupal behavior. (function ($, Drupal) { - Drupal.behaviors.initComponentModal = { + Drupal.behaviors.initInputNDS = { attach: function attach(context) { - $("body", context).once('nds-component-modal').each(function () { - initComponentModal(context); + $("body", context).once('nds-input').each(function () { + initInputNDS(context); }); } }; @@ -1433,35 +1421,31 @@ $(document).ready(function () { } else { // If Drupal isn't loaded, add JS for Pattern Lab. $(document).ready(function () { - initComponentModal(); + initInputNDS(); }); } -})(jQuery); // Part of NDS Lite +})(jQuery); // Dependencies +// - Bootstrap Datepicker +// - jQuery (function ($) { - // initComponentUSWDSBanner - Toggles the USWDS Banner Component open and closed. - function initComponentUSWDSBanner() { - if (document.querySelectorAll('#uswds-banner-toggle').length > 0) { - document.querySelector('#uswds-banner-toggle').addEventListener("click", function (e) { - if (document.getElementById("uswds-banner-toggle").getAttribute('aria-expanded') == 'true') { - document.getElementById("uswds-banner-toggle").setAttribute('aria-expanded', 'false'); - document.getElementById("uswds-banner-content").style.display = 'none'; - } else { - document.getElementById("uswds-banner-toggle").setAttribute('aria-expanded', 'true'); - document.getElementById("uswds-banner-content").style.display = 'block'; - } - }); - } + function initInputDatePicker() { + var context = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document; + $('.input--date-picker').each(function () { + if ($(this).find('input').attr('nds-date-picker') == 'true') { + $(this).find('input').datepicker(); + } + }); } if (typeof Drupal !== 'undefined') { // Define Drupal behavior. (function ($, Drupal) { - Drupal.behaviors.initComponentUSWDSBanner = { + Drupal.behaviors.initInputDatePicker = { attach: function attach(context) { - $("body", context).once('nds-component-uswds-banner').each(function () { - initComponentUSWDSBanner(context); + $('body', context).once('nds-input-date-picker').each(function () { + initInputDatePicker(context); }); } }; @@ -1469,49 +1453,69 @@ $(document).ready(function () { } else { // If Drupal isn't loaded, add JS for Pattern Lab. $(document).ready(function () { - initComponentUSWDSBanner(); + initInputDatePicker(); }); } -})(jQuery); +})(jQuery); // Dependencies +// - Select2 +// - jQuery + (function ($) { - function initNavigationDropdown() { + function initInputSelect() { var context = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document; - $(".navigation--dropdown.hover").on('mouseover', function () { - openDropdown($(this)); - }); - $(".navigation--dropdown.hover").on('mouseout', function () { - closeDropdown($(this)); - }); - $(".navigation--dropdown").on('focusin', function (e) { - openDropdown($(this)); + $('[data-toggle="tooltip"]').tooltip(); + $('select').each(function () { + if ($(this).attr('nds-select') == 'true') { + $(this).select2({ + minimumResultsForSearch: 10 + }); + + if ($(this).val() != "") { + $(this).siblings('.select2-container').addClass('no-clear selection-made'); + } + } }); - $(".navigation--dropdown").on('focusout', function (e) { - if (this.contains(e.relatedTarget)) { - return; + $('select').change(function (e, p) { + if ($(this).attr('nds-select') == 'true') { + if (!e.target.multiple) { + $(this).siblings('.select2-container').addClass('selection-made'); + + if (!$(this).siblings('.select2-container').find('.single-clear').length && $(this).attr('data-select-all-times') != "true") { + $(this).siblings('.select2-container').append(''); + } + } else { + $(this).find('option:selected').length > 0 ? $(this).siblings('.select2-container').addClass('selection-made-multi') : $(this).siblings('.select2-container').removeClass('selection-made-multi'); + } } + }); // Listener to Add Accessibility Compliance to Open Modals - closeDropdown($(this)); - }); - } + $('select').on('select2:open', function (e) { + $('.select2-container').find('.select2-search__field').attr('aria-label', 'Search for choices'); + $('.select2-container').find('.select2-results__options').attr('aria-label', 'Available choices'); + }); // Add Accessibility Compliane to Loaded Select Field - function openDropdown($el) { - $el.addClass('is-open'); - $el.find('.navigation--dropdown__toggle').attr('aria-expanded', 'true'); - } + $('.select2-selection--single').find('.select2-selection__rendered').attr('aria-label', 'Click to select option.'); + $('.select2-selection--multiple').attr('aria-label', 'Click to select option(s).'); // Remove selection on click of "X" - function closeDropdown($el) { - $el.removeClass('is-open'); - $el.find('.navigation--dropdown__toggle').attr('aria-expanded', 'false'); + $(document).on('click', '.single-clear', function (e) { + e.stopPropagation(); + var $selectField = $(this).parent().siblings('select'); + $selectField.prop('selectedIndex', 0); + var placeholder = $selectField.attr("data-placeholder"); + $(this).parent().removeClass('selection-made'); + $(this).siblings('.selection').find('.select2-selection__rendered').text(placeholder); + $(this).remove(); + }); } if (typeof Drupal !== 'undefined') { // Define Drupal behavior. (function ($, Drupal) { - Drupal.behaviors.initNavigationDropdown = { + Drupal.behaviors.initInputSelect = { attach: function attach(context) { - $("body", context).once('nds-navigation-dropdown').each(function () { - initNavigationDropdown(context); + $('body', context).once('nds-input-select').each(function () { + initInputSelect(context); }); } }; @@ -1519,80 +1523,57 @@ $(document).ready(function () { } else { // If Drupal isn't loaded, add JS for Pattern Lab. $(document).ready(function () { - initNavigationDropdown(); + initInputSelect(); }); } })(jQuery); // Part of NDS Lite (function ($) { - // initNavigationDrawer - Functionality to support the NDS mobile drawer. - function initNavigationDrawer() { + // initLinkExternal - Adds external link icons to links that qualify as external. + function initLinkExternal() { var context = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document; + var externalLinks = document.querySelectorAll('a'); - if (document.querySelectorAll('.navigation--drawer').length > 0) { - var wWidth = windowWidth(); - document.querySelector('#global-mobile-menu').addEventListener("click", function (e) { - document.querySelector('#main-navigation-mobile').classList.add("drawer--open"); - var overlay = getNextSibling(document.querySelector('#main-navigation-mobile'), '.navigation--drawer--overlay'); - overlay.style.display = 'block'; - document.querySelector('.navigation--drawer__top__button-close').focus(); - var tabElements = document.querySelector('#main-navigation-mobile').querySelectorAll('button, a'); - - for (var i = 0; i < tabElements.length; i++) { - tabElements[i].setAttribute('tabindex', '0'); - } - }); - document.querySelector('.navigation--drawer--overlay').addEventListener("click", function (e) { - closeMenu(); - }); - document.querySelector('.navigation--drawer__top__button-close').addEventListener("click", function (e) { - closeMenu(); - }); - - window.onresize = function (e) { - if (wWidth != windowWidth()) { - wWidth = windowWidth(); - closeMenu(); - } - }; // 508 Compliance Focus Helpers - + for (var i = 0; i < externalLinks.length; i++) { + if (externalLinks[i].innerHTML != "") { + var url = externalLinks[i].getAttribute('href'); + var hostname = externalLinks[i].hostname; - document.querySelector('.skip-to--top').addEventListener("focus", function (e) { - document.querySelector('.navigation--drawer__top__button-close').focus(); - }); - document.querySelector('.skip-to--back').addEventListener("focus", function (e) { - var tabElements = document.querySelector('.navigation--drawer__inner').querySelectorAll('button, a'); + if (url && hostname !== location.hostname) { + url = url.toLowerCase(); - if (hasClass(tabElements[tabElements.length - 1], "ext-link-icon")) { - tabElements[tabElements.length - 2].focus(); - } else { - tabElements[tabElements.length - 1].focus(); + if ((url.indexOf('http://') > -1 || url.indexOf('https://') > -1) && url.indexOf('localhost:3002') <= 0) { + externalLinks[i].setAttribute('target', '_blank'); + var linkIcon = document.createElement('a'); + linkIcon.setAttribute('href', url); + linkIcon.setAttribute('class', "ext-link-icon"); + linkIcon.setAttribute('aria-label', "External Link"); + externalLinks[i].insertAdjacentElement('afterend', linkIcon); + } } - }); + } } - } // closeMenu - Helper function to close the mobile drawer. + } // initLinkExternalMailto - Adds envelope icons to mailto links. - function closeMenu() { - document.querySelector('#global-mobile-menu').focus(); - document.querySelector('#main-navigation-mobile').classList.remove("drawer--open"); - var overlay = getNextSibling(document.querySelector('#main-navigation-mobile'), '.navigation--drawer--overlay'); - overlay.style.display = 'none'; - var tabElements = document.querySelector('#main-navigation-mobile').querySelectorAll('button, a'); + function initLinkExternalMailto() { + var context = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document; + var mailtoLinks = document.querySelectorAll('a[href^="mailto:"]'); - for (var i = 0; i < tabElements.length; i++) { - tabElements[i].setAttribute('tabindex', '-1'); + for (var i = 0; i < mailtoLinks.length; i++) { + mailtoLinks[i].classList.add('link--external--mail'); } } if (typeof Drupal !== 'undefined') { // Define Drupal behavior. (function ($, Drupal) { - Drupal.behaviors.initNavigationDrawer = { + Drupal.behaviors.initLinks = { attach: function attach(context) { - $("body", context).once('nds-navigation-drawer').each(function () { - initNavigationDrawer(context); + $("body", context).once('nds-links').each(function () { + initLinkExternal(context); + initLinkExternalMailto(context); }); } }; @@ -1600,42 +1581,61 @@ $(document).ready(function () { } else { // If Drupal isn't loaded, add JS for Pattern Lab. $(document).ready(function () { - initNavigationDrawer(); + initLinkExternal(); + initLinkExternalMailto(); }); } -})(jQuery); +})(jQuery); // Dependencies +// - DataTables +// - jQuery + (function ($) { - function initNavigationTabs() { + function initTableDefault() { var context = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document; - var tabs = document.querySelectorAll('.navigation--tabs__tab'); - for (var i = 0; i < tabs.length; i++) { - tabs[i].addEventListener('click', function () { - var activeClass = 'active'; - var tabParent = this.closest('.navigation--tabs'); - var relatedTabs = tabParent.querySelectorAll('.navigation--tabs__tab'); + /* KEY + Sorting: Add data-tablesort="true" to the tag. + Numeric Sort Support for a Column: Add data-column-num="true" to the
tag of the appropriate column. + */ + $("table").each(function () { + if ($(this).attr('nds-datatable') == 'true') { + var defaultConfigs = { + "responsive": true, + "paging": false, + "info": false, + "autoWidth": false, + "searching": false + }; - if (!hasClass(this, activeClass)) { - for (var j = 0; j < relatedTabs.length; j++) { - if (hasClass(relatedTabs[j], activeClass)) { - relatedTabs[j].classList.remove(activeClass); + if (!($(this).attr('data-tablesort') == "true")) { + defaultConfigs['ordering'] = false; + } else { + // Determine Column Type + var columns = []; + $(this).find('thead').find('th').each(function (i) { + if ($(this).attr('data-column-num') == "true") { + columns.push({ + "type": "natural", + "targets": i + }); } - } - - this.classList.add(activeClass); + }); + defaultConfigs['columnDefs'] = columns; } - }); - } + + $(this).dataTable(defaultConfigs); + } + }); } if (typeof Drupal !== 'undefined') { // Define Drupal behavior. (function ($, Drupal) { - Drupal.behaviors.initNavigationTabs = { + Drupal.behaviors.initTableDefault = { attach: function attach(context) { - $("body", context).once('nds-navigation-tabs').each(function () { - initNavigationTabs(context); + $("body", context).once('nds-table-default').each(function () { + initTableDefault(context); }); } }; @@ -1643,7 +1643,7 @@ $(document).ready(function () { } else { // If Drupal isn't loaded, add JS for Pattern Lab. $(document).ready(function () { - initNavigationTabs(); + initTableDefault(); }); } })(jQuery); \ No newline at end of file diff --git a/nds-drupal-theme/nds/source/js/global/nds-min.js b/nds-drupal-theme/nds/source/js/global/nds-min.js index 973dbea2..8823f845 100644 --- a/nds-drupal-theme/nds/source/js/global/nds-min.js +++ b/nds-drupal-theme/nds/source/js/global/nds-min.js @@ -1 +1 @@ -"use strict";!function(e){function t(){arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;for(var e=document.querySelectorAll(".input--radio, .input--checkbox"),t=0;t0&&void 0!==arguments[0]?arguments[0]:document;e(".input--date-picker").each(function(){"true"==e(this).find("input").attr("nds-date-picker")&&e(this).find("input").datepicker()})}"undefined"!=typeof Drupal?function(e,n){n.behaviors.initInputDatePicker={attach:function(n){e("body",n).once("nds-input-date-picker").each(function(){t(n)})}}}(jQuery,Drupal):e(document).ready(function(){t()})}(jQuery),function(e){function t(){arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;e('[data-toggle="tooltip"]').tooltip(),e("select").each(function(){"true"==e(this).attr("nds-select")&&(e(this).select2({minimumResultsForSearch:10}),""!=e(this).val()&&e(this).siblings(".select2-container").addClass("no-clear selection-made"))}),e("select").change(function(t,n){"true"==e(this).attr("nds-select")&&(t.target.multiple?e(this).find("option:selected").length>0?e(this).siblings(".select2-container").addClass("selection-made-multi"):e(this).siblings(".select2-container").removeClass("selection-made-multi"):(e(this).siblings(".select2-container").addClass("selection-made"),e(this).siblings(".select2-container").find(".single-clear").length||"true"==e(this).attr("data-select-all-times")||e(this).siblings(".select2-container").append('')))}),e("select").on("select2:open",function(t){e(".select2-container").find(".select2-search__field").attr("aria-label","Search for choices"),e(".select2-container").find(".select2-results__options").attr("aria-label","Available choices")}),e(".select2-selection--single").find(".select2-selection__rendered").attr("aria-label","Click to select option."),e(".select2-selection--multiple").attr("aria-label","Click to select option(s)."),e(document).on("click",".single-clear",function(t){t.stopPropagation();var n=e(this).parent().siblings("select");n.prop("selectedIndex",0);var o=n.attr("data-placeholder");e(this).parent().removeClass("selection-made"),e(this).siblings(".selection").find(".select2-selection__rendered").text(o),e(this).remove()})}"undefined"!=typeof Drupal?function(e,n){n.behaviors.initInputSelect={attach:function(n){e("body",n).once("nds-input-select").each(function(){t(n)})}}}(jQuery,Drupal):e(document).ready(function(){t()})}(jQuery),function(e){function t(){arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;for(var e=document.querySelectorAll("a"),t=0;t-1||n.indexOf("https://")>-1)&&n.indexOf("localhost:3002")<=0){e[t].setAttribute("target","_blank");var a=document.createElement("a");a.setAttribute("href",n),a.setAttribute("class","ext-link-icon"),a.setAttribute("aria-label","External Link"),e[t].insertAdjacentElement("afterend",a)}}}function n(){arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;for(var e=document.querySelectorAll('a[href^="mailto:"]'),t=0;t0&&void 0!==arguments[0]?arguments[0]:document;e("table").each(function(){if("true"==e(this).attr("nds-datatable")){var t={responsive:!0,paging:!1,info:!1,autoWidth:!1,searching:!1};if("true"!=e(this).attr("data-tablesort"))t.ordering=!1;else{var n=[];e(this).find("thead").find("th").each(function(t){"true"==e(this).attr("data-column-num")&&n.push({type:"natural",targets:t})}),t.columnDefs=n}e(this).dataTable(t)}})}"undefined"!=typeof Drupal?function(e,n){n.behaviors.initTableDefault={attach:function(n){e("body",n).once("nds-table-default").each(function(){t(n)})}}}(jQuery,Drupal):e(document).ready(function(){t()})}(jQuery),function(e){function t(){arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;if(document.querySelectorAll(".materialboxed").length){var e=document.querySelectorAll(".materialboxed");M.Materialbox.init(e)}}"undefined"!=typeof Drupal?function(e,n){n.behaviors.initComponentMedia={attach:function(n){e("body",n).once("nds-component-media").each(function(){t(n)})}}}(jQuery,Drupal):e(document).ready(function(){t()})}(jQuery),function(e){function t(){arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;if(document.querySelectorAll(".component--modal").length)for(var e='button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])',t=document.getElementsByClassName("component--modal"),n=function(){var n=t[o].querySelectorAll(e)[0],a=t[o].querySelectorAll(e),i=a[a.length-1];document.addEventListener("keydown",function(e){("Tab"===e.key||9===e.keyCode)&&(e.shiftKey?document.activeElement===n&&(i.focus(),e.preventDefault()):document.activeElement===i&&(n.focus(),e.preventDefault()))}),n.focus()},o=0;o0&&document.querySelector("#uswds-banner-toggle").addEventListener("click",function(e){"true"==document.getElementById("uswds-banner-toggle").getAttribute("aria-expanded")?(document.getElementById("uswds-banner-toggle").setAttribute("aria-expanded","false"),document.getElementById("uswds-banner-content").style.display="none"):(document.getElementById("uswds-banner-toggle").setAttribute("aria-expanded","true"),document.getElementById("uswds-banner-content").style.display="block")})}"undefined"!=typeof Drupal?function(e,n){n.behaviors.initComponentUSWDSBanner={attach:function(n){e("body",n).once("nds-component-uswds-banner").each(function(){t()})}}}(jQuery,Drupal):e(document).ready(function(){t()})}(jQuery),function(e){function t(){for(var e=document.getElementsByClassName("component--accordion__card"),t=0;t a"),"data-nav","header-nav-"+m+"-")}else o(h,"data-nav","header-nav-")}var g=document.getElementsByClassName("global--footer");for(t=0;t0&&void 0!==e)for(var i=0;i0&&void 0!==arguments[0]?arguments[0]:document;if(document.querySelectorAll(".parallax").length){var e=document.querySelectorAll(".parallax");M.Parallax.init(e)}}"undefined"!=typeof Drupal?function(e,n){n.behaviors.initBlockHero={attach:function(n){e("body",n).once("nds-block-hero").each(function(){t(n)})}}}(jQuery,Drupal):e(document).ready(function(){t()})}(jQuery),function(e){function t(){arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;e(".navigation--dropdown.hover").on("mouseover",function(){n(e(this))}),e(".navigation--dropdown.hover").on("mouseout",function(){o(e(this))}),e(".navigation--dropdown").on("focusin",function(t){n(e(this))}),e(".navigation--dropdown").on("focusout",function(t){this.contains(t.relatedTarget)||o(e(this))})}function n(e){e.addClass("is-open"),e.find(".navigation--dropdown__toggle").attr("aria-expanded","true")}function o(e){e.removeClass("is-open"),e.find(".navigation--dropdown__toggle").attr("aria-expanded","false")}"undefined"!=typeof Drupal?function(e,n){n.behaviors.initNavigationDropdown={attach:function(n){e("body",n).once("nds-navigation-dropdown").each(function(){t(n)})}}}(jQuery,Drupal):e(document).ready(function(){t()})}(jQuery),function(e){function t(){arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;if(document.querySelectorAll(".navigation--drawer").length>0){var e=windowWidth();document.querySelector("#global-mobile-menu").addEventListener("click",function(e){document.querySelector("#main-navigation-mobile").classList.add("drawer--open"),getNextSibling(document.querySelector("#main-navigation-mobile"),".navigation--drawer--overlay").style.display="block",document.querySelector(".navigation--drawer__top__button-close").focus();for(var t=document.querySelector("#main-navigation-mobile").querySelectorAll("button, a"),n=0;n0&&void 0!==arguments[0]?arguments[0]:document;for(var e=document.querySelectorAll(".navigation--tabs__tab"),t=0;t0&&void 0!==arguments[0]?arguments[0]:document;for(var e=document.querySelectorAll(".input--radio, .input--checkbox"),t=0;t0&&void 0!==arguments[0]?arguments[0]:document;e(".input--date-picker").each(function(){"true"==e(this).find("input").attr("nds-date-picker")&&e(this).find("input").datepicker()})}"undefined"!=typeof Drupal?function(e,n){n.behaviors.initInputDatePicker={attach:function(n){e("body",n).once("nds-input-date-picker").each(function(){t(n)})}}}(jQuery,Drupal):e(document).ready(function(){t()})}(jQuery),function(e){function t(){arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;e('[data-toggle="tooltip"]').tooltip(),e("select").each(function(){"true"==e(this).attr("nds-select")&&(e(this).select2({minimumResultsForSearch:10}),""!=e(this).val()&&e(this).siblings(".select2-container").addClass("no-clear selection-made"))}),e("select").change(function(t,n){"true"==e(this).attr("nds-select")&&(t.target.multiple?e(this).find("option:selected").length>0?e(this).siblings(".select2-container").addClass("selection-made-multi"):e(this).siblings(".select2-container").removeClass("selection-made-multi"):(e(this).siblings(".select2-container").addClass("selection-made"),e(this).siblings(".select2-container").find(".single-clear").length||"true"==e(this).attr("data-select-all-times")||e(this).siblings(".select2-container").append('')))}),e("select").on("select2:open",function(t){e(".select2-container").find(".select2-search__field").attr("aria-label","Search for choices"),e(".select2-container").find(".select2-results__options").attr("aria-label","Available choices")}),e(".select2-selection--single").find(".select2-selection__rendered").attr("aria-label","Click to select option."),e(".select2-selection--multiple").attr("aria-label","Click to select option(s)."),e(document).on("click",".single-clear",function(t){t.stopPropagation();var n=e(this).parent().siblings("select");n.prop("selectedIndex",0);var o=n.attr("data-placeholder");e(this).parent().removeClass("selection-made"),e(this).siblings(".selection").find(".select2-selection__rendered").text(o),e(this).remove()})}"undefined"!=typeof Drupal?function(e,n){n.behaviors.initInputSelect={attach:function(n){e("body",n).once("nds-input-select").each(function(){t(n)})}}}(jQuery,Drupal):e(document).ready(function(){t()})}(jQuery),function(e){function t(){arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;for(var e=document.querySelectorAll("a"),t=0;t-1||n.indexOf("https://")>-1)&&n.indexOf("localhost:3002")<=0){e[t].setAttribute("target","_blank");var a=document.createElement("a");a.setAttribute("href",n),a.setAttribute("class","ext-link-icon"),a.setAttribute("aria-label","External Link"),e[t].insertAdjacentElement("afterend",a)}}}function n(){arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;for(var e=document.querySelectorAll('a[href^="mailto:"]'),t=0;t0&&void 0!==arguments[0]?arguments[0]:document;e("table").each(function(){if("true"==e(this).attr("nds-datatable")){var t={responsive:!0,paging:!1,info:!1,autoWidth:!1,searching:!1};if("true"!=e(this).attr("data-tablesort"))t.ordering=!1;else{var n=[];e(this).find("thead").find("th").each(function(t){"true"==e(this).attr("data-column-num")&&n.push({type:"natural",targets:t})}),t.columnDefs=n}e(this).dataTable(t)}})}"undefined"!=typeof Drupal?function(e,n){n.behaviors.initTableDefault={attach:function(n){e("body",n).once("nds-table-default").each(function(){t(n)})}}}(jQuery,Drupal):e(document).ready(function(){t()})}(jQuery),function(e){function t(){for(var e=document.getElementsByClassName("component--accordion__card"),t=0;t a"),"data-nav","header-nav-"+m+"-")}else o(h,"data-nav","header-nav-")}var g=document.getElementsByClassName("global--footer");for(t=0;t0&&void 0!==e)for(var i=0;i0&&void 0!==arguments[0]?arguments[0]:document;if(document.querySelectorAll(".parallax").length){var e=document.querySelectorAll(".parallax");M.Parallax.init(e)}}"undefined"!=typeof Drupal?function(e,n){n.behaviors.initBlockHero={attach:function(n){e("body",n).once("nds-block-hero").each(function(){t(n)})}}}(jQuery,Drupal):e(document).ready(function(){t()})}(jQuery),function(e){function t(){arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;if(document.querySelectorAll(".materialboxed").length){var e=document.querySelectorAll(".materialboxed");M.Materialbox.init(e)}}"undefined"!=typeof Drupal?function(e,n){n.behaviors.initComponentMedia={attach:function(n){e("body",n).once("nds-component-media").each(function(){t(n)})}}}(jQuery,Drupal):e(document).ready(function(){t()})}(jQuery),function(e){function t(){arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;if(document.querySelectorAll(".component--modal").length)for(var e='button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])',t=document.getElementsByClassName("component--modal"),n=function(){var n=t[o].querySelectorAll(e)[0],a=t[o].querySelectorAll(e),i=a[a.length-1];document.addEventListener("keydown",function(e){("Tab"===e.key||9===e.keyCode)&&(e.shiftKey?document.activeElement===n&&(i.focus(),e.preventDefault()):document.activeElement===i&&(n.focus(),e.preventDefault()))}),n.focus()},o=0;o0&&document.querySelector("#uswds-banner-toggle").addEventListener("click",function(e){"true"==document.getElementById("uswds-banner-toggle").getAttribute("aria-expanded")?(document.getElementById("uswds-banner-toggle").setAttribute("aria-expanded","false"),document.getElementById("uswds-banner-content").style.display="none"):(document.getElementById("uswds-banner-toggle").setAttribute("aria-expanded","true"),document.getElementById("uswds-banner-content").style.display="block")})}"undefined"!=typeof Drupal?function(e,n){n.behaviors.initComponentUSWDSBanner={attach:function(n){e("body",n).once("nds-component-uswds-banner").each(function(){t()})}}}(jQuery,Drupal):e(document).ready(function(){t()})}(jQuery),function(e){function t(){arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;if(document.querySelectorAll(".navigation--drawer").length>0){var e=windowWidth();document.querySelector("#global-mobile-menu").addEventListener("click",function(e){document.querySelector("#main-navigation-mobile").classList.add("drawer--open"),getNextSibling(document.querySelector("#main-navigation-mobile"),".navigation--drawer--overlay").style.display="block",document.querySelector(".navigation--drawer__top__button-close").focus();for(var t=document.querySelector("#main-navigation-mobile").querySelectorAll("button, a"),n=0;n0&&void 0!==arguments[0]?arguments[0]:document;e(".navigation--dropdown.hover").on("mouseover",function(){n(e(this))}),e(".navigation--dropdown.hover").on("mouseout",function(){o(e(this))}),e(".navigation--dropdown").on("focusin",function(t){n(e(this))}),e(".navigation--dropdown").on("focusout",function(t){this.contains(t.relatedTarget)||o(e(this))})}function n(e){e.addClass("is-open"),e.find(".navigation--dropdown__toggle").attr("aria-expanded","true")}function o(e){e.removeClass("is-open"),e.find(".navigation--dropdown__toggle").attr("aria-expanded","false")}"undefined"!=typeof Drupal?function(e,n){n.behaviors.initNavigationDropdown={attach:function(n){e("body",n).once("nds-navigation-dropdown").each(function(){t(n)})}}}(jQuery,Drupal):e(document).ready(function(){t()})}(jQuery),function(e){function t(){arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;for(var e=document.querySelectorAll(".navigation--tabs__tab"),t=0;t 0 && arguments[0] !== undefined ? arguments[0] : document; - - if (document.querySelectorAll('.materialboxed').length) { - var elems = document.querySelectorAll('.materialboxed'); - var instances = M.Materialbox.init(elems); - } - } - - if (typeof Drupal !== 'undefined') { - // Define Drupal behavior. - (function ($, Drupal) { - Drupal.behaviors.initComponentMedia = { - attach: function attach(context) { - $("body", context).once('nds-component-media').each(function () { - initComponentMedia(context); - }); - } - }; - })(jQuery, Drupal); - } else { - // If Drupal isn't loaded, add JS for Pattern Lab. - $(document).ready(function () { - initComponentMedia(); - }); - } -})(jQuery); - -(function ($) { - function initComponentModal() { - var context = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document; - - if (document.querySelectorAll('.component--modal').length) { - var focusableElements = 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'; - var modalsList = document.getElementsByClassName("component--modal"); - - var _loop = function _loop() { - var firstFocusableElement = modalsList[i].querySelectorAll(focusableElements)[0]; - var focusableContent = modalsList[i].querySelectorAll(focusableElements); - var lastFocusableElement = focusableContent[focusableContent.length - 1]; - document.addEventListener('keydown', function (e) { - var isTabPressed = e.key === 'Tab' || e.keyCode === 9; - - if (!isTabPressed) { - return; - } - - if (e.shiftKey) { - if (document.activeElement === firstFocusableElement) { - lastFocusableElement.focus(); - e.preventDefault(); - } - } else { - if (document.activeElement === lastFocusableElement) { - firstFocusableElement.focus(); - e.preventDefault(); - } - } - }); - firstFocusableElement.focus(); - }; - - for (var i = 0; i < modalsList.length; i++) { - _loop(); - } - } - } - - if (typeof Drupal !== 'undefined') { - // Define Drupal behavior. - (function ($, Drupal) { - Drupal.behaviors.initComponentModal = { - attach: function attach(context) { - $("body", context).once('nds-component-modal').each(function () { - initComponentModal(context); - }); - } - }; - })(jQuery, Drupal); - } else { - // If Drupal isn't loaded, add JS for Pattern Lab. - $(document).ready(function () { - initComponentModal(); - }); - } -})(jQuery); // Part of NDS Lite - - -(function ($) { - // initComponentUSWDSBanner - Toggles the USWDS Banner Component open and closed. - function initComponentUSWDSBanner() { - if (document.querySelectorAll('#uswds-banner-toggle').length > 0) { - document.querySelector('#uswds-banner-toggle').addEventListener("click", function (e) { - if (document.getElementById("uswds-banner-toggle").getAttribute('aria-expanded') == 'true') { - document.getElementById("uswds-banner-toggle").setAttribute('aria-expanded', 'false'); - document.getElementById("uswds-banner-content").style.display = 'none'; - } else { - document.getElementById("uswds-banner-toggle").setAttribute('aria-expanded', 'true'); - document.getElementById("uswds-banner-content").style.display = 'block'; - } - }); - } - } - - if (typeof Drupal !== 'undefined') { - // Define Drupal behavior. - (function ($, Drupal) { - Drupal.behaviors.initComponentUSWDSBanner = { - attach: function attach(context) { - $("body", context).once('nds-component-uswds-banner').each(function () { - initComponentUSWDSBanner(context); - }); - } - }; - })(jQuery, Drupal); - } else { - // If Drupal isn't loaded, add JS for Pattern Lab. - $(document).ready(function () { - initComponentUSWDSBanner(); - }); - } })(jQuery); // Part of NDS Lite @@ -579,43 +455,117 @@ })(jQuery); (function ($) { - function initNavigationDropdown() { + function initComponentMedia() { var context = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document; - $(".navigation--dropdown.hover").on('mouseover', function () { - openDropdown($(this)); - }); - $(".navigation--dropdown.hover").on('mouseout', function () { - closeDropdown($(this)); - }); - $(".navigation--dropdown").on('focusin', function (e) { - openDropdown($(this)); + + if (document.querySelectorAll('.materialboxed').length) { + var elems = document.querySelectorAll('.materialboxed'); + var instances = M.Materialbox.init(elems); + } + } + + if (typeof Drupal !== 'undefined') { + // Define Drupal behavior. + (function ($, Drupal) { + Drupal.behaviors.initComponentMedia = { + attach: function attach(context) { + $("body", context).once('nds-component-media').each(function () { + initComponentMedia(context); + }); + } + }; + })(jQuery, Drupal); + } else { + // If Drupal isn't loaded, add JS for Pattern Lab. + $(document).ready(function () { + initComponentMedia(); }); - $(".navigation--dropdown").on('focusout', function (e) { - if (this.contains(e.relatedTarget)) { - return; + } +})(jQuery); + +(function ($) { + function initComponentModal() { + var context = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document; + + if (document.querySelectorAll('.component--modal').length) { + var focusableElements = 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'; + var modalsList = document.getElementsByClassName("component--modal"); + + var _loop = function _loop() { + var firstFocusableElement = modalsList[i].querySelectorAll(focusableElements)[0]; + var focusableContent = modalsList[i].querySelectorAll(focusableElements); + var lastFocusableElement = focusableContent[focusableContent.length - 1]; + document.addEventListener('keydown', function (e) { + var isTabPressed = e.key === 'Tab' || e.keyCode === 9; + + if (!isTabPressed) { + return; + } + + if (e.shiftKey) { + if (document.activeElement === firstFocusableElement) { + lastFocusableElement.focus(); + e.preventDefault(); + } + } else { + if (document.activeElement === lastFocusableElement) { + firstFocusableElement.focus(); + e.preventDefault(); + } + } + }); + firstFocusableElement.focus(); + }; + + for (var i = 0; i < modalsList.length; i++) { + _loop(); } + } + } - closeDropdown($(this)); + if (typeof Drupal !== 'undefined') { + // Define Drupal behavior. + (function ($, Drupal) { + Drupal.behaviors.initComponentModal = { + attach: function attach(context) { + $("body", context).once('nds-component-modal').each(function () { + initComponentModal(context); + }); + } + }; + })(jQuery, Drupal); + } else { + // If Drupal isn't loaded, add JS for Pattern Lab. + $(document).ready(function () { + initComponentModal(); }); } +})(jQuery); // Part of NDS Lite - function openDropdown($el) { - $el.addClass('is-open'); - $el.find('.navigation--dropdown__toggle').attr('aria-expanded', 'true'); - } - function closeDropdown($el) { - $el.removeClass('is-open'); - $el.find('.navigation--dropdown__toggle').attr('aria-expanded', 'false'); +(function ($) { + // initComponentUSWDSBanner - Toggles the USWDS Banner Component open and closed. + function initComponentUSWDSBanner() { + if (document.querySelectorAll('#uswds-banner-toggle').length > 0) { + document.querySelector('#uswds-banner-toggle').addEventListener("click", function (e) { + if (document.getElementById("uswds-banner-toggle").getAttribute('aria-expanded') == 'true') { + document.getElementById("uswds-banner-toggle").setAttribute('aria-expanded', 'false'); + document.getElementById("uswds-banner-content").style.display = 'none'; + } else { + document.getElementById("uswds-banner-toggle").setAttribute('aria-expanded', 'true'); + document.getElementById("uswds-banner-content").style.display = 'block'; + } + }); + } } if (typeof Drupal !== 'undefined') { // Define Drupal behavior. (function ($, Drupal) { - Drupal.behaviors.initNavigationDropdown = { + Drupal.behaviors.initComponentUSWDSBanner = { attach: function attach(context) { - $("body", context).once('nds-navigation-dropdown').each(function () { - initNavigationDropdown(context); + $("body", context).once('nds-component-uswds-banner').each(function () { + initComponentUSWDSBanner(context); }); } }; @@ -623,7 +573,7 @@ } else { // If Drupal isn't loaded, add JS for Pattern Lab. $(document).ready(function () { - initNavigationDropdown(); + initComponentUSWDSBanner(); }); } })(jQuery); // Part of NDS Lite @@ -709,6 +659,56 @@ } })(jQuery); +(function ($) { + function initNavigationDropdown() { + var context = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document; + $(".navigation--dropdown.hover").on('mouseover', function () { + openDropdown($(this)); + }); + $(".navigation--dropdown.hover").on('mouseout', function () { + closeDropdown($(this)); + }); + $(".navigation--dropdown").on('focusin', function (e) { + openDropdown($(this)); + }); + $(".navigation--dropdown").on('focusout', function (e) { + if (this.contains(e.relatedTarget)) { + return; + } + + closeDropdown($(this)); + }); + } + + function openDropdown($el) { + $el.addClass('is-open'); + $el.find('.navigation--dropdown__toggle').attr('aria-expanded', 'true'); + } + + function closeDropdown($el) { + $el.removeClass('is-open'); + $el.find('.navigation--dropdown__toggle').attr('aria-expanded', 'false'); + } + + if (typeof Drupal !== 'undefined') { + // Define Drupal behavior. + (function ($, Drupal) { + Drupal.behaviors.initNavigationDropdown = { + attach: function attach(context) { + $("body", context).once('nds-navigation-dropdown').each(function () { + initNavigationDropdown(context); + }); + } + }; + })(jQuery, Drupal); + } else { + // If Drupal isn't loaded, add JS for Pattern Lab. + $(document).ready(function () { + initNavigationDropdown(); + }); + } +})(jQuery); + (function ($) { function initNavigationTabs() { var context = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;