-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add fragment support and update docs (#2)
* Update docs * Update default className * Add prop pass-through * Scaffold Fragment in render * Update dependencies and remove demo UMD * Update docs and add license * Fix toggle issue when using Fragment * Update dev dependencies
- Loading branch information
Showing
8 changed files
with
383 additions
and
483 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
/dist | ||
/node_modules | ||
index.umd.js | ||
npm-debug.log | ||
yarn-error.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2018 Brody McKee | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,60 @@ | ||
# react-outline-manager | ||
# React Outline Manager | ||
|
||
A simple component to help manage outlines in React applications. | ||
[![license](https://img.shields.io/npm/l/react-outline-manager.svg)](https://github.com/mrmckeb/react-outline-manager/blob/develop/LICENSE) | ||
[![npm](https://img.shields.io/npm/v/react-outline-manager.svg)](https://www.npmjs.com/package/react-outline-manager) | ||
[![type definitions](https://img.shields.io/npm/types/react-outline-manager.svg)](https://www.typescriptlang.org/) | ||
|
||
A simple component to help manage focus outlines in React applications. No dependencies. | ||
|
||
Includes CJS, ESM, and UMD (supporting browser usage) packages. TypeScript definitions are also included. | ||
|
||
## How it works | ||
|
||
Outlines on focussable elements are hidden by default, but shown if a user begins to interact with their keyboard | ||
(specifically, the `tab` key). | ||
Unlike CSS-only solutions that simply hide outlines on focusable elements, this component can help you to create | ||
beautiful web apps without sacrificing accessibility. | ||
|
||
Includes CJS, ESM, and UMD (supporting browser usage). | ||
When using this component, outlines on focusable elements are hidden until a user begins to interact with keyboard | ||
(specifically, the `tab` key). Optionally, resuming mouse/touch input can hide outlines again. | ||
|
||
TypeScript definitions are also included. | ||
From version [v1.2.0](https://github.com/mrmckeb/react-outline-manager/releases/tag/v1.1.0) and above, React v16.2+ is | ||
required due to the introduction of `Fragment` support. | ||
|
||
## Usage | ||
|
||
To use, wrap your tree with this component. | ||
To install with Yarn: | ||
```sh | ||
yarn add react-outline-manager | ||
``` | ||
|
||
To install with npm: | ||
```sh | ||
npm install --save react-outline-manager | ||
``` | ||
<ReactOutlineManager> | ||
<YourApp /> | ||
</ReactOutlineManager> | ||
|
||
Once installed, simply import React Outline Manager and wrap your your application. | ||
|
||
```js | ||
import ReactOutlineManager from 'react-outline-manager'; | ||
|
||
const MyAppWithOutlineManager = () => ( | ||
<ReactOutlineManager> | ||
<YourApp /> | ||
</ReactOutlineManager> | ||
); | ||
``` | ||
|
||
## Props | ||
Only wrapped components will be affected. This means that you can also choose to only wrap a part of you application if | ||
desired. | ||
|
||
## Props | ||
|
||
|Prop |Default value |Description| | ||
|-----------|---------------------|-----------| | ||
|`className`|`ReactOutlineHandler`|Use this to change the class of the wrapping component. This class is only visible when outlines should be hidden.| | ||
|`tagName` |`div` |Use this to change the element type used in the wrapping component.| | ||
|`className`|`ReactOutlineManager`|Use this to change the class of the wrapping component. This class is only visible when outlines should be hidden.| | ||
|`tagName` |`false` |Use this to change the element type used in the wrapping component, such as a `div`. When `false` (or omitted), this component renders as a `Fragment` and the `className` will be applied to the `body` tag.| | ||
|`toggle` |`false` |By default, outlines are enabled when a user hits tab, but not hidden again. Set this option to `true` if you want outlines to toggle on and off as the user switches between input methods.| | ||
|
||
When `tagName` is set, you may also pass through standard React HTML props. For example: | ||
```js | ||
<ReactOutlineManager onClick={() => {}} /> | ||
``` |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.