Skip to content
This repository was archived by the owner on Sep 20, 2023. It is now read-only.

Commit 5091847

Browse files
authored
Merge pull request #18 from rpearce/maintenance
maintenance, bumps, license, builds
2 parents a119627 + feed8bd commit 5091847

File tree

12 files changed

+24783
-22282
lines changed

12 files changed

+24783
-22282
lines changed

.browserslistrc

Lines changed: 0 additions & 3 deletions
This file was deleted.

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
language: node_js
22
node_js:
3-
- "12"
3+
- "13"
44
cache: yarn
55
after_success:
66
- npm run coverage

API.md

Lines changed: 0 additions & 40 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,20 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
66

7+
## [4.1.0] - 2019-12-29
8+
9+
### Added
10+
* added `browser` field for umd build
11+
12+
### Changed
13+
* bumped all deps
14+
* updated `main` and `module` fields
15+
* license from ISC to BSD-3
16+
* moved API docs back to README
17+
18+
### Removed
19+
* `.browserslistrc` file (just use babel preset-env default)
20+
721
## [4.0.0] - 2019-09-12
822

923
### Changed

LICENSE

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,30 @@
1-
ISC License (ISC)
1+
Copyright (c) 2019, Robert Pearce
22

3-
Copyright 2018 Robert Pearce
3+
All rights reserved.
44

5-
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
5+
Redistribution and use in source and binary forms, with or without
6+
modification, are permitted provided that the following conditions are met:
67

7-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
8+
* Redistributions of source code must retain the above copyright
9+
notice, this list of conditions and the following disclaimer.
10+
11+
* Redistributions in binary form must reproduce the above
12+
copyright notice, this list of conditions and the following
13+
disclaimer in the documentation and/or other materials provided
14+
with the distribution.
15+
16+
* Neither the name of Robert Pearce nor the names of other
17+
contributors may be used to endorse or promote products derived
18+
from this software without specific prior written permission.
19+
20+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

README.md

Lines changed: 58 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,64 @@ following to an element that wants to be a "button":
1111
* enforced labelling via either `aria-label` or `children`
1212

1313
## Links
14-
* [`API Documentation`](./API.md)
15-
* [`Authors`](./AUTHORS)
16-
* [`Changelog`](./CHANGELOG.md)
17-
* [`Contributing`](./CONTRIBUTING.md)
18-
* [`Code of Conduct`](./CODE_OF_CONDUCT.md)
14+
* [Installation](#installation)
15+
* [Usage](#usage)
16+
* [API](#api)
17+
* [All Contributors](#contributors)
18+
* [Authors](./AUTHORS)
19+
* [Changelog](./CHANGELOG.md)
20+
* [Contributing](./CONTRIBUTING.md)
21+
* [Code of Conduct](./CODE_OF_CONDUCT.md)
22+
23+
# Installation
24+
```
25+
npm i react-button-a11y
26+
```
27+
or
28+
```
29+
yarn add react-button-a11y
30+
```
31+
32+
## Usage
33+
34+
### With `aria-label`
35+
```js
36+
import ButtonA11y from 'react-button-a11y'
37+
38+
// ...
39+
40+
<ButtonA11y
41+
aria-label="Click this to do X"
42+
className="some-className"
43+
onClick={evt => { console.log('press happened: ', evt) }}
44+
/>
45+
```
46+
47+
### Without `aria-label`
48+
If you don't provide an `aria-label`, you need to provide `children` so that
49+
there is something to describe what clicking / tapping this button does.
50+
```js
51+
import ButtonA11y from 'react-button-a11y'
52+
53+
// ...
54+
55+
<ButtonA11y
56+
className="some-className"
57+
onClick={evt => { console.log('press happened: ', evt) }}
58+
>
59+
Click this to do X
60+
</ButtonA11y>
61+
```
62+
63+
# API
64+
65+
| Prop | Type | Required | Default | Details |
66+
| --- | --- | --- | --- | --- |
67+
| `aria-label` | String | yes if `children` absent | none | Pass an `aria-label` if you don't pass children with descriptive text |
68+
| `children` | Node | yes if `aria-label` absent | none | Pass `children` with descriptive text if you don't pass an `aria-label` |
69+
| `element` | String | no | `'span'` | The default element is a `div`, but you can pass a `span`, e.g., if you like |
70+
| `onClick` | Function | yes | `Function.prototype` | When the button is "pressed" (via Enter or Spacebar or click), this callback will be triggered with the event |
71+
| `strictMode` | Bool | no | `true` | An error will be thrown if enabled and you fail to pass both an `aria-label` and `children` |
1972

2073
## Contributors
2174

0 commit comments

Comments
 (0)