diff --git a/dist/react-simpletabs.js b/dist/react-simpletabs.js index 9834249..1103365 100644 --- a/dist/react-simpletabs.js +++ b/dist/react-simpletabs.js @@ -20,41 +20,41 @@ return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; -/******/ + /******/ // The require function /******/ function __webpack_require__(moduleId) { -/******/ + /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) /******/ return installedModules[moduleId].exports; -/******/ + /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ exports: {}, /******/ id: moduleId, /******/ loaded: false /******/ }; -/******/ + /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ + /******/ // Flag the module as loaded /******/ module.loaded = true; -/******/ + /******/ // Return the exports of the module /******/ return module.exports; /******/ } -/******/ -/******/ + + /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; -/******/ + /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; -/******/ + /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; -/******/ + /******/ // Load entry module and return exports /******/ return __webpack_require__(0); /******/ }) @@ -107,7 +107,9 @@ return /******/ (function(modules) { // webpackBootstrap } }, componentWillReceiveProps: function(newProps){ - if(newProps.tabActive){ this.setState({tabActive: newProps.tabActive}) } + if(newProps.tabActive && newProps.tabActive !== this.props.tabActive){ + this.setState({tabActive: newProps.tabActive}); + } }, render:function () { var className = classNames('tabs', this.props.className); @@ -134,8 +136,6 @@ return /******/ (function(modules) { // webpackBootstrap onAfterChange(index, $selectedPanel, $selectedTabMenu); } }); - - e.preventDefault(); }, _getMenuItems:function () { if (!this.props.children) { @@ -159,7 +159,7 @@ return /******/ (function(modules) { // webpackBootstrap return ( React.createElement("li", {ref: ref, key: index, className: classes}, - React.createElement("a", {href: "#", onClick: this.setActive.bind(this, index + 1)}, + React.createElement("a", {onClick: this.setActive.bind(this, index + 1)}, title ) ) @@ -211,7 +211,13 @@ return /******/ (function(modules) { // webpackBootstrap /* 2 */ /***/ function(module, exports, __webpack_require__) { - /** @jsx React.DOM */function classNames() { + var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/** @jsx React.DOM *//*! + Copyright (c) 2015 Jed Watson. + Licensed under the MIT License (MIT), see + http://jedwatson.github.io/classnames + */ + + function classNames() { var classes = ''; var arg; @@ -237,11 +243,18 @@ return /******/ (function(modules) { // webpackBootstrap return classes.substr(1); } - // safely export classNames in case the script is included directly on a page + // safely export classNames for node / browserify if (typeof module !== 'undefined' && module.exports) { module.exports = classNames; } + // safely export classNames for RequireJS + if (true) { + !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function() { + return classNames; + }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); + } + /***/ }, /* 3 */ @@ -252,3 +265,4 @@ return /******/ (function(modules) { // webpackBootstrap /***/ } /******/ ]) }); +; \ No newline at end of file diff --git a/lib/react-simpletabs.jsx b/lib/react-simpletabs.jsx index 0b0dc2f..ed93f5a 100644 --- a/lib/react-simpletabs.jsx +++ b/lib/react-simpletabs.jsx @@ -42,7 +42,9 @@ var Tabs = React.createClass({ } }, componentWillReceiveProps: function(newProps){ - if(newProps.tabActive){ this.setState({tabActive: newProps.tabActive}) } + if(newProps.tabActive && newProps.tabActive !== this.props.tabActive){ + this.setState({tabActive: newProps.tabActive}); + } }, render () { var className = classNames('tabs', this.props.className); @@ -69,8 +71,6 @@ var Tabs = React.createClass({ onAfterChange(index, $selectedPanel, $selectedTabMenu); } }); - - e.preventDefault(); }, _getMenuItems () { if (!this.props.children) { @@ -94,7 +94,7 @@ var Tabs = React.createClass({ return (