import { jsx as _jsx } from "react/jsx-runtime";
// packages/ui/src/components/layout/components/DropdownNavigation.tsx
/**
 * @fileoverview DropdownNavigation Component
 * @description Professional, prop-driven navigation bar with dropdown support for layout presets.
 *
 * Features:
 * - Accepts a navigation prop (array of menu/submenu objects)
 * - Renders top-level menu items and dropdowns (using @donotdev/components/dropdown-menu)
 * - Keyboard accessible and ARIA compliant
 * - No hardcoded content, fully customizable
 * - CSS variable support for theming
 *
 * @version 0.0.2
 * @since 0.0.1
 * @author AMBROISE PARK Consulting
 */
import { DropdownMenu, Button, cn, Stack } from '@donotdev/components';
import { Link } from '../../../routing/Link';
import { NavigationItemComponent } from '../../../routing/NavigationItem';
/**
 * DropdownNavigation component - professional navigation with dropdown support
 *
 * Renders a navigation bar with dropdown menus for complex navigation structures.
 * Supports both direct links and dropdown menus with subroutes.
 *
 * @version 0.0.2
 * @since 0.0.1
 * @author AMBROISE PARK Consulting
 *
 * @param navigation - Array of navigation menu items
 * @param className - Additional CSS classes
 * @returns Rendered navigation component
 */
const DropdownNavigation = ({ navigation, className, }) => {
    return (_jsx(Stack, { role: "navigation", direction: "row", align: "center", className: className, style: { gap: 'var(--gap-sm)' }, children: navigation.map((item, idx) => item.routes && item.routes.length > 0 ? (_jsx(DropdownMenu, { trigger: _jsx(Button, { icon: item.icon, children: item.label }), items: item.routes.map((route) => {
                // NavigationItemComponent already renders a Link/anchor — use it directly.
                // External links are handled via the route.external flag inside NavigationItemComponent.
                return {
                    label: route.label,
                    children: _jsx(NavigationItemComponent, { route: route }),
                    asChild: !!route.path,
                };
            }), contentAlign: "start" }, item.label + idx)) : item.path ? (_jsx(Button, { icon: item.icon, "aria-label": item.label, render: ({ children, ...props }) => (_jsx(Link, { path: item.path, ...props, children: children })), children: item.label }, item.label + idx)) : (_jsx(Button, { icon: item.icon, disabled: true, "aria-label": item.label, children: item.label }, item.label + idx))) }));
};
export default DropdownNavigation;
