Skip to content
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
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
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
## [`master`](https://github.com/elastic/eui/tree/master)

- Added `.eui-textNumber` utility class to apply `tnum` font-feature setting ([#5078](https://github.com/elastic/eui/pull/5078))
- Changed `EuiPageHeader`'s tab implementation to use size `xl` when only content ([#5135](https://github.com/elastic/eui/pull/5135))
- Added `pageTitleProps` prop to `EuiPageHeader` to pass through props to the `EuiTitle` ([#5135](https://github.com/elastic/eui/pull/5135))
- Added screen-reader only `<h1>` to `EuiPageHeader` when tabs exist without a `pageTitle` ([#5135](https://github.com/elastic/eui/pull/5135))
- Added `bottomBorder` prop and `xl` `size` to `EuiTabs` ([#5135](https://github.com/elastic/eui/pull/5135))
- Added `prepend` and `append` props to `EuiTab` ([#5135](https://github.com/elastic/eui/pull/5135))
- Refactored styles of `EuiTabs` ([#5135](https://github.com/elastic/eui/pull/5135))
- Removed Sass variables for `EuiTabs` font size (`$euiTabFontSize, $euiTabFontSizeS, $euiTabFontSizeL`) ([#5135](https://github.com/elastic/eui/pull/5135))
- Extended all `EuiTabProps` for each `EuiTabbedContentTab` ([#5135](https://github.com/elastic/eui/pull/5135))

**Theme: Amsterdam**

- Deprecated `display` prop of `EuiTabs` in favor of unified styles and `bottomBorder` ([#5135](https://github.com/elastic/eui/pull/5135))

## [`37.6.2`](https://github.com/elastic/eui/tree/v37.6.2)

Expand Down
2 changes: 1 addition & 1 deletion src-docs/src/components/guide_section/_guide_section.scss
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
}
}

.guideSectionTabs__tab {
.guideSectionTabs__tab > * {
font-weight: $euiFontWeightMedium !important; // sass-lint:disable-line no-important
}

Expand Down
38 changes: 0 additions & 38 deletions src-docs/src/views/page_header/page_header.js

This file was deleted.

15 changes: 15 additions & 0 deletions src-docs/src/views/page_header/page_header.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import React from 'react';

import { EuiPageHeader, EuiButton } from '../../../../src/components';

export default () => (
<EuiPageHeader
pageTitle="Page title"
iconType="logoKibana"
description="This description should be describing the current page as depicted by the page title. It will never extend beneath the right side content."
rightSideItems={[
<EuiButton fill>Add something</EuiButton>,
<EuiButton>Do something</EuiButton>,
]}
/>
);
46 changes: 41 additions & 5 deletions src-docs/src/views/page_header/page_header_example.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ const pageHeaderSource = require('!!raw-loader!./page_header');

import PageHeaderTabs from './page_header_tabs';
const pageHeaderTabsSource = require('!!raw-loader!./page_header_tabs');
import PageHeaderTabsTitle from './page_header_tabs_title';
const pageHeaderTabsTitleSource = require('!!raw-loader!./page_header_tabs_title');

import PageHeaderCustom from './page_header_custom';
import { EuiText } from '../../../../src/components/text';
Expand Down Expand Up @@ -76,10 +78,6 @@ export const PageHeaderExample = {
props: { EuiPageHeader },
snippet: `<EuiPageHeader
pageTitle="Page title"
tabs={[
{ label:"Tab 1", isSelected: true },
{ label:"Tab 2" }
]}
description="Example of a description."
rightSideItems={[
<EuiButton fill>Button 1</EuiButton>,
Expand All @@ -89,6 +87,42 @@ export const PageHeaderExample = {
},
{
title: 'Tabs in the page header',
source: [
{
type: GuideSectionTypes.JS,
code: pageHeaderTabsTitleSource,
},
],
text: (
<>
<p>
A set of <EuiCode>tabs</EuiCode> can be displayed inside the page
header by passing an array of{' '}
<Link to="/navigation/tabs">
<strong>EuiTab</strong>
</Link>{' '}
objects using the <EuiCode>label</EuiCode> key for the tab content.
When displaying tabs it is recommended to also apply the{' '}
<EuiCode>bottomBorder</EuiCode> prop (on the{' '}
<strong>EuiPageHeader</strong> component not through{' '}
<EuiCode>tabsProps</EuiCode>) to create separation of the header and
content. You&apos;ll still need to manage the page content and
selected tab in your own instance.
</p>
</>
),
demo: <PageHeaderTabsTitle />,
props: { EuiPageHeader },
snippet: `<EuiPageHeader
pageTitle="Page title"
tabs={[
{ label:"Tab 1", isSelected: true },
{ label:"Tab 2" }
]}
bottomBorder
/>`,
},
{
source: [
{
type: GuideSectionTypes.JS,
Expand All @@ -102,7 +136,8 @@ export const PageHeaderExample = {
<EuiCode>pageTitle</EuiCode>, <strong>EuiPageHeader</strong> will
promote those tabs as if they are the page title. This means that
any <EuiCode>description</EuiCode> or <EuiCode>children</EuiCode>{' '}
will sit <strong>below</strong> the tabs.
will sit <strong>below</strong> the tabs and should be describing
the currently selected tab.
</p>
</>
),
Expand All @@ -113,6 +148,7 @@ export const PageHeaderExample = {
{ label:"Tab 1", isSelected: true },
{ label:"Tab 2" }
]}
bottomBorder
description="Example of a description."
/>`,
},
Expand Down
36 changes: 0 additions & 36 deletions src-docs/src/views/page_header/page_header_tabs.js

This file was deleted.

19 changes: 19 additions & 0 deletions src-docs/src/views/page_header/page_header_tabs.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import React from 'react';

import { EuiPageHeader } from '../../../../src/components';

export default () => (
<EuiPageHeader
tabs={[
{
label: 'Tab 1',
isSelected: true,
},
{
label: 'Tab 2',
},
]}
description="This description should be describing the current page as depicted by the current tab. It has grow set to false to ensure a readable line-length."
bottomBorder
/>
);
23 changes: 23 additions & 0 deletions src-docs/src/views/page_header/page_header_tabs_title.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import React from 'react';

import { EuiPageHeader, EuiButton } from '../../../../src/components';

export default () => (
<EuiPageHeader
pageTitle="Page title"
tabs={[
{
label: 'Tab 1',
isSelected: true,
},
{
label: 'Tab 2',
},
]}
rightSideItems={[
<EuiButton fill>Add something</EuiButton>,
<EuiButton>Do something</EuiButton>,
]}
bottomBorder
/>
);
10 changes: 10 additions & 0 deletions src-docs/src/views/page_header/playground.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,16 @@ export const pageHeaderConfig = () => {
type: PropTypes.String,
};

propsToUse.alignItems = {
...propsToUse.alignItems,
value: 'top',
};

propsToUse.restrictWidth = {
...propsToUse.restrictWidth,
type: PropTypes.Number,
};

propsToUse.rightSideItems = simulateFunction({
...propsToUse.rightSideItems,
custom: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,27 @@ import {
EuiButton,
EuiIcon,
EuiTabbedContent,
EuiTitle,
EuiText,
EuiSpacer,
EuiTabbedContentProps,
EuiTabbedContentTab,
} from '../../../../src/components';

const tabs = [
const tabs: EuiTabbedContentProps['tabs'] = [
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ugh, so this is where the CodeSandbox link WILL break because of TS (defining types). It mostly just ignores it as function params, but here I get a full blown error, no render. But removing the type here has a cascade effect and really this is the best way to implement this consumer-side.

I'm open to suggestions.

Again, it was actually very important to do this in the docs because it did catch an error where the EuiTabbedContentProps needed to fully extend the EuITabProps in order to pass down the new props I added.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm looking into this locally now and I think I should be able to get CodeSandbox to build .tsx rather than .js files, which makes this demo work! The only thing is, I'm leaning towards making that its own PR instead of lumping it into this one (since it's already so big). WDYT? I'd personally be OK merging this PR in as-is (with a temporarily broken CodeSandbox link) knowing that we'll fix that functionality in a fast follow-up PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

🙌 Yeah if a fix is incoming for that, we def don't need to bloat or block this PR with it. Thank you!

{
id: 'cobalt',
name: 'Cobalt',
content: (
<Fragment>
<EuiSpacer />
<EuiTitle>
<h3>Cobalt</h3>
</EuiTitle>
<EuiText>
Cobalt is a chemical element with symbol Co and atomic number 27. Like
nickel, cobalt is found in the Earth&rsquo;s crust only in chemically
combined form, save for small deposits found in alloys of natural
meteoric iron. The free element, produced by reductive smelting, is a
hard, lustrous, silver-gray metal.
<p>
Cobalt is a chemical element with symbol Co and atomic number 27.
Like nickel, cobalt is found in the Earth&rsquo;s crust only in
chemically combined form, save for small deposits found in alloys of
natural meteoric iron. The free element, produced by reductive
smelting, is a hard, lustrous, silver-gray metal.
</p>
</EuiText>
</Fragment>
),
Expand All @@ -35,35 +35,29 @@ const tabs = [
content: (
<Fragment>
<EuiSpacer />
<EuiTitle>
<h3>Dextrose</h3>
</EuiTitle>
<EuiText>
Intravenous sugar solution, also known as dextrose solution, is a
mixture of dextrose (glucose) and water. It is used to treat low blood
sugar or water loss without electrolyte loss.
<p>
Intravenous sugar solution, also known as dextrose solution, is a
mixture of dextrose (glucose) and water. It is used to treat low
blood sugar or water loss without electrolyte loss.
</p>
</EuiText>
</Fragment>
),
},
{
id: 'hydrogen',
name: (
<span>
<EuiIcon type="heatmap" />
&nbsp;Hydrogen
</span>
),
name: 'Hydrogen',
prepend: <EuiIcon type="heatmap" />,
content: (
<Fragment>
<EuiSpacer />
<EuiTitle>
<h3>Hydrogen</h3>
</EuiTitle>
<EuiText>
Hydrogen is a chemical element with symbol H and atomic number 1. With
a standard atomic weight of 1.008, hydrogen is the lightest element on
the periodic table
<p>
Hydrogen is a chemical element with symbol H and atomic number 1.
With a standard atomic weight of 1.008, hydrogen is the lightest
element on the periodic table
</p>
</EuiText>
</Fragment>
),
Expand All @@ -74,14 +68,13 @@ const tabs = [
content: (
<Fragment>
<EuiSpacer />
<EuiTitle>
<h3>Monosodium Glutamate</h3>
</EuiTitle>
<EuiText>
Monosodium glutamate (MSG, also known as sodium glutamate) is the
sodium salt of glutamic acid, one of the most abundant naturally
occurring non-essential amino acids. Monosodium glutamate is found
naturally in tomatoes, cheese and other foods.
<p>
Monosodium glutamate (MSG, also known as sodium glutamate) is the
sodium salt of glutamic acid, one of the most abundant naturally
occurring non-essential amino acids. Monosodium glutamate is found
naturally in tomatoes, cheese and other foods.
</p>
</EuiText>
</Fragment>
),
Expand All @@ -91,7 +84,7 @@ const tabs = [
export default () => {
const [selectedTab, setSelectedTab] = useState(tabs[1]);

const onTabClick = (selectedTab) => {
const onTabClick = (selectedTab: EuiTabbedContentTab) => {
setSelectedTab(selectedTab);
};

Expand Down
3 changes: 2 additions & 1 deletion src-docs/src/views/tabs/playground.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ export const tabsConfig = () => {
const propsToUse = propUtilityForPlayground(docgenInfo.props);

propsToUse.children = {
value: '<EuiTab>Tab 1</EuiTab><EuiTab isSelected>Tab 2</EuiTab>',
value:
'<EuiTab>Tab 1</EuiTab><EuiTab isSelected>Tab 2</EuiTab><EuiTab disabled>Tab 3</EuiTab><EuiTab href="#">Tab link</EuiTab>',
type: PropTypes.ReactNode,
hidden: false,
};
Expand Down
Loading