import React from 'react';

// individual radio button, applies state-template styling
var RadioButton = function RadioButton(_ref) {
  var input = _ref.input,
      value = _ref.value,
      label = _ref.label,
      variant = _ref.variant,
      disabled = _ref.disabled;
  var checked = input.value.toString().indexOf(value) !== -1;

  var onChange = function onChange() {
    return input.onChange(value);
  };

  var inputProps = {
    disabled: disabled,
    checked: checked,
    onChange: onChange,
    type: 'radio',
    name: input.name
  };

  if (variant) {
    return React.createElement("label", {
      className: 'check'
    }, React.createElement("input", Object.assign({
      className: 'hidden-up pos-abs top-0 left-0'
    }, inputProps)), React.createElement("span", {
      className: "btn btn-lg btn-block bg-".concat(variant, "--checked rounded-0")
    }, label));
  }

  return React.createElement("label", {
    className: 'form-check-inline p-l-md m-l-0 m-r-md'
  }, React.createElement("input", Object.assign({
    className: 'hidden-up pos-abs'
  }, inputProps)), React.createElement("div", {
    className: 'check-icon-radio'
  }, React.createElement("i", null)), label);
};

RadioButton.defaultProps = {
  variant: '',
  disabled: false
};
export default RadioButton;