'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var React = require('react');
var useWindowKeyPress = require('./useWindowKeyPress.js');

function useHasFocus(ref) {
    const [hasFocus, setHasFocus] = React.useState(false);
    const tabPressed = useWindowKeyPress.useWindowKeyPress('Tab');
    React.useEffect(() => {
        if (ref.current === document.activeElement) {
            setHasFocus(true);
        }
        else {
            setHasFocus(false);
        }
    }, [tabPressed]);
    return { hasFocus, setHasFocus };
}

exports.useHasFocus = useHasFocus;
