formsy-material-ui-react16
Version:
A formsy-react compatibility wrapper for Material-UI form components with React 16
72 lines (53 loc) • 4 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.FormsyRadio = undefined;
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; }; }();
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _formsyReact = require('formsy-react');
var _RadioButton = require('material-ui/RadioButton');
var _RadioButton2 = _interopRequireDefault(_RadioButton);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
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) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var FormsyRadio = exports.FormsyRadio = function (_React$Component) {
_inherits(FormsyRadio, _React$Component);
function FormsyRadio() {
_classCallCheck(this, FormsyRadio);
return _possibleConstructorReturn(this, (FormsyRadio.__proto__ || Object.getPrototypeOf(FormsyRadio)).apply(this, arguments));
}
_createClass(FormsyRadio, [{
key: 'render',
value: function render() {
/* eslint no-unused-vars: 0 */
var _props = this.props,
getErrorMessage = _props.getErrorMessage,
getErrorMessages = _props.getErrorMessages,
getValue = _props.getValue,
hasValue = _props.hasValue,
innerRef = _props.innerRef,
isFormDisabled = _props.isFormDisabled,
isFormSubmitted = _props.isFormSubmitted,
isPristine = _props.isPristine,
isRequired = _props.isRequired,
isValid = _props.isValid,
isValidValue = _props.isValidValue,
resetValue = _props.resetValue,
setValidations = _props.setValidations,
setValue = _props.setValue,
showError = _props.showError,
showRequired = _props.showRequired,
validationError = _props.validationError,
validationErrors = _props.validationErrors,
validations = _props.validations,
rest = _objectWithoutProperties(_props, ['getErrorMessage', 'getErrorMessages', 'getValue', 'hasValue', 'innerRef', 'isFormDisabled', 'isFormSubmitted', 'isPristine', 'isRequired', 'isValid', 'isValidValue', 'resetValue', 'setValidations', 'setValue', 'showError', 'showRequired', 'validationError', 'validationErrors', 'validations']);
return _react2.default.createElement(_RadioButton2.default, rest);
}
}]);
return FormsyRadio;
}(_react2.default.Component);
exports.default = (0, _formsyReact.withFormsy)(FormsyRadio);