-
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 display, descriptionWidth, textWrap and isInvalid props to EuiExpression #3467
Add display, descriptionWidth, textWrap and isInvalid props to EuiExpression #3467
Conversation
Preview documentation changes for this PR: https://eui.elastic.co/pr_3467/ |
06dd882
to
4adbc16
Compare
4adbc16
to
23dad35
Compare
Preview documentation changes for this PR: https://eui.elastic.co/pr_3467/ |
Preview documentation changes for this PR: https://eui.elastic.co/pr_3467/ |
Preview documentation changes for this PR: https://eui.elastic.co/pr_3467/ |
This looks good. The demo example wasn't showing the truncate prop however. And do we need a |
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 thing is finally getting used and getting some ❤️ love.
Preview documentation changes for this PR: https://eui.elastic.co/pr_3467/ |
@mdefazio not sure what you mean by this, can you elaborate? do you mean a min-width for the |
@cchaos wondering if it's wrong having to set a width on |
Preview documentation changes for this PR: https://eui.elastic.co/pr_3467/ |
Preview documentation changes for this PR: https://eui.elastic.co/pr_3467/ |
@cchaos do you think that truncation should be for both the And another doubt, what do you think the truncate behaviour should be on the second Expression here ^? Truncate so that it only takes up one line? Like this |
Preview documentation changes for this PR: https://eui.elastic.co/pr_3467/ |
@cchaos I added the |
4590e7a
to
d15a4b4
Compare
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 looking really good. It maintains the original ideals of the component while simply making it more robust with more alternate displays. It might be a good idea to update the PR summary screenshots.
One addition to the truncate prop we may want to consider is using EuiInnerText
to apply the rendered text as the title
prop to both the description and values. This will ensure that the full truncated text can be seen with a long mouse hover.
Most of my other comments are copy changes and best practices. But truly this is in a great spot!
Preview documentation changes for this PR: https://eui.elastic.co/pr_3467/ |
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 looks great! Nice work!
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! Just a few nit comments now. I also added Greg for an eng for review.
const [example1, setExample1] = useState({ | ||
isOpen: false, | ||
value: ( | ||
<div> |
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 don't think you need this div
, but if you do, it gets removed if you change the selected options, so you need to add it to the onChange
function as well. You can simply change it to a fragment <></>
setExample2({ | ||
...example2, | ||
}); |
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.
setExample2({ | |
...example2, | |
}); |
setExample1({ | ||
...example1, | ||
}); |
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.
setExample1({ | |
...example1, | |
}); |
text: ( | ||
<p> | ||
To truncate <strong>EuiExpression</strong>'s content, pass{' '} | ||
<EuiCode>truncate</EuiCode> to the <EuiCode>textWrap</EuiCode> prop. |
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.
<EuiCode>truncate</EuiCode> to the <EuiCode>textWrap</EuiCode> prop. | |
<EuiCode language="ts">{'textWrap="truncate"'}</EuiCode>. |
Text truncation only works properly if the prop types of{' '} | ||
<EuiCode>description</EuiCode> and <EuiCode>value</EuiCode> are | ||
strings. If you're using nodes, use the{' '} | ||
<EuiCode>.eui-textTruncate</EuiCode> |
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.
<EuiCode>.eui-textTruncate</EuiCode> | |
<EuiCode>.eui-textTruncate</EuiCode>{' '} |
<div> | ||
<p className="eui-textTruncate">.kibana_task_manager</p> | ||
<p className="eui-textTruncate">kibana_sample_data_ecommerce</p> | ||
</div> |
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.
<div> | |
<p className="eui-textTruncate">.kibana_task_manager</p> | |
<p className="eui-textTruncate">kibana_sample_data_ecommerce</p> | |
</div> | |
<> | |
<p className="eui-textTruncate">.kibana_task_manager</p> | |
<p className="eui-textTruncate">kibana_sample_data_ecommerce</p> | |
</> |
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.
Code LGTM 👍
Preview documentation changes for this PR: https://eui.elastic.co/pr_3467/ |
…ression (elastic#3467) * added prop * added test and updated example * add cl * added description to tooltip * renamed prop, turned into enum * example is function component * update snippet * make the example more like alerting * new styles * basic combobox working * more progress on example * added align right * removed truncate * renamed column prop * cleanup * updated tests and added handling of color * remove unneeded line * Review updates * update test * re-added textWrap prop * update cl * PR feedback Co-authored-by: cchaos <[email protected]>
Summary
This PR adds the
display
,descriptionWidth
,textWrap
andisInvalid
props toEuiExpression
. The improvements introduced in this PR come, in part, as response to this Kibana ticket.There are three new sections in the docs. One where
display
anddescriptionWidth
are shown and two others fortextWrap
andisInvalid
respectively.New: Column display
New: Invalid state for both clickable and read-only
Expression
sNew: Text truncation
Checklist
- [ ] Checked for breaking changes and labeled appropriately- [ ] Checked for accessibility including keyboard-only and screenreader modes