diff --git a/CHANGELOG.md b/CHANGELOG.md index ce69ef48da0..d66a7a33bc6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,11 @@ - Removed `EuiToggle` and `EuiButtonToggle` in favor of `aria-pressed` ([4056](https://github.com/elastic/eui/pull/4056)) - Updated `legend` and `idSelected` props of `EuiButtonGroup` to be required ([4056](https://github.com/elastic/eui/pull/4056)) +- Removed `logoAPM` in favor of `logoObservability` ([4065](https://github.com/elastic/eui/pull/4065)) +- Removed `.euiHeaderNotification` CSS class ([4065](https://github.com/elastic/eui/pull/4065)) +- Removed `EuiNavDrawer` in favor of `EuiCollapsibleNav` ([4065](https://github.com/elastic/eui/pull/4065)) +- Removed `compressed` and `displayOnly` props from `EuiFormRow` in favor of the `display` prop ([4065](https://github.com/elastic/eui/pull/4065)) +- Removed `EuiPopover`'s `withTitle` prop ([4065](https://github.com/elastic/eui/pull/4065)) **Theme: Amsterdam** diff --git a/src-docs/src/routes.js b/src-docs/src/routes.js index 0261f3558a3..5905d4889a1 100644 --- a/src-docs/src/routes.js +++ b/src-docs/src/routes.js @@ -144,8 +144,6 @@ import { ModalExample } from './views/modal/modal_example'; import { MutationObserverExample } from './views/mutation_observer/mutation_observer_example'; -import { NavDrawerExample } from './views/nav_drawer/nav_drawer_example'; - import { OutsideClickDetectorExample } from './views/outside_click_detector/outside_click_detector_example'; import { OverlayMaskExample } from './views/overlay_mask/overlay_mask_example'; @@ -335,7 +333,6 @@ const navigation = [ HeaderExample, HorizontalRuleExample, ModalExample, - NavDrawerExample, PageExample, PanelExample, PopoverExample, diff --git a/src-docs/src/views/button/button_icon.js b/src-docs/src/views/button/button_icon.js index 47b9e8cda9c..7c5ca071acb 100644 --- a/src-docs/src/views/button/button_icon.js +++ b/src-docs/src/views/button/button_icon.js @@ -14,7 +14,6 @@ const colors = [ 'success', 'warning', 'danger', - 'disabled', ]; export default () => ( @@ -26,9 +25,16 @@ export default () => ( onClick={() => window.alert('Button clicked')} iconType="arrowRight" aria-label="Next" - disabled={color === 'disabled' ? true : false} /> ))} + + window.alert('Button clicked')} + iconType="arrowRight" + aria-label="Next" + disabled + /> + ); diff --git a/src-docs/src/views/context_menu/context_menu.js b/src-docs/src/views/context_menu/context_menu.js index 70097b78b22..ea1a2179e4f 100644 --- a/src-docs/src/views/context_menu/context_menu.js +++ b/src-docs/src/views/context_menu/context_menu.js @@ -141,7 +141,6 @@ export default () => { isOpen={isPopoverOpen} closePopover={closePopover} panelPaddingSize="none" - withTitle anchorPosition="downLeft"> diff --git a/src-docs/src/views/context_menu/context_menu_with_content.js b/src-docs/src/views/context_menu/context_menu_with_content.js index 163bb3f5d69..7a0b07958a3 100644 --- a/src-docs/src/views/context_menu/context_menu_with_content.js +++ b/src-docs/src/views/context_menu/context_menu_with_content.js @@ -117,7 +117,6 @@ export default () => { isOpen={isPopoverOpen} closePopover={closePopover} panelPaddingSize="none" - withTitle anchorPosition="upLeft"> @@ -130,7 +129,6 @@ export default () => { isOpen={isDynamicPopoverOpen} closePopover={closeDynamicPopover} panelPaddingSize="none" - withTitle anchorPosition="upLeft"> diff --git a/src-docs/src/views/filter_group/filter_group.js b/src-docs/src/views/filter_group/filter_group.js index 88f4a2fb4f3..423d8d0098c 100644 --- a/src-docs/src/views/filter_group/filter_group.js +++ b/src-docs/src/views/filter_group/filter_group.js @@ -75,8 +75,7 @@ export default () => { button={button} isOpen={isPopoverOpen} closePopover={closePopover} - panelPaddingSize="none" - withTitle> + panelPaddingSize="none">
diff --git a/src-docs/src/views/filter_group/filter_group_multi.js b/src-docs/src/views/filter_group/filter_group_multi.js index 82d593fff11..ad40a02e215 100644 --- a/src-docs/src/views/filter_group/filter_group_multi.js +++ b/src-docs/src/views/filter_group/filter_group_multi.js @@ -65,8 +65,7 @@ export default () => { button={button} isOpen={isPopoverOpen} closePopover={closePopover} - panelPaddingSize="none" - withTitle> + panelPaddingSize="none"> diff --git a/src-docs/src/views/nav_drawer/nav_drawer.js b/src-docs/src/views/nav_drawer/nav_drawer.js deleted file mode 100644 index 158cbb2beba..00000000000 --- a/src-docs/src/views/nav_drawer/nav_drawer.js +++ /dev/null @@ -1,544 +0,0 @@ -import React, { Fragment, useState, useRef } from 'react'; - -import { - EuiAvatar, - EuiButton, - EuiFocusTrap, - EuiHeader, - EuiHeaderBreadcrumbs, - EuiHeaderLogo, - EuiHeaderSection, - EuiHeaderSectionItem, - EuiHeaderSectionItemButton, - EuiHorizontalRule, - EuiIcon, - EuiImage, - EuiNavDrawer, - EuiNavDrawerGroup, - EuiPage, - EuiPageBody, - EuiPageContent, - EuiPageContentBody, - EuiPageContentHeader, - EuiPageContentHeaderSection, - EuiPageHeader, - EuiPageHeaderSection, - EuiShowFor, - EuiTitle, -} from '../../../../src/components'; - -export default () => { - const [isFullScreen, setIsFullScreen] = useState(false); - - const faveExtraAction = { - color: 'subdued', - iconType: 'starEmpty', - iconSize: 's', - 'aria-label': 'Add to favorites', - }; - - const pinExtraAction = { - color: 'subdued', - iconType: 'pin', - iconSize: 's', - }; - - const pinExtraActionFn = (val) => { - pinExtraAction['aria-label'] = `Pin ${val} to top`; - return pinExtraAction; - }; - - const topLinks = [ - { - label: 'Recently viewed', - iconType: 'clock', - flyoutMenu: { - title: 'Recent items', - listItems: [ - { - label: 'My dashboard', - href: '#/layout/nav-drawer', - iconType: 'dashboardApp', - extraAction: faveExtraAction, - }, - { - label: 'Workpad with title that wraps', - href: '#/layout/nav-drawer', - iconType: 'canvasApp', - extraAction: faveExtraAction, - }, - { - label: 'My logs', - href: '#/layout/nav-drawer', - iconType: 'logsApp', - 'aria-label': 'This is an alternate aria-label', - extraAction: faveExtraAction, - }, - ], - }, - }, - { - label: 'Favorites', - iconType: 'starEmpty', - flyoutMenu: { - title: 'Favorite items', - listItems: [ - { - label: 'My workpad', - href: '#/layout/nav-drawer', - iconType: 'canvasApp', - extraAction: { - color: 'subdued', - iconType: 'starFilled', - iconSize: 's', - 'aria-label': 'Remove from favorites', - alwaysShow: true, - }, - }, - { - label: 'My logs', - href: '#/layout/nav-drawer', - iconType: 'logsApp', - extraAction: { - color: 'subdued', - iconType: 'starFilled', - iconSize: 's', - 'aria-label': 'Remove from favorites', - alwaysShow: true, - }, - }, - ], - }, - }, - ]; - - const adminLinks = [ - { - label: 'Admin', - iconType: 'managementApp', - flyoutMenu: { - title: 'Tools and settings', - listItems: [ - { - label: 'Dev tools', - href: '#/layout/nav-drawer', - iconType: 'devToolsApp', - extraAction: { - color: 'subdued', - iconType: 'starEmpty', - iconSize: 's', - 'aria-label': 'Add to Tools and Settings to favorites', - }, - }, - { - label: 'Stack Monitoring', - href: '#/layout/nav-drawer', - iconType: 'monitoringApp', - extraAction: { - color: 'subdued', - iconType: 'starEmpty', - iconSize: 's', - 'aria-label': 'Add Stack Monitoring to favorites', - }, - }, - { - label: 'Stack Management', - href: '#/layout/nav-drawer', - iconType: 'managementApp', - extraAction: { - color: 'subdued', - iconType: 'starEmpty', - iconSize: 's', - 'aria-label': 'Add Stack Management to favorites', - }, - }, - { - label: 'Nature Plugin (image as icon)', - href: '#/layout/nav-drawer', - extraAction: { ...pinExtraActionFn('Nature Plugin') }, - icon: ( - - ), - }, - ], - }, - }, - ]; - - const analyzeLinks = [ - { - label: 'Analyze', - iconType: 'logoBusinessAnalytics', - flyoutMenu: { - title: 'Analyze your data', - listItems: [ - { - label: 'Discover', - href: '#/layout/nav-drawer', - iconType: 'discoverApp', - extraAction: { - color: 'subdued', - iconType: 'starEmpty', - iconSize: 's', - 'aria-label': 'Add Discover to favorites', - }, - }, - { - label: 'Visualize', - href: '#/layout/nav-drawer', - iconType: 'visualizeApp', - extraAction: { - color: 'subdued', - iconType: 'starEmpty', - iconSize: 's', - 'aria-label': 'Add Visualize to favorites', - }, - }, - { - label: 'Canvas', - href: '#/layout/nav-drawer', - iconType: 'canvasApp', - extraAction: { - color: 'subdued', - iconType: 'starEmpty', - iconSize: 's', - 'aria-label': 'Add Canvas to favorites', - }, - }, - { - label: 'Maps', - href: '#/layout/nav-drawer', - iconType: 'gisApp', - extraAction: { - color: 'subdued', - iconType: 'starEmpty', - iconSize: 's', - 'aria-label': 'Add Maps to favorites', - }, - }, - { - label: 'Machine Learning', - href: '#/layout/nav-drawer', - iconType: 'machineLearningApp', - extraAction: { - color: 'subdued', - iconType: 'starEmpty', - iconSize: 's', - 'aria-label': 'Add Machine Learning to favorites', - }, - }, - { - label: 'Graph', - href: '#/layout/nav-drawer', - iconType: 'graphApp', - extraAction: { - color: 'subdued', - iconType: 'starEmpty', - iconSize: 's', - 'aria-label': 'Add Graph to favorites', - }, - }, - ], - }, - }, - ]; - - const securityLinks = [ - { - label: 'Security', - iconType: 'logoSecurity', - flyoutMenu: { - title: 'Security', - listItems: [ - { - label: 'SIEM', - href: '#/layout/nav-drawer', - iconType: 'securityApp', - extraAction: { ...pinExtraActionFn('SIEM') }, - }, - { - label: 'Endpoints', - href: '#/layout/nav-drawer', - iconType: 'securityAnalyticsApp', - extraAction: { - color: 'subdued', - iconType: 'starEmpty', - iconSize: 's', - 'aria-label': 'Add SIEM to favorites', - }, - }, - ], - }, - }, - ]; - - const searchLinks = [ - { - label: 'Enterprise Search', - iconType: 'logoAppSearch', - flyoutMenu: { - title: 'Enterprise search', - listItems: [ - { - label: 'Site search', - href: '#/layout/nav-drawer', - iconType: 'searchProfilerApp', - extraAction: { - color: 'subdued', - iconType: 'starEmpty', - iconSize: 's', - 'aria-label': 'Add Enterprise search to favorites', - }, - }, - { - label: 'App search', - href: '#/layout/nav-drawer', - iconType: 'searchProfilerApp', - extraAction: { - color: 'subdued', - iconType: 'starEmpty', - iconSize: 's', - 'aria-label': 'Add App Search to favorites', - }, - }, - { - label: 'Workplace search', - href: '#/layout/nav-drawer', - iconType: 'searchProfilerApp', - extraAction: { - color: 'subdued', - iconType: 'starEmpty', - iconSize: 's', - 'aria-label': 'Add Workplace Search to favorites', - }, - }, - ], - }, - }, - ]; - - const observabilityLinks = [ - { - label: 'Observability', - iconType: 'logoMetrics', - flyoutMenu: { - title: 'Observe your operations', - listItems: [ - { - label: 'Logs', - href: '#/layout/nav-drawer', - iconType: 'logsApp', - extraAction: { - color: 'subdued', - iconType: 'starEmpty', - iconSize: 's', - 'aria-label': 'Add Logs to favorites', - }, - }, - { - label: 'Metrics', - href: '#/layout/nav-drawer', - iconType: 'metricsApp', - extraAction: { - color: 'subdued', - iconType: 'starEmpty', - iconSize: 's', - 'aria-label': 'Add Metrics to favorites', - }, - }, - { - label: 'APM', - href: '#/layout/nav-drawer', - iconType: 'apmApp', - extraAction: { - color: 'subdued', - iconType: 'starEmpty', - iconSize: 's', - 'aria-label': 'Add APM to favorites', - }, - }, - { - label: 'Uptime', - href: '#/layout/nav-drawer', - iconType: 'uptimeApp', - extraAction: { - color: 'subdued', - iconType: 'starEmpty', - iconSize: 's', - 'aria-label': 'Add Uptime to favorites', - }, - }, - ], - }, - }, - ]; - - const toggleFullScreen = () => - setIsFullScreen((isFullScreen) => !isFullScreen); - - const renderLogo = () => ( - - ); - - const renderMenuTrigger = () => ( - navDrawerRef.current.toggleOpen()}> - - - ); - const renderBreadcrumbs = () => { - const breadcrumbs = [ - { - text: 'Management', - href: '#', - onClick: (e) => { - e.preventDefault(); - console.log('You clicked management'); - }, - 'data-test-subj': 'breadcrumbsAnimals', - className: 'customClass', - }, - { - text: 'Truncation test is here for a really long item', - href: '#', - onClick: (e) => { - e.preventDefault(); - console.log('You clicked truncation test'); - }, - }, - { - text: 'hidden', - href: '#', - onClick: (e) => { - e.preventDefault(); - console.log('You clicked hidden'); - }, - }, - { - text: 'Users', - href: '#', - onClick: (e) => { - e.preventDefault(); - console.log('You clicked users'); - }, - }, - { - text: 'Create', - }, - ]; - - return ; - }; - - const navDrawerRef = useRef(null); - - let fullScreenDisplay; - - if (isFullScreen) { - fullScreenDisplay = ( - -
- - - - - {renderMenuTrigger()} - - - - {renderLogo()} - - - - - - - - - {renderBreadcrumbs()} - - - - - - - - - - - - - - - - - - - - - - - - -

Page title

-
-
-
- - - - -

Content title

-
-
-
- - - Exit fullscreen demo - - -
-
-
-
-
- ); - } - return ( - - - Show fullscreen demo - - - {/* - If the below fullScreen code renders, it actually attaches to the body because of - EuiOverlayMask's React portal usage. - */} - - {fullScreenDisplay} - - ); -}; diff --git a/src-docs/src/views/nav_drawer/nav_drawer_example.js b/src-docs/src/views/nav_drawer/nav_drawer_example.js deleted file mode 100644 index d87111c513e..00000000000 --- a/src-docs/src/views/nav_drawer/nav_drawer_example.js +++ /dev/null @@ -1,93 +0,0 @@ -import React from 'react'; -import { Link } from 'react-router-dom'; - -import { renderToHtml } from '../../services'; - -import { GuideSectionTypes } from '../../components'; - -import { - EuiNavDrawer, - EuiCode, - EuiCallOut, - EuiBadge, - EuiSpacer, -} from '../../../../src/components'; - -import NavDrawer from './nav_drawer'; -const navDrawerSource = require('!!raw-loader!./nav_drawer'); -const navDrawerHtml = renderToHtml(NavDrawer); -const navDrawerSnippet = ` - -`; - -export const NavDrawerExample = { - title: 'Nav drawer', - sections: [ - { - source: [ - { - type: GuideSectionTypes.JS, - code: navDrawerSource, - }, - { - type: GuideSectionTypes.HTML, - code: navDrawerHtml, - }, - ], - text: ( -
- - Set for deprecation. See details. - - -

- Please use{' '} - - EuiCollapsableNav - {' '} - instead of EuiNavDrawer for your global navigation - needs. Feature enhancements are no longer being made to this - component. -

-

- EuiNavDrawer provides a side navigation feature - that is complete with interactions and a mobile-friendly design. It - can contain one or more EuiNavDrawerGroup{' '} - components and is designed to be used in conjunction with{' '} - - EuiHeader - - . -

- -

- Providing a flyoutMenu prop on the{' '} - listItems object of an{' '} - EuiNavDrawerGroup will result in that link - opening a secondary menu. Note that this will also override the{' '} - onClick event. For more details about other - props available for the listItems object, - please refer to{' '} - - EuiListGroupItem - - . -

-
-
- ), - snippet: navDrawerSnippet, - props: { - EuiNavDrawer, - }, - demo: , - }, - ], -}; diff --git a/src-docs/src/views/suggest/global_filter_add.js b/src-docs/src/views/suggest/global_filter_add.js index e499705badf..514810a16fe 100644 --- a/src-docs/src/views/suggest/global_filter_add.js +++ b/src-docs/src/views/suggest/global_filter_add.js @@ -30,8 +30,7 @@ export default () => { + Add filter } - anchorPosition="downCenter" - withTitle> + anchorPosition="downCenter"> Add a filter diff --git a/src-docs/src/views/suggest/global_filter_options.js b/src-docs/src/views/suggest/global_filter_options.js index cc8d243a9f1..13a41329b10 100644 --- a/src-docs/src/views/suggest/global_filter_options.js +++ b/src-docs/src/views/suggest/global_filter_options.js @@ -102,8 +102,7 @@ export default () => { /> } anchorPosition="downCenter" - panelPaddingSize="none" - withTitle> + panelPaddingSize="none"> Change all filters diff --git a/src/components/basic_table/__snapshots__/in_memory_table.test.tsx.snap b/src/components/basic_table/__snapshots__/in_memory_table.test.tsx.snap index b2318573311..06c25f28ce6 100644 --- a/src/components/basic_table/__snapshots__/in_memory_table.test.tsx.snap +++ b/src/components/basic_table/__snapshots__/in_memory_table.test.tsx.snap @@ -357,14 +357,13 @@ exports[`EuiInMemoryTable behavior pagination 1`] = ` isOpen={false} ownFocus={false} panelPaddingSize="none" - withTitle={true} >
`; -exports[`EuiButtonEmpty props color disabled is rendered 1`] = ` - -`; - exports[`EuiButtonEmpty props color ghost is rendered 1`] = ` -`; - exports[`EuiButtonIcon props color ghost is rendered 1`] = ` - - - -
    -
  • - - - -
  • -
  • - - - -
  • -
- -
-
- - -`; - -exports[`EuiNavDrawer renders with falsy children 1`] = ` - -`; - -exports[`EuiNavDrawer renders with fragments 1`] = ` - -`; diff --git a/src/components/nav_drawer/_index.scss b/src/components/nav_drawer/_index.scss deleted file mode 100644 index 92cc8b78103..00000000000 --- a/src/components/nav_drawer/_index.scss +++ /dev/null @@ -1,6 +0,0 @@ -@import 'variables'; - -// Components -@import 'nav_drawer'; -@import 'nav_drawer_flyout'; -@import 'nav_drawer_group'; diff --git a/src/components/nav_drawer/_nav_drawer.scss b/src/components/nav_drawer/_nav_drawer.scss deleted file mode 100644 index ad9d03a0720..00000000000 --- a/src/components/nav_drawer/_nav_drawer.scss +++ /dev/null @@ -1,156 +0,0 @@ -// Nav drawer. Global application navigation. - -.euiNavDrawer { - width: $euiNavDrawerWidthCollapsed; - height: calc(100% - #{$euiNavDrawerTopPosition}); - position: fixed; - left: 0; - top: $euiNavDrawerTopPosition; - overflow: hidden; - z-index: $euiZHeader; - background: $euiHeaderBackgroundColor; - box-shadow: $euiNavDrawerSideShadow; - transition: width $euiAnimSpeedExtraFast $euiAnimSlightResistance; - display: flex; - - .euiNavDrawerMenu { - @include euiScrollBar; - overflow-y: auto; - overflow-x: hidden; - width: $euiNavDrawerWidthCollapsed; - height: 100%; - - &-hasFooter { - margin-bottom: $euiSizeXXL; - } - } - - .euiNavDrawer__expandButton { - @include euiBottomShadowFlat; - background-color: $euiColorEmptyShade; - position: fixed; - bottom: 0; - width: $euiNavDrawerWidthCollapsed; - transition: width $euiAnimSpeedExtraFast; - z-index: $euiZHeader + 1; - - .euiListGroupItem__button { - padding: $euiSizeM $euiSize; - } - - .navDrawerExpandButton-isCollapsed .euiListGroupItem__button { - max-width: 100%; - } - } - - &.euiNavDrawer-isCollapsed { - &.euiNavDrawer-flyoutIsExpanded { - width: $euiNavDrawerWidthCollapsed + $euiNavDrawerWidthExpanded; - } - - .euiNavDrawerMenu { - // Prevents scrollbar from overlapping links in collapsed form - // sass-lint:disable-block no-vendor-prefixes - // sass-lint:disable-block no-misspelled-properties - -ms-overflow-style: -ms-autohiding-scrollbar; - scrollbar-width: none; - - &::-webkit-scrollbar { - width: 0; - height: 0; - } - - .euiListGroup:not(.euiNavDrawer__expandButton) .euiListGroupItem__button { - max-width: $euiSizeXL; - } - - .euiListGroupItem__extraAction { - // Hides extra action from scrolling into view when tabbing in the collapsed view - visibility: hidden; - } - } - } - - &.euiNavDrawer-isExpanded { - width: $euiNavDrawerWidthExpanded; - - .euiNavDrawerMenu, - .euiNavDrawer__expandButton { - width: $euiNavDrawerWidthExpanded; - } - - &.euiNavDrawer-flyoutIsExpanded { - width: $euiNavDrawerWidthExpanded + $euiNavDrawerWidthCollapsed; - } - } -} - -.euiNavDrawerPage { - height: 100%; - - .euiNavDrawerPage__pageBody { - margin-left: $euiNavDrawerWidthCollapsed; - } -} - -@include euiBreakpoint('xs', 's') { - .euiNavDrawer { - width: 0; - - &.euiNavDrawer-isExpanded .euiNavDrawerMenu { - .euiListGroupItem__icon { - margin-right: $euiSizeM; - } - } - - &.euiNavDrawer-flyoutIsCollapsed .euiNavDrawerFlyout { - width: 0; - transition-duration: 0s; - } - - // No expand toggle on mobile - - .euiNavDrawerMenu-hasFooter { - margin-bottom: 0; - } - - .euiNavDrawer__expandButton { - display: none; - } - } - - .euiNavDrawerPage .euiNavDrawerPage__pageBody { - margin-left: 0; - } -} - -@include euiBreakpoint('xs', 's', 'm', 'l') { - .euiNavDrawer__expandButtonLockAction { - display: none; - } -} - -@include euiBreakpoint('xl') { - .euiNavDrawer-isLocked { - + .euiNavDrawerPage .euiNavDrawerPage__pageBody { - // Shrink the content from the left so it's no longer overlapped by the nav drawer (ALWAYS) - margin-left: $euiNavDrawerWidthExpanded !important; // sass-lint:disable-line no-important - transition: margin $euiAnimSpeedFast $euiAnimSlightResistance; - } - - &.euiNavDrawer-flyoutIsExpanded { - // Instead of one collapsed and one expanded, they're now both expanded - // Double the width of expanded sidebars - width: $euiNavDrawerWidthExpanded * 2 !important; // sass-lint:disable-line no-important - // Prevents a shift in the main menu on initial open. - // The lack of horizontal transition is less alarming than the shift. - transition: none; - } - } - - // In case they unlock while the flyout is expanded, - // the nav drawer doesn't actually get collapsed until an interaction - .euiNavDrawer-isExpanded.euiNavDrawer-flyoutIsExpanded { - width: $euiNavDrawerWidthExpanded * 2 !important; // sass-lint:disable-line no-important - } -} diff --git a/src/components/nav_drawer/_nav_drawer_flyout.scss b/src/components/nav_drawer/_nav_drawer_flyout.scss deleted file mode 100644 index c0e64954df0..00000000000 --- a/src/components/nav_drawer/_nav_drawer_flyout.scss +++ /dev/null @@ -1,32 +0,0 @@ -.euiNavDrawerFlyout { - @include euiScrollBar; - width: 0; - height: 100%; - padding: $euiSizeM $euiSizeS; - overflow-y: auto; - background-color: $euiNavDrawerBackgroundColor; - border-left: $euiBorderThin; - box-shadow: $euiNavDrawerSideShadow; - visibility: hidden; - opacity: 0; - - &.euiNavDrawerFlyout-isExpanded { - visibility: visible; - opacity: 1; - width: $euiNavDrawerWidthExpanded; - transition: opacity $euiAnimSpeedFast $euiNavDrawerContractingDelay, width $euiAnimSpeedNormal; - } - - &.euiNavDrawerFlyout-isCollapsed { - transition: opacity $euiAnimSpeedFast, width $euiAnimSpeedFast; - } - - .euiNavDrawerFlyout__title { - margin: 0 $euiSizeS $euiSizeXS; - } - - .euiNavDrawerFlyout__listGroup { - padding-left: 0; - padding-right: 0; - } -} diff --git a/src/components/nav_drawer/_nav_drawer_group.scss b/src/components/nav_drawer/_nav_drawer_group.scss deleted file mode 100644 index d44af8f5bc0..00000000000 --- a/src/components/nav_drawer/_nav_drawer_group.scss +++ /dev/null @@ -1,40 +0,0 @@ -.euiNavDrawerGroup__item { - .euiListGroupItem__label { - transition: all $euiAnimSpeedExtraFast; - } - - .euiListGroupItem__button { - color: inherit; // Force color to inherit from regular text color in case it's an anchor tag - - &:focus { - background-color: $euiFocusBackgroundColor; - border-radius: $euiBorderRadius; - } - } - - .euiListGroupItem__icon { - max-width: $euiSize; - } -} - -// Default icon will simulate an avatar but with coloring specific to -.euiNavDrawerGroup__itemDefaultIcon { - @include innerBorder('dark', 50%, .05); - @include size($euiSize); - line-height: $euiSize; - font-size: $euiSizeM; - flex-shrink: 0; // Ensures it never scales down below its intended size - display: inline-block; - text-align: center; - vertical-align: middle; - overflow: visible; - font-weight: $euiFontWeightMedium; // Explicitly state so it doesn't get overridden by inheritance - border-radius: 50%; - - &:after { - top: -$euiSizeXS; - left: -$euiSizeXS; - right: -$euiSizeXS; - bottom: -$euiSizeXS; - } -} diff --git a/src/components/nav_drawer/_variables.scss b/src/components/nav_drawer/_variables.scss deleted file mode 100644 index 6d53a9a6cf4..00000000000 --- a/src/components/nav_drawer/_variables.scss +++ /dev/null @@ -1,16 +0,0 @@ -// Themeable colors -$euiNavDrawerBackgroundColor: $euiHeaderBackgroundColor; - -// Drawer variables -$euiNavDrawerWidthExpanded: 240px; -$euiNavDrawerWidthCollapsed: $euiHeaderHeight; -$euiNavDrawerSideShadow: 2px 0 2px -1px rgba($euiShadowColor, .3); - -// Layout variables -$euiNavDrawerTopPosition: $euiHeaderHeight + 1px; - -// Animation variables -$euiNavDrawerExpandingDelay: $euiAnimSpeedNormal; -$euiNavDrawerContractingDelay: $euiAnimSpeedFast; -$euiNavDrawerExtendedDelay: $euiAnimSpeedExtraSlow * 2; -$euiNavDrawerMenuAddedDelay: $euiAnimSpeedExtraFast; diff --git a/src/components/nav_drawer/index.ts b/src/components/nav_drawer/index.ts deleted file mode 100644 index 754693c1545..00000000000 --- a/src/components/nav_drawer/index.ts +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -export { EuiNavDrawer, EuiNavDrawerProps } from './nav_drawer'; -export { EuiNavDrawerGroup, EuiNavDrawerGroupProps } from './nav_drawer_group'; -export { - EuiNavDrawerFlyout, - EuiNavDrawerFlyoutProps, -} from './nav_drawer_flyout'; diff --git a/src/components/nav_drawer/nav_drawer.test.tsx b/src/components/nav_drawer/nav_drawer.test.tsx deleted file mode 100644 index af897240602..00000000000 --- a/src/components/nav_drawer/nav_drawer.test.tsx +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import React from 'react'; -import { render } from 'enzyme'; - -import { EuiNavDrawer } from './nav_drawer'; -import { EuiNavDrawerGroup, FlyoutMenuItem } from './nav_drawer_group'; -import { EuiListGroupItemProps } from '../list_group'; - -const extraAction: EuiListGroupItemProps['extraAction'] = { - color: 'subdued', - iconType: 'pin', - iconSize: 's', -}; - -const topLinks: FlyoutMenuItem[] = [ - { - label: 'Recently viewed', - iconType: 'clock', - flyoutMenu: { - title: 'Recent items', - listItems: [ - { - label: 'My dashboard', - href: '#', - iconType: 'dashboardApp', - extraAction, - }, - { - label: 'Workpad with title that wraps', - href: '#', - iconType: 'canvasApp', - extraAction, - }, - { - label: 'My logs', - href: '#', - iconType: 'logsApp', - 'aria-label': 'This is an alternate aria-label', - extraAction, - }, - ], - }, - }, - { - label: 'Favorites', - iconType: 'starEmpty', - flyoutMenu: { - title: 'Favorite items', - listItems: [ - { - label: 'My workpad', - href: '#', - iconType: 'canvasApp', - extraAction: { - color: 'subdued', - iconType: 'starFilled', - iconSize: 's', - 'aria-label': 'Remove from favorites', - alwaysShow: true, - }, - }, - { - label: 'My logs', - href: '#', - iconType: 'logsApp', - extraAction: { - color: 'subdued', - iconType: 'starFilled', - iconSize: 's', - 'aria-label': 'Remove from favorites', - alwaysShow: true, - }, - }, - ], - }, - }, -]; - -const exploreLinks: FlyoutMenuItem[] = [ - { - label: 'Canvas', - href: '#', - iconType: 'canvasApp', - isActive: true, - extraAction, - }, - { - label: 'Discover', - href: '#', - iconType: 'discoverApp', - extraAction, - }, - { - label: 'Visualize', - href: '#', - iconType: 'visualizeApp', - extraAction, - }, - { - label: 'Dashboard', - href: '#', - iconType: 'dashboardApp', - extraAction, - }, - { - label: 'Machine learning', - href: '#', - iconType: 'machineLearningApp', - extraAction, - }, - { - label: 'Custom Plugin (no icon)', - href: '#', - extraAction, - }, -]; - -describe('EuiNavDrawer', () => { - test('is rendered', () => { - const component = render( - - - - - ); - - expect(component).toMatchSnapshot(); - }); - - describe('renders', () => { - test('with fragments', () => { - const component = render( - - <> - - - - - ); - - expect(component).toMatchSnapshot(); - }); - - test('with falsy children', () => { - const component = render( - - {false && } - {true ? undefined : } - - - ); - - expect(component).toMatchSnapshot(); - }); - }); -}); diff --git a/src/components/nav_drawer/nav_drawer.tsx b/src/components/nav_drawer/nav_drawer.tsx deleted file mode 100644 index e6f3ee8fbc4..00000000000 --- a/src/components/nav_drawer/nav_drawer.tsx +++ /dev/null @@ -1,454 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import React, { - Component, - ReactNode, - createRef, - MouseEventHandler, - isValidElement, - HTMLAttributes, -} from 'react'; -import classNames from 'classnames'; -import { EuiListGroup, EuiListGroupItem } from '../list_group'; -import { EuiNavDrawerFlyout } from './nav_drawer_flyout'; -import { - EuiNavDrawerGroup, - ATTR_SELECTOR, - FlyoutMenuItem, -} from './nav_drawer_group'; -import { EuiOutsideClickDetector } from '../outside_click_detector'; -import { EuiI18n } from '../i18n'; -import { EuiFlexItem, EuiFlexGroup } from '../flex'; -import { throttle } from '../color_picker/utils'; -import { CommonProps } from '../common'; - -const MENU_ELEMENT_ID = 'navDrawerMenu'; - -export interface EuiNavDrawerProps - extends CommonProps, - HTMLAttributes { - /** - * One or more ReactNodes to render as this component's content - */ - children?: ReactNode | ReactNode[]; - - /** - * Keep drawer locked open by default - */ - isLocked?: boolean; - - /** - * Returns the current state of isLocked - */ - onIsLockedUpdate?: (isLocked: boolean) => void; - - /** - * Adds fixed toggle button to bottom of menu area - */ - showExpandButton?: boolean; - - /** - * Display tooltips on side nav items - */ - showToolTips?: boolean; -} - -interface EuiNavDrawerState { - flyoutIsCollapsed: boolean; - flyoutListItems: FlyoutMenuItem[] | null; - focusReturnRef: ReactNode | null; - isCollapsed: boolean; - isLocked: boolean; - isManagingFocus: boolean; - navFlyoutTitle: string | undefined; - outsideClickDisabled: boolean; - toolTipsEnabled: boolean; -} - -export class EuiNavDrawer extends Component< - EuiNavDrawerProps, - EuiNavDrawerState -> { - static defaultProps = { - showExpandButton: true, - showToolTips: true, - }; - - state: EuiNavDrawerState = { - flyoutIsCollapsed: true, - flyoutListItems: null, - focusReturnRef: null, - isCollapsed: !this.props.isLocked, - isLocked: Boolean(this.props.isLocked), - isManagingFocus: false, - navFlyoutTitle: undefined, - outsideClickDisabled: true, - toolTipsEnabled: true, - }; - - expandButtonRef = createRef(); - - componentDidMount() { - if (this.props.isLocked) { - window.addEventListener('resize', this.functionToCallOnWindowResize); - } - } - - componentWillUnmount() { - window.removeEventListener('resize', this.functionToCallOnWindowResize); - } - - returnOnIsLockedUpdate = (isLockedState: EuiNavDrawerState['isLocked']) => { - if (this.props.onIsLockedUpdate) { - this.props.onIsLockedUpdate(isLockedState); - } - }; - - functionToCallOnWindowResize = throttle(() => { - if (window.innerWidth < 1200) { - this.collapseDrawer(); - this.collapseFlyout(); - } - // reacts every 50ms to resize changes and always gets the final update - }, 50); - - sideNavLockClicked = () => { - const { isLocked } = this.state; - - if (isLocked) { - window.removeEventListener('resize', this.functionToCallOnWindowResize); - } else { - window.addEventListener('resize', this.functionToCallOnWindowResize); - } - - this.returnOnIsLockedUpdate(!isLocked); - - this.setState({ - isLocked: !isLocked, - isCollapsed: false, - outsideClickDisabled: !isLocked, - }); - }; - - // Although not used in `src/`, this method is available to and used in `src-docs/` - // for implementation-specific nav menu toggling via `ref` reference - toggleOpen = () => { - this.setState( - ({ isCollapsed }) => ({ - isCollapsed: !isCollapsed, - }), - () => { - this.setState(({ isCollapsed }) => ({ - outsideClickDisabled: isCollapsed, - toolTipsEnabled: isCollapsed, - })); - } - ); - }; - - collapseButtonClick = () => { - if (this.state.isCollapsed) { - this.expandDrawer(); - } else { - this.collapseDrawer(); - } - - this.collapseFlyout(); - - requestAnimationFrame(() => { - if (this.expandButtonRef.current) { - this.expandButtonRef.current.focus(); - } - }); - }; - - expandDrawer = () => { - this.setState({ - isCollapsed: false, - outsideClickDisabled: false, - }); - - setTimeout(() => { - this.setState({ - toolTipsEnabled: false, - }); - }, 150); - }; - - collapseDrawer = () => { - this.setState({ - isCollapsed: true, - outsideClickDisabled: this.state.flyoutIsCollapsed ? true : false, - toolTipsEnabled: true, - isLocked: false, - }); - - this.returnOnIsLockedUpdate(false); - - // Scrolls the menu and flyout back to top when the nav drawer collapses - setTimeout(() => { - const element = document.getElementById('navDrawerMenu'); - if (element) { - element.scrollTop = 0; - } - }, 50); - - // In case it was locked before, remove the window resize listener - window.removeEventListener('resize', this.functionToCallOnWindowResize); - }; - - expandFlyout = ( - links: FlyoutMenuItem[], - title: string, - item: FlyoutMenuItem - ) => { - if (this.state.navFlyoutTitle === title) { - this.collapseFlyout(); - } else { - this.setState( - ({ isLocked }) => ({ - flyoutIsCollapsed: false, - flyoutListItems: links, - focusReturnRef: item.label, - isCollapsed: isLocked ? false : true, - navFlyoutTitle: title, - outsideClickDisabled: false, - toolTipsEnabled: false, - }), - () => { - // Ideally this uses React `ref` instead of `querySelector`, but the menu composition - // does not allow for deep `ref` element management at present - const element = document.querySelector( - `#${MENU_ELEMENT_ID} [${ATTR_SELECTOR}='${item.label}']` - ); - if (!element) return; - element.setAttribute('aria-expanded', 'true'); - } - ); - } - }; - - collapseFlyout = (shouldReturnFocus = true) => { - const { focusReturnRef: focusReturn } = this.state; - this.setState( - { - flyoutIsCollapsed: true, - navFlyoutTitle: undefined, - flyoutListItems: null, - toolTipsEnabled: this.state.isLocked ? false : true, - focusReturnRef: null, - }, - () => { - // Ideally this uses React `ref` instead of `querySelector`, but the menu composition - // does not allow for deep `ref` element management at present - const element = document.querySelector( - `#${MENU_ELEMENT_ID} [${ATTR_SELECTOR}='${focusReturn}']` - ) as HTMLElement; - if (!element) { - return; - } - requestAnimationFrame(() => { - element.setAttribute('aria-expanded', 'false'); - }); - if (!shouldReturnFocus) return; - requestAnimationFrame(() => { - element.focus(); - }); - } - ); - }; - - closeBoth = () => { - if (!this.state.isLocked) this.collapseDrawer(); - this.collapseFlyout(false); - }; - - handleDrawerMenuClick: MouseEventHandler = (event) => { - // walk up e.target until either: - // 1. a[href] - close the menu - // 2. document.body - do nothing - - let element = event.target as HTMLElement | null; - while ( - element !== null && - element !== document.body && - (element.tagName !== 'A' || element.getAttribute('href') === undefined) - ) { - element = element.parentElement; - } - - if (element !== document.body) { - // this is an anchor with an href - this.closeBoth(); - } - }; - - modifyChildren = (children: ReactNode | ReactNode[]): ReactNode => { - // Loop through the EuiNavDrawer children (EuiListGroup, EuiHorizontalRules, etc) - // Filter out falsy items - const filteredChildren = React.Children.toArray(children); - return React.Children.map(filteredChildren, (child) => { - if (isValidElement(child)) { - // Allow for Fragments by recursive modification - if (child.type === React.Fragment) { - return this.modifyChildren(child.props.children); - } - - // Check if child is an EuiNavDrawerGroup and if it does have a flyout, add the expand function - if (child.type === EuiNavDrawerGroup) { - return React.cloneElement(child, { - flyoutMenuButtonClick: this.expandFlyout, - showToolTips: this.state.toolTipsEnabled && this.props.showToolTips, - }); - } - } - - return child; - }); - }; - - render() { - const { - children, - className, - showExpandButton, - showToolTips, - isLocked, - onIsLockedUpdate, - ...rest - } = this.props; - - const classes = classNames( - 'euiNavDrawer', - { - 'euiNavDrawer-isCollapsed': this.state.isCollapsed, - 'euiNavDrawer-isExpanded': !this.state.isCollapsed, - 'euiNavDrawer-isLocked': this.state.isLocked, - 'euiNavDrawer-flyoutIsCollapsed': this.state.flyoutIsCollapsed, - 'euiNavDrawer-flyoutIsExpanded': !this.state.flyoutIsCollapsed, - }, - className - ); - - let footerContent; - if (showExpandButton) { - footerContent = ( - - - {([ - sideNavCollapse, - sideNavExpand, - sideNavLockAriaLabel, - sideNavLockExpanded, - sideNavLockCollapsed, - ]: string[]) => ( - - )} - - - ); - } - - const flyoutContent = ( - - ); - - // Add an onClick that expands the flyout sub menu for any list items (links) that have a flyoutMenu prop (sub links) - let modifiedChildren = children; - - modifiedChildren = this.modifyChildren(this.props.children); - - const menuClasses = classNames('euiNavDrawerMenu', { - 'euiNavDrawerMenu-hasFooter': footerContent, - }); - - return ( - this.closeBoth()} - isDisabled={this.state.outsideClickDisabled}> - - - ); - } -} diff --git a/src/components/nav_drawer/nav_drawer_flyout.tsx b/src/components/nav_drawer/nav_drawer_flyout.tsx deleted file mode 100644 index 85ba61564bc..00000000000 --- a/src/components/nav_drawer/nav_drawer_flyout.tsx +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import React, { - useState, - FunctionComponent, - KeyboardEventHandler, - HTMLAttributes, - useRef, -} from 'react'; -import classNames from 'classnames'; -import tabbable from 'tabbable'; - -import { keys } from '../../services'; - -import { EuiTitle } from '../title'; -import { EuiNavDrawerGroup, FlyoutMenuItem } from './nav_drawer_group'; -import { EuiListGroupProps } from '../list_group/list_group'; -import { EuiFocusTrap } from '../focus_trap'; -import { CommonProps } from '../common'; - -export interface EuiNavDrawerFlyoutProps - extends CommonProps, - HTMLAttributes { - /** - * Toggle the nav drawer between collapsed and expanded - */ - isCollapsed?: boolean; - - listItems?: FlyoutMenuItem[] | null; - - /** - * Passthrough function to be called when the flyout is closing - * @see `EuiNavDrawer` - */ - onClose?: (shouldReturnFocus?: boolean) => void; - - /** - * Display a title atop the flyout - */ - title?: string; - - wrapText?: EuiListGroupProps['wrapText']; -} - -export const EuiNavDrawerFlyout: FunctionComponent = ({ - className, - isCollapsed = true, - listItems, - onClose, - title, - wrapText = false, - ...rest -}) => { - const menuElementRef = useRef(null); - const [ - tabbables, - setTabbables, - ] = useState | null>(); - const LABEL = 'navDrawerFlyoutTitle'; - const classes = classNames( - 'euiNavDrawerFlyout', - { - 'euiNavDrawerFlyout-isCollapsed': isCollapsed, - 'euiNavDrawerFlyout-isExpanded': !isCollapsed, - }, - className - ); - - const handleKeyDown: KeyboardEventHandler = (event) => { - if (event.key === keys.ESCAPE) { - handleClose(); - } else if (event.key === keys.TAB) { - let tabs = tabbables; - if (!tabs && menuElementRef.current) { - tabs = tabbable(menuElementRef.current).filter( - (element) => element.tagName !== 'DIV' - ); - setTabbables(tabs); - } - if (!tabs) { - return; - } - if ( - (!event.shiftKey && document.activeElement === tabs[tabs.length - 1]) || - (event.shiftKey && document.activeElement === tabs[0]) - ) { - handleClose(); - } - } - }; - - const handleClose = (shouldReturnFocus = true) => { - setTabbables(null); - if (onClose) { - onClose(shouldReturnFocus); - } - }; - - return ( -
- -
- {title} -
-
- {listItems ? ( - - handleClose(false)} - /> - - ) : null} -
- ); -}; diff --git a/src/components/nav_drawer/nav_drawer_group.tsx b/src/components/nav_drawer/nav_drawer_group.tsx deleted file mode 100644 index c36202ac0cb..00000000000 --- a/src/components/nav_drawer/nav_drawer_group.tsx +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import React, { FunctionComponent, ReactNode } from 'react'; -import classNames from 'classnames'; - -import { EuiListGroup, EuiListGroupProps } from '../list_group/list_group'; -import { EuiListGroupItemProps } from '../list_group/list_group_item'; -import { toInitials } from '../../services'; - -export const ATTR_SELECTOR = 'data-name'; - -export type FlyoutMenuItem = EuiListGroupItemProps & { - 'data-name'?: ReactNode | ReactNode[]; - flyoutMenu?: { - title: string; - listItems: FlyoutMenuItem[]; - }; - label: string; -}; - -export interface EuiNavDrawerGroupProps extends EuiListGroupProps { - listItems?: FlyoutMenuItem[]; - - /** - * While not normally required, it is required to pass a function for handling - * of the flyout menu button click - */ - flyoutMenuButtonClick?: ( - links: FlyoutMenuItem[], - title: string, - item: FlyoutMenuItem - ) => void; - - /** - * Passthrough function to be called when the flyout is closing - * @see `EuiNavDrawer` - */ - onClose?: () => void; -} - -export const EuiNavDrawerGroup: FunctionComponent = ({ - className, - listItems, - flyoutMenuButtonClick, - onClose = () => {}, - ...rest -}) => { - // Alter listItems object with prop flyoutMenu and extra props - const newListItems = !(listItems && !!listItems.length) - ? undefined - : listItems.map((item) => { - // If the flyout menu exists, pass back the list of times and the title with the onClick handler of the item - const { flyoutMenu, ...itemProps } = item; - if (flyoutMenu && flyoutMenuButtonClick) { - const items = [...flyoutMenu.listItems]; - const title = `${flyoutMenu.title}`; - itemProps.onClick = () => { - flyoutMenuButtonClick(items, title, item); - }; - itemProps['aria-expanded'] = false; - } else { - itemProps.onClick = (event) => { - if (item.onClick) { - item.onClick(event); - } - onClose(); - }; - } - - // Make some declarations of props for the side nav implementation - itemProps.className = classNames( - 'euiNavDrawerGroup__item', - item.className - ); - itemProps.size = item.size || 's'; - itemProps[ATTR_SELECTOR] = item.label; - itemProps['aria-label'] = item['aria-label'] || item.label; - - // Add an avatar in place of non-existent icons - const itemProvidesIcon = !!item.iconType || !!item.icon; - if (!itemProvidesIcon) { - itemProps.icon = ( - - {toInitials(item.label)} - - ); - } - - // And return the item with conditional `onClick` and without `flyoutMenu` - return { ...itemProps }; - }); - - return ( - - ); -}; diff --git a/src/components/popover/popover.test.tsx b/src/components/popover/popover.test.tsx index e67674a5827..21c980ecb12 100644 --- a/src/components/popover/popover.test.tsx +++ b/src/components/popover/popover.test.tsx @@ -104,7 +104,6 @@ describe('EuiPopover', () => { const component = mount( } closePopover={closePopoverHandler} isOpen @@ -121,7 +120,6 @@ describe('EuiPopover', () => { const component = mount( } closePopover={closePopoverHandler} isOpen={false} diff --git a/src/components/popover/popover.tsx b/src/components/popover/popover.tsx index 698c59e4e2b..a1aa8c6ab4d 100644 --- a/src/components/popover/popover.tsx +++ b/src/components/popover/popover.tsx @@ -131,8 +131,6 @@ export interface EuiPopoverProps { * scrolls, this supports having fixed-position popover anchors. */ repositionOnScroll?: boolean; - withTitle?: boolean; - /** By default, popover content inherits the z-index of the anchor * component; pass zIndex to override */ zIndex?: number; @@ -603,7 +601,6 @@ export class EuiPopover extends Component { insert, isOpen, ownFocus, - withTitle, children, className, closePopover, @@ -633,7 +630,6 @@ export class EuiPopover extends Component { display ? displayToClassNameMap[display] : null, { 'euiPopover-isOpen': this.state.isOpening, - 'euiPopover--withTitle': withTitle, }, className ); @@ -644,7 +640,6 @@ export class EuiPopover extends Component { 'euiPopover__panel', `euiPopover__panel--${this.state.arrowPosition}`, { 'euiPopover__panel-isOpen': this.state.isOpening }, - { 'euiPopover__panel-withTitle': withTitle }, { 'euiPopover__panel-noArrow': !hasArrow || attachToAnchor }, { 'euiPopover__panel-isAttached': attachToAnchor }, panelClassName diff --git a/src/components/search_bar/filters/__snapshots__/field_value_selection_filter.test.tsx.snap b/src/components/search_bar/filters/__snapshots__/field_value_selection_filter.test.tsx.snap index de94fcf448c..5001571c665 100644 --- a/src/components/search_bar/filters/__snapshots__/field_value_selection_filter.test.tsx.snap +++ b/src/components/search_bar/filters/__snapshots__/field_value_selection_filter.test.tsx.snap @@ -22,7 +22,6 @@ exports[`FieldValueSelectionFilter active - field is global 1`] = ` ownFocus={true} panelClassName="euiFilterGroup__popoverPanel" panelPaddingSize="none" - withTitle={false} >
= threshold; return ( {searchBox} diff --git a/src/components/table/table_pagination/__snapshots__/table_pagination.test.tsx.snap b/src/components/table/table_pagination/__snapshots__/table_pagination.test.tsx.snap index a1242310499..5c387a1da73 100644 --- a/src/components/table/table_pagination/__snapshots__/table_pagination.test.tsx.snap +++ b/src/components/table/table_pagination/__snapshots__/table_pagination.test.tsx.snap @@ -8,7 +8,7 @@ exports[`EuiTablePagination is rendered 1`] = ` class="euiFlexItem euiFlexItem--flexGrowZero" >
{ isOpen={this.state.isPopoverOpen} closePopover={this.closePopover} panelPaddingSize="none" - withTitle anchorPosition="upRight"> diff --git a/src/components/tour/__snapshots__/tour_step.test.tsx.snap b/src/components/tour/__snapshots__/tour_step.test.tsx.snap index 71de909509a..c883b88d662 100644 --- a/src/components/tour/__snapshots__/tour_step.test.tsx.snap +++ b/src/components/tour/__snapshots__/tour_step.test.tsx.snap @@ -3,7 +3,7 @@ exports[`EuiTourStep can be closed 1`] = `
@@ -20,7 +20,7 @@ exports[`EuiTourStep can be closed 1`] = ` exports[`EuiTourStep can override the footer action 1`] = `
@@ -37,7 +37,7 @@ exports[`EuiTourStep can override the footer action 1`] = ` exports[`EuiTourStep can set a minWidth 1`] = `
@@ -54,7 +54,7 @@ exports[`EuiTourStep can set a minWidth 1`] = ` exports[`EuiTourStep can turn off the beacon 1`] = `
@@ -71,7 +71,7 @@ exports[`EuiTourStep can turn off the beacon 1`] = ` exports[`EuiTourStep is rendered 1`] = `
diff --git a/src/components/tour/tour_step.tsx b/src/components/tour/tour_step.tsx index b7f35f9a212..96707fba7b4 100644 --- a/src/components/tour/tour_step.tsx +++ b/src/components/tour/tour_step.tsx @@ -217,7 +217,6 @@ export const EuiTourStep: FunctionComponent = ({ panelStyle={newStyle || style} offset={hasBeacon ? 10 : 0} arrowChildren={hasBeacon && } - withTitle {...rest}>