-
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
[Emotion] Convert EuiComboBox #7950
Conversation
- class component with generic, so it's easier to use a render prop - we can avoid having to memoizing styles however by using `logicalStyle()` and `euiFormMaxWidth()` separate from combobox's styles + remove fullWidth modifier class
- DRY it out to a prop and the internal `EuiComboBoxOptionAppendPrepend` util - remove applicable Sass
- requires render prop due to class component with generic :T + `removeOptionMessage` requires some extra typing now due to that - remove unnecessary icon className/CSS - now handled by EuiFormControlLayout + remove unnecessary `__inputWrap--fullWidth` - it's already full width by default, width is set by the combobox wrapper
- use `inherit` property to handle both compressed and uncompressed styles - clean up form control styles into a nested obj - remove more modifiers from EuiCombBox (no Kibana usages)
+ convert margins to flex gap instead + move max-width CSS - no longer needs specificty override + convert EuiComboBoxPill from a class component to a function component
- move JSX consts to inline JSX instead so we don't need multiple `RenderWithEuiStylesMemoizer` + DRY out new constant for `200` max height + import reorder
- EuiFilterSelectItem is being used instead - no top level export, so no deprecation/breaking change needed
(lazily - see comment rationale)
(also lazily, since EuiSelectable has its own group labels)
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.
Quick note that the pill being lower than before is intentional. It's more visually centered now (hooray!)
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.
Group titles/labels shifting slightly vertically is, if not intentional, then expected due to line height changes from using euiTitle()
directly. It's likely also not an issue long term as we'll be switching to EuiSelectable's group labels in the future
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 didn't see any unwanted regression. There is a tiny change to truncated pills, that I think is an improvement, other than that awesome conversion! 👏
Screen.Recording.2024-08-08.at.13.32.02.mov
@@ -32,6 +33,39 @@ export const euiComboBoxOptionListStyles = (euiThemeContext: UseEuiTheme) => { | |||
.euiTextTruncate { | |||
pointer-events: none; | |||
} | |||
|
|||
/* We're being lazy here about child selectors/specificity, because EuiComboBox |
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.
Does it make sense to link the update issue as TODO? 🤔
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 entire style file will be likely be ripped out/removed by me in a few weeks here so I don't think I need a TODO! I'm usually pretty good about spotting unused components/files!
packages/eui/.loki/reference/chrome_desktop_Forms_EuiComboBox_With_Tooltip.png
Outdated
Show resolved
Hide resolved
+ move tooltip props to where it's being used in the story instead of a const
1f584ad
to
c6daf78
Compare
💚 Build Succeeded
History
|
`v95.6.0` ⏩ `v95.7.0` _[Questions? Please see our Kibana upgrade FAQ.](https://github.com/elastic/eui/blob/main/wiki/eui-team-processes/upgrading-kibana.md#faq-for-kibana-teams)_ --- ## [`v95.7.0`](https://github.com/elastic/eui/releases/v95.7.0) **CSS-in-JS conversions** - Converted `EuiSelectable` to Emotion ([#7940](elastic/eui#7940)) - Removed `$euiSelectableListItemBorder` - Removed `$euiSelectableListItemPadding` - Converted `EuiSelectableTemplateSitewide` to Emotion ([#7944](elastic/eui#7944)) - Removed `$euiSelectableTemplateFocusBackgroundLight` - Removed `$euiSelectableTemplateFocusBackgroundDark` - Removed `$euiSelectableTemplateSitewideTypes` - Converted `EuiComboBox` to Emotion ([#7950](elastic/eui#7950))
Summary
Converts EuiComboBox to Emotion (+ several cleanups along the way). As always, I recommend following along by commit. I also strongly recommend hiding whitespace diffs as a lot of the changes come from extra indentation from
RenderWithEuiStylesMemoizer
usage.This PR also deletes an entirely unused
EuiComboBoxOption
component. This appears to have been replaced byEuiFilterSelectItem
which will in turn be replaced byEuiSelectable
down the road.QA
General checklist
and screenreader modes- [ ] Added or updated jest and cypress tests- [ ] If applicable, added the breaking change issue label (and filled out the breaking change checklist)Emotion checklist
General
className(s)
read as expected in snapshots and browsersUnit tests
[ ]- already handledshouldRenderCustomStyles()
test was added and passes with parent component and any nestedchildProps
(e.g.tooltipProps
)[ ] Converted Enzyme to RTLno Enzyme usagesSass/Emotion conversion process
src/components/index.scss
src/amsterdam/overrides/{component}.scss
files (styles within should have been converted to the baseline Emotion styles)$euiSize
toeuiTheme.size.base
)[ ] Listed var/mixin removals in changelogNo vars or mixins[ ] Added an@warn
deprecation message within theglobal_styling/mixins/{component}.scss
file[ ] Removed or converted component-specific Sass vars/mixins to exported JS versions[ ] Ranyarn compile-scss
to update var/mixin JSON files[ ] Simplified- Not possiblecalc()
tomathWithUnits
if possible (if mixing different unit types, this may not be possible)CSS tech debt
[ ] Wrapped all animations or transitions inNo animationseuiCanAnimate
gap
property to add margin between items if using flex-inline
and-block
logical properties (check inline styles as well as CSS)DOM Cleanup
euiComponent
,euiComponent__child
)Kibana due diligence
{euiComponent}-
(case sensitive) to check for usage of modifier classes[ ] If usage exists, consider converting to adata
attribute so that consumers still have something to hook into**/target, **/*.snap, **/*.storyshot
for less noise) foreui{Component}
(case sensitive) to find:euiBadge
class on a div instead of simply using theEuiBadge
component)Extras/nice-to-have
[ ] Optional component/code cleanup: consider splitting up the component into multiple children if it's overly verbose or difficult to reason about[ ] Documentation pass[ ] Check for issues in the backlog that could be a quick fix for that componentModifier classes removed:
euiComboBox--fullWidth
(1 test selector in Kibana to update)euiComboBox--compressed
euiComboBox--prepended
euiComboBox--appended
euiComboBox__inputWrap--compressed
euiComboBox__inputWrap--fullWidth
euiComboBox__inputWrap--noWrap
euiComboBox__inputWrap--inGroup