import { jsx as _jsx } from "react/jsx-runtime";
import { bem } from "../@utils/bem.js";
const { b } = bem("gd-ui-kit-link");
/**
 * @internal
 */
export function UiLink({ variant = "secondary", flipUnderline = false, fullWidth = false, isDisabled = false, dataTestId, as = "a", href, onClick, tabIndex, ...rest }) {
    const className = b({ variant, flipUnderline, fullWidth, isDisabled });
    const ariaDisabled = isDisabled || undefined;
    const effectiveTabIndex = isDisabled ? -1 : tabIndex;
    if (as === "span") {
        return (_jsx("span", { ...rest, className: className, "data-testid": dataTestId, "aria-disabled": ariaDisabled, tabIndex: effectiveTabIndex }));
    }
    const handleClick = isDisabled
        ? (event) => event.preventDefault()
        : onClick;
    return (_jsx("a", { ...rest, className: className, "data-testid": dataTestId, href: isDisabled ? undefined : href, onClick: handleClick, "aria-disabled": ariaDisabled, tabIndex: effectiveTabIndex }));
}
