@wordpress/components
Version:
UI components for WordPress.
23 lines (22 loc) • 957 B
JavaScript
import { forwardRef, useContext } from "@wordpress/element";
import ToolbarItem from "../toolbar-item/index.mjs";
import ToolbarContext from "../toolbar-context/index.mjs";
import DropdownMenu from "../../dropdown-menu/index.mjs";
import { jsx } from "react/jsx-runtime";
// packages/components/src/toolbar/toolbar-dropdown-menu/index.tsx
function UnforwardedToolbarDropdownMenu(props, ref) {
if (!useContext(ToolbarContext)) return /* @__PURE__ */ jsx(DropdownMenu, { ...props });
return /* @__PURE__ */ jsx(ToolbarItem, {
ref,
...props.toggleProps,
children: (toolbarItemProps) => /* @__PURE__ */ jsx(DropdownMenu, {
...props,
popoverProps: { ...props.popoverProps },
toggleProps: toolbarItemProps
})
});
}
const ToolbarDropdownMenu = forwardRef(UnforwardedToolbarDropdownMenu);
ToolbarDropdownMenu.displayName = "ToolbarDropdownMenu";
export { ToolbarDropdownMenu, ToolbarDropdownMenu as default };
//# sourceMappingURL=index.mjs.map