import { forwardRef } from 'react';
import PrimitiveButton from '../primitives/PrimitiveButton/PrimitiveButton.mjs';
import PrimitiveAnchor from '../primitives/PrimitiveAnchor/PrimitiveAnchor.mjs';
import Circle from '../common/circle/Circle.mjs';
import { clsx } from 'clsx';
import { jsx } from 'react/jsx-runtime';

const IconButton = /*#__PURE__*/forwardRef(function IconButton({
  size = 48,
  href = '#',
  children,
  className,
  priority = 'primary',
  type = 'default',
  ...props
}, ref) {
  const isLink = href !== '#';
  return (
    /*#__PURE__*/
    // @ts-expect-error it's either link or `button` element so it has `onClick` / `href`
    jsx(Circle, {
      ref: ref,
      as: isLink ? PrimitiveAnchor : PrimitiveButton,
      size: size,
      fixedSize: true,
      className: clsx('np-icon-button', `np-icon-button-${priority}-${type}`, {
        disabled: props.disabled
      }, className),
      ...(isLink ? {
        href
      } : {}),
      ...props,
      children: children
    })
  );
});

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