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 EUI to v88.2.0 #165790

Merged
merged 26 commits into from
Sep 12, 2023
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
b9a1247
Upgrade EUI to v88.2.0
cee-chen Sep 5, 2023
3bcc203
Convert deprecated `euiAccordionForm` styles to new prop usage
cee-chen Sep 5, 2023
9295db7
[Watcher] Convert `.euiAccordionForm__title` and `.euiAccordionForm__…
cee-chen Sep 5, 2023
fe30ee8
[Security] Remove deprecated `.euiAccordionForm__title`
cee-chen Sep 5, 2023
132f105
[EuiAccordion] snapshot updates
cee-chen Sep 6, 2023
f42bbed
Replace global header Sass variables with CSS variables
cee-chen Sep 6, 2023
836b111
Update `--euiFixedHeadersOffset` dynamically based on Kibana chrome
cee-chen Sep 6, 2023
da3b2e5
Update Sass mixins to use CSS variables
cee-chen Sep 6, 2023
9447496
Remove repeated constant declaration
cee-chen Sep 6, 2023
d929acb
Start dismantling `kbnAffordForHeader` mixin
cee-chen Sep 6, 2023
123ca2d
Fix solution sidebar nav sticky position
cee-chen Sep 6, 2023
82af6db
Completely remove `kbnAffordForHeader` mixin
cee-chen Sep 6, 2023
c5d1e26
Remove need for `kbnBody--projectLayout` body class
cee-chen Sep 6, 2023
b5a8d27
[Dashboard] Clean up sticky nav to use `--euiFixedHeadersOffset` CSS var
cee-chen Sep 6, 2023
695e246
Update other misc usages/affordances for fixed headers to use new CSS…
cee-chen Sep 6, 2023
ebcd1fe
[EuiHeader] Snapshot updates
cee-chen Sep 6, 2023
6617059
Fix minute test percentage diff
cee-chen Sep 6, 2023
daa279e
[Security] Fix timeline "flyout"
cee-chen Sep 6, 2023
f7c3aac
[Lens] Remove unused `euiFlyout` className
cee-chen Sep 6, 2023
3e4611b
Merge branch 'main' into eui-88.2.x
cee-chen Sep 7, 2023
42a4c01
Merge branch 'main' into eui-88.2.x
cee-chen Sep 8, 2023
a8f074e
Merge branch 'main' into eui-88.2.x
stratoula Sep 11, 2023
b530f22
Fix `--euiFixedHeadersOffset` CSS variables with missing fallbacks
cee-chen Sep 11, 2023
2e64389
Merge remote-tracking branch 'upstream/main' into eui-88.2.x
cee-chen Sep 11, 2023
b7684cc
Merge branch 'main' into eui-88.2.x
cee-chen Sep 12, 2023
9704de3
Merge branch 'main' into eui-88.2.x
cee-chen Sep 12, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
"@elastic/datemath": "5.0.3",
"@elastic/elasticsearch": "npm:@elastic/elasticsearch-canary@8.9.1-canary.1",
"@elastic/ems-client": "8.4.0",
"@elastic/eui": "88.1.0",
"@elastic/eui": "88.2.0",
"@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 @@ -147,16 +147,15 @@ describe('start', () => {
const promise = chrome.getBodyClasses$().pipe(toArray()).toPromise();
service.stop();
await expect(promise).resolves.toMatchInlineSnapshot(`
Array [
Array [
"kbnBody",
"kbnBody--classicLayout",
"kbnBody--noHeaderBanner",
"kbnBody--chromeHidden",
"kbnVersion-1-2-3",
],
]
`);
Array [
Array [
"kbnBody",
"kbnBody--noHeaderBanner",
"kbnBody--chromeHidden",
"kbnVersion-1-2-3",
],
]
`);
});

it('strips off "snapshot" from the kibana version if present', async () => {
Expand All @@ -166,16 +165,15 @@ describe('start', () => {
const promise = chrome.getBodyClasses$().pipe(toArray()).toPromise();
service.stop();
await expect(promise).resolves.toMatchInlineSnapshot(`
Array [
Array [
"kbnBody",
"kbnBody--classicLayout",
"kbnBody--noHeaderBanner",
"kbnBody--chromeHidden",
"kbnVersion-8-0-0",
],
]
`);
Array [
Array [
"kbnBody",
"kbnBody--noHeaderBanner",
"kbnBody--chromeHidden",
"kbnVersion-8-0-0",
],
]
`);
});

it('does not add legacy browser warning if browser supports CSP', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,6 @@ export class ChromeService {
map(([headerBanner, isVisible, chromeStyle]) => {
return [
'kbnBody',
chromeStyle === 'project' ? 'kbnBody--projectLayout' : 'kbnBody--classicLayout',
headerBanner ? 'kbnBody--hasHeaderBanner' : 'kbnBody--noHeaderBanner',
isVisible ? 'kbnBody--chromeVisible' : 'kbnBody--chromeHidden',
getKbnVersionClass(),
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.

Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const AppMenuBar = ({ headerActionMenuMounter }: AppMenuBarProps) => {
/* fixates the elements position in the viewport, removes the element from the flow of the page */
position: sticky;
/* position below the primary fixed EuiHeader in the viewport */
top: 48px;
top: var(--euiFixedHeadersOffset, 0);
cee-chen marked this conversation as resolved.
Show resolved Hide resolved
`}
>
<HeaderActionMenu mounter={headerActionMenuMounter} />
Expand Down

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

Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const DefaultGroupPanelRenderer = ({
<div>
<EuiFlexGroup gutterSize="s" alignItems="center" responsive={false}>
<EuiFlexItem grow={false} className="eui-textTruncate">
<EuiTitle size="xs" className="euiAccordionForm__title">
<EuiTitle size="xs">
<h4 className="eui-textTruncate" title={title}>
{title}
</h4>
Expand Down

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

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Side Public License, v 1.
*/

import React, { FC, useEffect, useState } from 'react';
import React, { FC } from 'react';
import classNames from 'classnames';
import { EuiPageTemplate } from '@elastic/eui';

Expand All @@ -21,9 +21,6 @@ const getClasses = (template?: string, className?: string) => {
);
};

const KIBANA_CHROME_SELECTOR = '[data-test-subj="kibanaChrome"]';
const HEADER_GLOBAL_NAV_SELECTOR = '[data-test-subj="headerGlobalNav"]';

/**
* A thin wrapper around EuiPageTemplate with a few Kibana specific additions
*/
Expand All @@ -38,18 +35,6 @@ export const KibanaPageTemplateInner: FC<Props> = ({
}) => {
let header;

const [offset, setOffset] = useState<number | undefined>();

useEffect(() => {
const kibanaChrome = document.querySelector(KIBANA_CHROME_SELECTOR) as HTMLElement;
if (kibanaChrome) {
const kibanaChromeHeader = kibanaChrome.querySelector(
HEADER_GLOBAL_NAV_SELECTOR
) as HTMLElement;
setOffset(kibanaChromeHeader?.offsetTop + kibanaChromeHeader?.offsetHeight);
}
}, []);

if (isEmptyState && pageHeader && !children) {
const { iconType, pageTitle, description, rightSideItems } = pageHeader;
const title = pageTitle ? <h1>{pageTitle}</h1> : undefined;
Expand All @@ -70,9 +55,7 @@ export const KibanaPageTemplateInner: FC<Props> = ({
let sideBar;
if (pageSideBar) {
const sideBarProps = { ...pageSideBarProps };
if (offset) {
sideBarProps.sticky = { offset };
}
sideBarProps.sticky = true;
sideBar = <EuiPageTemplate.Sidebar {...sideBarProps}>{pageSideBar}</EuiPageTemplate.Sidebar>;
}

Expand Down

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

Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,8 @@ export const withSolutionNav = <P extends TemplateProps>(WrappedComponent: Compo
isMediumBreakpoint || (canBeCollapsed && isLargerBreakpoint && !isSideNavOpenOnDesktop);
const withSolutionNavStyles = WithSolutionNavStyles(euiTheme);
const sideBarClasses = classNames(
{
'kbnSolutionNav__sidebar--shrink': isSidebarShrunk,
},
'kbnSolutionNav__sidebar',
{ 'kbnSolutionNav__sidebar--shrink': isSidebarShrunk },
props.pageSideBarProps?.className,
withSolutionNavStyles
);
Expand Down
11 changes: 11 additions & 0 deletions src/core/public/_css_variables.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
:root {
// height of the header banner
--kbnHeaderBannerHeight: #{$euiSizeXL};
// total height of all fixed headers (when the banner is *not* present) inherited from EUI
--kbnHeaderOffset: var(--euiFixedHeadersOffset);
// total height of everything when the banner is present
--kbnHeaderOffsetWithBanner: calc(var(--kbnHeaderBannerHeight) + var(--kbnHeaderOffset));
}

// Quick note: This shouldn't be mixed with Sass variable declarations,
// as each import will cause :root to be re-declared unnecessarily
47 changes: 5 additions & 42 deletions src/core/public/_mixins.scss
Original file line number Diff line number Diff line change
@@ -1,43 +1,6 @@
@import './variables';

/* stylelint-disable-next-line length-zero-no-unit -- need consistent unit to sum them */
@mixin kibanaFullBodyHeight($additionalOffset: 0px) {
// default - header, no banner
height: calc(100vh - #{$kbnHeaderOffset + $additionalOffset});

@at-root {
// no header, no banner
.kbnBody--chromeHidden & {
height: calc(100vh - #{$additionalOffset});
}
// header, banner
.kbnBody--hasHeaderBanner & {
height: calc(100vh - #{$kbnHeaderOffsetWithBanner + $additionalOffset});
}
// no header, banner
.kbnBody--chromeHidden.kbnBody--hasHeaderBanner & {
height: calc(100vh - #{$kbnHeaderBannerHeight + $additionalOffset});
}
}
}

/* stylelint-disable-next-line length-zero-no-unit -- need consistent unit to sum them */
@mixin kibanaFullBodyMinHeight($additionalOffset: 0px) {
// default - header, no banner
min-height: calc(100vh - #{$kbnHeaderOffset + $additionalOffset});

@at-root {
// no header, no banner
.kbnBody--chromeHidden & {
min-height: calc(100vh - #{$additionalOffset});
}
// header, banner
.kbnBody--hasHeaderBanner & {
min-height: calc(100vh - #{$kbnHeaderOffsetWithBanner + $additionalOffset});
}
// no header, banner
.kbnBody--chromeHidden.kbnBody--hasHeaderBanner & {
min-height: calc(100vh - #{$kbnHeaderBannerHeight + $additionalOffset});
}
}
@mixin kibanaFullBodyHeight($additionalOffset: 0) {
// The `--euiFixedHeadersOffset` CSS variable is automatically updated by
// styles/rendering/_base.scss, based on whether the Kibana chrome has a
// header banner, and is visible or hidden
height: calc(100vh - var(--euiFixedHeadersOffset) - #{$additionalOffset});
}
8 changes: 0 additions & 8 deletions src/core/public/_variables.scss

This file was deleted.

2 changes: 1 addition & 1 deletion src/core/public/index.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
@import './variables';
@import './css_variables';
@import './mixins';
@import './styles/index';
31 changes: 1 addition & 30 deletions src/core/public/styles/chrome/_banner.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
position: fixed;
top: 0;
left: 0;
height: $kbnHeaderBannerHeight;
height: var(--kbnHeaderBannerHeight);
width: 100%;
z-index: $euiZHeader;
}
Expand All @@ -11,32 +11,3 @@
height: 100%;
width: 100%;
}

// overriding `top` positioning of the chrome headers
.kbnBody--hasHeaderBanner .header__bars {
.header__firstBar {
top: $kbnHeaderBannerHeight;
}
.header__secondBar {
top: $kbnHeaderBannerHeight + $euiHeaderHeightCompensation;
}
}

// overriding padding on the body element added by EUI
.kbnBody.kbnBody--hasHeaderBanner.kbnBody--projectLayout.euiBody--headerIsFixed {
padding-top: $kbnHeaderBannerHeight + $euiHeaderHeightCompensation;

// overriding `top` positioning of the project side nav, and flyouts
// overriding `top` positioning of the project app menu toolbar
&.euiBody--headerIsFixed .euiCollapsibleNav,
&.euiBody--headerIsFixed:not(.euiDataGrid__restrictBody) .euiFlyout,
.header__actionMenu {
top: $kbnHeaderBannerHeight + $euiHeaderHeightCompensation;
}

// overriding `height` calculation of the project side nav, and flyouts
&.euiBody--headerIsFixed .euiCollapsibleNav,
&.euiBody--headerIsFixed:not(.euiDataGrid__restrictBody) .euiFlyout {
height: calc(100% - #{$kbnHeaderBannerHeight + $euiHeaderHeightCompensation});
}
}
Loading