"use client";
import { jsx } from 'react/jsx-runtime';
import { MenuButton } from '../../node_modules/.pnpm/@ariakit_react-core@0.4.16_react-dom@19.1.1_react@19.1.1__react@19.1.1/node_modules/@ariakit/react-core/esm/menu/menu-button.js';
import { forwardRef } from 'react';
import { ReactComponent as SvgTriangleRight } from '../../icons/assets/triangle-right.svg.js';
import { DropdownMenuItem } from './dropdown-menu-item.js';
import { useDropdownContext } from './dropdown-menu-root.js';
import { getMatch } from './utils.js';
import { Root as Slot } from '../../node_modules/.pnpm/@radix-ui_react-slot@1.2.3_@types_react@19.1.9_react@19.1.1/node_modules/@radix-ui/react-slot/dist/index.js';

const DropdownMenuTrigger = forwardRef(({ children, asChild, stopPropagation = true, onClick, ...props }, ref) => {
    return (jsx(MenuButton, { ref: ref, render: asChild ? jsx(Slot, {}) : undefined, onClick: (e) => {
            if (stopPropagation)
                e.stopPropagation();
            onClick?.(e);
        }, ...props, children: children }));
});
/**
 * `TriggerItem` is a helper component that renders a `Trigger` as a `MenuItem`.
 */
const DropdownMenuTriggerItem = forwardRef(({ children, value, trailingIcon = jsx(SvgTriangleRight, {}), ...props }, ref) => {
    const { parent } = useDropdownContext();
    if (parent?.shouldFilter &&
        !getMatch(value, children, parent?.searchValue)) {
        return null;
    }
    return (jsx(MenuButton, { ref: ref, render: jsx(DropdownMenuItem, { value: value, trailingIcon: trailingIcon, ...props, forceRender: parent?.autocomplete ? 'combobox' : 'auto' }), children: children }));
});

export { DropdownMenuTrigger, DropdownMenuTriggerItem };
//# sourceMappingURL=dropdown-menu-trigger.js.map
