Skip to content

Commit d572887

Browse files
committed
expose prop info
1 parent 2267449 commit d572887

File tree

6 files changed

+56
-6
lines changed

6 files changed

+56
-6
lines changed

packages/react-core/src/components/ApplicationLauncher/ApplicationLauncher.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ import { ApplicationLauncherContext } from './ApplicationLauncherContext';
1212
import { ToggleMenuBaseProps } from '../../helpers/Popper/Popper';
1313
import { createRenderableFavorites, extendItemsWithFavorite } from '../../helpers/favorites';
1414

15-
export interface ApplicationLauncherProps extends ToggleMenuBaseProps, React.HTMLProps<HTMLDivElement> {
15+
export interface ApplicationLauncherProps
16+
extends Omit<ToggleMenuBaseProps, 'menuAppendTo'>,
17+
React.HTMLProps<HTMLDivElement> {
1618
/** Additional element css classes */
1719
className?: string;
1820
/** Display menu above or below dropdown toggle */
@@ -35,6 +37,14 @@ export interface ApplicationLauncherProps extends ToggleMenuBaseProps, React.HTM
3537
isGrouped?: boolean;
3638
/** Toggle Icon, optional to override the icon used for the toggle */
3739
toggleIcon?: React.ReactNode;
40+
/** The container to append the menu to. Defaults to 'inline'.
41+
* If your menu is being cut off you can append it to an element higher up the DOM tree.
42+
* Some examples:
43+
* menuAppendTo="parent"
44+
* menuAppendTo={() => document.body}
45+
* menuAppendTo={document.getElementById('target')}
46+
*/
47+
menuAppendTo?: HTMLElement | (() => HTMLElement) | 'inline' | 'parent';
3848
/** ID list of favorited ApplicationLauncherItems */
3949
favorites?: string[];
4050
/** Enables favorites. Callback called when an ApplicationLauncherItem's favorite button is clicked */

packages/react-core/src/components/ContextSelector/ContextSelector.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { getOUIAProps, OUIAProps, getDefaultOUIAId } from '../../helpers';
1818
let currentId = 0;
1919
const newId = currentId++;
2020

21-
export interface ContextSelectorProps extends ToggleMenuBaseProps, OUIAProps {
21+
export interface ContextSelectorProps extends Omit<ToggleMenuBaseProps, 'menuAppendTo'>, OUIAProps {
2222
/** content rendered inside the Context Selector */
2323
children?: React.ReactNode;
2424
/** Classes applied to root element of Context Selector */
@@ -29,6 +29,14 @@ export interface ContextSelectorProps extends ToggleMenuBaseProps, OUIAProps {
2929
onToggle?: (event: any, value: boolean) => void;
3030
/** Function callback called when user selects item */
3131
onSelect?: (event: any, value: React.ReactNode) => void;
32+
/** The container to append the menu to. Defaults to 'inline'.
33+
* If your menu is being cut off you can append it to an element higher up the DOM tree.
34+
* Some examples:
35+
* menuAppendTo="parent"
36+
* menuAppendTo={() => document.body}
37+
* menuAppendTo={document.getElementById('target')}
38+
*/
39+
menuAppendTo?: HTMLElement | (() => HTMLElement) | 'inline' | 'parent';
3240
/** Flag indicating that the context selector should expand to full height */
3341
isFullHeight?: boolean;
3442
/** Labels the Context Selector for Screen Readers */

packages/react-core/src/components/Dropdown/Dropdown.tsx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ import { DropdownWithContext } from './DropdownWithContext';
55
import { ToggleMenuBaseProps } from '../../helpers/Popper/Popper';
66
import { OUIAProps, useOUIAId } from '../../helpers';
77

8-
export interface DropdownProps extends ToggleMenuBaseProps, React.HTMLProps<HTMLDivElement>, OUIAProps {
8+
export interface DropdownProps
9+
extends Omit<ToggleMenuBaseProps, 'menuAppendTo'>,
10+
React.HTMLProps<HTMLDivElement>,
11+
OUIAProps {
912
/** Anything which can be rendered in a dropdown */
1013
children?: React.ReactNode;
1114
/** Classes applied to root element of dropdown */
@@ -32,6 +35,14 @@ export interface DropdownProps extends ToggleMenuBaseProps, React.HTMLProps<HTML
3235
};
3336
/** Display menu above or below dropdown toggle */
3437
direction?: DropdownDirection | 'up' | 'down';
38+
/** The container to append the menu to. Defaults to 'inline'.
39+
* If your menu is being cut off you can append it to an element higher up the DOM tree.
40+
* Some examples:
41+
* menuAppendTo="parent"
42+
* menuAppendTo={() => document.body}
43+
* menuAppendTo={document.getElementById('target')}
44+
*/
45+
menuAppendTo?: HTMLElement | (() => HTMLElement) | 'inline' | 'parent';
3546
/** Flag to indicate if dropdown has groups */
3647
isGrouped?: boolean;
3748
/** Toggle for the dropdown, examples: <DropdownToggle> or <DropdownToggleCheckbox> */
@@ -54,6 +65,7 @@ export const Dropdown: React.FunctionComponent<DropdownProps> = ({
5465
ouiaSafe,
5566
alignments,
5667
contextProps,
68+
menuAppendTo = 'inline',
5769
...props
5870
}: DropdownProps) => (
5971
<DropdownContext.Provider
@@ -79,7 +91,7 @@ export const Dropdown: React.FunctionComponent<DropdownProps> = ({
7991
...contextProps
8092
}}
8193
>
82-
<DropdownWithContext {...props} />
94+
<DropdownWithContext menuAppendTo={menuAppendTo} {...props} />
8395
</DropdownContext.Provider>
8496
);
8597
Dropdown.displayName = 'Dropdown';

packages/react-core/src/components/OptionsMenu/OptionsMenu.tsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ export enum OptionsMenuDirection {
1515
down = 'down'
1616
}
1717

18-
export interface OptionsMenuProps extends ToggleMenuBaseProps, React.HTMLProps<HTMLDivElement>, OUIAProps {
18+
export interface OptionsMenuProps
19+
extends Omit<ToggleMenuBaseProps, 'menuAppendTo'>,
20+
React.HTMLProps<HTMLDivElement>,
21+
OUIAProps {
1922
/** Classes applied to root element of the options menu */
2023
className?: string;
2124
/** Id of the root element of the options menu */
@@ -36,6 +39,14 @@ export interface OptionsMenuProps extends ToggleMenuBaseProps, React.HTMLProps<H
3639
position?: 'right' | 'left';
3740
/** Menu will open up or open down from the options menu toggle */
3841
direction?: 'up' | 'down';
42+
/** The container to append the menu to. Defaults to 'inline'.
43+
* If your menu is being cut off you can append it to an element higher up the DOM tree.
44+
* Some examples:
45+
* menuAppendTo="parent"
46+
* menuAppendTo={() => document.body}
47+
* menuAppendTo={document.getElementById('target')}
48+
*/
49+
menuAppendTo?: HTMLElement | (() => HTMLElement) | 'inline' | 'parent';
3950
}
4051

4152
export const OptionsMenu: React.FunctionComponent<OptionsMenuProps> = ({

packages/react-core/src/components/Select/Select.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export interface SelectViewMoreObject {
4848
onClick: (event: React.MouseEvent | React.ChangeEvent) => void;
4949
}
5050
export interface SelectProps
51-
extends ToggleMenuBaseProps,
51+
extends Omit<ToggleMenuBaseProps, 'menuAppendTo'>,
5252
Omit<React.HTMLProps<HTMLDivElement>, 'onSelect' | 'ref' | 'checked' | 'selected'>,
5353
OUIAProps {
5454
/** Content rendered inside the Select. Must be React.ReactElement<SelectGroupProps>[] */
@@ -165,6 +165,14 @@ export interface SelectProps
165165
shouldResetOnSelect?: boolean;
166166
/** Content rendered in the footer of the select menu */
167167
footer?: React.ReactNode;
168+
/** The container to append the menu to. Defaults to 'inline'.
169+
* If your menu is being cut off you can append it to an element higher up the DOM tree.
170+
* Some examples:
171+
* menuAppendTo="parent"
172+
* menuAppendTo={() => document.body}
173+
* menuAppendTo={document.getElementById('target')}
174+
*/
175+
menuAppendTo?: HTMLElement | (() => HTMLElement) | 'inline' | 'parent';
168176
}
169177

170178
export interface SelectState {

packages/react-core/src/helpers/Popper/Popper.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const getOppositePlacement = (placement: Placement): any =>
1414
(matched: string) => hash[matched as 'left' | 'right' | 'bottom' | 'top'] as BasePlacement
1515
);
1616

17+
/** @deprecated Please use the menuAppendTo prop directly from within the PF component which uses it. */
1718
export interface ToggleMenuBaseProps {
1819
/** The container to append the menu to. Defaults to 'inline'
1920
* If your menu is being cut off you can append it to an element higher up the DOM tree.

0 commit comments

Comments
 (0)