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

Expand EuiFlyout usage to help EuiCollapsibleNav #4713

Merged
merged 41 commits into from
May 11, 2021
Merged
Show file tree
Hide file tree
Changes from 37 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
42664ce
Fix when animation happens with docked navs
Mar 24, 2021
3170831
WIP _ Terrible
Mar 24, 2021
d492775
Conditionally render children of EuiCollapsibleNavGroup
Mar 24, 2021
41db315
Fixing click capture on toggle button
Mar 25, 2021
44207ea
[BREAKING] Width of EuiCollapsibleNav is now add via `style` prop ins…
Mar 25, 2021
8b04e68
Add playground
Mar 25, 2021
1ea7c37
[EuiFlyout] Extending `size` prop to accept width types
Mar 25, 2021
f3a9db0
[EuiFlyout] Added `side` prop
Mar 25, 2021
2e4068b
[EuiFlyout] added `type=push`, `pushBreakpoint` and `outsideClickClos…
Mar 25, 2021
3076cc1
[EuiFlyout] Added `as` prop
Mar 25, 2021
3cfbcdc
[BREAKING] Update EuiCollapsibleNav to use EuiFlyout
Mar 26, 2021
e8a4232
Added `closeButton` and `closeButtonPosition` to EuiFlyout and using …
Mar 26, 2021
a55d9c6
Fixing up EuiCallapsibleNav with docking of EuiFlyout
Apr 13, 2021
c800e26
Finalizing (?) the components
Apr 14, 2021
294c3aa
Updating docs
Apr 15, 2021
95fa072
[Breaking] EuiFlyout defaults to `ownFocus = true`
Apr 15, 2021
5a5f33c
Cleanup
Apr 19, 2021
680a3bb
[EuiFlyout] Wrapping in EuiPortal when `ownFocus=true`
Apr 20, 2021
1833e6c
forwardRef
thompsongl Apr 21, 2021
5022e0d
collapsible type
thompsongl Apr 21, 2021
6440aa4
Merge remote-tracking branch 'cchaos/update/collapsible-nav' into upd…
thompsongl Apr 21, 2021
c6c5883
Merge pull request #49 from thompsongl/update/collapsible-nav
cchaos Apr 26, 2021
9393dbe
Add `onTouchEnd` for mobile support
Apr 21, 2021
24d031d
Fixing z-indexes of flyouts compared to header
Apr 28, 2021
6ec3eae
Merge remote-tracking branch 'upstream/master' into update/collapsibl…
Apr 28, 2021
511720c
Restricting elements to div, span and sectioning elements
Apr 28, 2021
26ae7e5
A couple more z-index fixes (popovers in header over flyout)
Apr 30, 2021
2326d36
Fix for doc
Apr 30, 2021
6e588e6
Fixing visible focus ring on overflowing content like in flyouts
Apr 30, 2021
3084410
Merge remote-tracking branch 'upstream/master' into update/collapsibl…
Apr 30, 2021
53d9c3e
cl
Apr 30, 2021
feff170
Merge branch 'master' into update/collapsible-nav
cchaos Apr 30, 2021
21791b9
Removing `ownFocus` from push example
Apr 30, 2021
fe1edb3
Changing EuiFlyout `tabindex=0` to `-1`
May 3, 2021
ea7b30b
Merge remote-tracking branch 'upstream/master' into update/collapsibl…
May 3, 2021
daeaa4c
Update a11y callout
cchaos May 6, 2021
b2ac007
Merge branch 'master' into update/collapsible-nav
cchaos May 6, 2021
3364337
accomodate -> accommodate
May 11, 2021
5ac621f
No `ownFocus`
May 11, 2021
f93898d
Change `role=‘none’` to `role=null`
May 11, 2021
3273e25
Merge remote-tracking branch 'upstream/master' into update/collapsibl…
May 11, 2021
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
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

- Added `textTransform` property to `schemaDetectors` prop of `EuiDataGrid`([#4752](https://github.com/elastic/eui/pull/4752))
- Added `color`, `continuityAbove`, `continuityAboveBelow`, `continuityBelow`, `continuityWithin`, `eraser`, `fullScreenExit`, `function`, `percent`, `wordWrap`, and `wordWrapDisabled` glyphs to `EuiIcon` ([#4779](https://github.com/elastic/eui/pull/4779))
- Added `as`, `role`, `closeButtonProps`, `closeButtonPosition`, `outsideClickCloses`, `side`, `type`, and `pushMinBreakpoint` props to `EuiFlyout` ([#4713](https://github.com/elastic/eui/pull/4713))
- Extended `EuiFlyout` `size` prop to accept any CSS `width` value ([#4713](https://github.com/elastic/eui/pull/4713))
- Extended `EuiFlyout` and most of its props in `EuiCollapsibleNav` ([#4713](https://github.com/elastic/eui/pull/4713))

**Breaking changes**

- Changed the default of `EuiFlyout` `ownFocus` to `true` ([#4713](https://github.com/elastic/eui/pull/4713))
- Wrapped `EuiFlyout` within the `EuiOverlayMask` when `ownFocus=true` ([#4713](https://github.com/elastic/eui/pull/4713))
- Changed `EuiCollapsibleNav` width sizing from a Sass variable to a `size` prop ([#4713](https://github.com/elastic/eui/pull/4713))
- Changed `EuiOverlayMask` z-indexing when positioned `below` header to using `top` offset ([#4713](https://github.com/elastic/eui/pull/4713))

## [`33.0.0`](https://github.com/elastic/eui/tree/v33.0.0)

Expand Down
2 changes: 1 addition & 1 deletion src-docs/src/components/guide_components.scss
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ $elasticLogoTextDark: #1C1E23;
height: 100%;
left: 0;
top: 0;
z-index: $euiZHeader + 1;
z-index: $euiZHeader;
overflow: auto;

&--withHeader {
Expand Down
6 changes: 3 additions & 3 deletions src-docs/src/services/playground/knobs.js
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ const Knob = ({
}}
/>
);
} else return null;
} else return helpText || null;

case PropTypes.Custom:
if (custom && custom.use) {
Expand Down Expand Up @@ -352,9 +352,9 @@ const Knob = ({
case PropTypes.Function:
case PropTypes.Array:
case PropTypes.Object:
return null;
return helpText || null;
default:
return assertUnreachable();
return helpText || assertUnreachable();
}
};

Expand Down
31 changes: 26 additions & 5 deletions src-docs/src/views/collapsible_nav/collapsible_nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,25 @@ import { EuiText } from '../../../../src/components/text';
import { EuiCode } from '../../../../src/components/code';

export default () => {
const [navIsOpen, setNavIsOpen] = useState(false);
const [navIsDocked, setNavIsDocked] = useState(false);
const [navIsOpen, setNavIsOpen] = useState<boolean>(
JSON.parse(
String(localStorage.getItem('euiCollapsibleNavExample--isDocked'))
) || false
);
const [navIsDocked, setNavIsDocked] = useState<boolean>(
JSON.parse(
String(localStorage.getItem('euiCollapsibleNavExample--isDocked'))
) || false
);

return (
<>
<EuiCollapsibleNav
isOpen={navIsOpen}
isDocked={navIsDocked}
size={240}
button={
<EuiButton onClick={() => setNavIsOpen(!navIsOpen)}>
<EuiButton onClick={() => setNavIsOpen((isOpen) => !isOpen)}>
Toggle nav
</EuiButton>
}
Expand All @@ -27,9 +36,20 @@ export default () => {
<h2>I am some nav</h2>
</EuiTitle>
<EuiSpacer />
<EuiText size="s" color="subdued">
<p>
The docked status is being stored in{' '}
<EuiCode>localStorage</EuiCode>.
</p>
</EuiText>
<EuiSpacer />
<EuiButton
onClick={() => {
setNavIsDocked(!navIsDocked);
localStorage.setItem(
'euiCollapsibleNavExample--isDocked',
JSON.stringify(!navIsDocked)
);
}}>
Docked: {navIsDocked ? 'on' : 'off'}
</EuiButton>
Expand All @@ -39,8 +59,9 @@ export default () => {
{navIsDocked && (
<EuiText size="s" color="subdued">
<p>
The button gets hidden by default when the nav is docked unless you
set <EuiCode language="js">showButtonIfDocked = true</EuiCode>.
The <EuiCode>button</EuiCode> gets hidden by default when the nav is
docked unless you set{' '}
<EuiCode language="js">showButtonIfDocked = true</EuiCode>.
</p>
</EuiText>
)}
Expand Down
8 changes: 3 additions & 5 deletions src-docs/src/views/collapsible_nav/collapsible_nav_all.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,9 @@ const LearnLinks: EuiPinnableListGroupItemProps[] = [
];

export default () => {
const [navIsOpen, setNavIsOpen] = useState(
JSON.parse(String(localStorage.getItem('navIsDocked'))) || false
);
const [navIsOpen, setNavIsOpen] = useState(true);
const [navIsDocked, setNavIsDocked] = useState(
JSON.parse(String(localStorage.getItem('navIsDocked'))) || false
JSON.parse(String(localStorage.getItem('nav2IsDocked'))) || false
);

/**
Expand Down Expand Up @@ -234,7 +232,7 @@ export default () => {
onClick={() => {
setNavIsDocked(!navIsDocked);
localStorage.setItem(
'navIsDocked',
'nav2IsDocked',
JSON.stringify(!navIsDocked)
);
}}
Expand Down
42 changes: 17 additions & 25 deletions src-docs/src/views/collapsible_nav/collapsible_nav_example.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import React from 'react';
import { Link } from 'react-router-dom';

import { renderToHtml } from '../../services';

import { GuideSectionTypes } from '../../components';

import {
Expand All @@ -11,23 +9,22 @@ import {
EuiText,
EuiCallOut,
EuiCollapsibleNavGroup,
EuiHorizontalRule,
} from '../../../../src/components';

import { collapsibleNavConfig } from './playground';

import CollapsibleNav from './collapsible_nav';
const collapsibleNavSource = require('!!raw-loader!./collapsible_nav');
const collapsibleNavHtml = renderToHtml(CollapsibleNav);

import CollapsibleNavGroup from './collapsible_nav_group';
const collapsibleNavGroupSource = require('!!raw-loader!./collapsible_nav_group');
const collapsibleNavGroupHtml = renderToHtml(CollapsibleNavGroup);

import CollapsibleNavList from './collapsible_nav_list';
const collapsibleNavListSource = require('!!raw-loader!./collapsible_nav_list');
const collapsibleNavListHtml = renderToHtml(CollapsibleNavList);

import CollapsibleNavAll from './collapsible_nav_all';
const collapsibleNavAllSource = require('!!raw-loader!./collapsible_nav_all');
const collapsibleNavAllHtml = renderToHtml(CollapsibleNavAll);

export const CollapsibleNavExample = {
title: 'Collapsible nav',
Expand All @@ -46,19 +43,15 @@ export const CollapsibleNavExample = {
type: GuideSectionTypes.JS,
code: collapsibleNavSource,
},
{
type: GuideSectionTypes.HTML,
code: collapsibleNavHtml,
},
],
text: (
<>
<p>
<strong>EuiCollapsibleNav</strong> is a similar implementation to{' '}
<strong>EuiCollapsibleNav</strong> is a custom implementation of{' '}
<Link to="/layout/flyout">
<strong>EuiFlyout</strong>
</Link>
; the visibility of which must be maintained by the consuming
; the visibility of which must still be maintained by the consuming
application. An extra feature that it provides is the ability to{' '}
<EuiCode>dock</EuiCode> the flyout. This affixes the flyout to the
window and pushes the body content by adding left side padding.
Expand All @@ -72,11 +65,14 @@ export const CollapsibleNavExample = {
props: { EuiCollapsibleNav },
demo: <CollapsibleNav />,
snippet: `<EuiCollapsibleNav
ownFocus={false}
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any reason we want the snippet to have ownFocus={false}?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah yeah, so in Kibana we're going to use this setting on the global nav and went back and forth whether our docs should have it off by default too, then I think I forgot to update the snippet. Good catch.

size={240}
button={<EuiButton onClick={() => setNavIsOpen(!navIsOpen)}>Toggle nav</EuiButton>}
isOpen={navIsOpen}
isDocked={navIsDocked}
onClose={() => setNavIsOpen(false)}
/>`,
playground: collapsibleNavConfig,
},
{
title: 'Collapsible nav group',
Expand All @@ -85,10 +81,6 @@ export const CollapsibleNavExample = {
type: GuideSectionTypes.JS,
code: collapsibleNavGroupSource,
},
{
type: GuideSectionTypes.HTML,
code: collapsibleNavGroupHtml,
},
],
text: (
<>
Expand Down Expand Up @@ -130,10 +122,6 @@ export const CollapsibleNavExample = {
type: GuideSectionTypes.JS,
code: collapsibleNavListSource,
},
{
type: GuideSectionTypes.HTML,
code: collapsibleNavListHtml,
},
],
text: (
<>
Expand All @@ -152,7 +140,15 @@ export const CollapsibleNavExample = {
<p>Below are a few established patterns to use.</p>
</>
),
demo: <CollapsibleNavList />,
demo: (
<div>
<CollapsibleNavList />
<EuiHorizontalRule margin="none" />
</div>
),
demoPanelProps: {
paddingSize: 'none',
},
snippet: `<EuiCollapsibleNavGroup
title="Kibana"
iconType="logoKibana"
Expand All @@ -179,10 +175,6 @@ export const CollapsibleNavExample = {
type: GuideSectionTypes.JS,
code: collapsibleNavAllSource,
},
{
type: GuideSectionTypes.HTML,
code: collapsibleNavAllHtml,
},
],
text: (
<>
Expand Down
54 changes: 54 additions & 0 deletions src-docs/src/views/collapsible_nav/playground.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import { PropTypes } from 'react-view';
import { EuiCollapsibleNav } from '../../../../src/components/';
import { propUtilityForPlayground } from '../../services/playground';

export const collapsibleNavConfig = () => {
const docgenInfo = Array.isArray(EuiCollapsibleNav.__docgenInfo)
? EuiCollapsibleNav.__docgenInfo[0]
: EuiCollapsibleNav.__docgenInfo;
const propsToUse = propUtilityForPlayground(docgenInfo.props);

propsToUse.isOpen = {
...propsToUse.isOpen,
value: true,
};

propsToUse.ownFocus = {
...propsToUse.ownFocus,
value: false,
disabled: true,
};

propsToUse.size = {
...propsToUse.size,
type: PropTypes.Number,
value: 240,
};

propsToUse.as = {
...propsToUse.as,
type: PropTypes.string,
value: 'nav',
};

propsToUse.as = {
...propsToUse.as,
type: PropTypes.string,
value: 'nav',
};

return {
config: {
componentName: 'EuiCollapsibleNav',
props: propsToUse,
scope: {
EuiCollapsibleNav,
},
imports: {
'@elastic/eui': {
named: ['EuiCollapsibleNav'],
},
},
},
};
};
Loading