@choc-ui/chakra-autocomplete 5.2.10 → 5.3.1
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 +30 -15
- package/dist/autocomplete-input.d.ts.map +1 -1
- package/dist/index.es.js +1123 -1108
- package/dist/index.js +10 -10
- package/dist/types.d.ts +4 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/use-autocomplete.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -25,14 +25,14 @@
|
|
|
25
25
|
|
|
26
26
|
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
|
27
27
|
|
|
28
|
-
[](#contributors-)
|
|
29
29
|
|
|
30
30
|
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
|
31
31
|
|
|
32
32
|
</a>
|
|
33
33
|
<br />
|
|
34
34
|
AutoComplete Component for the <a href="https://chakra-ui.com">Chakra UI</a> Library.</em>
|
|
35
|
-
|
|
35
|
+
|
|
36
36
|
</sup>
|
|
37
37
|
<br />
|
|
38
38
|
<br />
|
|
@@ -385,7 +385,7 @@ Then add the `AutoCompleteCreatable` component to the bottom of the list. Refer
|
|
|
385
385
|
|
|
386
386
|
<img width="517" alt="CleanShot 2021-07-29 at 02 29 20@2x" src="https://user-images.githubusercontent.com/30869823/127417453-e78b9b48-26e8-4ff0-a264-1d6bb4717ab0.png">
|
|
387
387
|
|
|
388
|
-
|
|
388
|
+
## Loading State
|
|
389
389
|
|
|
390
390
|
Need to pull data from API, but don't want your users to see a blank screen? You can enable the loading state by passing the `isLoading` prop to `AutoComplete`. By doing this, 2 other props will be enabled
|
|
391
391
|
|
|
@@ -397,7 +397,13 @@ Best practice is to combine `setTimeout` and `useEffect` to create a debounce ef
|
|
|
397
397
|
|
|
398
398
|
A working code demo can be found [here](https://codesandbox.io/s/choc-ui-chakra-autocomplete-loading-tfc8jz)
|
|
399
399
|
|
|
400
|
-
|
|
400
|
+
## Integration with Form Libraries
|
|
401
|
+
|
|
402
|
+
It is relatively easy to integrate with form libaries such as `React Hook Form`, `Formik`, and others. Working examples can be found in the `demos` folder of this repo. See the [Contributing](#contribute) section of this doc on how to clone and set it up for testing.
|
|
403
|
+
|
|
404
|
+
Does your favorite form library not have a working example? Submit a PR to get it added and help others using this library quickly get up and running.
|
|
405
|
+
|
|
406
|
+
## Autocomplete methods
|
|
401
407
|
|
|
402
408
|
Assign a ref to the `AutoComplete` component and call the available methods with:
|
|
403
409
|
|
|
@@ -453,6 +459,12 @@ Wrapper and Provider for `AutoCompleteInput` and `AutoCompleteList`
|
|
|
453
459
|
<td>boolean</td>
|
|
454
460
|
<td>Suggestions list is open by default</td>
|
|
455
461
|
<td>false</td>
|
|
462
|
+
</tr>
|
|
463
|
+
<tr>
|
|
464
|
+
<td>prefocusFirstItem</td>
|
|
465
|
+
<td>boolean</td>
|
|
466
|
+
<td>Should prefocus first item intially, on query change, on open, and on filter out of current focused item</td>
|
|
467
|
+
<td>true</td>
|
|
456
468
|
</tr>
|
|
457
469
|
<tr>
|
|
458
470
|
<td>defaultValues</td>
|
|
@@ -560,7 +572,7 @@ boolean | MaybeRenderProp<{ value: Item["value"] }>
|
|
|
560
572
|
<tr>
|
|
561
573
|
<td>onSelectOption</td>
|
|
562
574
|
<td>
|
|
563
|
-
|
|
575
|
+
|
|
564
576
|
```ts
|
|
565
577
|
(params: {
|
|
566
578
|
item: Item;
|
|
@@ -591,7 +603,7 @@ boolean | MaybeRenderProp<{ value: Item["value"] }>
|
|
|
591
603
|
<tr>
|
|
592
604
|
<td>onReady</td>
|
|
593
605
|
<td>
|
|
594
|
-
|
|
606
|
+
|
|
595
607
|
```ts
|
|
596
608
|
(props:{tags:ItemTag[]}) => void
|
|
597
609
|
```
|
|
@@ -602,7 +614,7 @@ boolean | MaybeRenderProp<{ value: Item["value"] }>
|
|
|
602
614
|
<tr>
|
|
603
615
|
<td>onTagRemoved</td>
|
|
604
616
|
<td>
|
|
605
|
-
|
|
617
|
+
|
|
606
618
|
```ts
|
|
607
619
|
(removedTag: Item["value"],item: Item, tags: Item["value"][]) => void
|
|
608
620
|
```
|
|
@@ -643,7 +655,7 @@ boolean | MaybeRenderProp<{ value: Item["value"] }>
|
|
|
643
655
|
<tr>
|
|
644
656
|
<td>shouldRenderSuggestions</td>
|
|
645
657
|
<td>
|
|
646
|
-
|
|
658
|
+
|
|
647
659
|
```ts
|
|
648
660
|
(value: string) => boolean
|
|
649
661
|
```
|
|
@@ -731,7 +743,7 @@ Tags for multiple mode
|
|
|
731
743
|
<td>Yes<br></td>
|
|
732
744
|
<td>———</td>
|
|
733
745
|
</tr>
|
|
734
|
-
|
|
746
|
+
|
|
735
747
|
</tbody>
|
|
736
748
|
</table>
|
|
737
749
|
|
|
@@ -782,7 +794,7 @@ e.g.
|
|
|
782
794
|
<td>No<br></td>
|
|
783
795
|
<td>———</td>
|
|
784
796
|
</tr>
|
|
785
|
-
|
|
797
|
+
|
|
786
798
|
<tr>
|
|
787
799
|
<td>ref</td>
|
|
788
800
|
<td>
|
|
@@ -1020,7 +1032,7 @@ val => val;
|
|
|
1020
1032
|
```
|
|
1021
1033
|
|
|
1022
1034
|
</td>
|
|
1023
|
-
</tr>
|
|
1035
|
+
</tr>
|
|
1024
1036
|
</tbody>
|
|
1025
1037
|
</table>
|
|
1026
1038
|
|
|
@@ -1085,7 +1097,7 @@ When true, `AutoCompleteCreatable` is shown even when the `AutoCompleteInput` is
|
|
|
1085
1097
|
<td>No<br></td>
|
|
1086
1098
|
<td>———</td>
|
|
1087
1099
|
</tr>
|
|
1088
|
-
|
|
1100
|
+
|
|
1089
1101
|
</tbody>
|
|
1090
1102
|
</table>
|
|
1091
1103
|
|
|
@@ -1152,9 +1164,12 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
|
|
|
1152
1164
|
<td align="center"><a href="https://github.com/MathisFederico"><img src="https://avatars.githubusercontent.com/u/60117466?v=4" width="100px;" alt=""/><br /><sub><b>Mathis Federico</b></sub></a><br /><a href="https://github.com/anubra266/choc-autocomplete/commits?author=MathisFederico" title="Bug">🐛</a></td>
|
|
1153
1165
|
<td align="center"><a href="https://github.com/Kysluss"><img src="https://avatars.githubusercontent.com/u/29052043?v=4" width="100px;" alt=""/><br /><sub><b>Kyle Slusser</b></sub></a><br /><a href="https://github.com/anubra266/choc-autocomplete/commits?author=Kysluss" title="Code">💻🐛</a></td>
|
|
1154
1166
|
<td align="center"><a href="https://github.com/sakerhetspolisen"><img src="https://avatars.githubusercontent.com/u/68159964?v=4" width="100px;" alt=""/><br /><sub><b>Karl F. Sellergren</b></sub></a><br /><a href="https://github.com/anubra266/choc-autocomplete/commits?author=sakerhetspolisen" title="Code">🐛🔧</a></td>
|
|
1155
|
-
<td align="center"><a href="https://github.com/JedBh"><img src="https://avatars.githubusercontent.com/u/44101778?v=4" width="100px;" alt=""/><br /><sub><b>Jedediah Benhod</b></sub></a><br /><a href="https://github.com/anubra266/choc-autocomplete/commits?author=
|
|
1156
|
-
<td align="center"><a href="https://github.com/Janekk"><img src="https://avatars.githubusercontent.com/u/6827881?v=4" width="100px;" alt=""/><br /><sub><b>Janusz Kacalak</b></sub></a><br /><a href="https://github.com/anubra266/choc-autocomplete/commits?author=
|
|
1157
|
-
|
|
1167
|
+
<td align="center"><a href="https://github.com/JedBh"><img src="https://avatars.githubusercontent.com/u/44101778?v=4" width="100px;" alt=""/><br /><sub><b>Jedediah Benhod</b></sub></a><br /><a href="https://github.com/anubra266/choc-autocomplete/commits?author=jedBh" title="Code">🐛</a></td>
|
|
1168
|
+
<td align="center"><a href="https://github.com/Janekk"><img src="https://avatars.githubusercontent.com/u/6827881?v=4" width="100px;" alt=""/><br /><sub><b>Janusz Kacalak</b></sub></a><br /><a href="https://github.com/anubra266/choc-autocomplete/commits?author=janekk" title="Code">🐛</a></td>
|
|
1169
|
+
<td align="center"><a href="https://github.com/ThomasHickman"><img src="https://avatars.githubusercontent.com/u/6304200?v=4" width="100px;" alt=""/><br /><sub><b>Thomas Hickman</b></sub></a><br /><a href="https://github.com/anubra266/choc-autocomplete/commits?author=thomashickman" title="Bug">🐛</a></td>
|
|
1170
|
+
</tr>
|
|
1171
|
+
<tr>
|
|
1172
|
+
<td align="center"><a href="https://github.com/chrisregner"><img src="https://avatars.githubusercontent.com/u/26005158?v=4" width="100px;" alt=""/><br /><sub><b>Christopher Regner</b></sub></a><br /><a href="https://github.com/anubra266/choc-autocomplete/commits?author=chrisregner" title="Code">📖🐛</a></td>
|
|
1158
1173
|
</tr>
|
|
1159
1174
|
</table>
|
|
1160
1175
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autocomplete-input.d.ts","sourceRoot":"","sources":["../src/autocomplete-input.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,UAAU,EAIV,iBAAiB,EAMlB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,KAAoB,MAAM,OAAO,CAAC;AAGzC,OAAO,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAEhD,MAAM,WAAW,sBAAuB,SAAQ,IAAI,CAAC,UAAU,EAAE,UAAU,CAAC;IAC1E,QAAQ,CAAC,EAAE,eAAe,CAAC;QAAE,IAAI,EAAE,qBAAqB,CAAC,MAAM,CAAC,CAAA;KAAE,CAAC,CAAC;IACpE,UAAU,CAAC,EAAE,iBAAiB,CAAC;IAC/B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAC9B;AAgBD,eAAO,MAAM,iBAAiB,
|
|
1
|
+
{"version":3,"file":"autocomplete-input.d.ts","sourceRoot":"","sources":["../src/autocomplete-input.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,UAAU,EAIV,iBAAiB,EAMlB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,KAAoB,MAAM,OAAO,CAAC;AAGzC,OAAO,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAEhD,MAAM,WAAW,sBAAuB,SAAQ,IAAI,CAAC,UAAU,EAAE,UAAU,CAAC;IAC1E,QAAQ,CAAC,EAAE,eAAe,CAAC;QAAE,IAAI,EAAE,qBAAqB,CAAC,MAAM,CAAC,CAAA;KAAE,CAAC,CAAC;IACpE,UAAU,CAAC,EAAE,iBAAiB,CAAC;IAC/B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAC9B;AAgBD,eAAO,MAAM,iBAAiB,gGAqE7B,CAAC"}
|