diff --git a/lib/components/Popover/Popover.stories.js b/lib/components/Popover/Popover.stories.js
index 04ee5c60..b61ced5a 100644
--- a/lib/components/Popover/Popover.stories.js
+++ b/lib/components/Popover/Popover.stories.js
@@ -5,6 +5,7 @@ import Box from "../Box";
import Grid from "../Grid";
import Flex from "../Flex";
import StyledLink from "../StyledLink";
+import Spacer from "../Spacer";
export default {
title: "Components/Popover",
@@ -95,20 +96,22 @@ export const textAlignment = () => (
);
export const DisplayInlineBlock = () => (
- <>
-
-
-
-
-
-
-
-
-
-
-
-
- >
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
);
export const tooltipExample = () => (
diff --git a/lib/components/Popover/index.js b/lib/components/Popover/index.js
index 901bb365..bb46eabe 100644
--- a/lib/components/Popover/index.js
+++ b/lib/components/Popover/index.js
@@ -1,4 +1,4 @@
-import React, { cloneElement, useState } from "react";
+import React, { useState } from "react";
import {
useFloating,
autoUpdate,
@@ -18,12 +18,12 @@ import themeGet from "@styled-system/theme-get";
import styled from "styled-components";
import Icon from "../Icon";
import { PropTypes } from "prop-types";
-import Box from "../Box";
import {
getFloatingUiRootElement,
getFloatingUiZIndex,
isRenderedInReactSelectMenu
} from "../../utils/floatingUiHelpers";
+import { layout, space } from "styled-system";
const DIRECTIONS_MAP = {
topLeft: "top-start",
@@ -36,6 +36,15 @@ const DIRECTIONS_MAP = {
bottomRight: "bottom-end"
};
+const Container = styled.div`
+ ${space}
+ ${layout}
+
+ display: ${(props) =>
+ props.inlineBlock ? "inline-block !important" : "block !important"};
+ position: relative;
+`;
+
const TooltipControl = styled.div`
border: none;
background: none;
@@ -267,6 +276,7 @@ export default function Popover({
enableSelectAll,
variant,
ariaLabel,
+ inlineBlock,
...props
}) {
const [visible, setVisible] = useState(false);
@@ -310,32 +320,6 @@ export default function Popover({
tabIndex: "0"
};
- let triggerComponent = null;
-
- if (variant === "tooltip") {
- triggerComponent = (
-
-
-
- );
- } else if (children?.type?.$$typeof === Symbol.for("react.forward_ref")) {
- triggerComponent = cloneElement(children, triggerProps);
- } else {
- triggerComponent = (
-
- {children}
-
- );
- }
-
const directionClass =
context.placement === DIRECTIONS_MAP[direction]
? direction
@@ -363,7 +347,23 @@ export default function Popover({
const containsLinks = refs.floating?.current?.querySelectorAll("a").length;
return (
-
+
+ {variant === "tooltip" && (
+
+
+
+ )}
+
{text &&
(visible ? (
+ {children}
+
);
}