import React from 'react';
import { isEmptyRadio } from '../../../utils/validate';
import FieldWrapper from '../FieldWrapper';
import withField from '../withField';
import RadioButton from './RadioButton'; // group of radio buttons with optional help text and label
// displays error if validation fails

var FieldRadioButtons = function FieldRadioButtons(props) {
  var input = props.input,
      options = props.options,
      variant = props.variant,
      disabled = props.disabled;
  var disabledClass = disabled ? 'disabled' : '';
  return React.createElement(FieldWrapper, props, React.createElement("div", {
    className: disabledClass
  }, options.filter(function (x) {
    return !x.hidden;
  }).map(function (option) {
    return React.createElement(RadioButton, Object.assign({
      input: input,
      key: option.value,
      variant: variant,
      disabled: disabled
    }, option));
  })));
};

FieldRadioButtons.defaultProps = {
  variant: '',
  disabled: false
};
var withReduxField = withField(isEmptyRadio);
export default withReduxField(FieldRadioButtons);