import UI from "../ui";
import List from "../list/list";
import React from "react";
import type { NavProps, NavListProps, NavItemProps } from "./nav.types";
// Re-export types for external use
export type { NavProps, NavListProps, NavItemProps };
/**
* NavList - A navigation-specific list component for grouping navigation items.
*
* Extends the List component with navigation-specific layout options through
* the `isBlock` prop. Automatically renders as an unstyled list to maintain
* clean navigation aesthetics.
*
* ## Key Features:
* - **Flexible Layout**: Supports both horizontal (inline) and vertical (block) layouts
* - **Semantic HTML**: Uses `
` element for proper document structure
* - **Unstyled by Default**: Removes default list markers for clean navigation
* - **Accessible**: Works naturally with screen readers
*
* ## Accessibility:
* - ✅ Uses semantic `
` element
* - ✅ Screen readers announce as "list" with item count
* - ✅ Supports `aria-label` for multiple lists
* - ✅ Keyboard navigation works naturally with focusable children
*
* ## Layout Options:
* - **Inline (default)**: Horizontal navigation bars, top menus
* - **Block**: Vertical sidebars, mobile menus, footer navigation
*
* @example
* ```tsx
* // Horizontal navigation (default)
*
* Home
* About
*
* ```
*
* @example
* ```tsx
* // Vertical sidebar navigation
*
* Dashboard
* Settings
*
* ```
*
* @example
* ```tsx
* // Multiple lists with labels
*
* ```
*
* @param {NavListProps} props - Component props
* @param {boolean} [props.isBlock=false] - Display items vertically (block layout)
* @param {React.ReactNode} props.children - Navigation items (typically NavItem components)
* @param {string} [props.aria-label] - Accessible label for the list
* @returns {React.ReactElement} A navigation list component
*/
export const NavList = React.forwardRef<
HTMLUListElement,
NavListProps
>(({ isBlock, children, ...props }, ref) => {
return (
{children}
);
});
NavList.displayName = "NavList";
/**
* NavItem - An individual navigation link container (list item).
*
* Wraps navigation content (typically Link components) in a semantic list item
* element with consistent styling and accessibility support.
*
* ## Key Features:
* - **Semantic HTML**: Uses `
` element for proper list structure
* - **Flexible Content**: Accepts any React content (links, buttons, text)
* - **Customizable**: Supports custom styles and CSS classes
* - **Ref Forwarding**: Enables direct DOM access for advanced use cases
*
* ## Accessibility:
* - ✅ Uses semantic `
` element
* - ✅ Works with screen readers out of the box
* - ✅ Supports keyboard navigation naturally
* - ✅ Ref forwarding for programmatic focus if needed
*
* ## Best Practices:
* - Always wrap with NavList/Nav for proper semantics
* - Use `aria-current="page"` on the link inside to indicate current page
* - Ensure link text is descriptive and meaningful
* - Maintain sufficient color contrast (WCAG 2.1: 4.5:1 for normal text)
*
* @example
* ```tsx
* // Basic navigation item
*
* About Us
*
* ```
*
* @example
* ```tsx
* // Current page with aria-current
*
*
* About Us
*
*
* ```
*
* @example
* ```tsx
* // Custom styling
*
* Special Offer
*
* ```
*
* @example
* ```tsx
* // With icon
*
*
*
* Settings
*
*
* ```
*
* @param {NavItemProps} props - Component props
* @param {React.Ref} ref - Forwarded ref for DOM access
* @returns {React.ReactElement} A navigation item component
*/
export const NavItem = React.forwardRef<
HTMLLIElement,
NavItemProps
>(({ id, styles, classes, children, ...props }, ref) => {
return (
{children}
);
});
NavItem.displayName = "NavItem";
/**
* Nav - A semantic navigation container component for site navigation.
*
* The Nav component provides a semantic `