Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

uswds

Package Overview
Dependencies
Maintainers
4
Versions
99
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

uswds - npm Package Compare versions

Comparing version 0.9.3 to 0.9.4

gulp-tasks.png

3

CONTRIBUTING.md

@@ -13,2 +13,5 @@ # Welcome!

### Contributor Guidelines for Design
We have provided some guidelines for folks that would like to submit new components to the Draft Web Design Standards and the lifecycle those new components will go through. For more detail, please visit the [guidelines on our wiki](https://github.com/18F/web-design-standards/wiki/Component-Maturity-Scale).
### Submitting an issue

@@ -15,0 +18,0 @@

2

package.json
{
"name": "uswds",
"version": "0.9.3",
"version": "0.9.4",
"description": "Open source UI components and visual style guide for U.S. government websites",

@@ -5,0 +5,0 @@ "main": "src/js/start.js",

@@ -16,3 +16,3 @@ # Draft U.S. Web Design Standards

* Developers: Follow the instructions in this README to get started.
* [CSS, JavaScript, image, and font files of all the assets on this site are available for download](https://github.com/18F/web-design-standards/releases/download/v0.9.3/uswds-0.9.3.zip).
* [CSS, JavaScript, image, and font files of all the assets on this site are available for download](https://github.com/18F/web-design-standards/releases/download/v0.9.4/uswds-0.9.4.zip).

@@ -27,3 +27,3 @@ Here are a few different ways to use the Standards within your project.

[https://github.com/18F/web-design-standards/releases/download/v0.9.3/uswds-0.9.3.zip](https://github.com/18F/web-design-standards/releases/download/v0.9.3/uswds-0.9.3.zip)
[https://github.com/18F/web-design-standards/releases/download/v0.9.4/uswds-0.9.4.zip](https://github.com/18F/web-design-standards/releases/download/v0.9.4/uswds-0.9.4.zip)

@@ -33,3 +33,3 @@ Then, add the following folders into a relevant place in your code base — likely a directory where you keep third-party libraries:

```
uswds-0.9.3/
uswds-0.9.4/
├── js/

@@ -36,0 +36,0 @@ │   ├── uswds.min.js.map

@@ -28,3 +28,3 @@ var mocha = require('mocha');

$content = $el.find('#' + $button.attr(CONTROLS));
});
});

@@ -31,0 +31,0 @@ afterEach(function () {

var template = [
'<div class="usa-accordion">',
'<button class="usa-button-unstyled" aria-expanded="false" aria-controls="collapsible-0"></button>',
'<button class="usa-button-unstyled" aria-controls="collapsible-0"></button>',
'<div id="collapsible-0" aria-hidden="true" class="usa-accordion-content"></div>',

@@ -5,0 +5,0 @@ '</div>'

@@ -5,7 +5,7 @@

/**
* Accordion
* @class Accordion
*
* An accordion component.
*
* @param {jQuery} $el A jQuery html element to turn into an accordion.
* @param {jQuery} el A jQuery html element to turn into an accordion.
*/

@@ -15,12 +15,26 @@ function Accordion ($el) {

this.$root = $el;
// delegate click events on each <button>
this.$root.on('click', 'button', function (ev) {
var expanded = JSON.parse($(this).attr('aria-expanded'));
var $button = $(this);
var expanded = $button.attr('aria-expanded') === 'true';
ev.preventDefault();
self.hideAll();
if (!expanded) {
self.show($(this));
self.show($button);
}
});
// find the first expanded button
var $expanded = this.$('button[aria-expanded=true]');
this.hideAll();
if ($expanded.length) {
this.show($expanded);
}
}
/**
* @param {String} selector
* @return {jQuery}
*/
Accordion.prototype.$ = function (selector) {

@@ -30,10 +44,19 @@ return this.$root.find(selector);

/**
* @param {jQuery} button
* @return {Accordion}
*/
Accordion.prototype.hide = function ($button) {
var selector = $button.attr('aria-controls'),
$content = this.$('#' + selector);
$button.attr('aria-expanded', false);
$content.attr('aria-hidden', true);
return this;
};
/**
* @param {jQuery} button
* @return {Accordion}
*/
Accordion.prototype.show = function ($button) {

@@ -45,4 +68,8 @@ var selector = $button.attr('aria-controls'),

$content.attr('aria-hidden', false);
return this;
};
/**
* @return {Accordion}
*/
Accordion.prototype.hideAll = function () {

@@ -53,4 +80,5 @@ var self = this;

});
return this;
};
module.exports = Accordion;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc