Comparing version 0.0.9 to 0.0.10
/*! | ||
* Eyzy v0.0.8 | ||
* (c) 2020 amsik | ||
* Eyzy v0.0.10 | ||
* (c) 2021 amsik | ||
* Released under the MIT License. | ||
@@ -363,5 +363,32 @@ */ | ||
function getName(name) { | ||
return name || '' + getName['_']++; | ||
} | ||
function isChecked(o, val) { | ||
return o.value === val || o.label === val; | ||
} | ||
getName._ = 0; | ||
function RadioGroup(props) { | ||
var options = props.options, name = props.name, value = props.value, onChange = props.onChange; | ||
var rName = getName(name); | ||
var selectedValue = value; | ||
if (selectedValue === undefined && options[0]) { | ||
selectedValue = options[0].value || options[0].label; | ||
} | ||
var handleChange = function (e) { | ||
onChange(e.target.value); | ||
}; | ||
return (React.createElement("div", { className: 'eyzy-radio-group' }, options.map(function (o, i) { return (React.createElement("label", { key: i, className: cn({ active: isChecked(o, selectedValue) }) }, | ||
React.createElement("input", { type: "radio", name: rName, value: o.value || o.label, disabled: o.disabled, checked: isChecked(o, selectedValue), onChange: handleChange }), | ||
o.label)); }))); | ||
} | ||
var Radio = { | ||
Group: RadioGroup | ||
}; | ||
exports.Button = Button; | ||
exports.Checkbox = Checkbox; | ||
exports.Input = Input; | ||
exports.Radio = Radio; | ||
exports.Switch = Switch; | ||
@@ -368,0 +395,0 @@ exports.Tabs = Tabs; |
/*! | ||
* Eyzy v0.0.8 | ||
* (c) 2020 amsik | ||
* Eyzy v0.0.10 | ||
* (c) 2021 amsik | ||
* Released under the MIT License. | ||
@@ -357,3 +357,29 @@ */ | ||
export { Button, Checkbox, Input, Switch, Tabs, Tag }; | ||
function getName(name) { | ||
return name || '' + getName['_']++; | ||
} | ||
function isChecked(o, val) { | ||
return o.value === val || o.label === val; | ||
} | ||
getName._ = 0; | ||
function RadioGroup(props) { | ||
var options = props.options, name = props.name, value = props.value, onChange = props.onChange; | ||
var rName = getName(name); | ||
var selectedValue = value; | ||
if (selectedValue === undefined && options[0]) { | ||
selectedValue = options[0].value || options[0].label; | ||
} | ||
var handleChange = function (e) { | ||
onChange(e.target.value); | ||
}; | ||
return (React.createElement("div", { className: 'eyzy-radio-group' }, options.map(function (o, i) { return (React.createElement("label", { key: i, className: cn({ active: isChecked(o, selectedValue) }) }, | ||
React.createElement("input", { type: "radio", name: rName, value: o.value || o.label, disabled: o.disabled, checked: isChecked(o, selectedValue), onChange: handleChange }), | ||
o.label)); }))); | ||
} | ||
var Radio = { | ||
Group: RadioGroup | ||
}; | ||
export { Button, Checkbox, Input, Radio, Switch, Tabs, Tag }; | ||
//# sourceMappingURL=eyzy.js.map |
{ | ||
"name": "eyzy", | ||
"version": "0.0.9", | ||
"version": "0.0.10", | ||
"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
106950
1162