"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;

var _propTypes = _interopRequireDefault(require("prop-types"));

var _radioWithLabel = _interopRequireDefault(require("../radio-with-label"));

var _react = _interopRequireDefault(require("react"));

var _styles = require("@material-ui/core/styles");

var _classnames = _interopRequireDefault(require("classnames"));

var styles = function styles(theme) {
  return {
    radioLabel: {
      fontSize: theme.typography.fontSize - 2
    },
    choice: {
      display: 'flex',
      alignItems: 'center'
    },
    choiceHolder: {
      display: 'flex',
      alignItems: 'center'
    }
  };
};

var Group = function Group(props) {
  var feedbackLabels = props.feedbackLabels,
      value = props.value,
      classes = props.classes,
      className = props.className,
      _onChange = props.onChange,
      keys = props.keys;
  return /*#__PURE__*/_react["default"].createElement("div", {
    className: (0, _classnames["default"])(classes.choiceHolder, className)
  }, keys.map(function (key) {
    return /*#__PURE__*/_react["default"].createElement("div", {
      className: classes.choice,
      key: key
    }, /*#__PURE__*/_react["default"].createElement(_radioWithLabel["default"], {
      value: key,
      checked: value === key,
      classes: {
        label: classes.radioLabel
      },
      onChange: function onChange(e) {
        return _onChange(e.currentTarget.value);
      },
      label: feedbackLabels[key]
    }));
  }));
};

Group.propTypes = {
  className: _propTypes["default"].string,
  feedbackLabels: _propTypes["default"].object.isRequired,
  value: _propTypes["default"].string.isRequired,
  classes: _propTypes["default"].object.isRequired,
  keys: _propTypes["default"].arrayOf(_propTypes["default"].string),
  onChange: _propTypes["default"].func
};

var _default = (0, _styles.withStyles)(styles)(Group);

exports["default"] = _default;
//# sourceMappingURL=group.js.map