downshift 6.0.5 → 6.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -15
- package/dist/downshift.cjs.js +10 -7
- package/dist/downshift.esm.js +10 -7
- package/dist/downshift.native.cjs.js +10 -7
- package/dist/downshift.umd.js +10 -7
- package/dist/downshift.umd.js.map +1 -1
- package/dist/downshift.umd.min.js +1 -1
- package/dist/downshift.umd.min.js.map +1 -1
- package/package.json +2 -6
- package/preact/dist/downshift.cjs.js +10 -7
- package/preact/dist/downshift.esm.js +10 -7
- package/preact/dist/downshift.umd.js +10 -7
- package/preact/dist/downshift.umd.js.map +1 -1
- package/preact/dist/downshift.umd.min.js +1 -1
- package/preact/dist/downshift.umd.min.js.map +1 -1
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<h1 align="center">
|
|
2
2
|
downshift 🏎
|
|
3
3
|
<br>
|
|
4
|
-
<img src="https://downshift-js
|
|
4
|
+
<img src="https://github.com/downshift-js/downshift/blob/master/other/public/logo/downshift.svg" alt="downshift logo" title="downshift logo" width="300">
|
|
5
5
|
<br>
|
|
6
6
|
</h1>
|
|
7
7
|
<p align="center" style="font-size: 1.2rem;">Primitives to build simple, flexible, WAI-ARIA compliant React
|
|
@@ -160,7 +160,7 @@ npm install --save downshift
|
|
|
160
160
|
|
|
161
161
|
## Usage
|
|
162
162
|
|
|
163
|
-
> [Try it out in the browser]
|
|
163
|
+
> [Try it out in the browser][code-sandbox-try-it-out]
|
|
164
164
|
|
|
165
165
|
```jsx
|
|
166
166
|
import * as React from 'react'
|
|
@@ -230,8 +230,7 @@ render(
|
|
|
230
230
|
)
|
|
231
231
|
```
|
|
232
232
|
|
|
233
|
-
|
|
234
|
-
[here](https://codesandbox.io/s/n9095).
|
|
233
|
+
There is also an [example without getRootProps][code-sandbox-no-get-root-props].
|
|
235
234
|
|
|
236
235
|
> Warning: The example without `getRootProps` is not fully accessible with
|
|
237
236
|
> screen readers as it's not possible to achieve the HTML structure suggested by
|
|
@@ -1067,14 +1066,21 @@ platforms:
|
|
|
1067
1066
|
## Examples
|
|
1068
1067
|
|
|
1069
1068
|
> 🚨 We're in the process of moving all examples to the
|
|
1070
|
-
> [downshift-examples](https://github.com/
|
|
1069
|
+
> [downshift-examples](https://github.com/downshift-js/downshift-examples) repo
|
|
1071
1070
|
> (which you can open, interact with, and contribute back to live on
|
|
1072
1071
|
> [codesandbox](https://codesandbox.io/s/github/kentcdodds/downshift-examples))
|
|
1073
1072
|
|
|
1073
|
+
> 🚨 We're also in the process of updating our examples from the
|
|
1074
|
+
> [downshift-docs](https://github.com/downshift-js/downshift-docs) repo which is
|
|
1075
|
+
> actually used to create our docsite at [downshit-js.com][docsite]). Make sure to
|
|
1076
|
+
> check it out for the most relevant Downshift examples or try out the new hooks
|
|
1077
|
+
> that aim to replace Downshift.
|
|
1078
|
+
|
|
1074
1079
|
**Ordered Examples:**
|
|
1075
1080
|
|
|
1076
1081
|
If you're just learning downshift, review these in order:
|
|
1077
1082
|
|
|
1083
|
+
0. [basic automplete with getRootProps](https://codesandbox.io/s/github/kentcdodds/downshift-examples?file=/src/downshift/ordered-examples/00-get-root-props-example.js) - the same as example #1 but using the correct HTML structure as suggested by ARIA-WCAG.
|
|
1078
1084
|
1. [basic autocomplete](https://codesandbox.io/s/github/kentcdodds/downshift-examples/tree/master/?module=%2Fsrc%2Fordered-examples%2F01-basic-autocomplete.js&moduleview=1) -
|
|
1079
1085
|
very bare bones, not styled at all. Good place to start.
|
|
1080
1086
|
2. [styled autocomplete](https://codesandbox.io/s/github/kentcdodds/downshift-examples/tree/master/?module=%2Fsrc%2Fordered-examples%2F02-complete-autocomplete.js&moduleview=1) -
|
|
@@ -1087,14 +1093,6 @@ If you're just learning downshift, review these in order:
|
|
|
1087
1093
|
Shows how to create a MultiDownshift component that allows for an array of
|
|
1088
1094
|
selectedItems for multiple selection using a state reducer
|
|
1089
1095
|
|
|
1090
|
-
**Hooks Examples:**
|
|
1091
|
-
|
|
1092
|
-
We are also in the process of updating our [docsite][docsite] and we aim to add
|
|
1093
|
-
the examples that illustrate the use of hooks there. This is a great opportunity
|
|
1094
|
-
to contribute, by converting existing `Downshift` examples to either `useSelect`
|
|
1095
|
-
or `useCombobox` or by adding any other scenarios that you feel are
|
|
1096
|
-
representative.
|
|
1097
|
-
|
|
1098
1096
|
**Other Examples:**
|
|
1099
1097
|
|
|
1100
1098
|
Check out these examples of more advanced use/edge cases:
|
|
@@ -1214,7 +1212,7 @@ You can implement these other solutions using `downshift`, but if you'd prefer
|
|
|
1214
1212
|
to use these out of the box solutions, then that's fine too:
|
|
1215
1213
|
|
|
1216
1214
|
- [`react-select`](https://github.com/JedWatson/react-select)
|
|
1217
|
-
- [`react-
|
|
1215
|
+
- [`react-autosuggest`](https://github.com/moroshko/react-autosuggest)
|
|
1218
1216
|
|
|
1219
1217
|
## Bindings for ReasonML
|
|
1220
1218
|
|
|
@@ -1401,11 +1399,13 @@ Thanks goes to these people ([emoji key][emojis]):
|
|
|
1401
1399
|
<td align="center"><a href="https://github.com/limejoe"><img src="https://avatars2.githubusercontent.com/u/7977551?v=4" width="100px;" alt=""/><br /><sub><b>limejoe</b></sub></a><br /><a href="https://github.com/downshift-js/downshift/commits?author=limejoe" title="Code">💻</a> <a href="https://github.com/downshift-js/downshift/issues?q=author%3Alimejoe" title="Bug reports">🐛</a></td>
|
|
1402
1400
|
<td align="center"><a href="https://github.com/k88manish"><img src="https://avatars2.githubusercontent.com/u/19614770?v=4" width="100px;" alt=""/><br /><sub><b>Manish Kumar</b></sub></a><br /><a href="https://github.com/downshift-js/downshift/commits?author=k88manish" title="Code">💻</a></td>
|
|
1403
1401
|
</tr>
|
|
1402
|
+
<tr>
|
|
1403
|
+
<td align="center"><a href="https://github.com/fcrezza"><img src="https://avatars2.githubusercontent.com/u/48123020?v=4" width="100px;" alt=""/><br /><sub><b>Anang Fachreza</b></sub></a><br /><a href="https://github.com/downshift-js/downshift/commits?author=fcrezza" title="Documentation">📖</a> <a href="#example-fcrezza" title="Examples">💡</a></td>
|
|
1404
|
+
</tr>
|
|
1404
1405
|
</table>
|
|
1405
1406
|
|
|
1406
1407
|
<!-- markdownlint-enable -->
|
|
1407
1408
|
<!-- prettier-ignore-end -->
|
|
1408
|
-
|
|
1409
1409
|
<!-- ALL-CONTRIBUTORS-LIST:END -->
|
|
1410
1410
|
|
|
1411
1411
|
This project follows the [all-contributors][all-contributors] specification.
|
|
@@ -1482,3 +1482,7 @@ MIT
|
|
|
1482
1482
|
[select-aria]:
|
|
1483
1483
|
https://www.w3.org/TR/wai-aria-practices/examples/listbox/listbox-collapsible.html
|
|
1484
1484
|
[docsite]: https://downshift-js.com/
|
|
1485
|
+
[code-sandbox-try-it-out]:
|
|
1486
|
+
https://codesandbox.io/s/github/kentcdodds/downshift-examples?file=/src/downshift/ordered-examples/00-get-root-props-example.js
|
|
1487
|
+
[code-sandbox-no-get-root-props]:
|
|
1488
|
+
https://codesandbox.io/s/github/kentcdodds/downshift-examples?file=/src/downshift/ordered-examples/01-basic-autocomplete.js
|
package/dist/downshift.cjs.js
CHANGED
|
@@ -3176,13 +3176,16 @@ function downshiftUseComboboxReducer(state, action) {
|
|
|
3176
3176
|
break;
|
|
3177
3177
|
|
|
3178
3178
|
case InputBlur:
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3179
|
+
if (state.isOpen) {
|
|
3180
|
+
changes = _extends({
|
|
3181
|
+
isOpen: false,
|
|
3182
|
+
highlightedIndex: -1
|
|
3183
|
+
}, state.highlightedIndex >= 0 && action.selectItem && {
|
|
3184
|
+
selectedItem: props.items[state.highlightedIndex],
|
|
3185
|
+
inputValue: props.itemToString(props.items[state.highlightedIndex])
|
|
3186
|
+
});
|
|
3187
|
+
}
|
|
3188
|
+
|
|
3186
3189
|
break;
|
|
3187
3190
|
|
|
3188
3191
|
case InputChange:
|
package/dist/downshift.esm.js
CHANGED
|
@@ -3170,13 +3170,16 @@ function downshiftUseComboboxReducer(state, action) {
|
|
|
3170
3170
|
break;
|
|
3171
3171
|
|
|
3172
3172
|
case InputBlur:
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3173
|
+
if (state.isOpen) {
|
|
3174
|
+
changes = _extends({
|
|
3175
|
+
isOpen: false,
|
|
3176
|
+
highlightedIndex: -1
|
|
3177
|
+
}, state.highlightedIndex >= 0 && action.selectItem && {
|
|
3178
|
+
selectedItem: props.items[state.highlightedIndex],
|
|
3179
|
+
inputValue: props.itemToString(props.items[state.highlightedIndex])
|
|
3180
|
+
});
|
|
3181
|
+
}
|
|
3182
|
+
|
|
3180
3183
|
break;
|
|
3181
3184
|
|
|
3182
3185
|
case InputChange:
|
|
@@ -3109,13 +3109,16 @@ function downshiftUseComboboxReducer(state, action) {
|
|
|
3109
3109
|
break;
|
|
3110
3110
|
|
|
3111
3111
|
case InputBlur:
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3112
|
+
if (state.isOpen) {
|
|
3113
|
+
changes = _extends({
|
|
3114
|
+
isOpen: false,
|
|
3115
|
+
highlightedIndex: -1
|
|
3116
|
+
}, state.highlightedIndex >= 0 && action.selectItem && {
|
|
3117
|
+
selectedItem: props.items[state.highlightedIndex],
|
|
3118
|
+
inputValue: props.itemToString(props.items[state.highlightedIndex])
|
|
3119
|
+
});
|
|
3120
|
+
}
|
|
3121
|
+
|
|
3119
3122
|
break;
|
|
3120
3123
|
|
|
3121
3124
|
case InputChange:
|
package/dist/downshift.umd.js
CHANGED
|
@@ -4420,13 +4420,16 @@
|
|
|
4420
4420
|
break;
|
|
4421
4421
|
|
|
4422
4422
|
case InputBlur:
|
|
4423
|
-
|
|
4424
|
-
|
|
4425
|
-
|
|
4426
|
-
|
|
4427
|
-
|
|
4428
|
-
|
|
4429
|
-
|
|
4423
|
+
if (state.isOpen) {
|
|
4424
|
+
changes = _extends({
|
|
4425
|
+
isOpen: false,
|
|
4426
|
+
highlightedIndex: -1
|
|
4427
|
+
}, state.highlightedIndex >= 0 && action.selectItem && {
|
|
4428
|
+
selectedItem: props.items[state.highlightedIndex],
|
|
4429
|
+
inputValue: props.itemToString(props.items[state.highlightedIndex])
|
|
4430
|
+
});
|
|
4431
|
+
}
|
|
4432
|
+
|
|
4430
4433
|
break;
|
|
4431
4434
|
|
|
4432
4435
|
case InputChange:
|