Debian Codegraph @

node/@patternfly/react-core/dist/js/components/Popover/Popover.d.ts

raw
1 import { ReactElement } from 'react';
2 export declare enum PopoverPosition {
3 auto = "auto",
4 top = "top",
5 bottom = "bottom",
6 left = "left",
7 right = "right",
8 topStart = "top-start",
9 topEnd = "top-end",
10 bottomStart = "bottom-start",
11 bottomEnd = "bottom-end",
12 leftStart = "left-start",
13 leftEnd = "left-end",
14 rightStart = "right-start",
15 rightEnd = "right-end"
16 }
17 /** The main popover component. The following properties can also be passed into another component
18 * that has a property specifically for passing in popover properties.
19 */
20 export interface PopoverProps {
21 /** Text announced by screen reader when alert severity variant is set to indicate
22 * severity level.
23 */
24 alertSeverityScreenReaderText?: string;
25 /** Severity variants for an alert popover. This modifies the color of the header to
26 * match the severity.
27 */
28 alertSeverityVariant?: 'custom' | 'info' | 'warning' | 'success' | 'danger';
29 /** The duration of the CSS fade transition animation. */
30 animationDuration?: number;
31 /** The element to append the popover to. Defaults to "inline". */
32 appendTo?: HTMLElement | ((ref?: HTMLElement) => HTMLElement) | 'inline';
33 /** Accessible label for the popover, required when header is not present. */
34 'aria-label'?: string;
35 /**
36 * Body content of the popover. If you want to close the popover after an action within the
37 * body content, you can use the isVisible prop for manual control, or you can provide a
38 * function which will receive a callback as an argument to hide the popover, i.e.
39 * bodyContent={hide => <Button onClick={() => hide()}>Close</Button>}
40 */
41 bodyContent: React.ReactNode | ((hide: () => void) => React.ReactNode);
42 /**
43 * The trigger reference element to which the popover is relatively placed to. If you cannot wrap
44 * the element with the Popover, you can use the triggerRef prop instead.
45 * Usage: <Popover><Button>Reference</Button></Popover>
46 */
47 children?: ReactElement<any>;
48 /**
49 * The trigger reference element to which the popover is relatively placed to. If you can wrap the
50 * element with the popover, you can use the children prop instead, or both props together.
51 * When passed along with the trigger prop, the div element that wraps the trigger will be removed.
52 * Usage: <Popover triggerRef={() => document.getElementById('reference-element')} />
53 */
54 triggerRef?: HTMLElement | (() => HTMLElement) | React.RefObject<any>;
55 /** Additional classes added to the popover. */
56 className?: string;
57 /** Accessible label for the close button. */
58 closeBtnAriaLabel?: string;
59 /** Distance of the popover to its target. Defaults to 25. */
60 distance?: number;
61 /** The element to focus when the popover becomes visible. By default the first
62 * focusable element will receive focus.
63 */
64 elementToFocus?: HTMLElement | SVGElement | string;
65 /**
66 * If true, tries to keep the popover in view by flipping it if necessary.
67 * If the position is set to 'auto', this prop is ignored.
68 */
69 enableFlip?: boolean;
70 /**
71 * The desired position to flip the popover to if the initial position is not possible.
72 * By setting this prop to 'flip' it attempts to flip the popover to the opposite side if
73 * there is no space.
74 * You can also pass an array of positions that determines the flip order. It should contain
75 * the initial position followed by alternative positions if that position is unavailable.
76 * Example: Initial position is 'top'. Button with popover is in the top right corner.
77 * 'flipBehavior' is set to ['top', 'right', 'left']. Since there is no space to the top, it
78 * checks if right is available. There's also no space to the right, so it finally shows the
79 * popover on the left.
80 */
81 flipBehavior?: 'flip' | ('top' | 'bottom' | 'left' | 'right' | 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end' | 'left-start' | 'left-end' | 'right-start' | 'right-end')[];
82 /**
83 * Footer content of the popover. If you want to close the popover after an action within the
84 * footer content, you can use the isVisible prop for manual control, or you can provide a
85 * function which will receive a callback as an argument to hide the popover, i.e.
86 * footerContent={hide => <Button onClick={() => hide()}>Close</Button>}
87 */
88 footerContent?: React.ReactNode | ((hide: () => void) => React.ReactNode);
89 /** Removes fixed-width and allows width to be defined by contents. */
90 hasAutoWidth?: boolean;
91 /** Allows content to touch edges of popover container. */
92 hasNoPadding?: boolean;
93 /** Sets the heading level to use for the popover header. Defaults to h6. */
94 headerComponent?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
95 /**
96 * Simple header content to be placed within a title. If you want to close the popover after
97 * an action within the header content, you can use the isVisible prop for manual control,
98 * or you can provide a function which will receive a callback as an argument to hide the
99 * popover, i.e. headerContent={hide => <Button onClick={() => hide()}>Close</Button>}
100 */
101 headerContent?: React.ReactNode | ((hide: () => void) => React.ReactNode);
102 /** Icon to be displayed in the popover header. **/
103 headerIcon?: React.ReactNode;
104 /** Hides the popover when a click occurs outside (only works if isVisible is not controlled
105 * by the user).
106 */
107 hideOnOutsideClick?: boolean;
108 /** Id used as part of the various popover elements (popover-${id}-header/body/footer). */
109 id?: string;
110 /**
111 * True to show the popover programmatically. Used in conjunction with the shouldClose prop.
112 * By default, the popover child element handles click events automatically. If you want to
113 * control this programmatically, the popover will not auto-close if the close button is
114 * clicked, the escape key is used, or if a click occurs outside the popover. Instead, the
115 * consumer is responsible for closing the popover themselves by adding a callback listener
116 * for the shouldClose prop.
117 */
118 isVisible?: boolean;
119 /** Maximum width of the popover (default 18.75rem). */
120 maxWidth?: string;
121 /** Minimum width of the popover (default 6.25rem). */
122 minWidth?: string;
123 /**
124 * Lifecycle function invoked when the popover has fully transitioned out.
125 */
126 onHidden?: () => void;
127 /**
128 * Lifecycle function invoked when the popover begins to transition out.
129 */
130 onHide?: (event: MouseEvent | KeyboardEvent) => void;
131 /**
132 * Lifecycle function invoked when the popover has been mounted to the DOM.
133 */
134 onMount?: () => void;
135 /**
136 * Lifecycle function invoked when the popover begins to transition in.
137 */
138 onShow?: (event: MouseEvent | KeyboardEvent) => void;
139 /**
140 * Lifecycle function invoked when the popover has fully transitioned in.
141 */
142 onShown?: () => void;
143 /**
144 * Popover position. Note: With the enableFlip property set to true, it will change the
145 * position if there is not enough space for the starting position. The behavior of where it
146 * flips to can be controlled through the flipBehavior property.
147 */
148 position?: PopoverPosition | 'auto' | 'top' | 'bottom' | 'left' | 'right' | 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end' | 'left-start' | 'left-end' | 'right-start' | 'right-end';
149 /**
150 * Callback function that is only invoked when isVisible is also controlled. Called when the
151 * popover close button is clicked, the enter key was used on it, or the escape key is used.
152 */
153 shouldClose?: (event: MouseEvent | KeyboardEvent, hideFunction?: () => void) => void;
154 /**
155 * Callback function that is only invoked when isVisible is also controlled. Called when the
156 * enter key is used on the focused trigger.
157 */
158 shouldOpen?: (event: MouseEvent | KeyboardEvent, showFunction?: () => void) => void;
159 /** Flag indicating whether the close button should be shown. */
160 showClose?: boolean;
161 /** @deprecated Sets an interaction to open popover, defaults to "click" */
162 triggerAction?: 'click' | 'hover';
163 /** Whether to trap focus in the popover. When using a triggerAction of "hover", this will be set to false
164 * by default and must remain false.
165 */
166 withFocusTrap?: boolean;
167 /** The z-index of the popover. */
168 zIndex?: number;
169 }
170 export declare const Popover: React.FunctionComponent<PopoverProps>;
171 //# sourceMappingURL=Popover.d.ts.map