"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.IntersectionContainer = void 0;
const tslib_1 = require("tslib");
const jsx_runtime_1 = require("react/jsx-runtime");
const react_1 = tslib_1.__importDefault(require("react"));
const uikit_1 = require("@gravity-ui/uikit");
const cn_1 = require("../../../utils/cn.js");
require("./IntersectionContainer.css");
const b = (0, cn_1.block)('intersection-container');
const IntersectionContainer = ({ children, onIntersect, options, className, }) => {
    const [ref, setRef] = react_1.default.useState(null);
    (0, uikit_1.useIntersection)({ element: ref, onIntersect, options });
    if (onIntersect) {
        return ((0, jsx_runtime_1.jsx)("div", { className: b('container', className), ref: setRef, children: children }));
    }
    return children;
};
exports.IntersectionContainer = IntersectionContainer;
//# sourceMappingURL=IntersectionContainer.js.map
