var _excluded = ["direction", "options"],
  _excluded2 = ["label", "value"],
  _excluded3 = ["direction", "options"],
  _excluded4 = ["label", "value"];
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
import React from 'react';
import { Checkbox, Radio, Space } from 'antd';
export var CheckboxGroup = function CheckboxGroup(_ref) {
  var direction = _ref.direction,
    options = _ref.options,
    props = _objectWithoutProperties(_ref, _excluded);
  if (direction === 'vertical') {
    return /*#__PURE__*/React.createElement(Checkbox.Group, props, /*#__PURE__*/React.createElement(Space, {
      direction: direction
    }, options === null || options === void 0 ? void 0 : options.map(function (item) {
      if (_typeof(item) === 'object') {
        var label = item.label,
          value = item.value,
          other = _objectWithoutProperties(item, _excluded2);
        return /*#__PURE__*/React.createElement(Checkbox, _extends({}, other, {
          value: value,
          key: "".concat(item.value)
        }), label);
      }
      return /*#__PURE__*/React.createElement(Checkbox, {
        value: item,
        key: "".concat(item)
      }, item);
    })));
  }
  return /*#__PURE__*/React.createElement(Checkbox.Group, _extends({}, props, {
    options: options
  }));
};
export var RadioGroup = function RadioGroup(_ref2) {
  var direction = _ref2.direction,
    options = _ref2.options,
    props = _objectWithoutProperties(_ref2, _excluded3);
  if (direction === 'vertical') {
    return /*#__PURE__*/React.createElement(Radio.Group, props, /*#__PURE__*/React.createElement(Space, {
      direction: "vertical"
    }, options === null || options === void 0 ? void 0 : options.map(function (item) {
      if (_typeof(item) === 'object') {
        var label = item.label,
          value = item.value,
          other = _objectWithoutProperties(item, _excluded4);
        return /*#__PURE__*/React.createElement(Radio, _extends({}, other, {
          value: value,
          key: "".concat(item.value)
        }), label);
      }
      return /*#__PURE__*/React.createElement(Radio, {
        value: item,
        key: "".concat(item)
      }, item);
    })));
  }
  return /*#__PURE__*/React.createElement(Radio.Group, _extends({}, props, {
    options: options
  }));
};