"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ClickAwayListener = void 0;
const react_1 = require("react");
const useClickAwayEffect_1 = require("../useClickAwayEffect");
/**
 * компонент предоставляющий обертку для работы с хуком useClickAwayEffect
 */
const ClickAwayListener = ({ onClickAway, preventBubbling, isActive = true, children, }) => {
    const ref = (0, react_1.useRef)(null);
    (0, useClickAwayEffect_1.useClickAwayEffect)({ ref, onClickAway, preventBubbling, isActive });
    // biome-ignore lint/suspicious/noExplicitAny: ReactElement имеет generic unknown по умолчанию и не содержит ref внутри
    const child = children;
    return react_1.Children.only((0, react_1.cloneElement)(child, { ref }));
};
exports.ClickAwayListener = ClickAwayListener;
