export var keys = {
    Space: 'Space',
    Escape: 'Escape'
};
export var useKeyNavigation = function useKeyNavigation(param) {
    var opened = param.opened, closeOnEsc = param.closeOnEsc, onToggle = param.onToggle;
    var onKeyDown = function onKeyDown(event) {
        switch(event.code){
            case keys.Space:
                {
                    if (!opened) {
                        event.preventDefault();
                        onToggle(true, event);
                    }
                    break;
                }
            case keys.Escape:
                {
                    if (opened && closeOnEsc) {
                        event.preventDefault();
                        onToggle(false, event);
                    }
                    break;
                }
            default:
                {
                    break;
                }
        }
    };
    return {
        onKeyDown: onKeyDown
    };
};
