"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.useScrollFocusedIntoView = void 0;
var scroll_1 = require("../../utils/scroll");
var tiles_1 = require("../../utils/tiles");
exports.useScrollFocusedIntoView = function (containerRef) {
    var onFocus = function (e) {
        var tiles = tiles_1.getTiles(containerRef.current);
        var focusedTile = tiles.find(function (tile) { return tile.contains(e.target); });
        if (focusedTile) {
            scroll_1.scrollIntoView(containerRef.current, focusedTile);
        }
    };
    return { onFocus: onFocus };
};
