Skip to content
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

Upgrade @elastic/eui to 85.0.1 #162209

Merged
merged 12 commits into from
Jul 27, 2023
Merged
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
"@elastic/datemath": "5.0.3",
"@elastic/elasticsearch": "npm:@elastic/elasticsearch-canary@8.8.0-canary.2",
"@elastic/ems-client": "8.4.0",
"@elastic/eui": "84.0.0",
"@elastic/eui": "85.0.1",
"@elastic/filesaver": "1.1.2",
"@elastic/node-crypto": "1.2.1",
"@elastic/numeral": "^2.5.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ export function TableSortSelect({ tableSort, hasUpdatedAtMetadata, onChange }: P
closePopover={closePopover}
panelPaddingSize="none"
anchorPosition="downCenter"
panelClassName="euiFilterGroup__popoverPanel"
panelProps={{ css: { width: euiTheme.base * 18 } }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: would prefer 18 to be a constant. Not sure what that number is supposed to correspond to.

@ryankeairns, you like to call this out often, what do you think?

Copy link
Contributor

@cee-chen cee-chen Jul 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Y'all are super welcome to set your own constant! The number is what .euiFilterGroup__popoverPanel was setting as a width in CSS/Sass (link), it's just not hidden behind an EUI CSS class anymore, as we are no longer providing component-specific CSS utilities to consumers.

In any case, width is fairly content-specific so we would prefer consumers figure out what width they want to display based on their content and not on a generic.

>
<>
<EuiText css={panelHeaderCSS}>{i18nText.headerSort}</EuiText>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export const TagFilterPanel: FC<Props> = ({
closePopover={closePopover}
panelPaddingSize="none"
anchorPosition="downCenter"
panelClassName="euiFilterGroup__popoverPanel"
panelProps={{ css: { width: euiTheme.base * 18 } }}
panelStyle={isInUse ? { transition: 'none' } : undefined}
>
<EuiPopoverTitle paddingSize="m" css={popoverTitleCSS}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ const popoverTitleStyle = css`
padding: ${EQUAL_HEIGHT_OFFSET}px 0;
`;
const filterButtonStyle = css`
.euiFilterButton__textShift {
&,
& .euiFilterButton__textShift {
min-width: 0;
line-height: 1;
}
Expand Down Expand Up @@ -105,7 +106,12 @@ export function FieldTypeFilter<T extends FieldListItem = DataViewField>({
const itemStyle = useMemo(
() => css`
font-size: ${euiTheme.size.m};
padding: ${euiTheme.size.s} ${euiTheme.size.m};
// Specificity needed to override Sass styles
// EUI TODO: Remove this selector once EuiContextMenu has been converted to Emotion
&.euiContextMenuItem {
padding: ${euiTheme.size.s} ${euiTheme.size.m};
}
& + & {
border-top: 1px solid ${euiTheme.colors.lightestShade};
Expand Down Expand Up @@ -149,7 +155,7 @@ export function FieldTypeFilter<T extends FieldListItem = DataViewField>({
return (
<EuiPopover
id="unifiedFieldTypeFilter"
panelClassName="euiFilterGroup__popoverPanel"
panelProps={{ css: { width: euiTheme.base * 18 } }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In Discover, the filter button width and the filter item height look larger than it was in 8.9:

Before:
Screenshot 2023-07-25 at 12 08 48

Now:
Screenshot 2023-07-25 at 12 08 58

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @jughosta I'll look into that!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The filter button width should be fixed as with 14e7469 - I hadn't realized folks in Kibana were using EuiFilterButton outside of EuiFilterGroup, so that's my bad :)

Regarding the filter item height - this looks like it was affected by #161592 (Sass styling order). I pushed up a specificity override for now (f5a55e0) which we can remove once more of EUI is on Emotion 🤞

Thanks for your eagle eye on these things @jughosta, you're amazing!!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fixes, @cee-chen! You are amazing! 😉

panelPaddingSize="none"
anchorPosition="rightUp"
display="block"
Expand Down
2 changes: 1 addition & 1 deletion src/dev/license_checker/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export const LICENSE_OVERRIDES = {
'jsts@1.6.2': ['Eclipse Distribution License - v 1.0'], // cf. https://github.com/bjornharrtell/jsts
'@mapbox/jsonlint-lines-primitives@2.0.2': ['MIT'], // license in readme https://github.com/tmcw/jsonlint
'@elastic/ems-client@8.4.0': ['Elastic License 2.0'],
'@elastic/eui@84.0.0': ['SSPL-1.0 OR Elastic License 2.0'],
'@elastic/eui@85.0.1': ['SSPL-1.0 OR Elastic License 2.0'],
'language-subtag-registry@0.3.21': ['CC-BY-4.0'], // retired ODC‑By license https://github.com/mattcg/language-subtag-registry
'buffers@0.1.1': ['MIT'], // license in importing module https://www.npmjs.com/package/binary
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.presFilterByType__panel {
width: $euiSize * 18;
min-width: $euiSizeXXL * 8;
@include euiBreakpoint('l', 'xl') {
width: $euiFormMaxWidth;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export function FieldTypeFilter({
<EuiOutsideClickDetector onOutsideClick={() => {}} isDisabled={!isPopoverOpen}>
<EuiFilterGroup fullWidth>
<EuiPopover
panelClassName="euiFilterGroup__popoverPanel presFilterByType__panel"
panelClassName="presFilterByType__panel"
panelPaddingSize="none"
display="block"
isOpen={isPopoverOpen}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -679,8 +679,8 @@ describe('SavedObjectsFinder', () => {
wrapper.instance().componentDidMount!();
await nextTick();
expect(wrapper.find('button.euiFilterButton')).toHaveLength(2);
expect(wrapper.find('button.euiFilterButton [data-text="Types"]')).toHaveLength(1);
expect(wrapper.find('button.euiFilterButton [data-text="Tags"]')).toHaveLength(1);
expect(wrapper.find('button.euiFilterButton span[data-text="Types"]')).toHaveLength(1);
expect(wrapper.find('button.euiFilterButton span[data-text="Tags"]')).toHaveLength(1);
});

it('should not render filter buttons if disabled', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const MyEuiFilterGroup = styled(EuiFilterGroup)`
`;

const FilterAllButton = styled(EuiFilterButton)`
&,
& .euiFilterButton__textShift {
min-width: 28px;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe('GroupsFilterPopover', () => {
/>
);

wrapper.find('[data-test-subj="groups-filter-popover-button"]').first().simulate('click');
wrapper.find('button[data-test-subj="groups-filter-popover-button"]').first().simulate('click');
wrapper.update();

wrapper.find('EuiFilterSelectItem').first().simulate('click');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ describe('JobsTableFilters', () => {
<JobsTableFiltersComponent securityJobs={securityJobs} onFilterChanged={onFilterChanged} />
);

wrapper.find('[data-test-subj="show-elastic-jobs-filter-button"]').first().simulate('click');
wrapper
.find('button[data-test-subj="show-elastic-jobs-filter-button"]')
.first()
.simulate('click');
wrapper.update();

expect(
Expand All @@ -42,7 +45,10 @@ describe('JobsTableFilters', () => {
<JobsTableFiltersComponent securityJobs={securityJobs} onFilterChanged={onFilterChanged} />
);

wrapper.find('[data-test-subj="show-custom-jobs-filter-button"]').first().simulate('click');
wrapper
.find('button[data-test-subj="show-custom-jobs-filter-button"]')
.first()
.simulate('click');
wrapper.update();

expect(
Expand All @@ -59,10 +65,16 @@ describe('JobsTableFilters', () => {
<JobsTableFiltersComponent securityJobs={securityJobs} onFilterChanged={onFilterChanged} />
);

wrapper.find('[data-test-subj="show-custom-jobs-filter-button"]').first().simulate('click');
wrapper
.find('button[data-test-subj="show-custom-jobs-filter-button"]')
.first()
.simulate('click');
wrapper.update();

wrapper.find('[data-test-subj="show-elastic-jobs-filter-button"]').first().simulate('click');
wrapper
.find('button[data-test-subj="show-elastic-jobs-filter-button"]')
.first()
.simulate('click');
wrapper.update();

expect(
Expand All @@ -85,10 +97,16 @@ describe('JobsTableFilters', () => {
<JobsTableFiltersComponent securityJobs={securityJobs} onFilterChanged={onFilterChanged} />
);

wrapper.find('[data-test-subj="show-custom-jobs-filter-button"]').first().simulate('click');
wrapper
.find('button[data-test-subj="show-custom-jobs-filter-button"]')
.first()
.simulate('click');
wrapper.update();

wrapper.find('[data-test-subj="show-custom-jobs-filter-button"]').first().simulate('click');
wrapper
.find('button[data-test-subj="show-custom-jobs-filter-button"]')
.first()
.simulate('click');
wrapper.update();

expect(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ describe('Select Flow Direction', () => {
);

wrapper
.find(`[data-test-subj="${FlowDirection.biDirectional}"]`)
.find(`button[data-test-subj="${FlowDirection.biDirectional}"]`)
.first()
.simulate('click', event);
wrapper.update();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ describe('StatefulOpenTimeline', () => {
false
);

wrapper.find('[data-test-subj="only-favorites-toggle"]').first().simulate('click');
wrapper.find('button[data-test-subj="only-favorites-toggle"]').first().simulate('click');

expect(wrapper.find('[data-test-subj="open-timeline"]').last().prop('onlyFavorites')).toEqual(
true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ describe('SearchRow', () => {
</ThemeProvider>
);

wrapper.find('[data-test-subj="only-favorites-toggle"]').first().simulate('click');
wrapper.find('button[data-test-subj="only-favorites-toggle"]').first().simulate('click');

expect(onToggleOnlyFavorites).toHaveBeenCalled();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ describe('event_log_list_status_filter', () => {
<EventLogListStatusFilter selectedOptions={[]} onChange={onChangeMock} />
);

wrapper.find(EuiFilterButton).simulate('click');
wrapper.find(EuiFilterButton).find('button').simulate('click');

const statusItems = wrapper.find(EuiFilterSelectItem);
expect(statusItems.length).toEqual(4);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe('RuleStatusFilter', () => {

expect(wrapper.find('[data-test-subj="ruleStateFilterSelect"]').exists()).toBeFalsy();

wrapper.find(EuiFilterButton).simulate('click');
wrapper.find(EuiFilterButton).find('button').simulate('click');

const statusItems = wrapper.find(EuiSelectableListItem);
expect(statusItems.length).toEqual(3);
Expand All @@ -46,7 +46,7 @@ describe('RuleStatusFilter', () => {
<RuleStatusFilter selectedStatuses={[]} onChange={onChangeMock} />
);

wrapper.find(EuiFilterButton).simulate('click');
wrapper.find(EuiFilterButton).find('button').simulate('click');

wrapper.find(EuiSelectableListItem).at(0).simulate('click');
expect(onChangeMock).toHaveBeenCalledWith(['enabled']);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const createActions = (testBed: TestBed) => {
// EUI doesn't support data-test-subj's on the filter buttons, so we must access via CSS selector
find('searchBarContainer')
.find('.euiPopover')
.find('.euiFilterButton')
.find('button.euiFilterButton')
.at(index)
.simulate('click');
});
Expand All @@ -75,7 +75,7 @@ const createActions = (testBed: TestBed) => {
clickCriticalFilterButton: async () => {
await act(async () => {
// EUI doesn't support data-test-subj's on the filter buttons, so we must access via CSS selector
find('searchBarContainer').find('.euiFilterButton').at(0).simulate('click');
find('searchBarContainer').find('button.euiFilterButton').at(0).simulate('click');
});

component.update();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const createActions = (testBed: TestBed) => {
find('kibanaDeprecations')
.find('.euiSearchBar__filtersHolder')
.find('.euiPopover')
.find('.euiFilterButton')
.find('button.euiFilterButton')
.at(0)
.simulate('click');
});
Expand All @@ -77,7 +77,7 @@ const createActions = (testBed: TestBed) => {
// EUI doesn't support data-test-subj's on the filter buttons, so we must access via CSS selector
find('kibanaDeprecations')
.find('.euiSearchBar__filtersHolder')
.find('.euiFilterButton')
.find('button.euiFilterButton')
.at(0)
.simulate('click');
});
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1552,10 +1552,10 @@
resolved "https://registry.yarnpkg.com/@elastic/eslint-plugin-eui/-/eslint-plugin-eui-0.0.2.tgz#56b9ef03984a05cc213772ae3713ea8ef47b0314"
integrity sha512-IoxURM5zraoQ7C8f+mJb9HYSENiZGgRVcG4tLQxE61yHNNRDXtGDWTZh8N1KIHcsqN1CEPETjuzBXkJYF/fDiQ==

"@elastic/eui@84.0.0":
version "84.0.0"
resolved "https://registry.yarnpkg.com/@elastic/eui/-/eui-84.0.0.tgz#0d37da1fe3f2f9af54b62e127c9682d381111ba6"
integrity sha512-hgDWyXwlhpbNzQgIvGLppqSRMEVt2zMlXIxMzvlV6PYPJUh1K9f5pOyXtNyouFgYZG2bkltvG3cUrMLeBbgUkg==
"@elastic/eui@85.0.1":
version "85.0.1"
resolved "https://registry.yarnpkg.com/@elastic/eui/-/eui-85.0.1.tgz#835b77f20670918d0f30ccfa47f0f94cb1fdc9e8"
integrity sha512-OZ8XClOdiRTyhAcipaw3wGgA8HogNqNESJZ8jqUTGbVxN+hsLjAA64rKcqkTndid+7mbxV3+UePieRVnOkzMEg==
dependencies:
"@types/chroma-js" "^2.0.0"
"@types/lodash" "^4.14.194"
Expand Down