-
Notifications
You must be signed in to change notification settings - Fork 844
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 EuiCheckbox, EuiRadio, and EuiSwitch #7969
Conversation
- doesn't need to live in the main form vars fn, these variables are very specific to these components - simplify `customControlDisabledIconColor` to just darkShade - it's close enough and doesn't require extra computation
- more future proof for icon changes and generally less CSS - extra DOM is worth it, IMO
- remove old Emotion mixin, I'm makin' my own - note the different DOM rendering - now that we have `:has` CSS, we don't need to rely on flat `+` selectors - prefer flex for center alignment over absolute positioning
- literally just needs `border-radius: 50%` instead
+ inline conditional label - remove `--noLabel` modifier (replaced with `:has` CSS)
- inline conditional label, remove need for useMemo - inline the border-radius, it's only used here and doesn't need to be a shared var (it technically already is one)
+ misc cleanup while here - fragment syntax, test syntax
- a lot of colors are being simplified and slightly tweaked here to reduce transparency as well as one-off tinting/shading - remove Sass vars
- remove unnecessary min-height
- not sure if this is worth it, may revert
- move thumb to outside body since it has `overflow: hidden` and we want thumbs to be able to scale outside - use `aspect-ratio` CSS instead of static width/height that changes (instead inherits from the button which is already sized) - simplify `-1px` shenanigans by reducing transforms by default, store in thumbScales var + tweak hover/active states accordingly and DRY out a util for it
- simplify DOM - rename `__track` to `__icons`, feels more accurate - prefer flex and padding to center/position icons instead of positioning - no need for border-radius, `__body` already has it set + overflow hidden
+ update VRT to be more useful for permutation testing
+ fix broken EuiDataGrid drag/drop behavior - we can't use the scroll shadow transform Z workaround and drag/drop at the same time 🫠
- will no longer be a thing once the EuiFormRow PR merges, drop this commit then
649e99f
to
0795d3e
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.
QA'd on desktop and mobile. Other than a couple of minor things I noticed the changes look great!
EuiSwitch
rendered inEuiFormRow
s (see the second example) andEuiFormFieldset
have now bigger margins applied and look wrong (?)EuiCheckbox
andEuiRadio
have lost their regular EUI outlines when focused in light mode.EuiRadioGroup
doesn't seem to have an outline when focused at all
🙃 Oh that's fun, I totally forgot to cross-browser test in Chrome/Edge - they're fine in FF. Looking into this! |
This will be fixed once #7968 merges in - it's wrong because of this temporary commit (3d407a7). |
- Chrome/Edge's auto style defaults to currentColor which is the empty shade, so its invisible - Safari's is just godawful
4d3b9fa
to
5abd42a
Compare
I debugged the EuiFormFieldset one further and it looks like it was a very interesting/weird bug with |
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.
Looks and works beautifully! Thanks for quickly addressing my comments 💯
💚 Build Succeeded
History
|
`v95.7.0` ⏩ `v95.9.0` > [!CAUTION] > This PR contains the final set of Emotion conversions for all EuiForm components. > If your plugin contains any custom CSS/styling to **EuiFormRow, EuiFormControlLayout, EuiCheckbox, EuiRadio, or EuiSwitch**,⚠️ make sure to QA your UI to ensure no visual regressions have occurred!⚠️ --- ## [`v95.9.0`](https://github.com/elastic/eui/releases/v95.9.0) - Updated `EuiSearchBar`'s optional `box.schema` prop with a new `recognizedFields` configuration. This allows specifying the phrases that will be parsed as field clauses ([#7960](elastic/eui#7960)) - Updated `EuiIcon` with a new `tokenSemanticText` glyph ([#7971](elastic/eui#7971)) - Added support for TypeScript 5 ([#7980](elastic/eui#7980)) **Bug fixes** - Fixed `EuiSelectableTemplateSitewide` styles when used within a dark-themed `EuiHeader` ([#7977](elastic/eui#7977)) ## [`v95.8.0`](https://github.com/elastic/eui/releases/v95.8.0) - Updated `EuiHeaderLinks`'s mobile menu to set a slight popover padding by default ([#7961](elastic/eui#7961)) - This can be overridden via `popoverProps.panelPaddingSize` if needed. - Updated `EuiHeaderLink` to default to a size of `s` (down from `m`) ([#7961](elastic/eui#7961)) **Accessibility** - Updated the `aria-label` attribute for the `EuiFieldSearch` clear button ([#7970](elastic/eui#7970)) **Bug fixes** - Fixed a visual bug with `<EuiDualRange showInput="inputWithPopover" />` form controls ([#7957](elastic/eui#7957)) **Deprecations** - Deprecated `EuiFormRow`'s `columnCompressedSwitch` display prop. Use `columnCompressed` instead, which will automatically account for child `EuiSwitch`es ([#7968](elastic/eui#7968)) - Deprecated `EuiFormRow`'s `rowCompressed` display prop. Use `row` instead for vertical forms, or `centerCompressed` for inline forms ([#7968](elastic/eui#7968)) - (Styling) Updated `EuiFormRow`'s `hasEmptySpaceLabel` prop to no longer attempt to automatically align its content to a vertical center. Use the `display="center"` prop for that instead ([#7968](elastic/eui#7968)) **CSS-in-JS conversions** - Converted `EuiFormControlLayout` to Emotion ([#7954](elastic/eui#7954)) - Removed `.euiFormControlLayout--*icons` classNames and `--eui-form-control-layout-icons-padding` CSS var. Use `--euiFormControlRightIconsCount` or `--euiFormControlLeftIconsCount` instead - Converted `EuiFormLayoutDelimited` to Emotion ([#7957](elastic/eui#7957)) - Fixed `cloneElementWithCss` throwing an error when used multiple times without a `key` prop ([#7957](elastic/eui#7957)) - Updated `cloneElementWithCss` utility to support a third argument that allows prepending vs. appending the cloned Emotion css className ([#7957](elastic/eui#7957)) - Removed `@euiFormControlLayoutClearIcon` Sass mixin ([#7959](elastic/eui#7959)) - Converted `EuiDescribedFormGroup` to Emotion ([#7964](elastic/eui#7964)) - Converted `EuiForm`, `EuiFormHelpText`, and `EuiFormErrorText` to Emotion ([#7966](elastic/eui#7966)) - Converted `EuiFormLabel` and `EuiFormLegend` to Emotion; Removed `@euiFormLabel` mixin ([#7967](elastic/eui#7967)) - Converted `EuiFormRow` to Emotion ([#7968](elastic/eui#7968)) - Converted `EuiCheckbox` to Emotion ([#7969](elastic/eui#7969)) - Converted `EuiRadio` to Emotion ([#7969](elastic/eui#7969)) - Converted `EuiSwitch` to Emotion ([#7969](elastic/eui#7969)) - Removed the following Sass variables: ([#7969](elastic/eui#7969)) - `$euiFormCustomControlDisabledIconColor` - `$euiFormCustomControlBorderColor` - `$euiRadioSize` - `$euiCheckBoxSize` - `$euiCheckboxBorderRadius` - `$euiSwitchHeight` (and compressed/mini variants) - `$euiSwitchWidth` (and compressed/mini variants) - `$euiSwitchThumbSize` (and compressed/mini variants) - `$euiSwitchIconHeight` - `$euiSwitchOffColor` - Removed the following Sass mixins: ([#7969](elastic/eui#7969)) - `euiIconBackground` - `euiCustomControl` - `euiCustomControlSelected` - `euiCustomControlDisabled` - `euiCustomControlFocused` --------- Co-authored-by: Marta Bondyra <[email protected]>
Summary
closes #6400
Just a small 1.5k diff PR, nothing to see here 🙃
I honestly gave up trying to make my commits as granular as I usually do - there was a lot of old CSS in these components and I just ended up essentially rewriting the styles with more modern day flex/CSS and so forth.
To be totally honest, unless we have people incredibly passionate about CSS on the team (which I'm pretty sure is just me at this point), I would recommend only QAing this PR for visual regressions/bugs and not attempting to code review. 🤷
Intentional changes - technical details
<EuiIcon />
s to render their various indicators (checked, indeterminate, selected, etc) rather than CSS data-uri SVGsdisabledText
token as opposed to the custom form disabled text color. This is because these labels do not need the extra contrast from having a disabled background color.+
siblings selectors for CSS)QA
General checklist
Added orupdated jestand cypresstests- [ ] If applicable, added the breaking change issue label (and filled out the breaking change checklist)