greena13/react-hotkeys

View on GitHub
src/const/MousetrapToReactKeyNamesDictionary.js

Summary

Maintainability
A
0 mins
Test Coverage
/**
 * A mapping between Mousetrap syntax and React syntax to support the use of both
 */
const MousetrapToReactKeyNamesDictionary = {
  /**
   * Generic
   */
  'tab': 'Tab',

  'capslock': 'CapsLock',

  'shift': 'Shift',
  'meta': 'Meta',
  'alt': 'Alt',
  'ctrl': 'Control',

  'space': ' ',
  'spacebar': ' ',

  'escape': 'Escape',
  'esc': 'Escape',

  'left': 'ArrowLeft',
  'right': 'ArrowRight',
  'up': 'ArrowUp',
  'down': 'ArrowDown',

  /**
   * Mac
   */
  'return': 'Enter',
  'del': 'Delete',
  'command': 'Meta',
  'option': 'Alt',

  /**
   * Windows
   */
  'enter': 'Enter',
  'backspace': 'Backspace',
  'ins': 'Insert',
  'pageup': 'PageUp',
  'pagedown': 'PageDown',
  'end': 'End',
  'home': 'Home',
  'contextmenu': 'ContextMenu',
  'numlock': 'Clear'
};

export default MousetrapToReactKeyNamesDictionary;