import { MouseEventHandler, PointerEventHandler, CSSProperties, Component, ReactNode, FC, KeyboardEventHandler } from 'react'; import PopperJS from 'popper.js'; import { MoveBy } from './PopoverCore/utils/getModifiers'; import { Predicate } from './PopoverCore/utils/getAppendToElement'; export type Placement = PopperJS.Placement; export type AppendTo = PopperJS.Boundary | 'parent' | Element | Predicate | null; export interface PopoverProps { /** Specifies a CSS class name to be appended to the component's root element. * @internal */ className?: string; /** The location to display the content. */ placement?: Placement; /** Is the content shown or not. */ shown?: boolean; /** onClick on the component. */ onClick?: MouseEventHandler; /** Defines a callback function which is called on `pointerdown` on the trigger element wrapper. * @internal */ onPointerDown?: PointerEventHandler; /** Provides callback to invoke when clicked outside of the popover. */ onClickOutside?: (event: Event) => void; /** Provides callback to invoke when popover loses focus. */ onTabOut?: (event: KeyboardEvent) => void; /** Provides callback to invoke when popover loses focus. */ onEscPress?: KeyboardEventHandler; /** * Clicking on elements with this excluded class doesn't trigger the onClickOutside callback. */ excludeClass?: string; /** Defines a callback function which is called when the popover content element is clicked. * @internal */ onContentClick?: MouseEventHandler; /** Defines a callback function which is called on `pointerenter`, before any derived mouse events. * @internal */ onPointerEnter?: PointerEventHandler; /** Defines a callback function which is called on `pointerleave`, before any derived mouse events. * @internal */ onPointerLeave?: PointerEventHandler; /** onMouseEnter on the component. */ onMouseEnter?: MouseEventHandler; /** onMouseLeave on the component. */ onMouseLeave?: MouseEventHandler; /** onKeyDown on the target component. */ onKeyDown?: KeyboardEventHandler; /** Show show arrow from the content. */ showArrow?: boolean; /** * Whether to enable the flip behaviour. This behaviour is used to flip the ``'s placement * when it starts to overlap the target element (``). */ flip?: boolean; /** * Custom modifier function for the flip behavior. * Receives Popper.js data object and should return the modified data. * Use this to implement custom flip logic (e.g., flipping variations on the same side). */ flipModifier?: PopperJS.ModifierFn; /** * Whether to enable the fixed behaviour. This behaviour is used to keep the `` at it's * original placement even when it's being positioned outside the boundary. */ fixed?: boolean; /** Moves popover relative to the parent. */ moveBy?: MoveBy; /** Hide Delay in ms. */ hideDelay?: number; /** Show Delay in ms. */ showDelay?: number; /** Moves arrow by amount. */ moveArrowTo?: number; /** Enables calculations in relation to a dom element. */ appendTo?: AppendTo; /** Sets the duration of the show and hide animations in milliseconds. Accepts a single number or an object with separate `enter` and `exit` values. */ timeout?: number | { enter: number; exit: number; }; /** Applies inline styles to the root element of the component. */ style?: object; /** Sets the `id` HTML attribute of the popover content element. */ id?: string; fluid?: boolean; /** Custom arrow element. */ customArrow?(placement: Placement, arrowProps: object): ReactNode; /** Sets the `role` HTML attribute of the popover content element. */ role?: string; /** Sets the `z-index` CSS property of the popover content. */ zIndex?: CSSProperties['zIndex']; /** * popovers content is set to minimum width of trigger element, * but it can expand up to the value of maxWidth. */ dynamicWidth?: boolean; /** * popover content minWidth value * - `number` value which converts to css with `px` * - `string` value that contains `px` */ minWidth?: number | string; /** * popover content maxWidth value * - `number` value which converts to css with `px` * - `string` value that contains `px` */ maxWidth?: number | string; /** * popover content width value * - `number` value which converts to css with `px` * - `string` value that contains `px` */ width?: number | string; /** * Breaking change: * When true, onClickOutside is called only when popover content is shown. * @default true */ disableClickOutsideWhenClosed?: boolean; /** * Hook for testing purposes. */ dataHook?: string; /** * tabindex for popover content element. */ tabIndex?: number; ['aria-label']?: string; ['aria-labelledby']?: string; ['aria-describedby']?: string; /** * Whether to animate the popover content when it is shown or hidden. */ animate?: boolean; /** * Components skin value. Can be dark or light. */ skin?: PopoverSkin; /** Controls the color scheme of the popover content. * @deprecated Use `skin` instead. */ theme?: PopoverSkin; /** Callback to invoke when popover is shown. */ onShow?: () => void; /** Callback to invoke when popover is hidden. */ onHide?: () => void; /** Sets the trigger and the content of the popover, as `Popover.Element` and `Popover.Content` elements. */ children?: ReactNode; /** Enables hovering the popover content. * @default true */ interactive?: boolean; /** Enables overlay for content. */ overlay?: ReactNode; /** * Options controlling how the popover keeps its position in sync with * the trigger element while it is shown. */ autoUpdateOptions?: { /** * When `true`, the popover position is recalculated on every * `requestAnimationFrame` while the popover is shown. Useful when the * trigger element moves due to layout changes that Popper.js doesn't * detect automatically (e.g. animated containers, transform-based motion). * * Note: enabling this runs a continuous rAF loop for as long as the * popover is open, so prefer leaving it off unless you actually need it. * @default false */ animationFrame?: boolean; }; } export declare class Popover extends Component { static Element: FC<{ children: ReactNode; }>; static Content: FC<{ children: ReactNode; }>; } export type PopoverSkin = 'dark' | 'light'; export type PopoverTheme = PopoverSkin; //# sourceMappingURL=Popover.types.d.ts.map