'use strict';

var _rollupPluginBabelHelpers = require('../_rollupPluginBabelHelpers-ea66c137.js');
var React = require('react');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var React__default = /*#__PURE__*/_interopDefaultLegacy(React);

const IconButton = /*#__PURE__*/React__default["default"].forwardRef((props, ref) => {
  const {
    className = '',
    children,
    disabled = false,
    width = '56px',
    height = '56px',
    type = 'button',
    style = {},
    onBlur = () => {/* noop */},
    onClick = () => {/* noop */}
  } = props;
  const [isPressed, setIsPressed] = React.useState(false);
  return /*#__PURE__*/React__default["default"].createElement("button", {
    className: [...(Array.isArray(className) ? className : [className]), 'sendbird-iconbutton', isPressed ? 'sendbird-iconbutton--pressed' : ''].join(' '),
    disabled: disabled,
    ref: ref,
    type: type,
    style: _rollupPluginBabelHelpers._objectSpread2(_rollupPluginBabelHelpers._objectSpread2({}, style), {}, {
      height,
      width
    }),
    onClick: e => {
      if (disabled) {
        return;
      }
      setIsPressed(true);
      onClick === null || onClick === void 0 ? void 0 : onClick(e);
    },
    onBlur: e => {
      setIsPressed(false);
      onBlur === null || onBlur === void 0 ? void 0 : onBlur(e);
    }
  }, /*#__PURE__*/React__default["default"].createElement("span", {
    className: "sendbird-iconbutton__inner"
  }, children));
});

module.exports = IconButton;
//# sourceMappingURL=IconButton.js.map
