import React from 'react';
import { K as KEY_CODES } from './key_codes-a5a2b85e.js';

function useEscapeKey(onEscape) {
  var handleKeyUp = React.useCallback(function (e) {
    if (e.keyCode === KEY_CODES.ESC) {
      onEscape(e);
    }
  });
  React.useEffect(function () {
    document.addEventListener('keyup', handleKeyUp);
    return function () {
      document.removeEventListener('keyup', handleKeyUp);
    };
  }, []);
}

export { useEscapeKey as u };
