import _map from "lodash/fp/map";
import _get from "lodash/fp/get";
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
import classnames from 'classnames';
import React from 'react';
import PropTypes from 'prop-types';
import Provider from '../provider';
import style from './style.css';
import Item from './item';
const themeStyle = {
  setup: style.setup,
  coorpmanager: style.coorpmanager
};
const RadioGroup = (props, context) => {
  const {
    list = [],
    onChange,
    color,
    className,
    theme = 'setup'
  } = props;
  const {
    skin
  } = context;
  const borderColor = color || _get('common.primary', skin);
  const mainClass = themeStyle[theme];
  const items = _map(itemProps => {
    return /*#__PURE__*/React.createElement(Item, _extends({}, itemProps, {
      color: color,
      theme: theme,
      onChange: onChange,
      key: itemProps.value
    }));
  }, list);
  return /*#__PURE__*/React.createElement("div", {
    className: classnames([mainClass, style.container, className]),
    style: {
      borderColor
    }
  }, items);
};
RadioGroup.contextTypes = {
  skin: Provider.childContextTypes.skin
};
RadioGroup.propTypes = process.env.NODE_ENV !== "production" ? {
  color: PropTypes.string,
  theme: PropTypes.string,
  className: PropTypes.string,
  list: PropTypes.arrayOf(PropTypes.shape(Item.propTypes)),
  onChange: PropTypes.func
} : {};
export default RadioGroup;
//# sourceMappingURL=index.js.map