Skip to content

Commit

Permalink
feat(Autocomplete): add controllable isOpen, inputValue props; extend…
Browse files Browse the repository at this point in the history
… text behaviour on item select (#2567)

* feat(Autocomplete): add controllable inputValue prop; extend text behaviour on item select

* refactor(Autocomplete): test

* feat(Autocomplete): return clearAfterSelect and deprecate it

* fix: useCombobox internally changes input value on blur

* feat: extend ControlledFromOutside with new props
  • Loading branch information
maxcheremisin authored Aug 30, 2023
1 parent 56179a3 commit 51eb9f4
Show file tree
Hide file tree
Showing 5 changed files with 223 additions and 168 deletions.
5 changes: 5 additions & 0 deletions .changeset/soft-queens-eat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@contentful/f36-autocomplete': minor
---

Add new props: `textOnAfterSelect?: 'clear' | 'preserve' | 'replace'`, `isOpen?: boolean; onOpen?: () => void; onClose?: () => void`, `inputValue?: string`
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ export default function AutocompleteMultiSelectionExample() {
onSelectItem={handleSelectItem}
itemToString={(item) => item.name}
renderItem={(item) => item.name}
// When this prop is `true`, it will clean the TextInput after an option is selected
clearAfterSelect
// When `textOnAfterSelect` is `"clear"`, it will clean the TextInput after an option is selected
textOnAfterSelect="clear"
closeAfterSelect={false}
/>

Expand Down
Loading

1 comment on commit 51eb9f4

@vercel
Copy link

@vercel vercel bot commented on 51eb9f4 Aug 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.