├── .gitignore
├── .npmignore
├── CHANGELOG.md
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── bower.json
├── dist
├── react-menu.js
└── react-menu.min.js
├── eslint.json
├── examples
└── basic
│ ├── app.css
│ ├── app.js
│ └── index.html
├── karma.conf.js
├── lib
├── components
│ ├── Menu.js
│ ├── MenuOption.js
│ ├── MenuOptions.js
│ └── MenuTrigger.js
├── helpers
│ ├── injectCSS.js
│ └── uuid.js
├── index.js
└── mixins
│ └── buildClassName.js
├── package.json
├── scripts
├── build
├── dev-examples
├── preview-release
├── release
└── test
├── specs
├── Menu.spec.js
├── buildClassName.spec.js
├── helper.js
└── main.js
├── webpack.config.js
└── webpack.examples-config.js
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | examples/**/*-bundle.js
--------------------------------------------------------------------------------
/.npmignore:
--------------------------------------------------------------------------------
1 | CONTRIBUTING.md
2 | bower.json
3 | examples
4 | karma.conf.js
5 | script
6 | specs
7 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | v0.0.10 - Tue, 16 Aug 2016 15:36:53 GMT
2 | ---------------------------------------
3 |
4 | -
5 |
6 |
7 | v0.0.9 - Mon, 15 Aug 2016 20:11:02 GMT
8 | --------------------------------------
9 |
10 | -
11 |
12 |
13 | v0.0.8 - Thu, 04 Aug 2016 15:27:58 GMT
14 | --------------------------------------
15 |
16 | -
17 |
18 |
19 | v0.0.7 - Wed, 08 Jul 2015 15:16:44 GMT
20 | --------------------------------------
21 |
22 | - [3487aad](../../commit/3487aad) [added] bump to react 0.13
23 |
24 |
25 | v0.0.6 - Sat, 16 May 2015 18:38:13 GMT
26 | --------------------------------------
27 |
28 | -
29 |
30 |
31 | v0.0.5 - Sat, 29 Nov 2014 18:42:49 GMT
32 | --------------------------------------
33 |
34 | - [d61cbcf](../../commit/d61cbcf) [fixed] typo in docs regarding css class names
35 | - [7e5fa2a](../../commit/7e5fa2a) [fixed] Accessibility issues closes #2
36 | - [7e91a17](../../commit/7e91a17) [added] smart css defaults for MenuOptions placement
37 |
38 |
39 | v0.0.4 - Wed, 15 Oct 2014 17:53:32 GMT
40 | --------------------------------------
41 |
42 | - [022b8a8](../../commit/022b8a8) [fixed] issue where menu items not positioned absolute
43 | - [94b0dcf](../../commit/94b0dcf) [fixed] issue where menu always steals focus
44 | - [3fd228c](../../commit/3fd228c) [added] MenuOption cursor pointer in default style
45 | - [80cc592](../../commit/80cc592) [added] link to gh-pages example
46 |
47 |
48 | v0.0.3 - Sat, 11 Oct 2014 20:51:58 GMT
49 | --------------------------------------
50 |
51 | - [984104a](../../commit/984104a) [added] basic examples in README
52 | - [5be176c](../../commit/5be176c) [fixed] issue where components not exposed
53 |
54 |
55 | v0.0.2 - Sat, 11 Oct 2014 20:11:06 GMT
56 | --------------------------------------
57 |
58 | -
59 |
60 |
61 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | ### Commit Subjects
2 |
3 | If your patch **changes the API or fixes a bug** please use one of the
4 | following prefixes in your commit subject:
5 |
6 | - `[fixed] ...`
7 | - `[changed] ...`
8 | - `[added] ...`
9 | - `[removed] ...`
10 |
11 | That ensures the subject line of your commit makes it into the
12 | auto-generated changelog. Do not use these tags if your change doesn't
13 | fix a bug and doesn't change the public API.
14 |
15 | Commits with changed, added, or removed, must be reviewed by another
16 | collaborator.
17 |
18 | #### When using `[changed]` or `[removed]`...
19 |
20 | Please include an upgrade path with example code in the commit message.
21 | If it doesn't make sense to do this, then it doesn't make sense to use
22 | `[changed]` or `[removed]` :)
23 |
24 | ### Docs
25 |
26 | Please update the README with any API changes, the code and docs should
27 | always be in sync.
28 |
29 | ### Development
30 |
31 | - `scripts/test` will fire up a karma runner and watch for changes in the
32 | specs directory.
33 | - `npm test` will do the same but doesn't watch, just runs the tests.
34 | - `scripts/build-examples` does exactly that.
35 |
36 | ### Build
37 |
38 | Please do not include the output of `scripts/build` in your commits, we
39 | only do this when we release. (Also, you probably don't need to build
40 | anyway unless you are fixing something around our global build.)
41 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2014 Jason Madsen
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy of
4 | this software and associated documentation files (the "Software"), to deal in
5 | the Software without restriction, including without limitation the rights to
6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
7 | of the Software, and to permit persons to whom the Software is furnished to do
8 | so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in all
11 | copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | SOFTWARE.
20 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # react-menu
2 |
3 | An accessible menu component built for React.JS
4 |
5 | See example at [http://instructure-react.github.io/react-menu/](http://instructure-react.github.io/react-menu/)
6 |
7 | ## Basic Usage
8 |
9 | ```html
10 | var React = require('react');
11 | var ReactDOM = require('react-dom');
12 |
13 | var Menu = require('react-menu');
14 | var MenuTrigger = Menu.MenuTrigger;
15 | var MenuOptions = Menu.MenuOptions;
16 | var MenuOption = Menu.MenuOption;
17 |
18 | var App = React.createClass({
19 |
20 | render: function() {
21 | return (
22 |
46 | );
47 | }
48 | });
49 |
50 | ReactDOM.render(, document.body);
51 |
52 | ```
53 |
54 | For a working example see the `examples/basic` example
55 |
56 | ## Styles
57 |
58 | Bring in default styles by calling `injectCSS` on the `Menu` component.
59 |
60 | ```javascript
61 | var Menu = require('react-menu');
62 |
63 | Menu.injectCSS();
64 | ```
65 |
66 | Default styles will be added to the top of the head, and thus any styles you
67 | write will override any of the defaults.
68 |
69 | The following class names are used / available for modification in your own stylsheets:
70 |
71 | ```
72 | .Menu
73 | .Menu__MenuTrigger
74 | .Menu__MenuOptions
75 | .Menu__MenuOption
76 | .Menu__MenuOptions--vertical-bottom
77 | .Menu__MenuOptions--vertical-top
78 | .Menu__MenuOptions--horizontal-right
79 | .Menu__MenuOptions--horizontal-left
80 | ```
81 |
82 | The last four class names control the placement of menu options when the menu
83 | would otherwise bleed off the screen. See `/lib/helpers/injectCSS.js` for
84 | defaults. The `.Menu__MenuOptions` element will always have a vertical and
85 | horizontal modifier.
86 |
--------------------------------------------------------------------------------
/bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "react-menu",
3 | "version": "0.0.10",
4 | "homepage": "https://github.com/knomedia/react-menu",
5 | "authors": [
6 | "Jason Madsen"
7 | ],
8 | "description": "Accessible menu component for React.JS",
9 | "main": "dist/react-menu.js",
10 | "keywords": [
11 | "react",
12 | "menu",
13 | "dropdown"
14 | ],
15 | "license": "MIT",
16 | "ignore": [
17 | "**/.*",
18 | "node_modules",
19 | "bower_components",
20 | "specs",
21 | "modules",
22 | "examples",
23 | "script",
24 | "CONTRIBUTING.md",
25 | "karma.conf.js",
26 | "package.json"
27 | ]
28 | }
--------------------------------------------------------------------------------
/eslint.json:
--------------------------------------------------------------------------------
1 | {
2 | "env": {
3 | "browser": true,
4 | "node": true
5 | },
6 | "rules": {
7 | "quotes": 0,
8 | "no-comma-dangle": 2,
9 | "no-underscore-dangle": 0,
10 | "curly": 0,
11 | "strict": 0,
12 | "no-use-before-define": 0,
13 | "no-cond-assign": 0,
14 | "consistent-return": 0,
15 | "new-cap": 0,
16 | "no-unused-vars": 0
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/examples/basic/app.css:
--------------------------------------------------------------------------------
1 | .Menu {
2 | width: 37px;
3 | }
4 |
5 | .Menu__MenuOptions {
6 | width: 150px;
7 | }
8 |
9 | .Menu__MenuTrigger {
10 | text-align: right;
11 | font-size: 1.8em;
12 | padding-right: 10px;
13 | }
14 |
15 | .spacer {
16 | height: 5px;
17 | border-bottom: 1px solid #ccc;
18 | }
19 |
--------------------------------------------------------------------------------
/examples/basic/app.js:
--------------------------------------------------------------------------------
1 | var React = require('react');
2 | var ReactDOM = require('react-dom');
3 | var Menu = require('../../lib/index');
4 | var MenuTrigger = require('../../lib/components/MenuTrigger');
5 | var MenuOptions = require('../../lib/components/MenuOptions');
6 | var MenuOption = require('../../lib/components/MenuOption');
7 |
8 |
9 | Menu.injectCSS();
10 |
11 |
12 | var App = React.createClass({
13 |
14 | handleSecondOption: function() {
15 | alert('SECOND OPTION CLICKED');
16 | },
17 |
18 | handleDisabledSelect: function() {
19 | alert('this one is disabled');
20 | },
21 |
22 | render: function() {
23 | return (
24 |
25 |
57 |
58 |
react-menu has keyboard and screen reader support.