"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = SkipToSelectedBlock;
var _data = require("@wordpress/data");
var _i18n = require("@wordpress/i18n");
var _components = require("@wordpress/components");
var _store = require("../../store");
var _useBlockRefs = require("../block-list/use-block-props/use-block-refs");
var _jsxRuntime = require("react/jsx-runtime");
/**
 * WordPress dependencies
 */

/**
 * Internal dependencies
 */

/**
 * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/skip-to-selected-block/README.md
 */function SkipToSelectedBlock() {
  const selectedBlockClientId = (0, _data.useSelect)(select => select(_store.store).getBlockSelectionStart(), []);
  const ref = (0, _useBlockRefs.__unstableUseBlockRef)(selectedBlockClientId);
  const onClick = () => {
    ref.current.focus();
  };
  return selectedBlockClientId ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
    variant: "secondary",
    className: "block-editor-skip-to-selected-block",
    onClick: onClick,
    children: (0, _i18n.__)('Skip to the selected block')
  }) : null;
}
//# sourceMappingURL=index.js.map