diff --git a/ui/components/component-library/popover/README.mdx b/ui/components/component-library/popover/README.mdx index 8b8e26c51..973039ace 100644 --- a/ui/components/component-library/popover/README.mdx +++ b/ui/components/component-library/popover/README.mdx @@ -11,8 +11,6 @@ Popover is an overlay that appears by the trigger used for menus, additional con ## Props -The `Popover` accepts all props below as well as all [Box](/docs/ui-components-ui-box-box-stories-js--default-story#props) component props - ### Reference Element @@ -21,7 +19,8 @@ The `referenceElement` prop is required and used to position the popover relativ ```jsx import { useState } from 'react'; -import { Popover } from '../../ui/component-library'; +import { BackgroundColor } from '../../../helpers/constants/design-system' +import { Popover, Box } from '../../component-library'; const [referenceElement, setReferenceElement] = useState(); @@ -29,8 +28,12 @@ const setBoxRef = (ref) => { setReferenceElement(ref); }; - -Reference Element + +Reference element ``` ### Children @@ -44,7 +47,7 @@ import { Icon, IconSize, IconName, -} from '../../ui/component-library'; +} from '../../component-library'; @@ -61,7 +64,7 @@ Use the `position` prop with the `PopoverPosition` enum to set the position of t Default is `PopoverPosition.Auto` ```jsx -import { Popover, PopoverPosition } from '../../ui/component-library'; +import { Popover, PopoverPosition } from '../../component-library'; Auto AutoStart @@ -86,7 +89,7 @@ The `isPortal` prop is a boolean that when set to true, causes the Popover to be Default `false` ```jsx -import { Popover } from '../../ui/component-library'; +import { Popover } from '../../component-library'; Popover using create portal; ``` @@ -96,7 +99,7 @@ import { Popover } from '../../ui/component-library'; Use the `hasArrow` boolean to add an arrow to the popover. ```jsx -import { Popover } from '../../ui/component-library'; +import { Popover } from '../../component-library'; Popover with arrow; ``` @@ -106,7 +109,7 @@ import { Popover } from '../../ui/component-library'; Use the `isOpen` boolean to control the visibility of the popover. ```jsx -import { Popover } from '../../ui/component-library'; +import { Popover } from '../../component-library'; Popover with arrow; ``` @@ -117,7 +120,7 @@ Use the `flip` boolean to flip the popover to the opposite side of the reference For `PopoverPosition.Auto` this will become true. ```jsx -import { Popover } from '../../ui/component-library'; +import { Popover } from '../../component-library'; Flip demo; ``` @@ -128,7 +131,7 @@ Use the `preventOverflow` boolean to prevent the popover from overflowing the vi For `PopoverPosition.Auto` this will become true. ```jsx -import { Popover } from '../../ui/component-library'; +import { Popover } from '../../component-library'; Prevent overflow demo; ``` @@ -138,7 +141,7 @@ import { Popover } from '../../ui/component-library'; Use the `referenceHidden` boolean to hide the Popover when the reference element is no longer visible in the viewport. ```jsx -import { Popover } from '../../ui/component-library'; +import { Popover } from '../../component-library'; Reference hidden demo; ``` @@ -148,7 +151,7 @@ import { Popover } from '../../ui/component-library'; Use the `matchWidth` boolean to match the width of the popover to the reference element. ```jsx -import { Popover } from '../../ui/component-library'; +import { Popover } from '../../component-library'; Match width demo; ``` @@ -161,7 +164,7 @@ Use the `role` prop with `PopoverRole` enum to set the role of the popover. Default: `PopoverRole.Tooltip` ```jsx -import { Popover, PopoverRole } from '../../ui/component-library'; +import { Popover, PopoverRole } from '../../component-library'; PopoverRole.Tooltip; PopoverRole.Dialog; @@ -174,7 +177,7 @@ Default is `[0, 8]` First number controls the skidding offset and the second number controls the distance offset. ```jsx -import { Popover } from '../../ui/component-library'; +import { Popover } from '../../component-library'; offset override to [0,32]; ``` @@ -184,7 +187,7 @@ import { Popover } from '../../ui/component-library'; `onPressEscKey` is a callback function that is invoked when the 'Escape' key is pressed within the `Popover` component ```jsx -import { Popover } from '../../ui/component-library'; +import { Popover } from '../../component-library'; const [isOpen, setIsOpen] = useState(false); @@ -202,7 +205,7 @@ const handleClick = () => { Using the `PopoverHeader` component to add a header to the `Popover` component. The `PopoverHeader` is used to show common elements such as title, back button, and close button. ```jsx -import { Popover } from '../../ui/component-library'; +import { Popover } from '../../component-library'; { Not built into the `Popover` component, but a demo of `onFocus` and `onBlur` events on the reference element to control the visibility of the popover ```jsx -import { Popover } from '../../ui/component-library'; +import { Popover } from '../../component-library'; const [isOpen, setIsOpen] = useState(false); diff --git a/ui/components/component-library/popover/__snapshots__/popover.test.tsx.snap b/ui/components/component-library/popover/__snapshots__/popover.test.tsx.snap index a8fd6456c..04d16c13a 100644 --- a/ui/components/component-library/popover/__snapshots__/popover.test.tsx.snap +++ b/ui/components/component-library/popover/__snapshots__/popover.test.tsx.snap @@ -3,7 +3,7 @@ exports[`Popover should render popover element correctly 1`] = `