├── .babelrc ├── .flowconfig ├── .gitignore ├── .npmignore ├── LICENSE ├── README.md ├── assets └── cover.png ├── docs ├── bundle.js ├── favicon.ico ├── favicon.png └── index.html ├── package.json ├── src ├── docs │ ├── favicon.ico │ ├── favicon.png │ ├── index.html │ ├── index.jsx │ └── styles.css └── lib │ ├── global.js │ ├── index.jsx │ └── input.js ├── webpack.config.js └── yarn.lock /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["flow","env", "react"], 3 | "plugins": [ 4 | "transform-object-rest-spread", 5 | "transform-class-properties" 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | 3 | [include] 4 | 5 | [libs] 6 | 7 | [lints] 8 | 9 | [options] 10 | 11 | [strict] 12 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | *.log 3 | node_modules 4 | dist 5 | es 6 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | docs 2 | src 3 | .babelrc 4 | webpack.config.js -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Armando Sosa 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 🎹 React Keyboardist 2 | 3 | ![](assets/cover.png) 4 | 5 | React Keyboardist offers a simple and declarative way to add keyboard shortcuts to your react applications. It is just a React Wrapper for [🎹Keyboardist](https://github.com/soska/keyboardist.js). 6 | 7 | [Click here for a simple demo](http://soska.github.io/react-keyboardist/docs/index.html) 8 | 9 | ## TOC 10 | 11 | * [Installation](#installation) 12 | * [Global Listener](#global) 13 | * [How to Use](#how-to-use) 14 | * [Other Events](#other-events) 15 | * [Multiple Listeners For A Key](#multiple-listeners) 16 | * [Event Monitor](#monitor) 17 | * [KeyboardInput](#keyboard-input) 18 | * [How to Use](#how-to-use-input) 19 | * [Textarea](#textarea) 20 | * [Examples](#examples) 21 | * [Integration with React Router](#react-router) 22 | 23 | ## Installation 24 | 25 | ``` 26 | $ yarn add react-keyboardist 27 | 28 | or 29 | 30 | $ npm install --save react-keyboardist 31 | ``` 32 | 33 | ## Global Listener 34 | 35 | The default export `` provides a global listener attached to the document element that will listen for every key event except those that happen inside input elements (e.g. ``,`