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

react-accessible-accordion

Package Overview
Dependencies
Maintainers
4
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-accessible-accordion - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

47

dist/Accordion/accordion.js

@@ -9,6 +9,2 @@ 'use strict';

var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');

@@ -30,32 +26,20 @@

var defaultProps = {
accordion: true,
onChange: function onChange() {},
className: 'accordion',
activeItems: []
};
var propTypes = {
accordion: _propTypes2.default.bool,
children: _propTypes2.default.oneOfType([_propTypes2.default.arrayOf(_propTypes2.default.element), _propTypes2.default.object]).isRequired,
activeItems: _propTypes2.default.arrayOf(_propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.number])),
className: _propTypes2.default.string,
onChange: _propTypes2.default.func
};
var Accordion = function (_Component) {
_inherits(Accordion, _Component);
function Accordion(props) {
function Accordion() {
var _ref;
var _temp, _this, _ret;
_classCallCheck(this, Accordion);
var _this = _possibleConstructorReturn(this, (Accordion.__proto__ || Object.getPrototypeOf(Accordion)).call(this, props));
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
var activeItems = _this.preExpandedItems();
_this.state = {
activeItems: activeItems,
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = Accordion.__proto__ || Object.getPrototypeOf(Accordion)).call.apply(_ref, [this].concat(args))), _this), _this.state = {
activeItems: _this.preExpandedItems(),
accordion: true
};
_this.renderItems = _this.renderItems.bind(_this);
return _this;
}, _this.renderItems = _this.renderItems.bind(_this), _temp), _possibleConstructorReturn(_this, _ret);
}

@@ -164,5 +148,8 @@

Accordion.propTypes = propTypes;
Accordion.defaultProps = defaultProps;
Accordion.defaultProps = {
accordion: true,
onChange: function onChange() {},
className: 'accordion',
activeItems: []
};
exports.default = Accordion;

@@ -9,6 +9,2 @@ 'use strict';

var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');

@@ -18,5 +14,5 @@

var _uuid = require('uuid');
var _consecutive = require('consecutive');
var _uuid2 = _interopRequireDefault(_uuid);
var _consecutive2 = _interopRequireDefault(_consecutive);

@@ -37,32 +33,21 @@ var _classnames = require('classnames');

var defaultProps = {
accordion: true,
expanded: false,
onClick: function onClick() {},
className: 'accordion__item',
hideBodyClassName: null
};
var nextUuid = (0, _consecutive2.default)();
var propTypes = {
accordion: _propTypes2.default.bool,
onClick: _propTypes2.default.func,
expanded: _propTypes2.default.bool,
children: _propTypes2.default.arrayOf(_propTypes2.default.element).isRequired,
className: _propTypes2.default.string,
hideBodyClassName: _propTypes2.default.string
};
var AccordionItem = function (_Component) {
_inherits(AccordionItem, _Component);
function AccordionItem(props) {
function AccordionItem() {
var _ref;
var _temp, _this, _ret;
_classCallCheck(this, AccordionItem);
var _this = _possibleConstructorReturn(this, (AccordionItem.__proto__ || Object.getPrototypeOf(AccordionItem)).call(this, props));
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this.state = {
itemUuid: _uuid2.default.v4()
};
_this.renderChildren = _this.renderChildren.bind(_this);
return _this;
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = AccordionItem.__proto__ || Object.getPrototypeOf(AccordionItem)).call.apply(_ref, [this].concat(args))), _this), _this.state = {
itemUuid: nextUuid()
}, _this.renderChildren = _this.renderChildren.bind(_this), _temp), _possibleConstructorReturn(_this, _ret);
}

@@ -127,5 +112,9 @@

AccordionItem.propTypes = propTypes;
AccordionItem.defaultProps = defaultProps;
AccordionItem.defaultProps = {
accordion: true,
expanded: false,
onClick: function onClick() {},
className: 'accordion__item',
hideBodyClassName: ''
};
exports.default = AccordionItem;

@@ -33,7 +33,7 @@ 'use strict';

jest.mock('uuid', function () {
return {
v4: function v4() {
jest.mock('consecutive', function () {
return function () {
return function () {
return 'mock-uuid-hash';
}
};
};

@@ -196,3 +196,6 @@ });

_accordionItem2.default,
{ expanded: false, hideBodyClassName: 'testCSSClass--hidden' },
{
expanded: false,
hideBodyClassName: 'testCSSClass--hidden'
},
_react2.default.createElement(

@@ -199,0 +202,0 @@ _accordionItemTitle2.default,

@@ -7,6 +7,2 @@ 'use strict';

var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');

@@ -32,19 +28,10 @@

var propTypes = {
id: _propTypes2.default.string,
expanded: _propTypes2.default.bool,
children: _propTypes2.default.oneOfType([_propTypes2.default.element, _propTypes2.default.arrayOf(_propTypes2.default.element)]).isRequired,
className: _propTypes2.default.string,
hideBodyClassName: _propTypes2.default.string,
role: _propTypes2.default.string
};
var AccordionItemBody = function AccordionItemBody(props) {
var id = props.id,
expanded = props.expanded,
children = props.children,
className = props.className,
hideBodyClassName = props.hideBodyClassName,
role = props.role;
var AccordionItemBody = function AccordionItemBody(_ref) {
var id = _ref.id,
expanded = _ref.expanded,
children = _ref.children,
className = _ref.className,
hideBodyClassName = _ref.hideBodyClassName,
role = _ref.role;
var bodyClass = (0, _classnames2.default)(className, _defineProperty({}, hideBodyClassName, !expanded));

@@ -65,3 +52,2 @@ var ariaHidden = !expanded;

AccordionItemBody.propTypes = propTypes;
AccordionItemBody.defaultProps = defaultProps;

@@ -68,0 +54,0 @@ // We need this to be able to assign correct params to element.

@@ -9,6 +9,2 @@ 'use strict';

var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');

@@ -32,33 +28,17 @@

var defaultProps = {
id: '',
expanded: false,
onClick: function onClick() {},
ariaControls: '',
className: 'accordion__title',
hideBodyClassName: null,
role: ''
};
var propTypes = {
id: _propTypes2.default.string,
expanded: _propTypes2.default.bool,
onClick: _propTypes2.default.func,
ariaControls: _propTypes2.default.string,
children: _propTypes2.default.oneOfType([_propTypes2.default.element, _propTypes2.default.arrayOf(_propTypes2.default.element)]).isRequired,
className: _propTypes2.default.string,
hideBodyClassName: _propTypes2.default.string,
role: _propTypes2.default.string
};
var AccordionItemTitle = function (_Component) {
_inherits(AccordionItemTitle, _Component);
function AccordionItemTitle(props) {
function AccordionItemTitle() {
var _ref;
var _temp, _this, _ret;
_classCallCheck(this, AccordionItemTitle);
var _this = _possibleConstructorReturn(this, (AccordionItemTitle.__proto__ || Object.getPrototypeOf(AccordionItemTitle)).call(this, props));
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this.handleKeyPress = _this.handleKeyPress.bind(_this);
return _this;
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = AccordionItemTitle.__proto__ || Object.getPrototypeOf(AccordionItemTitle)).call.apply(_ref, [this].concat(args))), _this), _this.handleKeyPress = _this.handleKeyPress.bind(_this), _temp), _possibleConstructorReturn(_this, _ret);
}

@@ -100,4 +80,4 @@

role: role,
tabIndex: '0',
onKeyPress: this.handleKeyPress
tabIndex: '0' // eslint-disable-line jsx-a11y/no-noninteractive-tabindex
, onKeyPress: this.handleKeyPress
},

@@ -116,4 +96,4 @@ children

role: role,
tabIndex: '0',
onKeyPress: this.handleKeyPress
tabIndex: '0' // eslint-disable-line jsx-a11y/no-noninteractive-tabindex
, onKeyPress: this.handleKeyPress
},

@@ -128,8 +108,12 @@ children

AccordionItemTitle.propTypes = propTypes;
AccordionItemTitle.defaultProps = defaultProps;
// We need this to be able to assign correct params to element.
// Minifiers modify component name
AccordionItemTitle.accordionElementName = 'AccordionItemTitle';
AccordionItemTitle.defaultProps = {
id: '',
expanded: false,
onClick: function onClick() {},
ariaControls: '',
className: 'accordion__title',
hideBodyClassName: '',
role: ''
};
exports.default = AccordionItemTitle;
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
value: true
});

@@ -6,0 +6,0 @@ exports.AccordionItemBody = exports.AccordionItemTitle = exports.AccordionItem = exports.Accordion = undefined;

@@ -6,3 +6,5 @@ "use strict";

});
// eslint-disable-next-line
// eslint-disable-next-line import/prefer-default-export
var isArraysEqualShallow = exports.isArraysEqualShallow = function isArraysEqualShallow(array, other) {

@@ -9,0 +11,0 @@ if (array === other) {

{
"name": "react-accessible-accordion",
"version": "1.0.1",
"version": "1.0.2",
"description": "Accessible Accordion component for React",

@@ -21,3 +21,4 @@ "main": "dist/index.js",

"deploy": "npm run pages && ./bin/deploy.sh",
"prettier": "prettier **/*.js --write"
"prettier": "prettier **/*.js --write",
"prepublish": "npm run build"
},

@@ -24,0 +25,0 @@ "repository": {

@@ -9,2 +9,4 @@ [react-accessible-accordion](https://springload.github.io/react-accessible-accordion/) [![npm](https://img.shields.io/npm/v/react-accessible-accordion.svg?style=flat-square)](https://www.npmjs.com/package/react-accessible-accordion) [![Build Status](https://travis-ci.org/springload/react-accessible-accordion.svg?branch=master)](https://travis-ci.org/springload/react-accessible-accordion) [![Coverage Status](https://coveralls.io/repos/github/springload/react-accessible-accordion/badge.svg)](https://coveralls.io/github/springload/react-accessible-accordion) [![Dependency Status](https://david-dm.org/springload/react-accessible-accordion.svg?style=flat-square)](https://david-dm.org/springload/react-accessible-accordion) [![devDependency Status](https://david-dm.org/springload/react-accessible-accordion/dev-status.svg?style=flat-square)](https://david-dm.org/springload/react-accessible-accordion#info=devDependencies)

If you like accessible components, feel free to check this other repo [react-accessible-modal](https://github.com/springload/react-accessible-modal).
## Usage

@@ -11,0 +13,0 @@

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