// packages/components/src/toolbar/toolbar-dropdown-menu/index.tsx
import { forwardRef, useContext } from "@wordpress/element";
import ToolbarItem from "../toolbar-item/index.js";
import ToolbarContext from "../toolbar-context/index.js";
import DropdownMenu from "../../dropdown-menu/index.js";
import { jsx as _jsx } from "react/jsx-runtime";
function UnforwardedToolbarDropdownMenu(props, ref) {
  const accessibleToolbarState = useContext(ToolbarContext);
  if (!accessibleToolbarState) {
    return /* @__PURE__ */ _jsx(DropdownMenu, {
      ...props
    });
  }
  return /* @__PURE__ */ _jsx(ToolbarItem, {
    ref,
    ...props.toggleProps,
    children: (toolbarItemProps) => /* @__PURE__ */ _jsx(DropdownMenu, {
      ...props,
      popoverProps: {
        ...props.popoverProps
      },
      toggleProps: toolbarItemProps
    })
  });
}
var ToolbarDropdownMenu = forwardRef(UnforwardedToolbarDropdownMenu);
var toolbar_dropdown_menu_default = ToolbarDropdownMenu;
export {
  ToolbarDropdownMenu,
  toolbar_dropdown_menu_default as default
};
//# sourceMappingURL=index.js.map
