"use client";
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
import { ChevronDownIcon } from '../../node_modules/.pnpm/@radix-ui_react-icons@1.3.2_react@19.1.1/node_modules/@radix-ui/react-icons/dist/react-icons.esm.js';
import { cx } from '../../node_modules/.pnpm/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.js';
import { forwardRef, cloneElement } from 'react';
import { DropdownMenu } from '../dropdown-menu/dropdown-menu.js';
import styles from './breadcrumb.module.css.js';

const BreadcrumbItem = forwardRef(({ as, children, className, leadingIcon, current, href, dropdownItems, ...props }, ref) => {
    const renderedElement = as ?? jsx("a", { ref: ref });
    const label = (jsxs(Fragment, { children: [leadingIcon && (jsx("span", { className: styles['breadcrumb-icon'], children: leadingIcon })), children && jsx("span", { children: children })] }));
    if (dropdownItems) {
        return (jsxs(DropdownMenu, { children: [jsxs(DropdownMenu.Trigger, { className: styles['breadcrumb-dropdown-trigger'], children: [label, jsx(ChevronDownIcon, { className: styles['breadcrumb-dropdown-icon'] })] }), jsx(DropdownMenu.Content, { className: styles['breadcrumb-dropdown-content'], children: dropdownItems.map((dropdownItem, dropdownIndex) => (jsx(DropdownMenu.Item, { className: styles['breadcrumb-dropdown-item'], onSelect: dropdownItem?.onClick, children: dropdownItem.label }, dropdownIndex))) })] }));
    }
    return (jsx("li", { className: cx(styles['breadcrumb-item'], className), children: cloneElement(renderedElement, {
            className: cx(styles['breadcrumb-link'], current && styles['breadcrumb-link-active']),
            href,
            ...props,
            ...renderedElement.props
        }, label) }));
});
BreadcrumbItem.displayName = 'BreadcrumbItem';

export { BreadcrumbItem };
//# sourceMappingURL=breadcrumb-item.js.map
