"use strict";

exports.__esModule = true;
exports.default = void 0;
var _map2 = _interopRequireDefault(require("lodash/fp/map"));
var _get2 = _interopRequireDefault(require("lodash/fp/get"));
var _classnames = _interopRequireDefault(require("classnames"));
var _react = _interopRequireDefault(require("react"));
var _propTypes = _interopRequireDefault(require("prop-types"));
var _provider = _interopRequireDefault(require("../provider"));
var _style = _interopRequireDefault(require("./style.css"));
var _item = _interopRequireDefault(require("./item"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
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); }
const themeStyle = {
  setup: _style.default.setup,
  coorpmanager: _style.default.coorpmanager
};
const RadioGroup = (props, context) => {
  const {
    list = [],
    onChange,
    color,
    className,
    theme = 'setup'
  } = props;
  const {
    skin
  } = context;
  const borderColor = color || (0, _get2.default)('common.primary', skin);
  const mainClass = themeStyle[theme];
  const items = (0, _map2.default)(itemProps => {
    return /*#__PURE__*/_react.default.createElement(_item.default, _extends({}, itemProps, {
      color: color,
      theme: theme,
      onChange: onChange,
      key: itemProps.value
    }));
  }, list);
  return /*#__PURE__*/_react.default.createElement("div", {
    className: (0, _classnames.default)([mainClass, _style.default.container, className]),
    style: {
      borderColor
    }
  }, items);
};
RadioGroup.contextTypes = {
  skin: _provider.default.childContextTypes.skin
};
RadioGroup.propTypes = process.env.NODE_ENV !== "production" ? {
  color: _propTypes.default.string,
  theme: _propTypes.default.string,
  className: _propTypes.default.string,
  list: _propTypes.default.arrayOf(_propTypes.default.shape(_item.default.propTypes)),
  onChange: _propTypes.default.func
} : {};
var _default = exports.default = RadioGroup;
//# sourceMappingURL=index.js.map