accessible-react-tabs
Advanced tools
Comparing version 0.0.8 to 0.0.9
@@ -21,2 +21,6 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
}; | ||
if (_this.props.index === _this.props.selectedIndex && _this.props.callback) { | ||
_this.props.callback(); | ||
} | ||
return _this; | ||
@@ -23,0 +27,0 @@ } |
@@ -42,15 +42,12 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
if (this.state.selected === index) { | ||
if (this.props.callback) { | ||
this.props.callback; | ||
} | ||
return; | ||
} | ||
if (this.props.callback) { | ||
this.props.callback; | ||
} | ||
this.setState({ | ||
selected: index | ||
}); | ||
if (this.props.data[index].callback) { | ||
this.props.data[index].callback(); | ||
} | ||
}; | ||
@@ -75,9 +72,9 @@ | ||
if (this.props.callback) { | ||
this.props.callback; | ||
} | ||
this.setState({ | ||
selected: targetIndex | ||
}); | ||
if (this.props.callback) { | ||
this.props.callback(); | ||
} | ||
}; | ||
@@ -105,2 +102,3 @@ | ||
var label = tab.label; | ||
var cb = tab.callback; | ||
return React.createElement(Tab, { key: index, index: index, selectedIndex: _this2.state.selected, label: label, onClick: _this2.handleClick, onKeyDown: _this2.handleKeyDown }); | ||
@@ -107,0 +105,0 @@ }) |
@@ -29,2 +29,6 @@ "use strict"; | ||
}; | ||
if (_this.props.index === _this.props.selectedIndex && _this.props.callback) { | ||
_this.props.callback(); | ||
} | ||
return _this; | ||
@@ -31,0 +35,0 @@ } |
@@ -57,15 +57,12 @@ 'use strict'; | ||
if (this.state.selected === index) { | ||
if (this.props.callback) { | ||
this.props.callback; | ||
} | ||
return; | ||
} | ||
if (this.props.callback) { | ||
this.props.callback; | ||
} | ||
this.setState({ | ||
selected: index | ||
}); | ||
if (this.props.data[index].callback) { | ||
this.props.data[index].callback(); | ||
} | ||
}; | ||
@@ -90,9 +87,9 @@ | ||
if (this.props.callback) { | ||
this.props.callback; | ||
} | ||
this.setState({ | ||
selected: targetIndex | ||
}); | ||
if (this.props.callback) { | ||
this.props.callback(); | ||
} | ||
}; | ||
@@ -120,2 +117,3 @@ | ||
var label = tab.label; | ||
var cb = tab.callback; | ||
return _react2.default.createElement(_Tab2.default, { key: index, index: index, selectedIndex: _this2.state.selected, label: label, onClick: _this2.handleClick, onKeyDown: _this2.handleKeyDown }); | ||
@@ -122,0 +120,0 @@ }) |
{ | ||
"name": "accessible-react-tabs", | ||
"version": "0.0.8", | ||
"version": "0.0.9", | ||
"description": "Accessible tab component for React", | ||
@@ -5,0 +5,0 @@ "repository": { |
20178
357