text: 'use strict';function _interopDefault(a){return a&&'object'==typeof a&&'default'in a?a['default']:a}var React=_interopDefault(require('react')),PropTypes=_interopDefault(require('prop-types')),mergeClassName=function(a){for(var b=arguments.length,c=Array(1<b?b-1:0),d=1;d<b;d++)c[d-1]=arguments[d];return a&&a.className&&c.unshift(a.className),c.join(' ')},Context=React.createContext({isExpanded:!0,collapsible:!0,onToggleCollapse:function(){}}),classCallCheck=function(a,b){if(!(a instanceof b))throw new TypeError('Cannot call a class as a function')},createClass=function(){function a(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,'value'in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),_extends=Object.assign||function(a){for(var b,c=1;c<arguments.length;c++)for(var d in b=arguments[c],b)Object.prototype.hasOwnProperty.call(b,d)&&(a[d]=b[d]);return a},inherits=function(a,b){if('function'!=typeof b&&null!==b)throw new TypeError('Super expression must either be null or a function, not '+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)},possibleConstructorReturn=function(a,b){if(!a)throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');return b&&('object'==typeof b||'function'==typeof b)?b:a},Panel=function(a){function b(a){classCallCheck(this,b);var c=possibleConstructorReturn(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a));return c.onToggleCollapse=c.onToggleCollapse.bind(c),c.state={isExpanded:a.defaultExpanding,collapsible:a.collapsible},c}return inherits(b,a),createClass(b,[{key:'onToggleCollapse',value:function(){this.props.collapsible&&this.setState({isExpanded:!this.state.isExpanded})}},{key:'render',value:function(){return React.createElement(Context.Provider,{value:_extends({},this.state,{onToggleCollapse:this.onToggleCollapse})},React.createElement('div',{className:mergeClassName(this.props,'la-panel',this.state.isExpanded?'':'is-collapsed')},this.props.children))}}]),b}(React.Component);Panel.defaultProps={defaultExpanding:!0,collapsible:!0,showIcon:!0},Panel.propTypes={collapsible:PropTypes.bool,defaultExpanding:PropTypes.bool,showIcon:PropTypes.bool};var Header=function(a){return React.createElement(Context.Consumer,null,function(b){var c=b.onToggleCollapse,d=b.collapsible;return React.createElement('div',{className:mergeClassName(a,'la-panel__header')},d&&React.createElement('span',{className:'la-panel__indicator',onClick:c}),a.children)})},Body=function(a){return React.createElement(Context.Consumer,null,function(b){var c=b.isExpanded;return c&&React.createElement('div',{className:mergeClassName(a,'la-panel__body')},a.children)})};Panel.Header=Header,Panel.Body=Body,module.exports=Panel;
  