import { jsx as _jsx } from "react/jsx-runtime";
/*
 * Copyright (c) 2023-2025 Datalayer, Inc.
 * Distributed under the terms of the Modified BSD License.
 */
import { forwardRef, useCallback } from 'react';
import { useNavigate } from '../../hooks/index.js';
/**
 * Navigation link for primer NavList
 * Works with React Router, Next.js, or native browser navigation
 */
export const NavLink = forwardRef(({ to, children, ...props }, ref) => {
    const navigate = useNavigate();
    const onClick = useCallback((e) => {
        e.preventDefault();
        navigate(to);
    }, [to, navigate]);
    return (_jsx("a", { ref: ref, href: to, ...props, onClick: onClick, children: children }));
});
