-
Notifications
You must be signed in to change notification settings - Fork 841
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
Add Suggest component #2270
Add Suggest component #2270
Conversation
EuiSuggestItems tests pass
EuiSuggestItems tests pass
…to suggest-item
@cchaos I think I've addressed most of your comments. Still not 100% happy with the behavior of the input on the Saved Queries example (it's a bit jumpy). Additionally, I added a handler for a click on a suggestion. |
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.
Still not 100% happy with the behavior of the input on the Saved Queries example (it's a bit jumpy).
I think we can continue to tackle that in a separate PR. For now, I'm concentrating on the actual EuiSuggest and it's components.
Sorry still finding a few things since this is such a large PR.
When the status is unchanged
it feels odd that the focus state doesn't extend the full length of the input .
const statusElement = status !== 'isLoading' && ( | ||
<EuiToolTip | ||
position="left" | ||
content={tooltipContent} |
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.
I think you can still supply some good defaults in the component itself for the tooltip instead of forcing that on the consumer. Probably just add a few to the statusMap
but allow tooltipContent
to override.
content={tooltipContent} | |
content={tooltipContent || statusMap[status].tooltip} |
The ||
will evaluate the first option first and if it is false, move to the next option.
@cchaos managed to fix the styling when using |
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.
This is really starting to come together nicely! My comments now are super nit picky.
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.
Great! LGTM, but we should get an engineer to do a pass as well. @chandlerprall can you review this one?
constructor(props) { | ||
super(props); | ||
|
||
this.state = { |
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.
Similarly this state initialization can move out of the constructor.
@chandlerprall thanks for your review. I've made changes following your suggestions. |
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.
LGTM! Pulled locally and tested in docs
customLabel: '', | ||
}; | ||
} | ||
state = { |
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.
@chandlerprall Should all the state
s have been pulled out of the constructor?
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.
Yep! This change is great to see
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.
TIL, thx
This will need a changelog update, but is now safe to merge. Congrats 🎉 |
@andreadelrio let's get this in 🚀 |
|
||
const suggestionList = suggestions.map((item, index) => ( | ||
<EuiSuggestItem | ||
type={item.type} |
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.
className
is not mapped here. Shall I submit a PR? @andreadelrio
Fixes #1938
Fixes #2270
Summary
This PR adds the
EuiSuggest
component and the corresponding docs.This component provides a way to display suggestions using a text field. Behind the scenes it uses
EuiSuggestItem
to display each suggestion following a very similar format to the one currently present in Kibana.The consumer is to handle what the current status of
EuiSuggest
is. The supported status arenotYetSaved
,saved
,noNewChanges
andisLoading
. Custom tooltip content is supported for these.EuiSuggest
can also have elements prefixed and/or appended to it. For this, there's theprefix
andappend
props which are bothPropTypes.node
.Checklist
- [ ] Checked for accessibility including keyboard-only and screenreader modes