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); }

import * as React from 'react';
import classNames from 'classnames';
import { createUseStyles } from '@fluent-ui/styles';
import { styles } from './IconButton.styled';
import { IconButtonPropTypes } from './IconButton.type';
export const name = 'IconButton';
const useStyles = createUseStyles(styles, {
  name
});
const IconButton = React.forwardRef((props, ref) => {
  const {
    as: Component = 'button',
    className: classNameProp,
    variant = 'standard',
    disabled,
    size = 'medium',
    onClick,
    children,
    ...rest
  } = props;
  const classes = useStyles(props);
  const className = classNames(classes.root, {
    [classes.variantStandard]: variant === 'standard',
    [classes.variantPrimary]: variant === 'primary',
    [classes.sizeSmall]: size === 'small',
    [classes.sizeMedium]: size === 'medium',
    [classes.sizeLarge]: size === 'large'
  }, classNameProp);
  return React.createElement(Component, _extends({
    className: className,
    ref: ref,
    onClick: onClick,
    disabled: disabled
  }, rest), children);
});
IconButton.displayName = `F${name}`;
IconButton.propTypes = IconButtonPropTypes;
IconButton.defaultProps = {
  variant: 'standard',
  size: 'medium'
};
export default IconButton;