Skip to content

Commit

Permalink
Release v1.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
caccamojr committed Mar 31, 2021
1 parent 11c38eb commit 59b0a7d
Show file tree
Hide file tree
Showing 12 changed files with 825 additions and 825 deletions.
2 changes: 1 addition & 1 deletion global-assets/source/js/global/nds-min.js

Large diffs are not rendered by default.

296 changes: 148 additions & 148 deletions global-assets/source/js/global/nds.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,130 +255,6 @@
initTableDefault();
});
}
})(jQuery);

(function ($) {
function initComponentMedia() {
var context = arguments.length > 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


Expand Down Expand Up @@ -579,51 +455,125 @@
})(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);
});
}
};
})(jQuery, Drupal);
} else {
// If Drupal isn't loaded, add JS for Pattern Lab.
$(document).ready(function () {
initNavigationDropdown();
initComponentUSWDSBanner();
});
}
})(jQuery); // Part of NDS Lite
Expand Down Expand Up @@ -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;
Expand Down
Binary file modified nds-documentation-site/public_html/assets/nds-bundled-js.zip
Binary file not shown.
Binary file modified nds-documentation-site/public_html/assets/nds-drupal-theme.zip
Binary file not shown.
Binary file modified nds-documentation-site/public_html/assets/nds-lite-js.zip
Binary file not shown.
Loading

0 comments on commit 59b0a7d

Please sign in to comment.