import 'core-js/modules/es.object.assign.js';
import { __rest } from '../../../_virtual/_tslib.js';
import { jsx } from 'react/jsx-runtime';
import { styled, Button, useTheme } from '@mui/material';
import { ButtonColors } from '../../styles/designTokens/button.js';

let _ = t => t,
  _t;
const StyledButton = styled(Button)(_t || (_t = _`
  padding: 0;

  &.MuiButton-sizeLarge {
    min-width: 52px;
  }

  &.MuiButton-sizeMedium {
    min-width: 44px;
  }

  &.MuiButton-sizeSmall {
    min-width: 36px;
  }

  .MuiButton-startIcon {
    margin: 0;
  }
`));
const IconButton = _a => {
  var _b, _c, _d;
  var {
      selected,
      color = 'primary',
      variant = 'contained',
      children
    } = _a,
    props = __rest(_a, ["selected", "color", "variant", "children"]);
  const theme = useTheme();
  const variantStyle = ButtonColors(theme)[variant];
  const selectedStyle = variantStyle.hover;
  return jsx(StyledButton, Object.assign({
    style: Object.assign({}, selected && {
      color: (_b = selectedStyle === null || selectedStyle === void 0 ? void 0 : selectedStyle.color) === null || _b === void 0 ? void 0 : _b[color],
      background: (_c = selectedStyle === null || selectedStyle === void 0 ? void 0 : selectedStyle.background) === null || _c === void 0 ? void 0 : _c[color],
      borderColor: (_d = selectedStyle === null || selectedStyle === void 0 ? void 0 : selectedStyle.borderColor) === null || _d === void 0 ? void 0 : _d[color]
    })
  }, props, {
    color: color,
    variant: variant,
    startIcon: children
  }));
};

export { IconButton, IconButton as default };
