circuitsim-component-selector
Advanced tools
Comparing version
@@ -35,2 +35,4 @@ 'use strict'; | ||
var PropTypes = _reactAddons2['default'].PropTypes; | ||
var CONFIG = { | ||
@@ -60,20 +62,6 @@ Mouse: [{ | ||
_get(Object.getPrototypeOf(ComponentSelector.prototype), 'constructor', this).call(this, props); | ||
this.state = { | ||
selectedButton: { | ||
group: 'Mouse', | ||
button: 'Select' | ||
} | ||
}; | ||
this.toButtonGroups = this.toButtonGroups.bind(this); | ||
this.buttonClicked = this.buttonClicked.bind(this); | ||
} | ||
_createClass(ComponentSelector, [{ | ||
key: 'buttonClicked', | ||
value: function buttonClicked(selectedButton) { | ||
this.setState({ | ||
selectedButton: selectedButton | ||
}); | ||
} | ||
}, { | ||
key: 'toButtonGroups', | ||
@@ -86,3 +74,3 @@ value: function toButtonGroups(buttonProps, groupName) { | ||
theme: this.props.theme, | ||
onClick: this.buttonClicked, | ||
onClick: this.props.onButtonClicked, | ||
selectedButton: selectedButton | ||
@@ -111,5 +99,22 @@ }); | ||
ComponentSelector.propTypes = { | ||
theme: _reactAddons2['default'].PropTypes.object.isRequired, | ||
style: _reactAddons2['default'].PropTypes.object | ||
theme: PropTypes.object.isRequired, | ||
style: PropTypes.object, | ||
selectedButton: PropTypes.shape({ | ||
group: PropTypes.string.isRequired, | ||
button: PropTypes.string.isRequired | ||
}), | ||
onButtonClicked: PropTypes.func | ||
}; | ||
ComponentSelector.defaultProps = { | ||
selectedButton: { | ||
selectedButton: { | ||
group: 'Mouse', | ||
button: 'Select' | ||
} | ||
}, | ||
onButtonClicked: function onButtonClicked() /* { group, button } */{} | ||
}; | ||
module.exports = exports['default']; |
{ | ||
"name": "circuitsim-component-selector", | ||
"version": "0.2.4", | ||
"version": "0.3.0", | ||
"description": "Sidebar with buttons to select a circuit component.", | ||
@@ -5,0 +5,0 @@ "main": "dist/ComponentSelector.js", |
29243
0.19%460
0.22%