Comparing version 0.0.7 to 0.0.8
/*! | ||
* Eyzy v0.0.6 | ||
* (c) 2019 amsik | ||
* Eyzy v0.0.8 | ||
* (c) 2020 amsik | ||
* Released under the MIT License. | ||
@@ -297,5 +297,46 @@ */ | ||
var Switch = /** @class */ (function (_super) { | ||
__extends(Switch, _super); | ||
function Switch(props) { | ||
var _this = _super.call(this, props) || this; | ||
_this.handleClick = function () { | ||
if (_this.props.onChange) { | ||
_this.props.onChange(!_this.state.checked); | ||
} | ||
if (!('checked' in _this.props)) { | ||
_this.setState({ checked: !_this.state.checked }); | ||
} | ||
}; | ||
var checked = 'checked' in props | ||
? props.checked | ||
: props.defaultChecked; | ||
_this.state = { | ||
checked: checked || false | ||
}; | ||
return _this; | ||
} | ||
Switch.getDerivedStateFromProps = function (props, state) { | ||
if ('checked' in props) { | ||
return __assign(__assign({}, state), { checked: props.checked }); | ||
} | ||
return null; | ||
}; | ||
Switch.prototype.render = function () { | ||
var _a = this.props, size = _a.size, children = _a.children; | ||
var classNames = cn('eyzy-switch', size && "eyzy-switch-" + size); | ||
var button = React.createElement("button", { className: classNames, onClick: this.handleClick, "aria-checked": this.state.checked }); | ||
if (children) { | ||
return (React.createElement("span", { className: "eyzy-switch-container" }, | ||
button, | ||
React.createElement("span", { className: "eyzy-switch-text", onClick: this.handleClick }, children))); | ||
} | ||
return button; | ||
}; | ||
return Switch; | ||
}(React.PureComponent)); | ||
exports.Button = Button; | ||
exports.Checkbox = Checkbox; | ||
exports.Input = Input; | ||
exports.Switch = Switch; | ||
exports.Tabs = Tabs; | ||
@@ -302,0 +343,0 @@ exports.Tag = Tag; |
/*! | ||
* Eyzy v0.0.6 | ||
* (c) 2019 amsik | ||
* Eyzy v0.0.8 | ||
* (c) 2020 amsik | ||
* Released under the MIT License. | ||
@@ -291,3 +291,43 @@ */ | ||
export { Button, Checkbox, Input, Tabs, Tag }; | ||
var Switch = /** @class */ (function (_super) { | ||
__extends(Switch, _super); | ||
function Switch(props) { | ||
var _this = _super.call(this, props) || this; | ||
_this.handleClick = function () { | ||
if (_this.props.onChange) { | ||
_this.props.onChange(!_this.state.checked); | ||
} | ||
if (!('checked' in _this.props)) { | ||
_this.setState({ checked: !_this.state.checked }); | ||
} | ||
}; | ||
var checked = 'checked' in props | ||
? props.checked | ||
: props.defaultChecked; | ||
_this.state = { | ||
checked: checked || false | ||
}; | ||
return _this; | ||
} | ||
Switch.getDerivedStateFromProps = function (props, state) { | ||
if ('checked' in props) { | ||
return __assign(__assign({}, state), { checked: props.checked }); | ||
} | ||
return null; | ||
}; | ||
Switch.prototype.render = function () { | ||
var _a = this.props, size = _a.size, children = _a.children; | ||
var classNames = cn('eyzy-switch', size && "eyzy-switch-" + size); | ||
var button = React.createElement("button", { className: classNames, onClick: this.handleClick, "aria-checked": this.state.checked }); | ||
if (children) { | ||
return (React.createElement("span", { className: "eyzy-switch-container" }, | ||
button, | ||
React.createElement("span", { className: "eyzy-switch-text", onClick: this.handleClick }, children))); | ||
} | ||
return button; | ||
}; | ||
return Switch; | ||
}(React.PureComponent)); | ||
export { Button, Checkbox, Input, Switch, Tabs, Tag }; | ||
//# sourceMappingURL=eyzy.js.map |
{ | ||
"name": "eyzy", | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"author": "Kostiantyn", | ||
@@ -5,0 +5,0 @@ "description": "React UI Toolkit", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
91269
1022