-
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 EuiDroppable
& EuiDraggable
#7187
Conversation
+ remove modifier classes
- remove more modifier classes - [syntax nit] destructure `snapshot` for more readable code
- no theme tokens, so can be a static obj + remove 4 year old TODO that has never been added and probably isn't needed at this point
`euiFocusRing` mixin doesn't work because of `:focus-visible` prefer just an auto outline to match prod behavior, the outline is just more focused on the child item not sure what the custom drag handle CSS is for, drag handle focus outlines work fine as-is
- Remove all unused modifier classes (based on Kibana usage) - Fix cloned items missing Emotion styles - Fix missing React 17 snapshot updates
c9843c3
to
5342a6d
Compare
- DRY out with EuiDraggable spacing + switch `none` to a null to match EuiPanel padding styles (reduces rendered classNames) + remove exported types, not really being used
- convert all tests to RTL - add shouldRenderCustomStyles tests - switch modifier class to non BEM to indicate state vs styles
- add `shouldRenderCustomStyles` test - DRY out test context wrapper logic - fixed `...requiredProps` logic - switch from screen usage to destructured APIs
- remove unnecessary/unused jest mock
+ fix `false` className by using `classNames()` util
- extra selector specifier needed due to new Emotion wrapper around drag/drop components
5342a6d
to
283792a
Compare
@breehall I opted not to create a Storybook for this conversion mostly for expedience - the existing EUI docs are quite good for QA, and the props are a little tricky since this is a very 3rd party lib heavy and render prop heavy component. I'd love to see you create stories for drag/drop in the future however! (no rush, of course) |
Preview staging links for this PR:
|
💚 Build Succeeded
History
|
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.
Great conversion! It was actually a little less complicated than I thought it would be. I thoroughly tested the QA against prod and didn't find any unexpected changes.
One question on a class name below, but I think that's about it!
const PanelOrDiv = withPanel ? EuiPanel : 'div'; | ||
const panelOrDivProps = withPanel | ||
? { | ||
panelRef: provided.innerRef, | ||
hasShadow: true, | ||
paddingSize: 'none' as const, | ||
} | ||
: { ref: provided.innerRef }; | ||
|
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.
Elegant refactor and use down on line 119!
'euiDroppable--noGrow': !grow, | ||
}, | ||
spacingToClassNameMap[spacing], | ||
{ 'euiDroppable-isDisabled': dropIsDisabled }, |
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.
Are we just keeping this class for Kibana usages?
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.
Yes, there's two Kibana usages targeting --isDisabled
(that restore the cursor).
`v88.3.0`⏩`v88.5.0` closes #151514 --- ## [`88.5.0`](https://github.com/elastic/eui/tree/v88.5.0) - Updated `EuiCallOut` with a new `onDismiss` prop ([#7156](elastic/eui#7156)) - Added a new `renderCustomToolbar` prop to `EuiDataGrid`, which allows custom rendering of the toolbar. ([#7190](elastic/eui#7190)) - Added a new `allowResetButton` prop to `toolbarVisibility.showDisplaySelector` of `EuiDataGrid`, which allows hiding the "Reset to default" button from the display settings popover. ([#7190](elastic/eui#7190)) - Added a new `additionalDisplaySettings` prop to `toolbarVisibility.showDisplaySelector` of `EuiDataGrid`, which allows rendering extra settings inside the display settings popover. ([#7190](elastic/eui#7190)) - Updated `EuiDataGrid`'s toolbar display settings button icon ([#7190](elastic/eui#7190)) - Updated `EuiTextTruncate` with significantly improved iteration performance. Removed `measurementRenderAPI` prop, as `EuiTextTruncation` now only uses more performant canvas render API ([#7210](elastic/eui#7210)) - Updated `EuiPopover` with a new configurable `repositionToCrossAxis` prop ([#7211](elastic/eui#7211)) - Updated `EuiDatePicker` to support `compressed` input styling ([#7218](elastic/eui#7218)) - Added `gradient` and `palette` icon glyphs. ([#7220](elastic/eui#7220)) **Bug fixes** - Fixed `EuiPopover`'s missing animations on popover close ([#7211](elastic/eui#7211)) - Fixed `EuiInputPopover` anchoring to the wrong side and missing shadows on smaller screens ([#7211](elastic/eui#7211)) - Fixed `EuiSuperDatePicker` icon spacing on the quick select button ([#7217](elastic/eui#7217)) - Fixed a missing type in `EuiMarkdownEditor`'s default processing plugins ([#7221](elastic/eui#7221)) ## [`88.4.1`](https://github.com/elastic/eui/tree/v88.4.1) **Bug fixes** - Fixed missing `className`s on `EuiTextTruncate` ([#7212](elastic/eui#7212)) - Fixed `title`s on `EuiComboBox` dropdown options to always be present ([#7212](elastic/eui#7212)) - Fixed `EuiComboBox` truncation issues when search is an empty space ([#7212](elastic/eui#7212)) ## [`88.4.0`](https://github.com/elastic/eui/tree/v88.4.0) - Updated `EuiComboBox` to allow configuring text truncation behavior via `truncationProps`. These props can be set on the entire combobox as well as on on individual dropdown options. ([#7028](elastic/eui#7028)) - Updated `EuiInMemoryTable` with a new `searchFormat` prop (defaults to `eql`). When setting this prop to `text`, the built-in search bar will ignore EQL syntax and allow searching for plain strings with special characters and symbols. ([#7175](elastic/eui#7175)) **Bug fixes** - `EuiComboBox` now always shows the highlighted search text, even on truncated text ([#7028](elastic/eui#7028)) - Fixed missing i18n in `EuiSearchBar`'s default placeholder and aria-label text ([#7175](elastic/eui#7175)) - Fixed the inline compressed styles of `EuiDescriptionListTitle` to use a taller line-height for readability ([#7185](elastic/eui#7185)) - Fixed `EuiComboBox` to correctly truncate selected items when displayed as pills and plain text ([#7193](elastic/eui#7193)) **Accessibility** - Added `aria-current` attribute to `EuiTablePagination` ([#7186](elastic/eui#7186)) **CSS-in-JS conversions** - Converted `EuiDroppable` and `EuiDraggable` to Emotion; Removed `$euiDragAndDropSpacing` Sass variables ([#7187](elastic/eui#7187)) --------- Co-authored-by: Patryk Kopycinski <contact@patrykkopycinski.com> Co-authored-by: Jan Monschke <jan.monschke@elastic.co> Co-authored-by: Thomas Watson <watson@elastic.co>
Summary
As always, I recommend following along by commit as this PR contains some cleanup/tech debt tasks around tests etc.
This PR additionally contains a very small focus outline placement fix in 6e1823e:
Before:
After:
QA
General checklist
- [ ] Checked in both light and dark modes- [ ] Checked in mobileand cypress tests- [ ] If applicable, added the breaking change issue label (and filled out the breaking change checklist)[ ] Updated the Figma library counterpartEmotion checklist
Kibana usage
**/target, **/*.snap, **/*.storyshot
for less noise) foreui{Component}
(case sensitive) to find:{euiComponent}-
(case sensitive) to check for usage of modifier classes - Two modifier usages: 1, 2euiBadge
class on a div instead of simply using theEuiBadge
component) - NoneGeneral
className(s)
read as expected in snapshots and browsers[ ] Checked component playgroundNo playground, but added StorybooksUnit tests
shouldRenderCustomStyles()
test was added and passes with parent component and any nestedchildProps
(e.g.tooltipProps
)Sass/Emotion conversion process
$euiSize
toeuiTheme.size.base
)or convertedcomponent-specific Sass vars/mixinsto exported JS versions[ ] 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
file[ ] All SCSS overrides have been removed from the Amsterdam themeNo overridesCSS tech debt
euiCanAnimate
[ ] Usedgap
property to add margin between items if using flex[ ] Converted side specific padding, margin, and position to-inline
and-block
logical properties (check inline styles as well as CSS)DOM Cleanup
euiComponent
,euiComponent__child
) - Note: removed an unused modifier class on a childeuiDroppable__placeholder
elementExtras/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