| 7 | |
| 8 | const factory = (ripple, FontIcon) => { |
| 9 | class Button extends Component { |
| 10 | static propTypes = { |
| 11 | accent: PropTypes.bool, |
| 12 | children: PropTypes.node, |
| 13 | className: PropTypes.string, |
| 14 | disabled: PropTypes.bool, |
| 15 | flat: PropTypes.bool, |
| 16 | floating: PropTypes.bool, |
| 17 | href: PropTypes.string, |
| 18 | icon: PropTypes.oneOfType([ |
| 19 | PropTypes.string, |
| 20 | PropTypes.element |
| 21 | ]), |
| 22 | inverse: PropTypes.bool, |
| 23 | label: PropTypes.string, |
| 24 | mini: PropTypes.bool, |
| 25 | neutral: PropTypes.bool, |
| 26 | onMouseLeave: PropTypes.func, |
| 27 | onMouseUp: PropTypes.func, |
| 28 | primary: PropTypes.bool, |
| 29 | raised: PropTypes.bool, |
| 30 | theme: PropTypes.shape({ |
| 31 | accent: PropTypes.string, |
| 32 | button: PropTypes.string, |
| 33 | flat: PropTypes.string, |
| 34 | floating: PropTypes.string, |
| 35 | icon: PropTypes.string, |
| 36 | inverse: PropTypes.string, |
| 37 | mini: PropTypes.string, |
| 38 | neutral: PropTypes.string, |
| 39 | primary: PropTypes.string, |
| 40 | raised: PropTypes.string, |
| 41 | rippleWrapper: PropTypes.string, |
| 42 | toggle: PropTypes.string |
| 43 | }), |
| 44 | type: PropTypes.string |
| 45 | }; |
| 46 | |
| 47 | static defaultProps = { |
| 48 | accent: false, |
| 49 | className: '', |
| 50 | flat: false, |
| 51 | floating: false, |
| 52 | mini: false, |
| 53 | neutral: true, |
| 54 | primary: false, |
| 55 | raised: false, |
| 56 | type: 'button' |
| 57 | }; |
| 58 | |
| 59 | handleMouseUp = (event) => { |
| 60 | this.refs.button.blur(); |
| 61 | if (this.props.onMouseUp) this.props.onMouseUp(event); |
| 62 | }; |
| 63 | |
| 64 | handleMouseLeave = (event) => { |
| 65 | this.refs.button.blur(); |
| 66 | if (this.props.onMouseLeave) this.props.onMouseLeave(event); |