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 |
cchaos
left a comment
There was a problem hiding this comment.
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
cchaos
left a comment
There was a problem hiding this comment.
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/ |
mdefazio
left a comment
There was a problem hiding this comment.
This looks great! Nice work!
cchaos
left a comment
There was a problem hiding this comment.
🎉 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.
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.
| setExample2({ | |
| ...example2, | |
| }); |
| setExample1({ | ||
| ...example1, | ||
| }); |
There was a problem hiding this comment.
| 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.
| <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.
| <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.
| <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> | |
| </> |
|
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 <caroline.horn@elastic.co>






Summary
This PR adds the
display,descriptionWidth,textWrapandisInvalidprops 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
displayanddescriptionWidthare shown and two others fortextWrapandisInvalidrespectively.New: Column display

New: Invalid state for both clickable and read-only

ExpressionsNew: Text truncation

Checklist
- [ ] Checked for breaking changes and labeled appropriately- [ ] Checked for accessibility including keyboard-only and screenreader modes