react-radio-group
Advanced tools
Comparing version 2.1.1 to 2.2.0
(function (global, factory) { | ||
if (typeof define === "function" && define.amd) { | ||
define("RadioGroup", ["exports", "module", "react"], factory); | ||
} else if (typeof exports !== "undefined" && typeof module !== "undefined") { | ||
factory(exports, module, require("react")); | ||
if (typeof define === 'function' && define.amd) { | ||
define('RadioGroup', ['exports', 'module', 'react'], factory); | ||
} else if (typeof exports !== 'undefined' && typeof module !== 'undefined') { | ||
factory(exports, module, require('react')); | ||
} else { | ||
@@ -14,7 +14,7 @@ var mod = { | ||
})(this, function (exports, module, _react) { | ||
"use strict"; | ||
'use strict'; | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
@@ -24,9 +24,16 @@ var _React = _interopRequireDefault(_react); | ||
function radio(name, selectedValue, onChange) { | ||
return _React["default"].createClass({ | ||
return _React['default'].createClass({ | ||
render: function render() { | ||
return _React["default"].createElement("input", _extends({}, this.props, { | ||
type: "radio", | ||
name: name, | ||
checked: this.props.value === selectedValue, | ||
onChange: onChange.bind(null, this.props.value) })); | ||
var optional = {}; | ||
if (selectedValue !== undefined) { | ||
optional.checked = this.props.value === selectedValue; | ||
} | ||
if (typeof onChange === 'function') { | ||
optional.onChange = onChange.bind(null, this.props.value); | ||
} | ||
return _React['default'].createElement('input', _extends({}, this.props, { | ||
type: 'radio', | ||
name: name | ||
}, optional)); | ||
} | ||
@@ -36,4 +43,4 @@ }); | ||
module.exports = _React["default"].createClass({ | ||
displayName: "index", | ||
module.exports = _React['default'].createClass({ | ||
displayName: 'index', | ||
@@ -55,5 +62,5 @@ propTypes: { | ||
var renderedChildren = children(radio(name, selectedValue, onChange)); | ||
return renderedChildren && _React["default"].Children.only(renderedChildren); | ||
return renderedChildren && _React['default'].Children.only(renderedChildren); | ||
} | ||
}); | ||
}); |
{ | ||
"name": "react-radio-group", | ||
"version": "2.1.1", | ||
"version": "2.2.0", | ||
"description": "Better radio buttons.", | ||
@@ -30,7 +30,9 @@ "main": "index.js", | ||
"author": "chenglou <chenglou92@gmail.com>", | ||
"contributors": [{ | ||
"name": "Jamison Dance", | ||
"email": "jergason@gmail.com", | ||
"url": "http://jamisondance.com" | ||
}], | ||
"contributors": [ | ||
{ | ||
"name": "Jamison Dance", | ||
"email": "jergason@gmail.com", | ||
"url": "http://jamisondance.com" | ||
} | ||
], | ||
"license": "MIT", | ||
@@ -37,0 +39,0 @@ "bugs": { |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
38190
18
72
1