@talixo/accordion
Advanced tools
Comparing version 1.0.0-alpha.35 to 1.0.0-alpha.36
@@ -1,1 +0,1 @@ | ||
"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var React=_interopDefault(require("react")),PropTypes=_interopDefault(require("prop-types")),shared=require("@talixo/shared"),collapse=require("@talixo/collapse"),classCallCheck=function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")},createClass=function(){function e(e,n){for(var t=0;t<n.length;t++){var o=n[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(n,t,o){return t&&e(n.prototype,t),o&&e(n,o),n}}(),inherits=function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function, not "+typeof n);e.prototype=Object.create(n&&n.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),n&&(Object.setPrototypeOf?Object.setPrototypeOf(e,n):e.__proto__=n)},objectWithoutProperties=function(e,n){var t={};for(var o in e)n.indexOf(o)>=0||Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},possibleConstructorReturn=function(e,n){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!n||"object"!=typeof n&&"function"!=typeof n?e:n},propTypes={className:PropTypes.string,smooth:PropTypes.bool,animationSpeed:PropTypes.number,options:PropTypes.arrayOf(PropTypes.shape({label:PropTypes.node.isRequired,content:PropTypes.node.isRequired,animationSpeed:PropTypes.number})).isRequired,value:PropTypes.any,onChange:PropTypes.func,renderOpenIcon:PropTypes.func,renderCloseIcon:PropTypes.func,buildId:PropTypes.func,multi:PropTypes.bool},defaultProps={animationSpeed:200,smooth:!0,multi:!1,buildId:function(e,n){return n}};function buildElement(e,n,t){var o=e.buildId,r=e.onOpen,a=e.onClose,i=e.value,l=e.smooth,s=e.animationSpeed,c=e.renderOpenIcon,p=e.renderCloseIcon,u=o(n,t),d=-1===i.indexOf(u),f=shared.buildClassName("accordion-element",null,{collapsed:d}),m="animationSpeed"in n?n.animationSpeed:s,h={role:"tab",className:shared.prefix("accordion-element","toggle"),onClick:function(){return d?r(u):a(u)},"aria-expanded":!d},b={role:"tabpanel",className:shared.prefix("accordion-element","content"),smooth:l,animationSpeed:m,collapsed:d,"aria-hidden":d},v=d?c:p,y=v?React.createElement("span",{className:shared.prefix("accordion-element","toggle-icon")},v(n,Object.assign({},e,{id:u,collapsed:d}))):null,C=shared.prefix("accordion-element","toggle-inner"),P=shared.prefix("accordion-element","content-inner");return React.createElement("div",{className:f,key:t+"--"+u},React.createElement("button",Object.assign({type:"button"},h),React.createElement("div",{className:C},n.label,y)),React.createElement(collapse.Collapse,b,React.createElement("div",{className:P},n.content)))}function isSameList(e,n){if(e.length!==n.length)return!1;for(var t=0;t<e.length;t++)if(-1===n.indexOf(e[t]))return!1;return!0}var Accordion=function(e){function n(){var e,t,o;classCallCheck(this,n);for(var r=arguments.length,a=Array(r),i=0;i<r;i++)a[i]=arguments[i];return t=o=possibleConstructorReturn(this,(e=n.__proto__||Object.getPrototypeOf(n)).call.apply(e,[this].concat(a))),o.state={value:null==o.props.value?[]:[].concat(o.props.value)},o.change=function(e){var n=o.props,t=n.value,r=n.multi,a=n.onChange;isSameList(o.state.value,e)||(void 0===t&&o.setState({value:e}),r||(e=e.length?e[0]:null),a&&a(e))},o.onOpen=function(e){var n=o.props.multi,t=o.state.value,r=n?t.filter(function(n){return n!==e}).concat(e):[e];o.change(r)},o.onClose=function(e){var n=o.props.multi,t=o.state.value,r=n?t.filter(function(n){return n!==e}):[];o.change(r)},possibleConstructorReturn(o,t)}return inherits(n,e),createClass(n,[{key:"componentWillReceiveProps",value:function(e){void 0!==e.value&&e.value!==this.state.value&&this.setState({value:null==e.value?[]:[].concat(e.value)})}},{key:"render",value:function(){var e=this.props,n=e.options,t=e.className,o=e.smooth,r=e.animationSpeed,a=(e.value,e.multi,e.buildId),i=(e.onChange,e.renderOpenIcon),l=e.renderCloseIcon,s=objectWithoutProperties(e,["options","className","smooth","animationSpeed","value","multi","buildId","onChange","renderOpenIcon","renderCloseIcon"]),c=this.state.value,p=parseInt(r,10)||null,u=shared.buildClassName("accordion",t),d=buildElement.bind(null,{onOpen:this.onOpen,onClose:this.onClose,buildId:a,value:c,smooth:o,animationSpeed:p,renderOpenIcon:i,renderCloseIcon:l}),f=n.map(d);return React.createElement("div",Object.assign({className:u},s),f)}}]),n}(React.PureComponent);Accordion.displayName="Accordion",Accordion.propTypes=propTypes,Accordion.defaultProps=defaultProps,exports.Accordion=Accordion; | ||
"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var PropTypes=_interopDefault(require("prop-types")),shared=require("@talixo/shared"),collapse=require("@talixo/collapse");function createCommonjsModule(e,t){return e(t={exports:{}},t.exports),t.exports}var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},classCallCheck=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},createClass=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),inherits=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)},objectWithoutProperties=function(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n},possibleConstructorReturn=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},m=require("object-assign"),n=require("fbjs/lib/emptyObject"),p=require("fbjs/lib/emptyFunction"),q="function"==typeof Symbol&&Symbol.for,r=q?Symbol.for("react.element"):60103,t=q?Symbol.for("react.call"):60104,u=q?Symbol.for("react.return"):60105,v=q?Symbol.for("react.portal"):60106,w=q?Symbol.for("react.fragment"):60107,x="function"==typeof Symbol&&Symbol.iterator;function y(e){for(var t=arguments.length-1,n="Minified React error #"+e+"; visit http://facebook.github.io/react/docs/error-decoder.html?invariant="+e,r=0;r<t;r++)n+="&args[]="+encodeURIComponent(arguments[r+1]);throw(t=Error(n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings.")).name="Invariant Violation",t.framesToPop=1,t}var z={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}};function A(e,t,r){this.props=e,this.context=t,this.refs=n,this.updater=r||z}function B(e,t,r){this.props=e,this.context=t,this.refs=n,this.updater=r||z}function C(){}A.prototype.isReactComponent={},A.prototype.setState=function(e,t){"object"!==(void 0===e?"undefined":_typeof(e))&&"function"!=typeof e&&null!=e&&y("85"),this.updater.enqueueSetState(this,e,t,"setState")},A.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},C.prototype=A.prototype;var D=B.prototype=new C;function E(e,t,r){this.props=e,this.context=t,this.refs=n,this.updater=r||z}D.constructor=B,m(D,A.prototype),D.isPureReactComponent=!0;var F=E.prototype=new C;F.constructor=E,m(F,A.prototype),F.unstable_isAsyncReactComponent=!0,F.render=function(){return this.props.children};var G={current:null},H=Object.prototype.hasOwnProperty,I={key:!0,ref:!0,__self:!0,__source:!0};function J(e,t,n){var o,a={},i=null,l=null;if(null!=t)for(o in void 0!==t.ref&&(l=t.ref),void 0!==t.key&&(i=""+t.key),t)H.call(t,o)&&!I.hasOwnProperty(o)&&(a[o]=t[o]);var u=arguments.length-2;if(1===u)a.children=n;else if(1<u){for(var c=Array(u),s=0;s<u;s++)c[s]=arguments[s+2];a.children=c}if(e&&e.defaultProps)for(o in u=e.defaultProps)void 0===a[o]&&(a[o]=u[o]);return{$$typeof:r,type:e,key:i,ref:l,props:a,_owner:G.current}}function K(e){return"object"===(void 0===e?"undefined":_typeof(e))&&null!==e&&e.$$typeof===r}function escape(e){var t={"=":"=0",":":"=2"};return"$"+(""+e).replace(/[=:]/g,function(e){return t[e]})}var L=/\/+/g,M=[];function N(e,t,n,r){if(M.length){var o=M.pop();return o.result=e,o.keyPrefix=t,o.func=n,o.context=r,o.count=0,o}return{result:e,keyPrefix:t,func:n,context:r,count:0}}function O(e){e.result=null,e.keyPrefix=null,e.func=null,e.context=null,e.count=0,10>M.length&&M.push(e)}function P(e,n,o,a){var i=void 0===e?"undefined":_typeof(e);"undefined"!==i&&"boolean"!==i||(e=null);var l=!1;if(null===e)l=!0;else switch(i){case"string":case"number":l=!0;break;case"object":switch(e.$$typeof){case r:case t:case u:case v:l=!0}}if(l)return o(a,e,""===n?"."+Q(e,0):n),1;if(l=0,n=""===n?".":n+":",Array.isArray(e))for(var c=0;c<e.length;c++){var s=n+Q(i=e[c],c);l+=P(i,s,o,a)}else if(null===e||void 0===e?s=null:s="function"==typeof(s=x&&e[x]||e["@@iterator"])?s:null,"function"==typeof s)for(e=s.call(e),c=0;!(i=e.next()).done;)l+=P(i=i.value,s=n+Q(i,c++),o,a);else"object"===i&&y("31","[object Object]"===(o=""+e)?"object with keys {"+Object.keys(e).join(", ")+"}":o,"");return l}function Q(e,t){return"object"===(void 0===e?"undefined":_typeof(e))&&null!==e&&null!=e.key?escape(e.key):t.toString(36)}function R(e,t){e.func.call(e.context,t,e.count++)}function S(e,t,n){var o=e.result,a=e.keyPrefix;e=e.func.call(e.context,t,e.count++),Array.isArray(e)?T(e,o,n,p.thatReturnsArgument):null!=e&&(K(e)&&(t=a+(!e.key||t&&t.key===e.key?"":(""+e.key).replace(L,"$&/")+"/")+n,e={$$typeof:r,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}),o.push(e))}function T(e,t,n,r,o){var a="";null!=n&&(a=(""+n).replace(L,"$&/")+"/"),t=N(t,a,r,o),null==e||P(e,"",S,t),O(t)}var U={Children:{map:function(e,t,n){if(null==e)return e;var r=[];return T(e,r,null,t,n),r},forEach:function(e,t,n){if(null==e)return e;t=N(null,null,t,n),null==e||P(e,"",R,t),O(t)},count:function(e){return null==e?0:P(e,"",p.thatReturnsNull,null)},toArray:function(e){var t=[];return T(e,t,null,p.thatReturnsArgument),t},only:function(e){return K(e)||y("143"),e}},Component:A,PureComponent:B,unstable_AsyncComponent:E,Fragment:w,createElement:J,cloneElement:function(e,t,n){var o=m({},e.props),a=e.key,i=e.ref,l=e._owner;if(null!=t){if(void 0!==t.ref&&(i=t.ref,l=G.current),void 0!==t.key&&(a=""+t.key),e.type&&e.type.defaultProps)var u=e.type.defaultProps;for(c in t)H.call(t,c)&&!I.hasOwnProperty(c)&&(o[c]=void 0===t[c]&&void 0!==u?u[c]:t[c])}var c=arguments.length-2;if(1===c)o.children=n;else if(1<c){u=Array(c);for(var s=0;s<c;s++)u[s]=arguments[s+2];o.children=u}return{$$typeof:r,type:e.type,key:a,ref:i,props:o,_owner:l}},createFactory:function(e){var t=J.bind(null,e);return t.type=e,t},isValidElement:K,version:"16.2.0",__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:{ReactCurrentOwner:G,assign:m}},V=Object.freeze({default:U}),W=V&&U||V;module.exports=W.default?W.default:W;var react_production_min=Object.freeze({}),react=createCommonjsModule(function(e){e.exports=react_production_min}),propTypes={className:PropTypes.string,smooth:PropTypes.bool,animationSpeed:PropTypes.number,options:PropTypes.arrayOf(PropTypes.shape({label:PropTypes.node.isRequired,content:PropTypes.node.isRequired,animationSpeed:PropTypes.number})).isRequired,value:PropTypes.any,onChange:PropTypes.func,renderOpenIcon:PropTypes.func,renderCloseIcon:PropTypes.func,buildId:PropTypes.func,multi:PropTypes.bool},defaultProps={animationSpeed:200,smooth:!0,multi:!1,buildId:function(e,t){return t}};function buildElement(e,t,n){var r=e.buildId,o=e.onOpen,a=e.onClose,i=e.value,l=e.smooth,u=e.animationSpeed,c=e.renderOpenIcon,s=e.renderCloseIcon,p=r(t,n),f=-1===i.indexOf(p),d=shared.buildClassName("accordion-element",null,{collapsed:f}),y="animationSpeed"in t?t.animationSpeed:u,m={role:"tab",className:shared.prefix("accordion-element","toggle"),onClick:function(){return f?o(p):a(p)},"aria-expanded":!f},h={role:"tabpanel",className:shared.prefix("accordion-element","content"),smooth:l,animationSpeed:y,collapsed:f,"aria-hidden":f},v=f?c:s,b=v?react.createElement("span",{className:shared.prefix("accordion-element","toggle-icon")},v(t,Object.assign({},e,{id:p,collapsed:f}))):null,P=shared.prefix("accordion-element","toggle-inner"),g=shared.prefix("accordion-element","content-inner");return react.createElement("div",{className:d,key:n+"--"+p},react.createElement("button",Object.assign({type:"button"},m),react.createElement("div",{className:P},t.label,b)),react.createElement(collapse.Collapse,h,react.createElement("div",{className:g},t.content)))}function isSameList(e,t){if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(-1===t.indexOf(e[n]))return!1;return!0}var Accordion=function(e){function t(){var e,n,r;classCallCheck(this,t);for(var o=arguments.length,a=Array(o),i=0;i<o;i++)a[i]=arguments[i];return n=r=possibleConstructorReturn(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(a))),r.state={value:null==r.props.value?[]:[].concat(r.props.value)},r.change=function(e){var t=r.props,n=t.value,o=t.multi,a=t.onChange;isSameList(r.state.value,e)||(void 0===n&&r.setState({value:e}),o||(e=e.length?e[0]:null),a&&a(e))},r.onOpen=function(e){var t=r.props.multi,n=r.state.value,o=t?n.filter(function(t){return t!==e}).concat(e):[e];r.change(o)},r.onClose=function(e){var t=r.props.multi,n=r.state.value,o=t?n.filter(function(t){return t!==e}):[];r.change(o)},possibleConstructorReturn(r,n)}return inherits(t,e),createClass(t,[{key:"componentWillReceiveProps",value:function(e){void 0!==e.value&&e.value!==this.state.value&&this.setState({value:null==e.value?[]:[].concat(e.value)})}},{key:"render",value:function(){var e=this.props,t=e.options,n=e.className,r=e.smooth,o=e.animationSpeed,a=(e.value,e.multi,e.buildId),i=(e.onChange,e.renderOpenIcon),l=e.renderCloseIcon,u=objectWithoutProperties(e,["options","className","smooth","animationSpeed","value","multi","buildId","onChange","renderOpenIcon","renderCloseIcon"]),c=this.state.value,s=parseInt(o,10)||null,p=shared.buildClassName("accordion",n),f=buildElement.bind(null,{onOpen:this.onOpen,onClose:this.onClose,buildId:a,value:c,smooth:r,animationSpeed:s,renderOpenIcon:i,renderCloseIcon:l}),d=t.map(f);return react.createElement("div",Object.assign({className:p},u),d)}}]),t}(react.PureComponent);Accordion.displayName="Accordion",Accordion.propTypes=propTypes,Accordion.defaultProps=defaultProps,exports.Accordion=Accordion; |
{ | ||
"name": "@talixo/accordion", | ||
"version": "1.0.0-alpha.35", | ||
"version": "1.0.0-alpha.36", | ||
"description": "UI component which represents Accordion", | ||
@@ -35,5 +35,4 @@ "main": "dist/index.js", | ||
"@talixo/shared": "^1.0.0-alpha.35", | ||
"prop-types": "^15.6.1", | ||
"react": "^16.2.0" | ||
"prop-types": "^15.6.1" | ||
} | ||
} |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
106512
3
2298
2
1