From 98325dd23e251f56e16865a242ce4c213382b8f9 Mon Sep 17 00:00:00 2001 From: dignifiedquire Date: Wed, 6 May 2015 10:02:37 +0200 Subject: [PATCH] build --- dist/react-simpletabs.js | 8 +++++++- dist/react-simpletabs.min.js | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/dist/react-simpletabs.js b/dist/react-simpletabs.js index 1fe91da..5cfa79b 100644 --- a/dist/react-simpletabs.js +++ b/dist/react-simpletabs.js @@ -170,7 +170,13 @@ return /******/ (function(modules) { // webpackBootstrap }, _getSelectedPanel:function () { var index = this.state.tabActive - 1; - var $panel = this.props.children[index]; + var $panel + React.Children.forEach(this.props.children, function ($item, i) { + if (index === i) { + $panel = $item; + return; + } + }) return ( React.createElement("article", {ref: "tab-panel", className: "tab-panel"}, diff --git a/dist/react-simpletabs.min.js b/dist/react-simpletabs.min.js index c833c0e..12bc1b0 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(r){if(n[r])return n[r].exports;var s=n[r]={exports:{},id:r,loaded:!1};return e[r].call(s.exports,s,s.exports,t),s.loaded=!0,s.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";var r=n(1),s=n(2);n(3);var a=r.createClass({displayName:"Tabs",propTypes:{className:r.PropTypes.oneOfType([r.PropTypes.array,r.PropTypes.string,r.PropTypes.object]),tabActive:r.PropTypes.number,onMount:r.PropTypes.func,onBeforeChange:r.PropTypes.func,onAfterChange:r.PropTypes.func,children:r.PropTypes.node.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"],n=this.refs["tab-menu-"+e];this.props.onMount&&this.props.onMount(e,t,n)},componentWillReceiveProps:function(e){e.tabActive&&this.setState({tabActive:e.tabActive})},render:function(){var e=s("tabs",this.props.className);return r.createElement("div",{className:e},this._getMenuItems(),this._getSelectedPanel())},setActive:function(e,t){var n=this.props.onAfterChange,r=this.props.onBeforeChange,s=this.refs["tab-panel"],a=this.refs["tab-menu-"+e];if(r){var i=r(e,s,a);if(i===!1)return}this.setState({tabActive:e},function(){n&&n(e,s,a)}),t.preventDefault()},_getMenuItems:function(){if(!this.props.children)throw new Error("Tabs must contain at least one Tabs.Panel");var e=r.Children.map(this.props.children,function(e,t){"function"==typeof e&&(e=e());var n="tab-menu-"+(t+1),a=e.props.title,i=s("tabs-menu-item",this.state.tabActive===t+1&&"is-active");return r.createElement("li",{ref:n,key:t,className:i},r.createElement("a",{href:"#",onClick:this.setActive.bind(this,t+1)},a))}.bind(this));return r.createElement("nav",{className:"tabs-navigation"},r.createElement("ul",{className:"tabs-menu"},e))},_getSelectedPanel:function(){var e=this.state.tabActive-1,t=this.props.children[e];return r.createElement("article",{ref:"tab-panel",className:"tab-panel"},t)}});a.Panel=r.createClass({displayName:"Panel",propTypes:{title:r.PropTypes.oneOfType([r.PropTypes.string,r.PropTypes.element]).isRequired,children:r.PropTypes.node.isRequired},render:function(){return r.createElement("div",null,this.props.children)}}),e.exports=a},function(t,n,r){t.exports=e},function(e,t,n){function r(){for(var e,t="",n=0;n