diff --git a/src/components/Popover/Popover.tsx b/src/components/Popover/Popover.tsx index 2a785985..d6279495 100644 --- a/src/components/Popover/Popover.tsx +++ b/src/components/Popover/Popover.tsx @@ -3,12 +3,14 @@ import { Arrow, Close, Content, + Portal, Root, Trigger, } from '@radix-ui/react-popover' import React, { ComponentProps, ElementRef, FC, forwardRef } from 'react' import type { AsProps, CSSProps } from '../../stitches.config' import { styled } from '../../stitches.config' +import { ConditionalWrapper } from '../../utils' import { paperStyles } from '../Paper' const StyledContent = styled(Content, paperStyles, { @@ -30,16 +32,28 @@ const StyledArrow = styled(Arrow, { fill: '$paper', }) -type PopoverContentProps = CSSProps & AsProps & ComponentProps +type PopoverContentProps = CSSProps & + AsProps & + ComponentProps & { + /** By default, portals your content parts into the body, set false to add at dom location. */ + portalled?: boolean + /** Specify a container element to portal the content into. */ + container?: ComponentProps['container'] + } export const PopoverContent = forwardRef< ElementRef, PopoverContentProps ->(({ children, ...props }, forwardedRef) => ( - - - {children} - +>(({ portalled = true, container, children, ...props }, forwardedRef) => ( + {child}} + > + + + {children} + + )) PopoverContent.toString = () => `.${StyledContent.className}`