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

@infotech/uikit-accordeon

Package Overview
Dependencies
Maintainers
3
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@infotech/uikit-accordeon - npm Package Compare versions

Comparing version 0.2.0-beta.0 to 0.2.0-beta.1

16

lib/Accordeon.js

@@ -23,10 +23,10 @@ "use strict";

var styles = {
"Accordeon": "uikit_86535b6_components_accordeon__Accordeon_62262baf",
"Header": "uikit_86535b6_components_accordeon__Header_62262baf",
"Sign": "uikit_86535b6_components_accordeon__Sign_62262baf",
"Label": "uikit_86535b6_components_accordeon__Label_62262baf",
"Badge": "uikit_86535b6_components_accordeon__Badge_62262baf",
"Body": "uikit_86535b6_components_accordeon__Body_62262baf",
"Light": "uikit_86535b6_components_accordeon__Light_62262baf",
"AccordeonGroup": "uikit_86535b6_components_accordeon__AccordeonGroup_62262baf"
"Accordeon": "uikit_7dc6b197_components_accordeon__Accordeon_62262baf",
"Header": "uikit_7dc6b197_components_accordeon__Header_62262baf",
"Sign": "uikit_7dc6b197_components_accordeon__Sign_62262baf",
"Label": "uikit_7dc6b197_components_accordeon__Label_62262baf",
"Badge": "uikit_7dc6b197_components_accordeon__Badge_62262baf",
"Body": "uikit_7dc6b197_components_accordeon__Body_62262baf",
"Light": "uikit_7dc6b197_components_accordeon__Light_62262baf",
"AccordeonGroup": "uikit_7dc6b197_components_accordeon__AccordeonGroup_62262baf"
}; // @related-file ./styles.css

@@ -33,0 +33,0 @@

@@ -18,6 +18,6 @@ "use strict";

var _classnames = _interopRequireDefault(require("classnames"));
var _Accordeon = _interopRequireDefault(require("./Accordeon"));
var _classnames = _interopRequireDefault(require("classnames"));
require("./styles.css");

@@ -31,3 +31,3 @@

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 _typeof(obj) { "@babel/helpers - typeof"; 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); }

@@ -50,6 +50,2 @@ 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 _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 _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); }

@@ -61,2 +57,6 @@

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 _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
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); }

@@ -69,17 +69,26 @@

var styles = {
"Accordeon": "uikit_86535b6_components_accordeon__Accordeon_62262baf",
"Header": "uikit_86535b6_components_accordeon__Header_62262baf",
"Sign": "uikit_86535b6_components_accordeon__Sign_62262baf",
"Label": "uikit_86535b6_components_accordeon__Label_62262baf",
"Badge": "uikit_86535b6_components_accordeon__Badge_62262baf",
"Body": "uikit_86535b6_components_accordeon__Body_62262baf",
"Light": "uikit_86535b6_components_accordeon__Light_62262baf",
"AccordeonGroup": "uikit_86535b6_components_accordeon__AccordeonGroup_62262baf"
"Accordeon": "uikit_7dc6b197_components_accordeon__Accordeon_62262baf",
"Header": "uikit_7dc6b197_components_accordeon__Header_62262baf",
"Sign": "uikit_7dc6b197_components_accordeon__Sign_62262baf",
"Label": "uikit_7dc6b197_components_accordeon__Label_62262baf",
"Badge": "uikit_7dc6b197_components_accordeon__Badge_62262baf",
"Body": "uikit_7dc6b197_components_accordeon__Body_62262baf",
"Light": "uikit_7dc6b197_components_accordeon__Light_62262baf",
"AccordeonGroup": "uikit_7dc6b197_components_accordeon__AccordeonGroup_62262baf"
}; // @related-file ./styles.css
var AccordeonGroup =
/*#__PURE__*/
function (_Component) {
var AccordeonGroup = /*#__PURE__*/function (_Component) {
_inherits(AccordeonGroup, _Component);
_createClass(AccordeonGroup, null, [{
key: "getDerivedStateFromProps",
value: function getDerivedStateFromProps(props, state) {
var controllable = Array.isArray(props.openIndexes);
return {
openIndexes: controllable ? props.openIndexes : state.openIndexes,
controllable: controllable
};
}
}]);
function AccordeonGroup(props) {

@@ -93,25 +102,39 @@ var _this;

_defineProperty(_assertThisInitialized(_this), "handleClick", function (index) {
var nextIsOpenIndexes = [];
var nextopenIndexes = [];
if ((0, _includes.default)(_this.state.isOpenIndexes, index)) {
nextIsOpenIndexes = (0, _filter.default)(_this.state.isOpenIndexes, function (value) {
if ((0, _includes.default)(_this.state.openIndexes, index)) {
nextopenIndexes = (0, _filter.default)(_this.state.openIndexes, function (value) {
return value !== index;
});
} else if (_this.props.independent) {
nextIsOpenIndexes = [].concat(_toConsumableArray(_this.state.isOpenIndexes), [index]);
nextopenIndexes = [].concat(_toConsumableArray(_this.state.openIndexes), [index]);
} else {
nextIsOpenIndexes = [index];
nextopenIndexes = [index];
}
_this.setState({
isOpenIndexes: nextIsOpenIndexes
});
if (typeof _this.props.onChangeOpenIndexes === "function") {
_this.props.onChangeOpenIndexes(nextIsOpenIndexes);
if (!_this.state.controllable) {
/* Change state only if component is not controllable */
_this.setState({
openIndexes: nextopenIndexes
}, function () {
if (typeof _this.props.onChangeOpenIndexes === "function") {
_this.props.onChangeOpenIndexes(nextopenIndexes);
}
});
} else if (typeof _this.props.onChangeOpenIndexes === "function") {
_this.props.onChangeOpenIndexes(nextopenIndexes);
}
});
var controllable = Array.isArray(_this.props.openIndexes) && !Array.isArray(_this.props.defaultOpenIndexes);
var initialOpenIndexes = controllable ? _this.props.openIndexes || [] : Array.isArray(_this.props.defaultOpenIndexes) ? _this.props.defaultOpenIndexes : [];
/* If it is not controllable and not independent then select just first element */
if (!controllable && !props.independent) {
initialOpenIndexes = (0, _take.default)(initialOpenIndexes, 1);
}
_this.state = {
isOpenIndexes: props.independent ? props.defaultOpenIndexes : (0, _take.default)(props.defaultOpenIndexes)
openIndexes: initialOpenIndexes,
controllable: controllable
};

@@ -133,3 +156,3 @@ return _this;

},
isOpen: (0, _includes.default)(_this2.state.isOpenIndexes, index)
isOpen: (0, _includes.default)(_this2.state.openIndexes, index)
}));

@@ -142,3 +165,4 @@ });

onChangeOpenIndexes = _this$props.onChangeOpenIndexes,
restProps = _objectWithoutProperties(_this$props, ["independent", "defaultOpenIndexes", "onChangeOpenIndexes"]);
openIndexes = _this$props.openIndexes,
restProps = _objectWithoutProperties(_this$props, ["independent", "defaultOpenIndexes", "onChangeOpenIndexes", "openIndexes"]);

@@ -145,0 +169,0 @@ return _react.default.createElement("div", _extends({}, restProps, {

@@ -32,3 +32,3 @@ "use strict";

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 _typeof(obj) { "@babel/helpers - typeof"; 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); }

@@ -55,5 +55,3 @@ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

var AccordeonStatefull =
/*#__PURE__*/
function (_Component) {
var AccordeonStatefull = /*#__PURE__*/function (_Component) {
_inherits(AccordeonStatefull, _Component);

@@ -60,0 +58,0 @@

{
"name": "@infotech/uikit-accordeon",
"version": "0.2.0-beta.0",
"version": "0.2.0-beta.1",
"main": "lib/index.js",

@@ -25,3 +25,4 @@ "scripts": {

"rc",
"uikit"
"uikit",
"accordeon"
],

@@ -28,0 +29,0 @@ "files": [

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