-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Suggest] refactor to support new QueryList state #2748
Conversation
also remove isTyping state, which fixes double render. when open, selectedItem appears in placeholder instead of input value. this is a nicer experience and works great with resetOnSelect.
these keys used to clear the selection, now they just cancel a selection in progress and keep the previous selection state.
fix esc/tab testsPreview: documentation | landing | table |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question about the ternary, otherwise cool
> | ||
<InputGroup | ||
placeholder="Search..." | ||
value={inputValue} | ||
placeholder={isOpen && selectedItemText ? selectedItemText : "Search..."} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
""
, which you set as the default on line 110 is falsy. is that what you intend?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes it should say "Search..." instead of ""
default placeholderPreview: documentation | landing | table |
* move resetOnSelect to IListItemsProps so all components share it * ⭐ allow activeItem and query to be un/controlled move required props from IQueryListProps to optional in IListItemsProps! add handleQueryChange to renderer props. move activeItem/query state into IQueryListState * QueryList initialize state and update renderer usage * refactor QueryList to control activeItem and query and always pick an enabled first item * refactor four friends to push state into QueryList * little fixes * common suite of tests for select components * update docs: no value/onChange in inputProps * tzp tests * only invoke onQueryChange if it changed * revert Suggest (followup PR with more extensive changes) * [Suggest] refactor to support new QueryList state (#2748) * refactor Suggest to use QueryList's activeItem and query also remove isTyping state, which fixes double render. when open, selectedItem appears in placeholder instead of input value. this is a nicer experience and works great with resetOnSelect. * add resetOnSelect switch to Suggest example * revert disabled tests * fix esc/tab tests these keys used to clear the selection, now they just cancel a selection in progress and keep the previous selection state. * default placeholder * remove omnibar query prop (semantic conflict) * activeItem: T | null - explicit null for "no active item" - undefined optional prop puts it in uncontrolled mode * maybeRenderClearButton
Targets #2747
Changes proposed in this pull request:
Suggest
to support newQueryList
state and un/controlled features.Suggest
now shows the selected item as the placeholder text when editing.isTyping
, which was responsible for inconsistent behavior in the common test suites.resetOnSelect
switch to example