import { _ as _objectSpread2 } from '../_rollupPluginBabelHelpers-4f8ebde4.js';
import React__default, { useState } from 'react';

const IconButton = /*#__PURE__*/React__default.forwardRef((props, ref) => {
  const {
    className = '',
    children,
    disabled = false,
    width = '56px',
    height = '56px',
    type = 'button',
    style = {},
    onBlur = () => {/* noop */},
    onClick = () => {/* noop */}
  } = props;
  const [isPressed, setIsPressed] = useState(false);
  return /*#__PURE__*/React__default.createElement("button", {
    className: [...(Array.isArray(className) ? className : [className]), 'sendbird-iconbutton', isPressed ? 'sendbird-iconbutton--pressed' : ''].join(' '),
    disabled: disabled,
    ref: ref,
    type: type,
    style: _objectSpread2(_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.createElement("span", {
    className: "sendbird-iconbutton__inner"
  }, children));
});

export { IconButton as default };
//# sourceMappingURL=IconButton.js.map
