// packages/block-editor/src/components/block-settings-menu/block-parent-selector-menu-item.js
import { useRef } from "@wordpress/element";
import { MenuItem } from "@wordpress/components";
import { useViewportMatch } from "@wordpress/compose";
import { useDispatch } from "@wordpress/data";
import { __, sprintf } from "@wordpress/i18n";
import BlockIcon from "../block-icon";
import { useShowHoveredOrFocusedGestures } from "../block-toolbar/utils";
import { store as blockEditorStore } from "../../store";
import { jsx } from "react/jsx-runtime";
function BlockParentSelectorMenuItem({
  parentClientId,
  parentBlockType
}) {
  const isSmallViewport = useViewportMatch("medium", "<");
  const { selectBlock } = useDispatch(blockEditorStore);
  const menuItemRef = useRef();
  const gesturesProps = useShowHoveredOrFocusedGestures({
    ref: menuItemRef,
    highlightParent: true
  });
  if (!isSmallViewport) {
    return null;
  }
  return /* @__PURE__ */ jsx(
    MenuItem,
    {
      ...gesturesProps,
      ref: menuItemRef,
      icon: /* @__PURE__ */ jsx(BlockIcon, { icon: parentBlockType.icon }),
      onClick: () => selectBlock(parentClientId),
      children: sprintf(
        /* translators: %s: Name of the block's parent. */
        __("Select parent block (%s)"),
        parentBlockType.title
      )
    }
  );
}
export {
  BlockParentSelectorMenuItem as default
};
//# sourceMappingURL=block-parent-selector-menu-item.js.map
