├── .gitignore
├── LICENSE
├── README.md
├── example
├── .npmignore
├── index.html
├── index.tsx
├── package.json
└── tsconfig.json
├── package.json
├── src
└── index.tsx
├── test
└── disabled.test.tsx
├── tsconfig.json
└── yarn.lock
/.gitignore:
--------------------------------------------------------------------------------
1 | *.log
2 | .DS_Store
3 | node_modules
4 | .cache
5 | .rts2_cache_cjs
6 | .rts2_cache_esm
7 | .rts2_cache_umd
8 | .rts2_cache_system
9 | dist
10 | .idea
11 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2019 Kristijan Ristovski
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.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # 🙅♂️ react-disable
2 |
3 | ### Other projects by [@thekitze](https://twitter.com/thekitze)
4 |
5 | - 💻 [Sizzy](https://sizzy.co) - A browser for developers and designers
6 | - 🏫 [React Academy](https://reactacademy.io) - Interactive React and GraphQL workshops
7 | - 💌 [Twizzy](https://twizzy.app) - A standalone app for Twitter DM
8 | - 🤖 [JSUI](https://github.com/kitze/JSUI) - A powerful UI toolkit for managing JavaScript apps
9 |
10 | ---
11 |
12 | ## Demo
13 | 
14 |
15 | ## Usage
16 |
17 | `yarn add react-disable`
18 |
19 | Just wrap any children with the `Disable` component in order to disable the section.
20 | The disabled sections are also aware if a parent is disabled, so they will be disabled, but the styles won't be duplicated (the opacity won't be multiplied, etc.)
21 |
22 | ```jsx
23 | import { Disable } from 'react-disable';
24 |
25 | const App = () => {
26 | const [disableForm, setDisableForm] = React.useState(false);
27 | const toggle = () => setDisableForm(d => !d);
28 |
29 | return (
30 |