[EuiComboBox] Added option.prepend and option.append support#6953
[EuiComboBox] Added option.prepend and option.append support#6953cee-chen merged 11 commits intoelastic:mainfrom
option.prepend and option.append support#6953Conversation
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_6953/ |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_6953/ |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_6953/ |
|
Hey Shahzad! Super apologies it's taken me so long to get around to reviewing this PR - I plan on taking some time to look at it first thing tomorrow. Any objections if I push up any changes/cleanup/feedback directly to your branch? If you'd prefer that I leave code comments in GitHub instead, no worries, just let me know. |
|
@cee-chen for sure feel free to push updates. |
option.prepend and option.icon support
+ cleanup - flatten more `euiComboBoxOption` selectors
+ other misc cleanup - remove unnecessary eslint disable (accounts for rest spread), add some newlines
- Use just one demo that switches between single selection and multi selection - Reuse as much copy from `EuiSelectable` as possible - misc cleanup - remove `Fragment`s
option.prepend and option.icon supportoption.prepend and option.append support
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_6953/ |
|
@ryankeairns Do you mind taking a designer pass on https://eui.elastic.co/pr_6953/#/forms/combo-box#option-rendering and letting me know if the UI (spacing, etc.) looks good to you or if you have any changes you'd like to see? Worth mentioning, the pill display and dropdown option display can be styled separately. |
|
Great eye Ryan!! I was wondering why the vertical alignment was slightly bugging me, I just thought I was going crazy. Out of curiosity, is this already an issue on main/prod? |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_6953/ |
I don't believe so. It looked to come directly from this new |
`85.0.0` ➡️ `85.1.0`⚠️ The biggest change in this PR by far is the **removal** of several `EuiFilterSelectItem` CSS classes and styles associated with those classes. EUI has previously exported component-specific CSS classes for usage such as `.euiFilterSelect__items`, `.euiFilterGroup__popoverPanel`, or `.euiAccordionForm`. ❌ **As of our move to CSS-in-JS, we are actively moving away from this architecture**. The goal is to either provide either a component or prop directly to you instead of a CSS class. As a reminder, our classNames are not guaranteed APIs and are subject to change without warning - should you need to tweak or customize EUI's styling, we strongly recommend passing in your own `className`. 💬 Moving forward, EUI will attempted to convert any usages of removed CSS classes and their direct usages in Kibana for you. In most cases, we'll hopefully be able to take the correct path of using a component or prop instead. In cases where we cannot or significant/complex changes are required, we may temporarily convert the CSS to a static CSS-in-JS usage instead and add a TODO asking the relevant team to address this in their own time (for example, the deprecation of `EuiFilterSelectItem` and its conversion to `EuiSelectable`). ## [`85.1.0`](https://github.com/elastic/eui/tree/v85.1.0) - Updated `EuiComboBox`'s `options` to accept `option.append` and `option.prepend` props ([#6953](elastic/eui#6953)) - Updated deprecated `.substr()` usages to `.substring()` ([#6954](elastic/eui#6954)) - Updated `EuiInlineEdit`'s read mode button to include a title tooltip, increasing readability of truncated text ([#6966](elastic/eui#6966)) **Bug fixes** - Fixed `EuiFilterGroup`'s responsive styles ([#6983](elastic/eui#6983)) **Deprecations** - Deprecated `EuiFilterSelectItem`; Use `EuiSelectable` instead ([#6982](elastic/eui#6982)) **CSS-in-JS conversions** - Converted `EuiFilterSelectItem` to Emotion ([#6982](elastic/eui#6982)) - Removed `.euiFilterSelect__items` CSS; Use `EuiSelectable` instead ([#6982](elastic/eui#6982)) - Removed `.euiFilterSelect__note` and `.euiFilterSelect__noteContent` CSS; Use `EuiSelectableMessage` instead ([#6982](elastic/eui#6982)) - Added `focus.transparency` and `focus.backgroundColor` theme tokens ([#6984](elastic/eui#6984)) --------- Co-authored-by: Cee Chen <constance.chen@elastic.co> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>


Summary
closes #2358 (see linked issue comments for more context as to why this particular API was chosen above others)
This PR adds the ability for consumers to pass in
prependandappendnodes to EuiComboBox's options, e.g.These nodes are rendered for both in the dropdown options as well as in the selected pill display:
Screenshots
Multi selection:
Single selection:
QA
General checklist
@defaultif default values are missing)and playground toggles- [ ] Checked Code Sandbox works for any docs examplesand cypress tests- [ ] Checked for breaking changes and labeled appropriately- [ ] Updated the Figma library counterpart