Skip to content

Commit dcb96f1

Browse files
authored
Omit is* word in components value (#117)
Ref #6 (comment) Thses names allow to distinguish values from functions. isActive -> active isFocused -> focused isHovered -> hovered isTouched -> touched
1 parent a1c85eb commit dcb96f1

File tree

19 files changed

+135
-135
lines changed

19 files changed

+135
-135
lines changed

.size-snapshot.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
{
22
"dist/react-powerplug.umd.js": {
3-
"bundled": 23769,
4-
"minified": 9469,
5-
"gzipped": 2596
3+
"bundled": 23707,
4+
"minified": 9407,
5+
"gzipped": 2594
66
},
77
"dist/react-powerplug.cjs.js": {
8-
"bundled": 20833,
9-
"minified": 10881,
10-
"gzipped": 2485
8+
"bundled": 20771,
9+
"minified": 10819,
10+
"gzipped": 2483
1111
},
1212
"dist/react-powerplug.esm.js": {
13-
"bundled": 20171,
14-
"minified": 10321,
15-
"gzipped": 2348,
13+
"bundled": 20109,
14+
"minified": 10259,
15+
"gzipped": 2344,
1616
"treeshaked": {
1717
"rollup": {
1818
"code": 365,

README.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,11 @@ import { Pagination, Tabs, Checkbox } from './MyDumbComponents'
7979
| **\<Set>** | `{ initial, onChange }` | `{ values, add, clear, remove, has }` | [:point_down:](#set) [:books:](docs/components/Set.md) |
8080
| **\<List>** | `{ initial, onChange }` | `{ list, first, last, push, pull, sort, set }` | [:point_down:](#list) [:books:](docs/components/List.md) |
8181
| <h6>FEEDBACK CONTAINERS</h6> |
82-
| **\<Hover>** | `{ onChange }` | `{ isHovered, bind }` | [:point_down:](#hover) [:books:](docs/components/Hover.md) |
83-
| **\<Active>** | `{ onChange }` | `{ isActive, bind }` | [:point_down:](#active) [:books:](docs/components/Active.md) |
84-
| **\<Focus>** | `{ onChange }` | `{ isFocused, bind }` | [:point_down:](#focus) [:books:](docs/components/Focus.md) |
85-
| **\<Touch>** | `{ onChange }` | `{ isTouched, bind }` | [:point_down:](#touch) [:books:](docs/components/Touch.md) |
86-
| **\<FocusManager>** | `{ onChange }` | `{ isFocused, blur, bind }` | [:point_down:](#focusmanager) [:books:](docs/components/FocusManager.md) |
82+
| **\<Hover>** | `{ onChange }` | `{ hovered, bind }` | [:point_down:](#hover) [:books:](docs/components/Hover.md) |
83+
| **\<Active>** | `{ onChange }` | `{ active, bind }` | [:point_down:](#active) [:books:](docs/components/Active.md) |
84+
| **\<Focus>** | `{ onChange }` | `{ focused, bind }` | [:point_down:](#focus) [:books:](docs/components/Focus.md) |
85+
| **\<Touch>** | `{ onChange }` | `{ touched, bind }` | [:point_down:](#touch) [:books:](docs/components/Touch.md) |
86+
| **\<FocusManager>** | `{ onChange }` | `{ focused, blur, bind }` | [:point_down:](#focusmanager) [:books:](docs/components/FocusManager.md) |
8787
| <h6>FORM CONTAINERS</h6> |
8888
| **\<Input>** | `{ initial, onChange }` | `{ set, value, bind }` | [:point_down:](#input) [:books:](docs/components/Input.md) |
8989
| **\<Form>** | `{ initial, onChange }` | `{ input, values }` | [:point_down:](#form) [:books:](docs/components/Form.md) |
@@ -209,9 +209,9 @@ import { Pagination, Tabs, Checkbox } from './MyDumbComponents'
209209
210210
```jsx
211211
<Hover>
212-
{({ isHovered, bind }) => (
212+
{({ hovered, bind }) => (
213213
<div {...bind}>
214-
You are {isHovered ? 'hovering' : 'not hovering'} this div.
214+
You are {hovered ? 'hovering' : 'not hovering'} this div.
215215
</div>
216216
)}
217217
</Hover>
@@ -221,9 +221,9 @@ import { Pagination, Tabs, Checkbox } from './MyDumbComponents'
221221
222222
```jsx
223223
<Active>
224-
{({ isActive, bind }) => (
224+
{({ active, bind }) => (
225225
<div {...bind}>
226-
You are {isActive ? 'clicking' : 'not clicking'} this div.
226+
You are {active ? 'clicking' : 'not clicking'} this div.
227227
</div>
228228
)}
229229
</Active>
@@ -233,9 +233,9 @@ import { Pagination, Tabs, Checkbox } from './MyDumbComponents'
233233
234234
```jsx
235235
<Touch>
236-
{({ isTouched, bind }) => (
236+
{({ touched, bind }) => (
237237
<div {...bind}>
238-
You are {isTouched ? 'touching' : 'not touching'} this div.
238+
You are {touched ? 'touching' : 'not touching'} this div.
239239
</div>
240240
)}
241241
</Touch>
@@ -245,10 +245,10 @@ import { Pagination, Tabs, Checkbox } from './MyDumbComponents'
245245
246246
```jsx
247247
<Focus>
248-
{({ isFocused, bind }) => (
248+
{({ focused, bind }) => (
249249
<div>
250250
<input {...bind} placeholder="Focus me" />
251-
<div>You are {isFocused ? 'focusing' : 'not focusing'} input.</div>
251+
<div>You are {focused ? 'focusing' : 'not focusing'} input.</div>
252252
</div>
253253
)}
254254
</Focus>

docs/components/Active.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ import { Active } from 'react-powerplug'
99

1010
```jsx
1111
<Active>
12-
{({ isActive, bind }) => (
12+
{({ active, bind }) => (
1313
<div {...bind}>
14-
You are {isActive ? 'clicking' : 'not clicking'} this div.
14+
You are {active ? 'clicking' : 'not clicking'} this div.
1515
</div>
1616
)}
1717
</Active>
@@ -20,13 +20,13 @@ import { Active } from 'react-powerplug'
2020
## Active Props
2121

2222
**onChange** _(optional)_
23-
The onChange event of the Active is called whenever the isActive state changes.
23+
The onChange event of the Active is called whenever the active state changes.
2424

2525
## Active Children Props
2626

27-
TL;DR: `{ isActive, bind }`
27+
TL;DR: `{ active, bind }`
2828

29-
**isActive**
29+
**active**
3030
`boolean`
3131
True if is activated (being clicked) the binded element
3232

docs/components/Focus.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ import { Focus } from 'react-powerplug'
99

1010
```jsx
1111
<Focus>
12-
{({ isFocused, bind }) => (
12+
{({ focused, bind }) => (
1313
<div>
1414
<input {...bind} placeholder="Focus me" />
15-
<div>You are {isFocused ? 'focusing' : 'not focusing'} the input.</div>
15+
<div>You are {focused ? 'focusing' : 'not focusing'} the input.</div>
1616
</div>
1717
)}
1818
</Focus>
@@ -21,13 +21,13 @@ import { Focus } from 'react-powerplug'
2121
## Focus Props
2222

2323
**onChange** _(optional)_
24-
The onChange event of the Focus is called whenever the isFocused state changes.
24+
The onChange event of the Focus is called whenever the focused state changes.
2525

2626
## Focus Children Props
2727

28-
TL;DR: `{ isFocused, bind }`
28+
TL;DR: `{ focused, bind }`
2929

30-
**isFocused**
30+
**focused**
3131
`boolean`
3232
True if is focusing the binded element
3333

docs/components/Hover.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ import { Hover } from 'react-powerplug'
99

1010
```jsx
1111
<Hover>
12-
{({ isHovered, bind }) => (
12+
{({ hovered, bind }) => (
1313
<div {...bind}>
14-
You are {isHovered ? 'hovering' : 'not hovering'} this div.
14+
You are {hovered ? 'hovering' : 'not hovering'} this div.
1515
</div>
1616
)}
1717
</Hover>
@@ -20,13 +20,13 @@ import { Hover } from 'react-powerplug'
2020
## Hover Props
2121

2222
**onChange** _(optional)_
23-
The onChange event of the Hover is called whenever the isHovered state changes.
23+
The onChange event of the Hover is called whenever the hovered state changes.
2424

2525
## Hover Children Props
2626

27-
TL;DR: `{ isHovered, bind }`
27+
TL;DR: `{ hovered, bind }`
2828

29-
**isHovered**
29+
**hovered**
3030
`boolean`
3131
True if is hovering the binded element
3232

docs/components/Touch.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ import { Touch } from 'react-powerplug'
88

99
```jsx
1010
<Touch>
11-
{({ isTouched, bind }) => (
11+
{({ touched, bind }) => (
1212
<div {...bind}>
13-
You are {isTouched ? 'touching' : 'not touching'} this div.
13+
You are {touched ? 'touching' : 'not touching'} this div.
1414
</div>
1515
)}
1616
</Touch>
@@ -19,13 +19,13 @@ import { Touch } from 'react-powerplug'
1919
## Touch Props
2020

2121
**onChange** _(optional)_
22-
The onChange event of the Touch is called whenever the isTouched state changes.
22+
The onChange event of the Touch is called whenever the touched state changes.
2323

2424
## Touch Children Props
2525

26-
TL;DR: `{ isTouched, bind }`
26+
TL;DR: `{ touched, bind }`
2727

28-
**isTouched**
28+
**touched**
2929
`boolean`
3030
True if is touching the binded element
3131

docs/utils/composeEvents.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ import { Hover, composeEvents } from 'react-powerplug'
77

88
const HoveredDiv = ({ children, onMouseEnter, onMouseLeave, ...restProps }) => (
99
<Hover>
10-
{({ isHover, bindHover }) => (
10+
{({ hovered, bindHover }) => (
1111
<div
1212
{...composeEvents({ onMouseEnter, onMouseLeave }, bindHover)}
1313
{...restProps}
14-
children={children(isHover)}
14+
children={children(hovered)}
1515
/>
1616
)}
1717
</Hover>

src/components/Active.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ import onChangeProp from '../utils/onChangeProp'
55

66
const Active = ({ onChange, ...props }) => (
77
<State
8-
initial={{ isActive: false }}
9-
onChange={onChangeProp(onChange, 'isActive')}
8+
initial={{ active: false }}
9+
onChange={onChangeProp(onChange, 'active')}
1010
>
1111
{({ state, setState }) =>
1212
renderProps(props, {
13-
isActive: state.isActive,
13+
active: state.active,
1414
bind: {
15-
onMouseDown: () => setState({ isActive: true }),
16-
onMouseUp: () => setState({ isActive: false }),
15+
onMouseDown: () => setState({ active: true }),
16+
onMouseUp: () => setState({ active: false }),
1717
},
1818
})
1919
}

src/components/Focus.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ import onChangeProp from '../utils/onChangeProp'
55

66
const Focus = ({ onChange, ...props }) => (
77
<State
8-
initial={{ isFocused: false }}
9-
onChange={onChangeProp(onChange, 'isFocused')}
8+
initial={{ focused: false }}
9+
onChange={onChangeProp(onChange, 'focused')}
1010
>
1111
{({ state, setState }) =>
1212
renderProps(props, {
13-
isFocused: state.isFocused,
13+
focused: state.focused,
1414
bind: {
15-
onFocus: () => setState({ isFocused: true }),
16-
onBlur: () => setState({ isFocused: false }),
15+
onFocus: () => setState({ focused: true }),
16+
onBlur: () => setState({ focused: false }),
1717
},
1818
})
1919
}

src/components/FocusManager.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,24 @@ const FocusManager = ({ onChange, ...props }) => {
77
let canBlur = true
88
return (
99
<State
10-
initial={{ isFocused: false }}
11-
onChange={onChangeProp(onChange, 'isFocused')}
10+
initial={{ focused: false }}
11+
onChange={onChangeProp(onChange, 'focused')}
1212
>
1313
{({ state, setState }) =>
1414
renderProps(props, {
15-
isFocused: state.isFocused,
15+
focused: state.focused,
1616
blur: () => {
17-
setState({ isFocused: false })
17+
setState({ focused: false })
1818
},
1919
bind: {
2020
tabIndex: -1,
2121
onBlur: () => {
2222
if (canBlur) {
23-
setState({ isFocused: false })
23+
setState({ focused: false })
2424
}
2525
},
2626
onFocus: () => {
27-
setState({ isFocused: true })
27+
setState({ focused: true })
2828
},
2929
onMouseDown: () => {
3030
canBlur = false

0 commit comments

Comments
 (0)