var _excluded = ["className", "style", "children", "onClick"];

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, { useContext } from 'react';
import clsx from 'clsx';
import ConfigProviderContext from '../config-provider/ConfigProviderContext';
import ButtonContext from './ButtonContext';
import { SHADOW } from '../utils/constant';
export var ButtonGroup = function ButtonGroup(_ref) {
  var className = _ref.className,
      style = _ref.style,
      children = _ref.children,
      onClick = _ref.onClick,
      props = _objectWithoutPropertiesLoose(_ref, _excluded);

  var _useContext = useContext(ConfigProviderContext),
      prefixCls = _useContext.prefixCls,
      createNamespace = _useContext.createNamespace;

  var _createNamespace = createNamespace('button-group', prefixCls),
      bem = _createNamespace[0];

  var internalClick = function internalClick(e) {
    if (props.disabled) return;
    onClick == null ? void 0 : onClick(e);
  };

  return /*#__PURE__*/React.createElement("div", {
    onClick: internalClick,
    style: style,
    className: clsx(className, bem([props.type, {
      round: props.round,
      plain: props.plain,
      disabled: props.disabled
    }]), props.shadow && SHADOW + "--" + +props.shadow)
  }, /*#__PURE__*/React.createElement(ButtonContext.Provider, {
    value: {
      parent: props
    }
  }, children));
};
export default ButtonGroup;