New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@ndla/accordion

Package Overview
Dependencies
Maintainers
5
Versions
282
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ndla/accordion - npm Package Compare versions

Comparing version 0.3.0 to 0.3.1

45

es/Accordion.js

@@ -1,9 +0,19 @@

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
/**

@@ -16,3 +26,2 @@ * Copyright (c) 2018-present, NDLA.

*/
import React from 'react';

@@ -22,19 +31,22 @@ import PropTypes from 'prop-types';

import { spacing } from '@ndla/core';
export var AccordionWrapper = /*#__PURE__*/styled('div', {
target: 'e18b3cxr0'
})('display:flex;flex-direction:column;margin:', spacing.normal, ' 0;');
export var Accordion = function (_React$Component) {
export var AccordionWrapper =
/*#__PURE__*/
styled("div", {
target: "e185tsm00"
})("display:flex;flex-direction:column;margin:", spacing.normal, " 0;");
export var Accordion =
/*#__PURE__*/
function (_React$Component) {
_inherits(Accordion, _React$Component);
function Accordion(props) {
var _this;
_classCallCheck(this, Accordion);
var _this = _possibleConstructorReturn(this, (Accordion.__proto__ || Object.getPrototypeOf(Accordion)).call(this, props));
_this = _possibleConstructorReturn(this, _getPrototypeOf(Accordion).call(this, props));
_this.state = {
panelsOpen: props.openIndexes
};
_this.togglePanel = _this.togglePanel.bind(_this);
_this.togglePanel = _this.togglePanel.bind(_assertThisInitialized(_assertThisInitialized(_this)));
return _this;

@@ -44,3 +56,3 @@ }

_createClass(Accordion, [{
key: 'togglePanel',
key: "togglePanel",
value: function togglePanel(index) {

@@ -50,3 +62,2 @@ var panelsOpen = this.state.panelsOpen;

if (single) {

@@ -69,3 +80,3 @@ this.setState({

}, {
key: 'render',
key: "render",
value: function render() {

@@ -81,3 +92,2 @@ return this.props.children({

}(React.Component);
Accordion.propTypes = {

@@ -88,5 +98,4 @@ children: PropTypes.func.isRequired,

};
Accordion.defaultProps = {
openIndexes: []
};

72

es/AccordionBar.js

@@ -8,3 +8,2 @@ /**

*/
import React from 'react';

@@ -15,17 +14,24 @@ import PropTypes from 'prop-types';

import { colors, spacing, fonts } from '@ndla/core';
var StyledAccordionBar = /*#__PURE__*/styled('div', {
target: 'e1csyvf20'
})('background:', colors.brand.light, ';padding:', spacing.small, ' ', spacing.normal, ' ', spacing.small, ' calc(', spacing.xsmall, ' * 3);color:', colors.brand.primary, ';display:flex;align-items:center;justify-content:flex-start;border:0;transition:color 100ms ease,background 100ms ease;.c-icon{transition:transform 100ms ease;transform:rotate(0deg);margin-right:', spacing.small, ';}', function (props) {
return props.isOpen && /*#__PURE__*/css('.c-icon{transform:rotate(90deg);}background:#fff;');
}, ';', function (props) {
return props.hasError && /*#__PURE__*/css('border:2px solid ', colors.support.redLight, ';padding:calc(', spacing.small, ' - 2px) calc(', spacing.normal, ' - 2px) calc(', spacing.small, ' - 2px) calc((', spacing.xsmall, ' * 3) - 2px);');
}, ';', function (props) {
return props.hasError && props.isOpen && /*#__PURE__*/css('border-bottom:0;padding-bottom:', spacing.normal, ';');
}, ';', function (props) {
return props.hasError && !props.isOpen && 'background: ' + colors.support.redLight;
}, ';');
var accordionButtonCss = /*#__PURE__*/css('border:0;background:none;cursor:pointer;color:', colors.brand.primary, ';display:flex;align-items:center;height:', spacing.large, ';span{box-shadow:inset 0 -1px;font-weight:', fonts.weight.semibold, ';', fonts.sizes(spacing.normal, 1.1), ';}&:hover,&:focus{span{box-shadow:none;}}');
var StyledAccordionBar =
/*#__PURE__*/
styled("div", {
target: "e1f069ol0"
})("background:", colors.brand.light, ";padding:", spacing.small, " ", spacing.normal, " ", spacing.small, " calc(", spacing.xsmall, " * 3);color:", colors.brand.primary, ";display:flex;align-items:center;justify-content:flex-start;border:0;transition:color 100ms ease,background 100ms ease;.c-icon{transition:transform 100ms ease;transform:rotate(0deg);margin-right:", spacing.small, ";}", function (props) {
return props.isOpen &&
/*#__PURE__*/
css(".c-icon{transform:rotate(90deg);}background:#fff;");
}, ";", function (props) {
return props.hasError &&
/*#__PURE__*/
css("border:2px solid ", colors.support.redLight, ";padding:calc(", spacing.small, " - 2px) calc(", spacing.normal, " - 2px) calc(", spacing.small, " - 2px) calc((", spacing.xsmall, " * 3) - 2px);");
}, ";", function (props) {
return props.hasError && props.isOpen &&
/*#__PURE__*/
css("border-bottom:0;padding-bottom:", spacing.normal, ";");
}, ";", function (props) {
return props.hasError && !props.isOpen && "background: ".concat(colors.support.redLight);
}, ";");
var accordionButtonCss =
/*#__PURE__*/
css("border:0;background:none;cursor:pointer;color:", colors.brand.primary, ";display:flex;align-items:center;height:", spacing.large, ";span{box-shadow:inset 0 -1px;font-weight:", fonts.weight.semibold, ";", fonts.sizes(spacing.normal, 1.1), ";}&:hover,&:focus{span{box-shadow:none;}}");
export var AccordionBar = function AccordionBar(_ref) {

@@ -38,24 +44,16 @@ var ariaLabel = _ref.ariaLabel,

onClick = _ref.onClick;
return React.createElement(
StyledAccordionBar,
{ isOpen: isOpen, hasError: hasError },
React.createElement(
'button',
{
type: 'button',
'aria-label': ariaLabel,
'aria-expanded': isOpen,
'aria-controls': panelId,
onClick: onClick,
className: accordionButtonCss },
React.createElement(ChevronRight, { className: 'c-icon--medium' }),
React.createElement(
'span',
null,
children
)
)
);
return React.createElement(StyledAccordionBar, {
isOpen: isOpen,
hasError: hasError
}, React.createElement("button", {
type: "button",
"aria-label": ariaLabel,
"aria-expanded": isOpen,
"aria-controls": panelId,
onClick: onClick,
className: accordionButtonCss
}, React.createElement(ChevronRight, {
className: "c-icon--medium"
}), React.createElement("span", null, children)));
};
AccordionBar.propTypes = {

@@ -62,0 +60,0 @@ ariaLabel: PropTypes.string.isRequired,

@@ -1,3 +0,5 @@

function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
/**

@@ -10,3 +12,2 @@ * Copyright (c) 2018-present, NDLA.

*/
import React from 'react';

@@ -16,23 +17,21 @@ import PropTypes from 'prop-types';

import { colors, spacing } from '@ndla/core';
var StyledAccordionPanel = /*#__PURE__*/styled('section', {
target: 'e13a5a4j0'
})('display:flex;transition:opacity 200ms ease;opacity:1;margin-bottom:', spacing.normal, ';background:#fff;padding-left:calc(', spacing.large, ' + ', spacing.small, ');padding-right:', spacing.large, ';padding-bottom:', spacing.large, ';max-height:auto;', function (props) {
return !props.isOpen && /*#__PURE__*/css('margin-bottom:', spacing.xsmall, ';padding:0;border:0;max-height:0;opacity:0;');
}, ';', function (props) {
return props.hasError && props.isOpen && /*#__PURE__*/css('border:2px solid ', colors.support.redLight, ';border-top:0;padding-left:calc(', spacing.large, ' + ', spacing.small, ' - 2px);padding-right:calc(', spacing.large, ' - 2px);padding-bottom:calc(', spacing.large, ' - 2px);');
}, ';');
var AccordionPanel = function AccordionPanel(_ref) {
var StyledAccordionPanel =
/*#__PURE__*/
styled("section", {
target: "e2rxy250"
})("display:flex;transition:opacity 200ms ease;opacity:1;margin-bottom:", spacing.normal, ";background:#fff;padding-left:calc(", spacing.large, " + ", spacing.small, ");padding-right:", spacing.large, ";padding-bottom:", spacing.large, ";max-height:auto;", function (props) {
return !props.isOpen &&
/*#__PURE__*/
css("margin-bottom:", spacing.xsmall, ";padding:0;border:0;max-height:0;opacity:0;");
}, ";", function (props) {
return props.hasError && props.isOpen &&
/*#__PURE__*/
css("border:2px solid ", colors.support.redLight, ";border-top:0;padding-left:calc(", spacing.large, " + ", spacing.small, " - 2px);padding-right:calc(", spacing.large, " - 2px);padding-bottom:calc(", spacing.large, " - 2px);");
}, ";");
export var AccordionPanel = function AccordionPanel(_ref) {
var children = _ref.children,
rest = _objectWithoutProperties(_ref, ['children']);
rest = _objectWithoutProperties(_ref, ["children"]);
return React.createElement(
StyledAccordionPanel,
rest,
children
);
return React.createElement(StyledAccordionPanel, rest, children);
};
export { AccordionPanel };
AccordionPanel.propTypes = {

@@ -39,0 +38,0 @@ id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),

@@ -8,6 +8,4 @@ /**

*/
export { Accordion as default, AccordionWrapper } from './Accordion';
export { AccordionPanel } from './AccordionPanel';
export { AccordionBar } from './AccordionBar';

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -8,48 +8,57 @@ Object.defineProperty(exports, "__esModule", {

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _react = require("react");
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _propTypes = require('prop-types');
var _propTypes = require("prop-types");
var _propTypes2 = _interopRequireDefault(_propTypes);
var _reactEmotion = require('react-emotion');
var _reactEmotion = require("react-emotion");
var _reactEmotion2 = _interopRequireDefault(_reactEmotion);
var _core = require('@ndla/core');
var _core = require("@ndla/core");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /**
* Copyright (c) 2018-present, NDLA.
*
* This source code is licensed under the GPLv3 license found in the
* LICENSE file in the root directory of this source tree.
*
*/
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
var AccordionWrapper = /*#__PURE__*/exports.AccordionWrapper = (0, _reactEmotion2.default)('div', {
target: 'e18b3cxr0'
})('display:flex;flex-direction:column;margin:', _core.spacing.normal, ' 0;');
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
var Accordion = exports.Accordion = function (_React$Component) {
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
var AccordionWrapper =
/*#__PURE__*/
exports.AccordionWrapper = (0, _reactEmotion2.default)("div", {
target: "e185tsm00"
})("display:flex;flex-direction:column;margin:", _core.spacing.normal, " 0;");
var Accordion =
/*#__PURE__*/
exports.Accordion = function (_React$Component) {
_inherits(Accordion, _React$Component);
function Accordion(props) {
var _this;
_classCallCheck(this, Accordion);
var _this = _possibleConstructorReturn(this, (Accordion.__proto__ || Object.getPrototypeOf(Accordion)).call(this, props));
_this = _possibleConstructorReturn(this, _getPrototypeOf(Accordion).call(this, props));
_this.state = {
panelsOpen: props.openIndexes
};
_this.togglePanel = _this.togglePanel.bind(_this);
_this.togglePanel = _this.togglePanel.bind(_assertThisInitialized(_assertThisInitialized(_this)));
return _this;

@@ -59,3 +68,3 @@ }

_createClass(Accordion, [{
key: 'togglePanel',
key: "togglePanel",
value: function togglePanel(index) {

@@ -65,3 +74,2 @@ var panelsOpen = this.state.panelsOpen;

if (single) {

@@ -84,3 +92,3 @@ this.setState({

}, {
key: 'render',
key: "render",
value: function render() {

@@ -102,5 +110,4 @@ return this.props.children({

};
Accordion.defaultProps = {
openIndexes: []
};

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -8,40 +8,50 @@ Object.defineProperty(exports, "__esModule", {

var _react = require('react');
var _react = require("react");
var _react2 = _interopRequireDefault(_react);
var _propTypes = require('prop-types');
var _propTypes = require("prop-types");
var _propTypes2 = _interopRequireDefault(_propTypes);
var _reactEmotion = require('react-emotion');
var _reactEmotion = require("react-emotion");
var _reactEmotion2 = _interopRequireDefault(_reactEmotion);
var _common = require('@ndla/icons/common');
var _common = require("@ndla/icons/common");
var _core = require('@ndla/core');
var _core = require("@ndla/core");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var StyledAccordionBar = /*#__PURE__*/(0, _reactEmotion2.default)('div', {
target: 'e1csyvf20'
})('background:', _core.colors.brand.light, ';padding:', _core.spacing.small, ' ', _core.spacing.normal, ' ', _core.spacing.small, ' calc(', _core.spacing.xsmall, ' * 3);color:', _core.colors.brand.primary, ';display:flex;align-items:center;justify-content:flex-start;border:0;transition:color 100ms ease,background 100ms ease;.c-icon{transition:transform 100ms ease;transform:rotate(0deg);margin-right:', _core.spacing.small, ';}', function (props) {
return props.isOpen && /*#__PURE__*/(0, _reactEmotion.css)('.c-icon{transform:rotate(90deg);}background:#fff;');
}, ';', function (props) {
return props.hasError && /*#__PURE__*/(0, _reactEmotion.css)('border:2px solid ', _core.colors.support.redLight, ';padding:calc(', _core.spacing.small, ' - 2px) calc(', _core.spacing.normal, ' - 2px) calc(', _core.spacing.small, ' - 2px) calc((', _core.spacing.xsmall, ' * 3) - 2px);');
}, ';', function (props) {
return props.hasError && props.isOpen && /*#__PURE__*/(0, _reactEmotion.css)('border-bottom:0;padding-bottom:', _core.spacing.normal, ';');
}, ';', function (props) {
return props.hasError && !props.isOpen && 'background: ' + _core.colors.support.redLight;
}, ';'); /**
* Copyright (c) 2018-present, NDLA.
*
* This source code is licensed under the GPLv3 license found in the
* LICENSE file in the root directory of this source tree.
*
*/
/**
* Copyright (c) 2018-present, NDLA.
*
* This source code is licensed under the GPLv3 license found in the
* LICENSE file in the root directory of this source tree.
*
*/
var StyledAccordionBar =
/*#__PURE__*/
(0, _reactEmotion2.default)("div", {
target: "e1f069ol0"
})("background:", _core.colors.brand.light, ";padding:", _core.spacing.small, " ", _core.spacing.normal, " ", _core.spacing.small, " calc(", _core.spacing.xsmall, " * 3);color:", _core.colors.brand.primary, ";display:flex;align-items:center;justify-content:flex-start;border:0;transition:color 100ms ease,background 100ms ease;.c-icon{transition:transform 100ms ease;transform:rotate(0deg);margin-right:", _core.spacing.small, ";}", function (props) {
return props.isOpen &&
/*#__PURE__*/
(0, _reactEmotion.css)(".c-icon{transform:rotate(90deg);}background:#fff;");
}, ";", function (props) {
return props.hasError &&
/*#__PURE__*/
(0, _reactEmotion.css)("border:2px solid ", _core.colors.support.redLight, ";padding:calc(", _core.spacing.small, " - 2px) calc(", _core.spacing.normal, " - 2px) calc(", _core.spacing.small, " - 2px) calc((", _core.spacing.xsmall, " * 3) - 2px);");
}, ";", function (props) {
return props.hasError && props.isOpen &&
/*#__PURE__*/
(0, _reactEmotion.css)("border-bottom:0;padding-bottom:", _core.spacing.normal, ";");
}, ";", function (props) {
return props.hasError && !props.isOpen && "background: ".concat(_core.colors.support.redLight);
}, ";");
var accordionButtonCss =
/*#__PURE__*/
(0, _reactEmotion.css)("border:0;background:none;cursor:pointer;color:", _core.colors.brand.primary, ";display:flex;align-items:center;height:", _core.spacing.large, ";span{box-shadow:inset 0 -1px;font-weight:", _core.fonts.weight.semibold, ";", _core.fonts.sizes(_core.spacing.normal, 1.1), ";}&:hover,&:focus{span{box-shadow:none;}}");
var accordionButtonCss = /*#__PURE__*/(0, _reactEmotion.css)('border:0;background:none;cursor:pointer;color:', _core.colors.brand.primary, ';display:flex;align-items:center;height:', _core.spacing.large, ';span{box-shadow:inset 0 -1px;font-weight:', _core.fonts.weight.semibold, ';', _core.fonts.sizes(_core.spacing.normal, 1.1), ';}&:hover,&:focus{span{box-shadow:none;}}');
var AccordionBar = exports.AccordionBar = function AccordionBar(_ref) {

@@ -54,22 +64,15 @@ var ariaLabel = _ref.ariaLabel,

onClick = _ref.onClick;
return _react2.default.createElement(
StyledAccordionBar,
{ isOpen: isOpen, hasError: hasError },
_react2.default.createElement(
'button',
{
type: 'button',
'aria-label': ariaLabel,
'aria-expanded': isOpen,
'aria-controls': panelId,
onClick: onClick,
className: accordionButtonCss },
_react2.default.createElement(_common.ChevronRight, { className: 'c-icon--medium' }),
_react2.default.createElement(
'span',
null,
children
)
)
);
return _react2.default.createElement(StyledAccordionBar, {
isOpen: isOpen,
hasError: hasError
}, _react2.default.createElement("button", {
type: "button",
"aria-label": ariaLabel,
"aria-expanded": isOpen,
"aria-controls": panelId,
onClick: onClick,
className: accordionButtonCss
}, _react2.default.createElement(_common.ChevronRight, {
className: "c-icon--medium"
}), _react2.default.createElement("span", null, children)));
};

@@ -76,0 +79,0 @@

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -8,46 +8,43 @@ Object.defineProperty(exports, "__esModule", {

var _react = require('react');
var _react = require("react");
var _react2 = _interopRequireDefault(_react);
var _propTypes = require('prop-types');
var _propTypes = require("prop-types");
var _propTypes2 = _interopRequireDefault(_propTypes);
var _reactEmotion = require('react-emotion');
var _reactEmotion = require("react-emotion");
var _reactEmotion2 = _interopRequireDefault(_reactEmotion);
var _core = require('@ndla/core');
var _core = require("@ndla/core");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } /**
* Copyright (c) 2018-present, NDLA.
*
* This source code is licensed under the GPLv3 license found in the
* LICENSE file in the root directory of this source tree.
*
*/
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
var StyledAccordionPanel = /*#__PURE__*/(0, _reactEmotion2.default)('section', {
target: 'e13a5a4j0'
})('display:flex;transition:opacity 200ms ease;opacity:1;margin-bottom:', _core.spacing.normal, ';background:#fff;padding-left:calc(', _core.spacing.large, ' + ', _core.spacing.small, ');padding-right:', _core.spacing.large, ';padding-bottom:', _core.spacing.large, ';max-height:auto;', function (props) {
return !props.isOpen && /*#__PURE__*/(0, _reactEmotion.css)('margin-bottom:', _core.spacing.xsmall, ';padding:0;border:0;max-height:0;opacity:0;');
}, ';', function (props) {
return props.hasError && props.isOpen && /*#__PURE__*/(0, _reactEmotion.css)('border:2px solid ', _core.colors.support.redLight, ';border-top:0;padding-left:calc(', _core.spacing.large, ' + ', _core.spacing.small, ' - 2px);padding-right:calc(', _core.spacing.large, ' - 2px);padding-bottom:calc(', _core.spacing.large, ' - 2px);');
}, ';');
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
var AccordionPanel = function AccordionPanel(_ref) {
var StyledAccordionPanel =
/*#__PURE__*/
(0, _reactEmotion2.default)("section", {
target: "e2rxy250"
})("display:flex;transition:opacity 200ms ease;opacity:1;margin-bottom:", _core.spacing.normal, ";background:#fff;padding-left:calc(", _core.spacing.large, " + ", _core.spacing.small, ");padding-right:", _core.spacing.large, ";padding-bottom:", _core.spacing.large, ";max-height:auto;", function (props) {
return !props.isOpen &&
/*#__PURE__*/
(0, _reactEmotion.css)("margin-bottom:", _core.spacing.xsmall, ";padding:0;border:0;max-height:0;opacity:0;");
}, ";", function (props) {
return props.hasError && props.isOpen &&
/*#__PURE__*/
(0, _reactEmotion.css)("border:2px solid ", _core.colors.support.redLight, ";border-top:0;padding-left:calc(", _core.spacing.large, " + ", _core.spacing.small, " - 2px);padding-right:calc(", _core.spacing.large, " - 2px);padding-bottom:calc(", _core.spacing.large, " - 2px);");
}, ";");
var AccordionPanel = exports.AccordionPanel = function AccordionPanel(_ref) {
var children = _ref.children,
rest = _objectWithoutProperties(_ref, ['children']);
rest = _objectWithoutProperties(_ref, ["children"]);
return _react2.default.createElement(
StyledAccordionPanel,
rest,
children
);
return _react2.default.createElement(StyledAccordionPanel, rest, children);
};
exports.AccordionPanel = AccordionPanel;
AccordionPanel.propTypes = {

@@ -54,0 +51,0 @@ id: _propTypes2.default.oneOfType([_propTypes2.default.number, _propTypes2.default.string]),

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -7,5 +7,5 @@ Object.defineProperty(exports, "__esModule", {

var _Accordion = require('./Accordion');
var _Accordion = require("./Accordion");
Object.defineProperty(exports, 'default', {
Object.defineProperty(exports, "default", {
enumerable: true,

@@ -16,3 +16,3 @@ get: function get() {

});
Object.defineProperty(exports, 'AccordionWrapper', {
Object.defineProperty(exports, "AccordionWrapper", {
enumerable: true,

@@ -24,5 +24,5 @@ get: function get() {

var _AccordionPanel = require('./AccordionPanel');
var _AccordionPanel = require("./AccordionPanel");
Object.defineProperty(exports, 'AccordionPanel', {
Object.defineProperty(exports, "AccordionPanel", {
enumerable: true,

@@ -34,5 +34,5 @@ get: function get() {

var _AccordionBar = require('./AccordionBar');
var _AccordionBar = require("./AccordionBar");
Object.defineProperty(exports, 'AccordionBar', {
Object.defineProperty(exports, "AccordionBar", {
enumerable: true,

@@ -39,0 +39,0 @@ get: function get() {

{
"name": "@ndla/accordion",
"version": "0.3.0",
"version": "0.3.1",
"description": "A simple accordion from NDLA",

@@ -8,12 +8,3 @@ "license": "GPL-3.0",

"module": "es/index.js",
"jsnext:main": "es/index.js",
"sideEffects": false,
"scripts": {
"build": "npm run build:commonjs && npm run build:es",
"build:commonjs": "cross-env BABEL_ENV=commonjs babel src --quiet --out-dir lib --ignore __tests__",
"build:es": "cross-env BABEL_ENV=es babel src --quiet --out-dir es --ignore __tests__",
"clean": "rimraf lib es",
"test": "jest",
"prepublish": "npm run clean && npm run build"
},
"repository": {

@@ -32,3 +23,3 @@ "type": "git",

"dependencies": {
"@ndla/core": "^0.4.0"
"@ndla/core": "^0.4.1"
},

@@ -35,0 +26,0 @@ "peerDependencies": {

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