├── .babelrc
├── .eslintrc
├── .gitignore
├── .npmignore
├── LICENSE
├── README.md
├── package.json
├── src
├── Popups.jsx
├── Viewer.jsx
├── index.html
└── viewer.js
└── webpack.config.js
/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": [
3 | "env",
4 | "react",
5 | ],
6 | "plugins": [
7 | "transform-class-properties",
8 | ]
9 | }
--------------------------------------------------------------------------------
/.eslintrc:
--------------------------------------------------------------------------------
1 | {
2 | "parser": "babel-eslint",
3 | "parserOptions": {
4 | "sourceType": "module",
5 | "ecmaFeatures": {
6 | "jsx": true
7 | }
8 | },
9 | "env": {
10 | "es6": true,
11 | "browser": true,
12 | "commonjs": true,
13 | },
14 | "plugins": [
15 | "react",
16 | "jsx-control-statements",
17 | ],
18 | "extends": [
19 | "eslint:recommended",
20 | "plugin:react/recommended",
21 | "plugin:jsx-control-statements/recommended",
22 | ],
23 | "rules": {
24 | "object-curly-spacing": [2, "always"],
25 | "no-console": 1,
26 | "no-unused-vars": 1,
27 | "quotes": 2,
28 | "quote-props": 2,
29 | "func-call-spacing": [2, "always"],
30 | "strict": [2, "global"],
31 | "semi": [2, "never"],
32 | "no-tabs": 2,
33 | "no-template-curly-in-string": 2,
34 | "no-unsafe-negation": 2,
35 | "accessor-pairs": [2, {"getWithoutSet": true}],
36 | "array-callback-return": 2,
37 | "block-scoped-var": 2,
38 | "class-methods-use-this": [2, { "exceptMethods": [] }],
39 | "eqeqeq": 2,
40 | "no-prototype-builtins": 2,
41 | "no-else-return": 2,
42 | "no-global-assign": [2, {"exceptions": []}],
43 | "no-implicit-globals": 2,
44 | "no-loop-func": 2,
45 | "no-fallthrough": 2,
46 | "no-floating-decimal": 2,
47 | "no-return-assign": 2,
48 | "no-sequences": 2,
49 | "no-unmodified-loop-condition": 2,
50 | "no-unused-expressions": [2, { "allowShortCircuit": true, "allowTernary": true }],
51 | "no-useless-call": 2,
52 | "no-useless-concat": 2,
53 | "no-useless-escape": 2,
54 | "no-useless-return": 2,
55 | "no-void": 2,
56 | "no-with": 2,
57 | "yoda": [2, "never", { "exceptRange": true }],
58 | "no-shadow-restricted-names": 2,
59 | "no-shadow": [2, { "builtinGlobals": true, "hoist": "all", "allow": [] }],
60 | "no-use-before-define": ["error", { "functions": true, "classes": true }],
61 | "comma-dangle": [2, "always-multiline"],
62 | "comma-style": [2, "last", { "exceptions": {} }],
63 | "eol-last": 2,
64 | "indent": [2, 2],
65 | "key-spacing": 2,
66 | "new-cap": 2,
67 | "new-parens": 2,
68 | "no-array-constructor": 2,
69 | "no-lonely-if": 2,
70 | "no-mixed-operators": 2,
71 | "no-multiple-empty-lines": [2, {max: 1}],
72 | "no-nested-ternary": 2,
73 | "no-unneeded-ternary": 2,
74 | "no-trailing-spaces": 2,
75 | "no-whitespace-before-property": 2,
76 | "operator-assignment": 2,
77 | "space-before-function-paren": 2,
78 | "space-before-blocks": 2,
79 | "space-in-parens": 2,
80 | "space-infix-ops": 2,
81 | "wrap-regex": 2,
82 | "arrow-body-style": 2,
83 | "arrow-parens": 2,
84 | "arrow-spacing": 2,
85 | "no-confusing-arrow": 2,
86 | "no-duplicate-imports": 2,
87 | "no-useless-computed-key": 2,
88 | "no-useless-rename": 2,
89 | "no-var": 2,
90 | "object-shorthand": 2,
91 | "prefer-arrow-callback": 2,
92 | "prefer-const": 2,
93 | "prefer-rest-params": 2,
94 | "prefer-spread": 2,
95 | "prefer-template": 2,
96 | "rest-spread-spacing": 2,
97 | "symbol-description": 2,
98 | "template-curly-spacing": 2,
99 |
100 | "react/display-name": 0,
101 | "react/forbid-component-props": [2, { "forbid": [
102 | "className",
103 | "style",
104 | ] }],
105 | "react/no-children-prop": 2,
106 | "react/no-danger": 2,
107 | "react/no-danger-with-children": 2,
108 | "react/no-did-mount-set-state": [2, "disallow-in-func"],
109 | "react/no-did-update-set-state": 2,
110 | "react/no-direct-mutation-state": 2,
111 | "react/no-find-dom-node": 0,
112 | "react/no-is-mounted": 2,
113 | "react/no-render-return-value": 2,
114 | "react/no-string-refs": 2,
115 | "react/no-unescaped-entities": 2,
116 | "react/no-unknown-property": 2,
117 | "react/no-unused-prop-types": 2,
118 | "react/prop-types": 0,
119 | "react/react-in-jsx-scope": 2,
120 | "react/require-render-return": 2,
121 | "react/self-closing-comp": 2,
122 | "react/style-prop-object": 2,
123 |
124 | "react/jsx-closing-bracket-location": 2,
125 | "react/jsx-curly-spacing": 2,
126 | "react/jsx-equals-spacing": 2,
127 | "react/jsx-filename-extension": 0,
128 | "react/jsx-first-prop-new-line": [2, "multiline-multiprop"],
129 | "react/jsx-indent": [2, 2],
130 | "react/jsx-indent-props": [2, 2],
131 | "react/jsx-key": 2,
132 | "react/jsx-max-props-per-line": [2, {maximum: 3}],
133 | "react/jsx-no-comment-textnodes": 2,
134 | "react/jsx-no-duplicate-props": 2,
135 | "react/jsx-no-target-blank": 2,
136 | "react/jsx-pascal-case": 2,
137 | "react/jsx-tag-spacing": 2,
138 | "react/jsx-uses-react": 2,
139 | "react/jsx-uses-vars": 2,
140 |
141 | "react/jsx-no-undef": 0,
142 | "jsx-control-statements/jsx-jcs-no-undef": 2,
143 | },
144 | }
145 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules/
2 | npm-debug.log
3 | dist
--------------------------------------------------------------------------------
/.npmignore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Radivarig/react-popups/960b47296d41b9cb3965519e022dbd34fa0e04d6/.npmignore
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2018 Reslav Hollos
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
13 | all 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
21 | THE SOFTWARE.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # react-popups
2 |
3 | Try it - [Live Example](https://radivarig.github.io/#/react-popups)
4 |
5 | 
6 |
7 | ### Install
8 |
9 | `npm install --save react-popups`
10 |
11 | ### Demo
12 |
13 | Check out [Live Example](https://radivarig.github.io/#/react-popups) and the [example code](https://github.com/Radivarig/react-popups/blob/master/src/PopupsViewer.jsx), or run locally
14 | ```bash
15 | git clone git@github.com:Radivarig/react-popups.git
16 | npm install
17 | npm run build
18 | npm run start
19 | ```
20 |
21 | ### Features
22 |
23 | - create custom popup components on custom event
24 | - pass data to them
25 | - detect screen quadrant (safe to click near edges)
26 | - close all front popups on click
27 |
28 | ### Basic Usage
29 |
30 | ```javascript
31 | // ...
32 | var Popups = require('react-popups')
33 |
34 | var PopupHandler = React.createClass({
35 | render: function() {
36 | console.log('received: ', this.props.data) // received: clicked element identifier
37 | var Popup =
54 | The