UNPKG

3.94 kBTypeScriptView Raw
1import * as React from 'react';
2import { Placement } from './thirdparty/popper-core';
3import '@patternfly/react-styles/css/components/Popper/Popper.css';
4export interface ToggleMenuBaseProps {
5 /** The container to append the menu to. Defaults to 'inline'
6 * If your menu is being cut off you can append it to an element higher up the DOM tree.
7 * Some examples:
8 * menuAppendTo="parent"
9 * menuAppendTo={() => document.body}
10 * menuAppendTo={document.getElementById('target')}
11 */
12 menuAppendTo?: HTMLElement | (() => HTMLElement) | 'parent' | 'inline';
13}
14export declare const getOpacityTransition: (animationDuration: number) => string;
15export interface PopperProps {
16 /**
17 * The reference element to which the Popover is relatively placed to.
18 * Use either trigger or reference, not both.
19 */
20 trigger?: React.ReactNode;
21 /**
22 * The reference element to which the Popover is relatively placed to.
23 * Use either trigger or reference, not both.
24 */
25 reference?: HTMLElement | (() => HTMLElement) | React.RefObject<any>;
26 /** The popper (menu/tooltip/popover) element */
27 popper: React.ReactElement;
28 /** True to set the width of the popper element to the trigger element's width */
29 popperMatchesTriggerWidth?: boolean;
30 /** popper direction */
31 direction?: 'up' | 'down';
32 /** popper position */
33 position?: 'right' | 'left' | 'center';
34 /** Instead of direction and position can set the placement of the popper */
35 placement?: Placement;
36 /** The container to append the popper to. Defaults to 'document.body' */
37 appendTo?: HTMLElement | (() => HTMLElement);
38 /** z-index of the popper element */
39 zIndex?: number;
40 /** True to make the popper visible */
41 isVisible?: boolean;
42 /**
43 * Map class names to positions, for example:
44 * {
45 * top: styles.modifiers.top,
46 * bottom: styles.modifiers.bottom,
47 * left: styles.modifiers.left,
48 * right: styles.modifiers.right
49 * }
50 */
51 positionModifiers?: {
52 top?: string;
53 right?: string;
54 bottom?: string;
55 left?: string;
56 topStart?: string;
57 topEnd?: string;
58 bottomStart?: string;
59 bottomEnd?: string;
60 leftStart?: string;
61 leftEnd?: string;
62 rightStart?: string;
63 rightEnd?: string;
64 };
65 /** Distance of the popper to the trigger */
66 distance?: number;
67 /** Callback function when mouse enters trigger */
68 onMouseEnter?: (event?: MouseEvent) => void;
69 /** Callback function when mouse leaves trigger */
70 onMouseLeave?: (event?: MouseEvent) => void;
71 /** Callback function when trigger is focused */
72 onFocus?: (event?: FocusEvent) => void;
73 /** Callback function when trigger is blurred (focus leaves) */
74 onBlur?: (event?: FocusEvent) => void;
75 /** Callback function when trigger is clicked */
76 onTriggerClick?: (event?: MouseEvent) => void;
77 /** Callback function when Enter key is used on trigger */
78 onTriggerEnter?: (event?: KeyboardEvent) => void;
79 /** Callback function when popper is clicked */
80 onPopperClick?: (event?: MouseEvent) => void;
81 /** Callback function when document is clicked */
82 onDocumentClick?: (event?: MouseEvent, triggerElement?: HTMLElement, popperElement?: HTMLElement) => void;
83 /** Callback function when keydown event occurs on document */
84 onDocumentKeyDown?: (event?: KeyboardEvent) => void;
85 /** Enable to flip the popper when it reaches the boundary */
86 enableFlip?: boolean;
87 /** The behavior of how the popper flips when it reaches the boundary */
88 flipBehavior?: 'flip' | ('top' | 'bottom' | 'left' | 'right' | 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end' | 'left-start' | 'left-end' | 'right-start' | 'right-end')[];
89}
90export declare const Popper: React.FunctionComponent<PopperProps>;
91//# sourceMappingURL=Popper.d.ts.map
\No newline at end of file