@vtex/styleguide
Advanced tools
Comparing version 2.0.0-rc.9 to 2.0.0-rc.10
@@ -36,15 +36,6 @@ 'use strict'; | ||
function Toggle(props) { | ||
function Toggle() { | ||
_classCallCheck(this, Toggle); | ||
var _this = _possibleConstructorReturn(this, (Toggle.__proto__ || Object.getPrototypeOf(Toggle)).call(this, props)); | ||
_this.handleCheck = function () { | ||
return !_this.props.disabled && _this.setState({ checked: !_this.state.checked }); | ||
}; | ||
_this.state = { | ||
checked: props.checked | ||
}; | ||
return _this; | ||
return _possibleConstructorReturn(this, (Toggle.__proto__ || Object.getPrototypeOf(Toggle)).apply(this, arguments)); | ||
} | ||
@@ -58,4 +49,4 @@ | ||
disabled = _props.disabled, | ||
id = _props.id; | ||
var checked = this.state.checked; | ||
id = _props.id, | ||
checked = _props.checked; | ||
@@ -110,2 +101,7 @@ | ||
var eventHandlers = { | ||
onClick: this.props.onClick ? this.props.onClick : undefined, | ||
onChange: this.props.onChange ? this.props.onChange : undefined | ||
}; | ||
return _react2.default.createElement( | ||
@@ -116,4 +112,4 @@ 'label', | ||
className: 'flex flex-row items-center ' + (!disabled && 'pointer') | ||
}, this.props.htmlProps), | ||
this.props.children, | ||
}, eventHandlers), | ||
this.props.children ? this.props.children : '', | ||
_react2.default.createElement( | ||
@@ -138,3 +134,4 @@ 'div', | ||
transition: 'left .2s ease-out' | ||
} }, | ||
} | ||
}, | ||
_react2.default.createElement(_Deny2.default, { fill: '#ff8080' }) | ||
@@ -148,7 +145,8 @@ ), | ||
transition: 'left .2s ease-out' | ||
} }, | ||
} | ||
}, | ||
_react2.default.createElement(_Check2.default, { fill: '#8bc34a' }) | ||
) | ||
), | ||
_react2.default.createElement('input', { | ||
_react2.default.createElement('input', Object.assign({ | ||
id: '' + id, | ||
@@ -158,5 +156,4 @@ type: 'checkbox', | ||
disabled: disabled, | ||
checked: this.state.checked, | ||
onClick: this.handleCheck | ||
}) | ||
checked: checked | ||
}, eventHandlers)) | ||
); | ||
@@ -172,5 +169,3 @@ } | ||
disabled: false, | ||
htmlProps: {}, | ||
primary: false, | ||
secondary: false | ||
semantic: false | ||
}; | ||
@@ -180,9 +175,10 @@ | ||
checked: _propTypes2.default.bool, | ||
semantic: _propTypes2.default.bool, | ||
disabled: _propTypes2.default.bool, | ||
id: _propTypes2.default.string, | ||
htmlProps: _propTypes2.default.object, | ||
primary: _propTypes2.default.bool, | ||
secondary: _propTypes2.default.bool | ||
children: _propTypes2.default.node, | ||
onChange: _propTypes2.default.func, | ||
onClick: _propTypes2.default.func | ||
}; | ||
exports.default = Toggle; |
{ | ||
"name": "@vtex/styleguide", | ||
"version": "2.0.0-rc.9", | ||
"version": "2.0.0-rc.10", | ||
"scripts": { | ||
@@ -5,0 +5,0 @@ "test": "react-scripts test --env=jsdom", |
44326
908