diff --git a/dist/react-simpletabs.js b/dist/react-simpletabs.js index 5cc312b..1fe91da 100644 --- a/dist/react-simpletabs.js +++ b/dist/react-simpletabs.js @@ -84,10 +84,7 @@ return /******/ (function(modules) { // webpackBootstrap onMount: React.PropTypes.func, onBeforeChange: React.PropTypes.func, onAfterChange: React.PropTypes.func, - children: React.PropTypes.oneOfType([ - React.PropTypes.array, - React.PropTypes.element - ]).isRequired + children: React.PropTypes.node.isRequired }, getDefaultProps:function () { return { tabActive: 1 }; @@ -190,10 +187,7 @@ return /******/ (function(modules) { // webpackBootstrap React.PropTypes.string, React.PropTypes.element ]).isRequired, - children: React.PropTypes.oneOfType([ - React.PropTypes.array, - React.PropTypes.element - ]).isRequired + children: React.PropTypes.node.isRequired }, render:function () { return React.createElement("div", null, this.props.children); diff --git a/dist/react-simpletabs.min.js b/dist/react-simpletabs.min.js index 1396e32..c833c0e 100644 --- a/dist/react-simpletabs.min.js +++ b/dist/react-simpletabs.min.js @@ -7,4 +7,4 @@ * @author Pedro Nauck (https://github.com/pedronauck) * */ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?exports.ReactSimpleTabs=t(require("react")):e.ReactSimpleTabs=t(e.React)}(this,function(e){return function(e){function t(n){if(r[n])return r[n].exports;var s=r[n]={exports:{},id:n,loaded:!1};return e[n].call(s.exports,s,s.exports,t),s.loaded=!0,s.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){"use strict";var n=r(1),s=r(2);r(3);var a=n.createClass({displayName:"Tabs",propTypes:{className:n.PropTypes.oneOfType([n.PropTypes.array,n.PropTypes.string,n.PropTypes.object]),tabActive:n.PropTypes.number,onMount:n.PropTypes.func,onBeforeChange:n.PropTypes.func,onAfterChange:n.PropTypes.func,children:n.PropTypes.oneOfType([n.PropTypes.array,n.PropTypes.element]).isRequired},getDefaultProps:function(){return{tabActive:1}},getInitialState:function(){return{tabActive:this.props.tabActive}},componentDidMount:function(){var e=this.state.tabActive,t=this.refs["tab-panel"],r=this.refs["tab-menu-"+e];this.props.onMount&&this.props.onMount(e,t,r)},componentWillReceiveProps:function(e){e.tabActive&&this.setState({tabActive:e.tabActive})},render:function(){var e=s("tabs",this.props.className);return n.createElement("div",{className:e},this._getMenuItems(),this._getSelectedPanel())},setActive:function(e,t){var r=this.props.onAfterChange,n=this.props.onBeforeChange,s=this.refs["tab-panel"],a=this.refs["tab-menu-"+e];if(n){var o=n(e,s,a);if(o===!1)return}this.setState({tabActive:e},function(){r&&r(e,s,a)}),t.preventDefault()},_getMenuItems:function(){if(!this.props.children)throw new Error("Tabs must contain at least one Tabs.Panel");var e=n.Children.map(this.props.children,function(e,t){"function"==typeof e&&(e=e());var r="tab-menu-"+(t+1),a=e.props.title,o=s("tabs-menu-item",this.state.tabActive===t+1&&"is-active");return n.createElement("li",{ref:r,key:t,className:o},n.createElement("a",{href:"#",onClick:this.setActive.bind(this,t+1)},a))}.bind(this));return n.createElement("nav",{className:"tabs-navigation"},n.createElement("ul",{className:"tabs-menu"},e))},_getSelectedPanel:function(){var e=this.state.tabActive-1,t=this.props.children[e];return n.createElement("article",{ref:"tab-panel",className:"tab-panel"},t)}});a.Panel=n.createClass({displayName:"Panel",propTypes:{title:n.PropTypes.oneOfType([n.PropTypes.string,n.PropTypes.element]).isRequired,children:n.PropTypes.oneOfType([n.PropTypes.array,n.PropTypes.element]).isRequired},render:function(){return n.createElement("div",null,this.props.children)}}),e.exports=a},function(t,r,n){t.exports=e},function(e,t,r){function n(){for(var e,t="",r=0;r