This repository has been archived by the owner on Aug 27, 2019. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upgrade to latest version of design standards (#13)
* Closes #10 * Also add some instructions in README on how to do this manually
- Loading branch information
Showing
83 changed files
with
724 additions
and
203 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Empty file.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
var select = require('../utils/select'); | ||
var addClass = require('../utils/add-class'); | ||
var removeClass = require('../utils/remove-class'); | ||
var dispatch = require('../utils/dispatch'); | ||
|
||
function getSiblings (el) { | ||
var n = el.parentNode.firstChild; | ||
var matches = []; | ||
|
||
while (n) { | ||
if (n.nodeType == 1 && n != el) { | ||
matches.push(n); | ||
} | ||
n = n.nextSibling; | ||
} | ||
|
||
return matches; | ||
} | ||
|
||
var showPanelListener = function () { | ||
var panelToShow = this.parentNode; | ||
var otherPanels = getSiblings(panelToShow); | ||
removeClass(panelToShow, 'hidden'); | ||
otherPanels.forEach(function (el) { | ||
addClass(el, 'hidden'); | ||
}); | ||
}; | ||
|
||
var events= []; | ||
|
||
module.exports = function footerAccordion () { | ||
|
||
var navList = select('.usa-footer-big nav ul'); | ||
var primaryLink = select('.usa-footer-big nav .usa-footer-primary-link'); | ||
|
||
if (events.length) { | ||
events.forEach(function (e) { | ||
e.off(); | ||
}); | ||
events = []; | ||
} | ||
|
||
if (window.innerWidth < 600) { | ||
|
||
navList.forEach(function (el) { | ||
addClass(el, 'hidden'); | ||
}); | ||
|
||
primaryLink.forEach(function (el) { | ||
events.push( | ||
dispatch(el, 'click', showPanelListener) | ||
); | ||
}); | ||
|
||
} else { | ||
navList.forEach(function (el) { | ||
removeClass(el, 'hidden'); | ||
}); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
var select = require('../../utils/select'); | ||
var addClass = require('../../utils/add-class'); | ||
var removeClass = require('../../utils/remove-class'); | ||
var dispatch = require('../../utils/dispatch'); | ||
|
||
var navElements = select('.usa-menu-btn, .usa-overlay, .usa-nav-close'); | ||
var toggleElements = select('.usa-overlay, .usa-nav'); | ||
var navCloseElement = select('.usa-nav-close')[ 0 ]; | ||
|
||
navElements.forEach(function (element) { | ||
dispatch(element, 'click touchstart', function (e) { | ||
toggleElements.forEach(function (element) { | ||
toggleClass(element, 'is-visible'); | ||
}); | ||
toggleClass(document.body, 'usa-mobile_nav-active'); | ||
navCloseElement.focus(); | ||
return false; | ||
}); | ||
}); | ||
|
||
function toggleClass (element, className) { | ||
if (element.classList) { | ||
element.classList.toggle(className); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
var select = require('../../utils/select'); | ||
var addClass = require('../../utils/add-class'); | ||
var removeClass = require('../../utils/remove-class'); | ||
var dispatch = require('../../utils/dispatch'); | ||
|
||
var searchForm = select('.js-search-form')[ 0 ]; | ||
var searchButton = select('.js-search-button')[ 0 ]; | ||
var searchButtonContainer = select('.js-search-button-container')[ 0 ]; | ||
var searchDispatcher; | ||
|
||
if (searchButton && searchForm) { | ||
dispatch(searchButton, 'click touchstart', searchButtonClickHandler); | ||
} | ||
|
||
function searchButtonClickHandler (event) { | ||
if (isOpen(searchForm)) { | ||
closeSearch(); | ||
} else { | ||
openSearch(); | ||
searchDispatcher = dispatch(document.body, 'click touchstart', searchOpenClickHandler); | ||
} | ||
|
||
return false; | ||
} | ||
|
||
function searchOpenClickHandler (event) { | ||
var target = event.target; | ||
if (! searchFormContains(target)) { | ||
closeSearch(); | ||
searchDispatcher.off(); | ||
} | ||
} | ||
|
||
function openSearch () { | ||
addClass(searchForm, 'is-visible'); | ||
addClass(searchButton, 'is-hidden'); | ||
} | ||
|
||
function closeSearch () { | ||
removeClass(searchForm, 'is-visible'); | ||
removeClass(searchButton, 'is-hidden'); | ||
} | ||
|
||
function isOpen (element) { | ||
var classRegexp = new RegExp('(^| )is-visible( |$)', 'gi'); | ||
return classRegexp.test(element.className); | ||
} | ||
|
||
function searchFormContains (element) { | ||
return (searchForm && searchForm.contains(element)) || | ||
(searchButtonContainer && searchButtonContainer.contains(element)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,12 @@ | ||
module.exports = function ($field, showing) { | ||
$field.attr('autocapitalize', 'off'); | ||
$field.attr('autocorrect', 'off'); | ||
$field.attr('type', showing ? 'password' : 'text'); | ||
/** | ||
* Flips given INPUT elements between masked (hiding the field value) and unmasked | ||
* @param {Array.HTMLElement} fields - An array of INPUT elements | ||
* @param {Boolean} mask - Whether the mask should be applied, hiding the field value | ||
*/ | ||
module.exports = function (fields, mask) { | ||
fields.forEach(function (field) { | ||
field.setAttribute('autocapitalize', 'off'); | ||
field.setAttribute('autocorrect', 'off'); | ||
field.setAttribute('type', mask ? 'password' : 'text'); | ||
}); | ||
}; |
Oops, something went wrong.