From e6487873e14e72eedd9b35c51a1d6acd97d664fa Mon Sep 17 00:00:00 2001 From: Greg Thompson Date: Wed, 15 Apr 2020 15:50:34 -0500 Subject: [PATCH 1/2] add panelStyle prop --- src/components/popover/popover.tsx | 10 +++++++--- .../tour/__snapshots__/tour_step.test.tsx.snap | 1 - src/components/tour/tour_step.tsx | 4 ++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/components/popover/popover.tsx b/src/components/popover/popover.tsx index 9125f0becba..5254b7f6e63 100644 --- a/src/components/popover/popover.tsx +++ b/src/components/popover/popover.tsx @@ -120,6 +120,11 @@ export interface EuiPopoverProps { panelRef?: RefCallback; + /** + * Optional, standard DOM `style` attribute. Passed to the EuiPanel. + */ + panelStyle?: CSSProperties; + popoverRef?: Ref; /** When `true`, the popover's position is re-calculated when the user @@ -137,8 +142,6 @@ export interface EuiPopoverProps { */ onTrapDeactivation?: ReactFocusLockProps['onDeactivation']; - style?: CSSProperties; - /** * Distance away from the anchor that the popover will render. */ @@ -529,13 +532,13 @@ export class EuiPopover extends Component { : zIndexProp; const popoverStyles = { + ...this.props.panelStyle, top, left: this.props.attachToAnchor && anchorBoundingBox ? anchorBoundingBox.left : left, zIndex, - ...this.props.style, }; const willRenderArrow = !this.props.attachToAnchor && this.props.hasArrow; @@ -600,6 +603,7 @@ export class EuiPopover extends Component { panelClassName, panelPaddingSize, panelRef, + panelStyle, popoverRef, hasArrow, arrowChildren, diff --git a/src/components/tour/__snapshots__/tour_step.test.tsx.snap b/src/components/tour/__snapshots__/tour_step.test.tsx.snap index 534021a6c38..71de909509a 100644 --- a/src/components/tour/__snapshots__/tour_step.test.tsx.snap +++ b/src/components/tour/__snapshots__/tour_step.test.tsx.snap @@ -40,7 +40,6 @@ exports[`EuiTourStep can set a minWidth 1`] = ` class="euiPopover euiPopover--anchorLeftUp euiPopover--withTitle" data-test-subj="test subject string" offset="10" - style="min-width:240px" >
= ({ closePopover={closePopover} isOpen={isStepOpen} panelClassName={classes} - style={newStyle || style} + panelStyle={newStyle || style} offset={hasBeacon ? 10 : 0} arrowChildren={hasBeacon && } withTitle From 0dfe0feb0ad9dc6555e19085cea5ae800ca0994d Mon Sep 17 00:00:00 2001 From: Greg Thompson Date: Thu, 16 Apr 2020 16:19:07 -0500 Subject: [PATCH 2/2] CL --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 46625f61632..52ef601408c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,13 @@ ## [`master`](https://github.com/elastic/eui/tree/master) - Added `showCloseButton` and `dockedBreakpoint` flexibility to `EuiCollapsibleNav` ([#3330](https://github.com/elastic/eui/pull/3330)) +- Added `panelStyle` prop to `EuiPopover` to distinguish style object configuration ([#3329](https://github.com/elastic/eui/pull/3329)) **Bug Fixes** - Fixed `EuiInMemoryTable` `isClearable` property to initiate reset ([#3328](https://github.com/elastic/eui/pull/3328)) - Fixed `EuiCollapsibleNav` docked states on mobile ([#3330](https://github.com/elastic/eui/pull/3330)) +- Fixed `EuiPopover` positioning from being overridden by `style` prop ([#3329](https://github.com/elastic/eui/pull/3329)) **Breaking changes**