// packages/core/src/components/popover/popover-portal.tsx
import type { JSX } from "solid-js";
import { Portal } from "../../utilities/portal/portal";

export interface PopoverPortalProps {
  /** Override the portal target container. */
  target?: Element | null | undefined;
  children: JSX.Element;
}

/** Renders children into a portal (defaults to document.body). */
export function PopoverPortal(props: PopoverPortalProps): JSX.Element {
  return props.target !== undefined ? (
    <Portal target={props.target}>{props.children}</Portal>
  ) : (
    <Portal>{props.children}</Portal>
  );
}
