-
Notifications
You must be signed in to change notification settings - Fork 840
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 EuiFilterGroup and EuiFilterButton #6957
Conversation
- flattening out as much CSS as possible to EuiFilterButton - styles targeting popover/tooltip wrappers can't be targeted, but we can at least avoid euiFilterButtons receiving those styles with a DRY util and a `:not` selector
TODO: Kibana usages will need to be converted to a `css` prop as well, and import the styles fn directly
- DRY out box-shadow CSS, add more comments
- remove disabled styles - just use EuiButtonEmpty's default styles instead - non-disabled styles still need to be converted despite grody nesting levels :T
+ misc JS syntax cleanup + DRY out `hasNotification` condition - should be using `showBadge` instead content: - flatten `hasIcon` CSS text: - add missing parent `.euiFilterButton__text` className on textprops notification: - remove unnecessary vertical-align (no effect since flex is already doing its thing) - switch to gap instead of margin for spacing - flatten disabled opacity styles
- (focus) add manually border radius rounding logic - it's verbose (due to popover anchors) but visually worth it - (hover) force the notification badge to inherit both interactive and disabled cursors
Preview documentation changes for this PR: https://eui.elastic.co/pr_6957/ |
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 and updated tests look great! I found a couple of styling differences that probably need fixing:
- Single filter focus state outline offset is 1px different (fixed border radius looks so much better though!)
fullWidth
Layout example is squished to a single line and doesn't look good on small viewports
This was an intentional change (see 15cd531). I think the slight offset difference on the right is well worth the improved border-radius focus state, especially across multiple browsers (this is primarily only an issue on Chromium - FF and Safari have better focus rings).
Will take a look at this, not sure what's going on there. Thanks for catching it! |
This comment was marked as outdated.
This comment was marked as outdated.
- just use `euiMaxBreakpoint` instead of `euiBreakpoints`, the concept of "s and under" is easier to follow
@tkajtoch Breakpoints shenanigans should be fixed now. Thanks a million for catching that again! 🎉 Let me know if you're good with shipping with the focus outline change. |
Thank you!! I'm good, it definitely looks better than the previous version and I don't mind it at all :) I'll retest it as soon as the PR environment updates |
Preview documentation changes for this PR: https://eui.elastic.co/pr_6957/ |
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 and functionality look great! Thanks for converting tests to RTL 🎉
## Summary `[email protected]` ⏩ `[email protected]` ## [`85.0.1`](https://github.com/elastic/eui/tree/v85.0.1) **Bug fixes** - Fixed `EuiFilterGroup`'s responsive styles ([#6983](elastic/eui#6983)) ## [`85.0.0`](https://github.com/elastic/eui/tree/v85.0.0) - Updated `EuiThemeProvider` to set an Emotion theme context that returns the values of `useEuiTheme()` ([#6913](elastic/eui#6913)) - Added `size` prop to `EuiStepsHorizontal`, defaulting to the previous size of `m` ([#6928](elastic/eui#6928)) - Added new `s` sizing to `EuiStepsHorizontal` ([#6928](elastic/eui#6928)) - Added `at` and `key` icon glyphs. ([#6934](elastic/eui#6934)) - Added a new `cloneElementWithCss` Emotion utility ([#6939](elastic/eui#6939)) - Updated `EuiPopover` to allow consumer control of all `focusTrapProps` ([#6955](elastic/eui#6955)) **Bug fixes** - Fixed `EuiDataGrid` height calculation bug when browser zoom levels are not 100% ([#6895](elastic/eui#6895)) - Fixed `EuiTab` not correctly passing selection color state to `prepend` and `append` children ([#6938](elastic/eui#6938)) - Fixed `EuiInputPopover` to allow consumer control of its focus trap via `focusTrapProps` ([#6955](elastic/eui#6955)) **Breaking changes** - `EuiProvider` will no longer render multiple or duplicate nested instances of itself. If a nested `EuiProvider` is detected, that instance will return early without further processing, and will warn if configured to do so via `setEuiDevProviderWarning`. For nested theming, use `EuiThemeProvider` instead. ([#6949](elastic/eui#6949)) - Removed `onTrapDeactivation` prop from `EuiPopover`. Use `focusTrapProps.onDeactivation` instead ([#6955](elastic/eui#6955)) **CSS-in-JS conversions** - Converted `EuiFilterGroup` and `EuiFilterButton` to Emotion; Removed styles attached to `.euiFilterGroup__popoverPanel` ([#6957](elastic/eui#6957)) --------- Co-authored-by: Cee Chen <[email protected]> Co-authored-by: Kibana Machine <[email protected]>
## Summary `[email protected]` ⏩ `[email protected]` ## [`85.0.1`](https://github.com/elastic/eui/tree/v85.0.1) **Bug fixes** - Fixed `EuiFilterGroup`'s responsive styles ([elastic#6983](elastic/eui#6983)) ## [`85.0.0`](https://github.com/elastic/eui/tree/v85.0.0) - Updated `EuiThemeProvider` to set an Emotion theme context that returns the values of `useEuiTheme()` ([elastic#6913](elastic/eui#6913)) - Added `size` prop to `EuiStepsHorizontal`, defaulting to the previous size of `m` ([elastic#6928](elastic/eui#6928)) - Added new `s` sizing to `EuiStepsHorizontal` ([elastic#6928](elastic/eui#6928)) - Added `at` and `key` icon glyphs. ([elastic#6934](elastic/eui#6934)) - Added a new `cloneElementWithCss` Emotion utility ([elastic#6939](elastic/eui#6939)) - Updated `EuiPopover` to allow consumer control of all `focusTrapProps` ([elastic#6955](elastic/eui#6955)) **Bug fixes** - Fixed `EuiDataGrid` height calculation bug when browser zoom levels are not 100% ([elastic#6895](elastic/eui#6895)) - Fixed `EuiTab` not correctly passing selection color state to `prepend` and `append` children ([elastic#6938](elastic/eui#6938)) - Fixed `EuiInputPopover` to allow consumer control of its focus trap via `focusTrapProps` ([elastic#6955](elastic/eui#6955)) **Breaking changes** - `EuiProvider` will no longer render multiple or duplicate nested instances of itself. If a nested `EuiProvider` is detected, that instance will return early without further processing, and will warn if configured to do so via `setEuiDevProviderWarning`. For nested theming, use `EuiThemeProvider` instead. ([elastic#6949](elastic/eui#6949)) - Removed `onTrapDeactivation` prop from `EuiPopover`. Use `focusTrapProps.onDeactivation` instead ([elastic#6955](elastic/eui#6955)) **CSS-in-JS conversions** - Converted `EuiFilterGroup` and `EuiFilterButton` to Emotion; Removed styles attached to `.euiFilterGroup__popoverPanel` ([elastic#6957](elastic/eui#6957)) --------- Co-authored-by: Cee Chen <[email protected]> Co-authored-by: Kibana Machine <[email protected]>
Summary
EuiFilterSelectItem
), but this PR is getting pretty long as it is and already has its own set of Kibana changes, so I'll convert that component later separately.I recommend following along by commit - as always, there's a good amount of incidental cleanup happening, so I tried to make individual commits as atomic and 1:1 as possible for easier review.
Other than snapshots, there is one active Kibana cleanup item that needs to be done as part of the next upgrade, which is converting all direct usages of
.euiFilterGroup__popoverPanel
to Emotion (see7412d84
). @tkajtoch, let me know once you've created a Kibana upgrade PR and I'll push up the work needed for this to your branch.QA
gh pr checkout 6957 && yarn storybook
General checklist
and cypress testsand screenreader modesEmotion checklist
General
className(s)
read as expected in snapshots and browsers[ ] Checked component playground- No playground exists for this componentUnit tests
shouldRenderCustomStyles()
test was added and passes with parent component and any nestedchildProps
(e.g.tooltipProps
)Sass/Emotion conversion process
[ ] Converted all global Sass vars/mixins to JS (e.g.No Sass vars$euiSize
toeuiTheme.size.base
)[ ] Removed or converted component-specific Sass vars/mixins to exported JS versions[ ] Listed var/mixin removals in changelog[ ] Ranyarn compile-scss
to update var/mixin JSON files[ ] Simplifiedcalc()
tomathWithUnits
if possible (if mixing different unit types, this may not be possible)[ ] Added an@warn
deprecation message within theglobal_styling/mixins/{component}.scss
filesrc/amsterdam/overrides/{component}.scss
files (styles within should have been converted to the baseline Emotion styles)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
)-
(single hyphen instead of double hyphen) modifiers left alone, as there's multiple references to them across Kibana. Double hyphen modifiers are in snapshots only and were removedKibana due diligence
**/target, **/*.snap, **/*.storyshot
for less noise) foreui{Component}
(case sensitive) to find:euiBadge
class on a div instead of simply using theEuiBadge
component).euiFilterGroup__popoverPanel
need to be converted to Emotion instead (see 7412d84)Extras/nice-to-have
[ ] Documentation pass:[ ] Check for issues in the backlog that could be a quick fix for that component[ ] Optional component/code cleanup: consider splitting up the component into multiple children if it's overly verbose or difficult to reason about