import { j as jsxRuntimeExports } from '../../node_modules/.pnpm/react@18.2.0/node_modules/react/jsx-runtime.js';
import { MenuButton } from '../../node_modules/.pnpm/@ariakit_react-core@0.4.16_react-dom@18.3.1_react@18.2.0__react@18.2.0/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@18.2.12_react@18.2.0/node_modules/@radix-ui/react-slot/dist/index.js';

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

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