import _extends from "@babel/runtime/helpers/esm/extends";
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import Button from './Button';
import chainPropTypes from './chainPropTypes';
/**
 * IconButton
 * */

var IconButton = React.forwardRef(function IconButton(props, ref) {
  var children = props.children,
      classes = props.classes,
      className = props.className,
      color = props.color,
      disabled = props.disabled,
      prefixCls = props.prefixCls,
      other = _objectWithoutProperties(props, ["children", "classes", "className", "color", "disabled", "prefixCls"]);

  return React.createElement(Button, _extends({
    className: classNames(prefixCls, className),
    disabled: disabled,
    ref: ref
  }, other), children);
});
IconButton.propTypes = {
  /**
   *  icon元素
   */
  children: chainPropTypes(PropTypes.node, function (props) {
    var found = React.Children.toArray(props.children).some(function (child) {
      return React.isValidElement(child) && child.props.onClick;
    });

    if (found) {
      return new Error(['NeatUI: 你正试图给button的子元素添加点击事件回调。', 'Firefox 将不会触发该事件', 'https://github.com/mui-org/material-ui/issues/13957'].join('\n'));
    }

    return null;
  }),

  /**
   * @ignore
   */
  className: PropTypes.string,

  /**
   * 是否禁用.
   */
  disabled: PropTypes.bool
};
IconButton.defaultProps = {
  prefixCls: 'ne-icon-button',
  disabled: false
};
export default IconButton;