import React from 'react';
import classNames from 'classnames';
import { isEmptyCheck } from '../../../utils/validate';
import FieldWrapper from '../FieldWrapper';
import withField from '../withField';
import Checkbox from './Checkbox'; // group of checkboxes with optional help text and label
// displays error if validation fails

export var FieldCheckboxes = function FieldCheckboxes(props) {
  var input = props.input,
      options = props.options,
      variant = props.variant,
      disabled = props.disabled;
  var cn = classNames([{
    disabled: disabled
  }]);
  return React.createElement(FieldWrapper, props, React.createElement("div", {
    className: cn
  }, options.filter(function (x) {
    return !x.hidden;
  }).map(function (option) {
    return React.createElement(Checkbox, Object.assign({
      input: input,
      key: option.value,
      variant: variant,
      disabled: disabled
    }, option));
  })));
};
FieldCheckboxes.defaultProps = {
  variant: '',
  disabled: false
};
var withReduxField = withField(isEmptyCheck);
export default withReduxField(FieldCheckboxes);