downshift 5.1.0 → 5.2.2

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 CHANGED
@@ -1,11 +1,11 @@
1
1
  <h1 align="center">
2
2
  downshift 🏎
3
3
  <br>
4
- <img src="https://downshift.netlify.com/logo/downshift.svg" alt="downshift logo" title="downshift logo" width="300">
4
+ <img src="https://downshift.netlify.app/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
8
- autocomplete/dropdown/select/combobox components</p>
8
+ autocomplete, combobox or select dropdown components.</p>
9
9
 
10
10
  > See
11
11
  > [the intro blog post](https://kentcdodds.com/blog/introducing-downshift-for-react)
@@ -30,9 +30,10 @@ autocomplete/dropdown/select/combobox components</p>
30
30
 
31
31
  ## The problem
32
32
 
33
- You need an autocomplete/dropdown/select experience in your application and you
33
+ You need an autocomplete/combobox/select experience in your application and you
34
34
  want it to be accessible. You also want it to be simple and flexible to account
35
- for your use cases.
35
+ for your use cases. Finally, it should follow the [ARIA design
36
+ pattern][combobox-aria] for a combobox.
36
37
 
37
38
  ## This solution
38
39
 
@@ -83,7 +84,7 @@ the possibility of multiple selection, and want it to be functional and
83
84
  accessible, jump directly to the already implemented
84
85
  [useSelect][useselect-readme], [useCombobox][combobox-readme] and
85
86
  [useMultipleSelection][multiple-selection-readme]. For more examples of how to
86
- use the hooks check out our [docsite](https://downshift.netlify.com/)!
87
+ use the hooks check out our [docsite](https://downshift.netlify.app/)!
87
88
 
88
89
  ### Bundle size concerns
89
90
 
@@ -99,7 +100,6 @@ the library treeshaked (pruned) and given only the code you need. Since version
99
100
  <!-- START doctoc generated TOC please keep comment here to allow auto update -->
100
101
  <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
101
102
 
102
-
103
103
  - [Installation](#installation)
104
104
  - [Usage](#usage)
105
105
  - [Basic Props](#basic-props)
@@ -251,7 +251,7 @@ The previous example without `getRootProps` is
251
251
  > Warning: The example without `getRootProps` is not fully accessible with
252
252
  > screen readers as it's not possible to achieve a correct HTML structure for
253
253
  > the combobox. Examples on how to use `Downshift` component with and without
254
- > `getRootProps` are on the [docsite](https://downshift.netlify.com/).
254
+ > `getRootProps` are on the [docsite](https://downshift.netlify.app/).
255
255
 
256
256
  `<Downshift />` is the only component exposed by this package. It doesn't render
257
257
  anything itself, it just calls the render function and renders that. ["Use a
@@ -272,10 +272,13 @@ the section "[Children Function](#children-function)".
272
272
 
273
273
  ### itemToString
274
274
 
275
- > `function(item: any)` | defaults to: `i => (i == null ? '' : String(i))`
275
+ > `function(item: any)` | defaults to: `item => (item ? String(item) : '')`
276
+
277
+ If your items are stored as, say, objects instead of strings, downshift still
278
+ needs a string representation for each one (e.g., to set `inputValue`).
276
279
 
277
- Used to determine the string value for the selected item (which is used to
278
- compute the `inputValue`).
280
+ **Note:** This callback _must_ include a null check: it is invoked with `null`
281
+ whenever the user abandons input via `<Esc>`.
279
282
 
280
283
  ### onChange
281
284
 
@@ -399,10 +402,9 @@ This function is passed as props to a `Status` component nested within and
399
402
  allows you to create your own assertive ARIA statuses.
400
403
 
401
404
  A default `getA11yStatusMessage` function is provided that will check
402
- `resultCount` and return "No results." or if there are results but no item is
403
- highlighted, "`resultCount` results are available, use up and down arrow keys to
404
- navigate." If an item is highlighted it will run `itemToString(highlightedItem)`
405
- and display the value of the `highlightedItem`.
405
+ `resultCount` and return "No results are available." or if there are results ,
406
+ "`resultCount` results are available, use up and down arrow keys to navigate.
407
+ Press Enter key to select."
406
408
 
407
409
  The object you are passed to generate your status message has the following
408
410
  properties:
@@ -440,7 +442,7 @@ Called with the item that was selected and the new state of `downshift`. (see
440
442
 
441
443
  This function is called anytime the internal state changes. This can be useful
442
444
  if you're using downshift as a "controlled" component, where you manage some or
443
- all of the state (e.g. isOpen, selectedItem, highlightedIndex, etc) and then
445
+ all of the state (e.g., isOpen, selectedItem, highlightedIndex, etc) and then
444
446
  pass it as props, rather than letting downshift control all its state itself.
445
447
  The parameters both take the shape of internal state
446
448
  (`{highlightedIndex: number, inputValue: string, isOpen: boolean, selectedItem: any}`)
@@ -1394,11 +1396,16 @@ Thanks goes to these people ([emoji key][emojis]):
1394
1396
  <td align="center"><a href="https://github.com/stefanprobst"><img src="https://avatars0.githubusercontent.com/u/20753323?v=4" width="100px;" alt=""/><br /><sub><b>stefanprobst</b></sub></a><br /><a href="https://github.com/downshift-js/downshift/commits?author=stefanprobst" title="Code">💻</a> <a href="https://github.com/downshift-js/downshift/commits?author=stefanprobst" title="Tests">⚠️</a></td>
1395
1397
  <td align="center"><a href="https://github.com/louisaspicer"><img src="https://avatars1.githubusercontent.com/u/20270031?v=4" width="100px;" alt=""/><br /><sub><b>Louisa Spicer</b></sub></a><br /><a href="https://github.com/downshift-js/downshift/commits?author=louisaspicer" title="Code">💻</a> <a href="https://github.com/downshift-js/downshift/issues?q=author%3Alouisaspicer" title="Bug reports">🐛</a></td>
1396
1398
  <td align="center"><a href="https://neet.love"><img src="https://avatars2.githubusercontent.com/u/19276905?v=4" width="100px;" alt=""/><br /><sub><b>Ryō Igarashi</b></sub></a><br /><a href="https://github.com/downshift-js/downshift/issues?q=author%3Aneet" title="Bug reports">🐛</a> <a href="https://github.com/downshift-js/downshift/commits?author=neet" title="Code">💻</a></td>
1399
+ <td align="center"><a href="http://ryanlue.com/"><img src="https://avatars2.githubusercontent.com/u/12194123?v=4" width="100px;" alt=""/><br /><sub><b>Ryan Lue</b></sub></a><br /><a href="https://github.com/downshift-js/downshift/commits?author=rlue" title="Documentation">📖</a></td>
1400
+ </tr>
1401
+ <tr>
1402
+ <td align="center"><a href="https://github.com/mattleonowicz"><img src="https://avatars3.githubusercontent.com/u/9438872?v=4" width="100px;" alt=""/><br /><sub><b>Mateusz Leonowicz</b></sub></a><br /><a href="https://github.com/downshift-js/downshift/commits?author=mattleonowicz" title="Code">💻</a></td>
1397
1403
  </tr>
1398
1404
  </table>
1399
1405
 
1400
1406
  <!-- markdownlint-enable -->
1401
1407
  <!-- prettier-ignore-end -->
1408
+
1402
1409
  <!-- ALL-CONTRIBUTORS-LIST:END -->
1403
1410
 
1404
1411
  This project follows the [all-contributors][all-contributors] specification.
@@ -1470,3 +1477,5 @@ MIT
1470
1477
  [multiple-selection-readme]:
1471
1478
  https://github.com/downshift-js/downshift/tree/master/src/hooks/useMultipleSelection
1472
1479
  [bundle-phobia-link]: https://bundlephobia.com/result?p=downshift@3.4.8
1480
+ [combobox-aria]:
1481
+ https://www.w3.org/TR/wai-aria-practices/examples/combobox/aria1.1pattern/listbox-combo.html