import React from 'react';
import { MENU_ROLE } from './types';
import { jsx as _jsx } from "react/jsx-runtime";
export const DefaultLinkComponent = /*#__PURE__*/React.forwardRef(({
  onMouseEnter,
  onMouseLeave,
  onKeyDown,
  onClick,
  option,
  children,
  disabled,
  ...rest
}, ref) => {
  const {
    className,
    isExternal,
    link,
    testId
  } = option;
  const handleClick = e => {
    if (disabled) {
      e.preventDefault();
      e.stopPropagation();
    }
    onClick?.(e);
  };
  return /*#__PURE__*/_jsx("a", {
    className: className,
    ref: ref,
    rel: "noopener noreferrer",
    "test-id": testId,
    onClick: handleClick,
    onMouseEnter: onMouseEnter,
    onMouseLeave: onMouseLeave,
    onKeyDown: onKeyDown,
    target: isExternal ? '_blank' : undefined,
    href: disabled ? undefined : link,
    role: MENU_ROLE.MENUITEM,
    ...rest,
    children: children
  });
});
DefaultLinkComponent.displayName = 'LinkComponent';