"use strict";

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

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

var _compileClassNames3 = _interopRequireDefault(require("../../libraries/compileClassNames"));

var _ButtonGroupModule = _interopRequireDefault(require("./ButtonGroup.module.css"));

var _getCompliedCustomId = _interopRequireDefault(require("../../utils/getCompliedCustomId"));

var _Group = _interopRequireDefault(require("../group/Group"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

function _extends() { _extends = Object.assign || 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 _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

function ButtonGroup(props) {
  var _compileClassNames, _compileClassNames2;

  var children = props.children,
      variant = props.variant,
      direction = props.direction,
      color = props.color,
      gap = props.gap,
      tagAttributeProps = props.tagAttributeProps,
      customClassName = props.customClassName,
      role = props.role,
      customId = props.customId;
  var classNameStyle = (0, _compileClassNames3["default"])(customClassName, (_compileClassNames = {}, _defineProperty(_compileClassNames, _ButtonGroupModule["default"][variant], !!variant), _defineProperty(_compileClassNames, _ButtonGroupModule["default"][color], !!color), _defineProperty(_compileClassNames, _ButtonGroupModule["default"][direction], !!direction), _defineProperty(_compileClassNames, _ButtonGroupModule["default"][gap], !!gap), _compileClassNames), (_compileClassNames2 = {}, _defineProperty(_compileClassNames2, customClassName.variant, !!customClassName.variant), _defineProperty(_compileClassNames2, customClassName.direction, !!customClassName.direction), _defineProperty(_compileClassNames2, customClassName.color, !!customClassName.color), _defineProperty(_compileClassNames2, customClassName.gap, !!customClassName.gap), _compileClassNames2));
  return /*#__PURE__*/_react["default"].createElement(_Group["default"], _extends({
    customClassName: classNameStyle,
    role: role,
    dataId: (0, _getCompliedCustomId["default"])((props, customId))
  }, tagAttributeProps), children && children.map(function (child, i) {
    return /*#__PURE__*/_react["default"].cloneElement(child, {
      customClassName: {
        variant: _ButtonGroupModule["default"][variant]
      },
      key: i
    });
  }));
}