/*! * * Copyright (c) "Neo4j" * Neo4j Sweden AB [http://neo4j.com] * * This file is part of Neo4j. * * Neo4j is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ import { type OffsetOptions, type Placement } from '@floating-ui/react'; import React from 'react'; import { type CommonProps, type PolymorphicCommonProps } from '../_common/types'; import { type AnchorPosition } from './use-popover'; type PlacementOptions = 'bottom-end-top-end' | 'bottom-start-top-start' | 'bottom-middle-top-middle' | 'top-end-bottom-end' | 'top-start-bottom-start' | 'top-middle-bottom-middle' | 'bottom-start-bottom-end' | 'top-start-top-end' | 'middle-start-middle-end' | 'bottom-end-bottom-start' | 'top-end-top-start' | 'middle-end-middle-start'; export declare const placementTranslation: Record; type PopoverProps = { /** if the popover is open */ isOpen?: boolean; /** The content of the popover */ children?: React.ReactNode; /** * Can be used if the anchor should be separated from the trigger. * Note: to visually separate the anchor from the trigger, use the Popover.Anchor component instead. */ anchorElement?: Element | null; /** If the anchorPosition is provided the anchorElement will be ignored */ anchorPosition?: AnchorPosition; /** * The placement of the floating element is determined by two sets of words. The first set of words specifies the point on the anchor * element where the floating element will be attached. The second set of coordinates specifies the point on the floating element that * will attach to the anchor element. * */ placement?: PlacementOptions; /** can take either a number, an object or a function. Full documentation here: https://floating-ui.com/docs/offset */ offset?: OffsetOptions; /** * Called when an internal state change is triggered, when the floating element either opens or closes. It is not called when `isOpen` * is updated by the consumer. * */ onOpenChange?: (isOpen: boolean, event?: Event) => void; /** Use anchorEl for portal's container. Should be used if the popover is portaled and is inside a Dialog for example. */ hasAnchorPortal?: boolean; /** If the popover should constrain the focus inside the popover while open */ shouldCaptureFocus?: boolean; /** Which element to initially focus. */ initialFocus?: number | React.RefObject; /** The role of the popover. */ role?: 'tooltip' | 'dialog' | 'alertdialog' | 'menu' | 'listbox' | 'grid' | 'tree'; /** If the popover should close when the user clicks outside of it */ shouldCloseOnClickOutside?: boolean; /** * If the popover should close when focus moves outside of it, for example when tabbing away or focusing another element. * Defaults to the value of `shouldCloseOnClickOutside`. * Has no effect when `shouldCaptureFocus` is true, since focus cannot leave the popover. */ shouldCloseOnFocusOut?: boolean; /** The strategy of the popover. Fixed should be used when the popover is inside a Dialog. */ strategy?: 'fixed' | 'absolute'; /** Whether the content is rendered in a portal */ isPortaled?: boolean; /** * When true, limits the popover's max-height and max-width to the available viewport space. * The consumer is responsible for adding overflow handling (e.g. overflow-y: auto) to the content. * */ shouldConstrainSize?: boolean; }; export declare const usePopoverContext: () => import("./use-popover").UsePopoverReturn; type PopoverTriggerProps = { /** The content of the trigger */ children: React.ReactNode; /** Whether the trigger should render a button element, or pass its props to the child element */ hasButtonWrapper?: boolean; }; type PopoverAnchorProps = { children?: React.ReactNode; }; type PopoverContentProps = { children: React.ReactNode; className?: string; style?: React.CSSProperties; }; declare const Popover: (({ children, anchorElement, placement, isOpen, offset, anchorPosition, hasAnchorPortal: hasAnchorPortalProp, shouldCaptureFocus, initialFocus, onOpenChange, shouldCloseOnClickOutside, shouldCloseOnFocusOut, isPortaled: isPortaledProp, strategy: strategyProp, role, shouldConstrainSize, }: PopoverProps) => import("react/jsx-runtime").JSX.Element) & { Anchor: ({ children, ref, ...props }: CommonProps<"div", PopoverAnchorProps>) => import("react/jsx-runtime").JSX.Element; Content: ({ as, className, style, children, htmlAttributes, ref, ...restProps }: PolymorphicCommonProps) => import("react/jsx-runtime").JSX.Element | null; Trigger: ({ children, hasButtonWrapper, ref, ...props }: CommonProps<"button", PopoverTriggerProps>) => import("react/jsx-runtime").JSX.Element; }; export { Popover }; //# sourceMappingURL=Popover.d.ts.map