UNPKG

react-kube

Version:

Kube CSS in React Components

63 lines (50 loc) 2.97 kB
"use strict"; var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; } var _react = require("react"); var _react2 = _interopRequireDefault(_react); var RadioButton = (function (_React$Component) { function RadioButton() { _classCallCheck(this, RadioButton); if (_React$Component != null) { _React$Component.apply(this, arguments); } } _inherits(RadioButton, _React$Component); _createClass(RadioButton, [{ key: "handleChange", value: function handleChange(e) { this.props.onChange ? this.props.onChange(e.target.value) : null; //eslint-disable-line } }, { key: "render", value: function render() { return _react2["default"].createElement( "span", null, _react2["default"].createElement("input", { className: this.props.className, defaultChecked: this.props.checked, disabled: this.props.disabled, id: this.props.id ? this.props.id : this.props.name, name: this.props.name, onChange: this.handleChange.bind(this), style: this.props.style, type: "radio", value: this.props.value }), _react2["default"].createElement( "label", { htmlFor: this.props.id }, this.props.children ), !this.props.inline ? _react2["default"].createElement("br", null) : null ); } }]); return RadioButton; })(_react2["default"].Component); RadioButton.propTypes = { checked: _react2["default"].PropTypes.bool, children: _react2["default"].PropTypes.node, className: _react2["default"].PropTypes.string, disabled: _react2["default"].PropTypes.bool, id: _react2["default"].PropTypes.string, inline: _react2["default"].PropTypes.bool, name: _react2["default"].PropTypes.string.isRequired, style: _react2["default"].PropTypes.object, value: _react2["default"].PropTypes.string.isRequired }; module.exports = RadioButton;