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

Add panelStyle prop to EuiPopover; Fix EuiTourStep minWidth prop placement #3329

Merged
merged 3 commits into from
Apr 16, 2020
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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**

Expand Down
10 changes: 7 additions & 3 deletions src/components/popover/popover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@ export interface EuiPopoverProps {

panelRef?: RefCallback<HTMLElement | null>;

/**
* Optional, standard DOM `style` attribute. Passed to the EuiPanel.
*/
panelStyle?: CSSProperties;

popoverRef?: Ref<HTMLDivElement>;

/** When `true`, the popover's position is re-calculated when the user
Expand All @@ -137,8 +142,6 @@ export interface EuiPopoverProps {
*/
onTrapDeactivation?: ReactFocusLockProps['onDeactivation'];

style?: CSSProperties;

/**
* Distance away from the anchor that the popover will render.
*/
Expand Down Expand Up @@ -529,13 +532,13 @@ export class EuiPopover extends Component<Props, State> {
: 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;
Expand Down Expand Up @@ -600,6 +603,7 @@ export class EuiPopover extends Component<Props, State> {
panelClassName,
panelPaddingSize,
panelRef,
panelStyle,
popoverRef,
hasArrow,
arrowChildren,
Expand Down
1 change: 0 additions & 1 deletion src/components/tour/__snapshots__/tour_step.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -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"
>
<div
class="euiPopover__anchor"
Expand Down
4 changes: 2 additions & 2 deletions src/components/tour/tour_step.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export interface EuiTourStepProps
stepsTotal: number;

/**
* Optional, standard DOM `style` attribute
* Optional, standard DOM `style` attribute. Passed to the EuiPopover panel.
*/
style?: CSSProperties;

Expand Down Expand Up @@ -214,7 +214,7 @@ export const EuiTourStep: FunctionComponent<EuiTourStepProps> = ({
closePopover={closePopover}
isOpen={isStepOpen}
panelClassName={classes}
style={newStyle || style}
panelStyle={newStyle || style}
offset={hasBeacon ? 10 : 0}
arrowChildren={hasBeacon && <EuiBeacon className="euiTour__beacon" />}
withTitle
Expand Down