import React from "react"; import UI from "../ui"; import type { LinkProps } from "./link.types"; import { useDisabledState } from "../../hooks/use-disabled-state"; /** * Link - A semantic, accessible anchor component with enhanced security and styling. * * The Link component renders accessible `` elements with automatic security * attributes for external links, customizable styling variants, and full WCAG 2.1 * AA compliance. It supports traditional text links, button-styled links, and * programmatic focus management via ref forwarding. * * ## Features * * - ๐Ÿ”’ **Automatic Security**: External links get `rel="noopener noreferrer"` * - โ™ฟ **WCAG 2.1 AA Compliant**: Accessible focus indicators and semantic HTML * - ๐ŸŽจ **Flexible Styling**: Text links, button links, and pill variants * - โšก **Performance**: Optional prefetch hints for faster navigation * - ๐ŸŽฏ **Ref Forwarding**: Direct DOM access for focus management and scroll * - ๐Ÿงช **Type-Safe**: Full TypeScript support with comprehensive prop types * * ## Accessibility * * - โœ… Semantic `` element for proper keyboard navigation * - โœ… Focus indicators meet WCAG 2.4.7 (3:1 contrast ratio) * - โœ… Screen readers announce link purpose and destination * - โœ… External links include security attributes automatically * - โœ… Supports `aria-label` for icon-only or ambiguous links * - โœ… Ref forwarding enables skip-link patterns * * @example * // Basic internal link * About Us * * @example * // External link with automatic security * * Visit Example * * * @example * // Button-styled call-to-action link * * Get Started * * * @example * // Icon-only link with accessible label * *