@patternfly/react-core 4.202.33 → 4.202.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/dist/esm/components/ApplicationLauncher/ApplicationLauncher.d.ts +9 -2
- package/dist/esm/components/ApplicationLauncher/ApplicationLauncher.d.ts.map +1 -1
- package/dist/esm/components/ApplicationLauncher/ApplicationLauncher.js.map +1 -1
- package/dist/esm/components/ContextSelector/ContextSelector.d.ts +10 -2
- package/dist/esm/components/ContextSelector/ContextSelector.d.ts.map +1 -1
- package/dist/esm/components/ContextSelector/ContextSelector.js +3 -2
- package/dist/esm/components/ContextSelector/ContextSelector.js.map +1 -1
- package/dist/esm/components/ContextSelector/ContextSelectorToggle.js +3 -3
- package/dist/esm/components/ContextSelector/ContextSelectorToggle.js.map +1 -1
- package/dist/esm/components/Dropdown/Dropdown.d.ts +9 -2
- package/dist/esm/components/Dropdown/Dropdown.d.ts.map +1 -1
- package/dist/esm/components/Dropdown/Dropdown.js +2 -2
- package/dist/esm/components/Dropdown/Dropdown.js.map +1 -1
- package/dist/esm/components/OptionsMenu/OptionsMenu.d.ts +9 -2
- package/dist/esm/components/OptionsMenu/OptionsMenu.d.ts.map +1 -1
- package/dist/esm/components/OptionsMenu/OptionsMenu.js.map +1 -1
- package/dist/esm/components/Select/Select.d.ts +9 -2
- package/dist/esm/components/Select/Select.d.ts.map +1 -1
- package/dist/esm/components/Select/Select.js.map +1 -1
- package/dist/esm/helpers/Popper/Popper.d.ts +0 -10
- package/dist/esm/helpers/Popper/Popper.d.ts.map +1 -1
- package/dist/esm/helpers/Popper/Popper.js.map +1 -1
- package/dist/js/components/ApplicationLauncher/ApplicationLauncher.d.ts +9 -2
- package/dist/js/components/ApplicationLauncher/ApplicationLauncher.d.ts.map +1 -1
- package/dist/js/components/ApplicationLauncher/ApplicationLauncher.js.map +1 -1
- package/dist/js/components/ContextSelector/ContextSelector.d.ts +10 -2
- package/dist/js/components/ContextSelector/ContextSelector.d.ts.map +1 -1
- package/dist/js/components/ContextSelector/ContextSelector.js +3 -2
- package/dist/js/components/ContextSelector/ContextSelector.js.map +1 -1
- package/dist/js/components/ContextSelector/ContextSelectorToggle.js +3 -3
- package/dist/js/components/ContextSelector/ContextSelectorToggle.js.map +1 -1
- package/dist/js/components/Dropdown/Dropdown.d.ts +9 -2
- package/dist/js/components/Dropdown/Dropdown.d.ts.map +1 -1
- package/dist/js/components/Dropdown/Dropdown.js +2 -2
- package/dist/js/components/Dropdown/Dropdown.js.map +1 -1
- package/dist/js/components/OptionsMenu/OptionsMenu.d.ts +9 -2
- package/dist/js/components/OptionsMenu/OptionsMenu.d.ts.map +1 -1
- package/dist/js/components/OptionsMenu/OptionsMenu.js.map +1 -1
- package/dist/js/components/Select/Select.d.ts +9 -2
- package/dist/js/components/Select/Select.d.ts.map +1 -1
- package/dist/js/components/Select/Select.js.map +1 -1
- package/dist/js/helpers/Popper/Popper.d.ts +0 -10
- package/dist/js/helpers/Popper/Popper.d.ts.map +1 -1
- package/dist/js/helpers/Popper/Popper.js.map +1 -1
- package/dist/umd/react-core.js +8 -7
- package/dist/umd/react-core.min.js +1 -1
- package/package.json +5 -5
- package/src/components/ApplicationLauncher/ApplicationLauncher.tsx +9 -2
- package/src/components/ContextSelector/ContextSelector.tsx +12 -4
- package/src/components/ContextSelector/ContextSelectorToggle.tsx +3 -3
- package/src/components/Dropdown/Dropdown.tsx +11 -3
- package/src/components/OptionsMenu/OptionsMenu.tsx +9 -2
- package/src/components/Select/Select.tsx +10 -3
- package/src/helpers/Popper/Popper.tsx +0 -11
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-core",
|
|
3
|
-
"version": "4.202.
|
|
3
|
+
"version": "4.202.34",
|
|
4
4
|
"description": "This library provides a set of common React components for use with the PatternFly reference implementation.",
|
|
5
5
|
"main": "dist/js/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
"generate": "node scripts/copyStyles.js"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@patternfly/react-icons": "^4.53.
|
|
38
|
-
"@patternfly/react-styles": "^4.52.
|
|
39
|
-
"@patternfly/react-tokens": "^4.54.
|
|
37
|
+
"@patternfly/react-icons": "^4.53.34",
|
|
38
|
+
"@patternfly/react-styles": "^4.52.34",
|
|
39
|
+
"@patternfly/react-tokens": "^4.54.34",
|
|
40
40
|
"focus-trap": "6.2.2",
|
|
41
41
|
"react-dropzone": "9.0.0",
|
|
42
42
|
"tippy.js": "5.1.2",
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"react": "^16.8.0 || ^17.0.0",
|
|
61
61
|
"react-dom": "^16.8.0 || ^17.0.0"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "de4c7f23a825d7acacd504503250374f7bb5b302"
|
|
64
64
|
}
|
|
@@ -9,10 +9,9 @@ import { ApplicationLauncherGroup } from './ApplicationLauncherGroup';
|
|
|
9
9
|
import { ApplicationLauncherSeparator } from './ApplicationLauncherSeparator';
|
|
10
10
|
import { ApplicationLauncherItem } from './ApplicationLauncherItem';
|
|
11
11
|
import { ApplicationLauncherContext } from './ApplicationLauncherContext';
|
|
12
|
-
import { ToggleMenuBaseProps } from '../../helpers/Popper/Popper';
|
|
13
12
|
import { createRenderableFavorites, extendItemsWithFavorite } from '../../helpers/favorites';
|
|
14
13
|
|
|
15
|
-
export interface ApplicationLauncherProps extends
|
|
14
|
+
export interface ApplicationLauncherProps extends React.HTMLProps<HTMLDivElement> {
|
|
16
15
|
/** Additional element css classes */
|
|
17
16
|
className?: string;
|
|
18
17
|
/** Display menu above or below dropdown toggle */
|
|
@@ -35,6 +34,14 @@ export interface ApplicationLauncherProps extends ToggleMenuBaseProps, React.HTM
|
|
|
35
34
|
isGrouped?: boolean;
|
|
36
35
|
/** Toggle Icon, optional to override the icon used for the toggle */
|
|
37
36
|
toggleIcon?: React.ReactNode;
|
|
37
|
+
/** The container to append the menu to. Defaults to 'inline'.
|
|
38
|
+
* If your menu is being cut off you can append it to an element higher up the DOM tree.
|
|
39
|
+
* Some examples:
|
|
40
|
+
* menuAppendTo="parent"
|
|
41
|
+
* menuAppendTo={() => document.body}
|
|
42
|
+
* menuAppendTo={document.getElementById('target')}
|
|
43
|
+
*/
|
|
44
|
+
menuAppendTo?: HTMLElement | (() => HTMLElement) | 'inline' | 'parent';
|
|
38
45
|
/** ID list of favorited ApplicationLauncherItems */
|
|
39
46
|
favorites?: string[];
|
|
40
47
|
/** Enables favorites. Callback called when an ApplicationLauncherItem's favorite button is clicked */
|
|
@@ -10,7 +10,6 @@ import { TextInput } from '../TextInput';
|
|
|
10
10
|
import { InputGroup } from '../InputGroup';
|
|
11
11
|
import { KEY_CODES } from '../../helpers/constants';
|
|
12
12
|
import { FocusTrap } from '../../helpers';
|
|
13
|
-
import { ToggleMenuBaseProps } from '../../helpers/Popper/Popper';
|
|
14
13
|
import { Popper } from '../../helpers/Popper/Popper';
|
|
15
14
|
import { getOUIAProps, OUIAProps, getDefaultOUIAId } from '../../helpers';
|
|
16
15
|
|
|
@@ -18,7 +17,7 @@ import { getOUIAProps, OUIAProps, getDefaultOUIAId } from '../../helpers';
|
|
|
18
17
|
let currentId = 0;
|
|
19
18
|
const newId = currentId++;
|
|
20
19
|
|
|
21
|
-
export interface ContextSelectorProps extends
|
|
20
|
+
export interface ContextSelectorProps extends OUIAProps {
|
|
22
21
|
/** content rendered inside the Context Selector */
|
|
23
22
|
children?: React.ReactNode;
|
|
24
23
|
/** Classes applied to root element of Context Selector */
|
|
@@ -29,6 +28,14 @@ export interface ContextSelectorProps extends ToggleMenuBaseProps, OUIAProps {
|
|
|
29
28
|
onToggle?: (event: any, value: boolean) => void;
|
|
30
29
|
/** Function callback called when user selects item */
|
|
31
30
|
onSelect?: (event: any, value: React.ReactNode) => void;
|
|
31
|
+
/** The container to append the menu to. Defaults to 'inline'.
|
|
32
|
+
* If your menu is being cut off you can append it to an element higher up the DOM tree.
|
|
33
|
+
* Some examples:
|
|
34
|
+
* menuAppendTo="parent"
|
|
35
|
+
* menuAppendTo={() => document.body}
|
|
36
|
+
* menuAppendTo={document.getElementById('target')}
|
|
37
|
+
*/
|
|
38
|
+
menuAppendTo?: HTMLElement | (() => HTMLElement) | 'inline' | 'parent';
|
|
32
39
|
/** Flag indicating that the context selector should expand to full height */
|
|
33
40
|
isFullHeight?: boolean;
|
|
34
41
|
/** Labels the Context Selector for Screen Readers */
|
|
@@ -85,6 +92,7 @@ export class ContextSelector extends React.Component<ContextSelectorProps, { oui
|
|
|
85
92
|
}
|
|
86
93
|
|
|
87
94
|
parentRef: React.RefObject<HTMLDivElement> = React.createRef();
|
|
95
|
+
popperRef: React.RefObject<HTMLDivElement> = React.createRef();
|
|
88
96
|
|
|
89
97
|
onEnterPressed = (event: any) => {
|
|
90
98
|
if (event.charCode === KEY_CODES.ENTER) {
|
|
@@ -154,7 +162,7 @@ export class ContextSelector extends React.Component<ContextSelectorProps, { oui
|
|
|
154
162
|
const popperContainer = (
|
|
155
163
|
<div
|
|
156
164
|
className={css(styles.contextSelector, isOpen && styles.modifiers.expanded, className)}
|
|
157
|
-
ref={this.
|
|
165
|
+
ref={this.popperRef}
|
|
158
166
|
{...props}
|
|
159
167
|
>
|
|
160
168
|
{isOpen && menuContainer}
|
|
@@ -182,7 +190,7 @@ export class ContextSelector extends React.Component<ContextSelectorProps, { oui
|
|
|
182
190
|
isOpen={isOpen}
|
|
183
191
|
toggleText={toggleText}
|
|
184
192
|
id={toggleId}
|
|
185
|
-
parentRef={this.parentRef.
|
|
193
|
+
parentRef={menuAppendTo === 'inline' ? this.parentRef : this.popperRef}
|
|
186
194
|
aria-labelledby={`${screenReaderLabelId} ${toggleId}`}
|
|
187
195
|
isPlain={isPlain}
|
|
188
196
|
isText={isText}
|
|
@@ -57,16 +57,16 @@ export class ContextSelectorToggle extends React.Component<ContextSelectorToggle
|
|
|
57
57
|
|
|
58
58
|
onDocClick = (event: any) => {
|
|
59
59
|
const { isOpen, parentRef, onToggle } = this.props;
|
|
60
|
-
if (isOpen && parentRef && !parentRef.contains(event.target)) {
|
|
60
|
+
if (isOpen && parentRef?.current && !parentRef.current.contains(event.target)) {
|
|
61
61
|
onToggle(null, false);
|
|
62
62
|
this.toggle.current.focus();
|
|
63
63
|
}
|
|
64
64
|
};
|
|
65
65
|
|
|
66
66
|
onEscPress = (event: any) => {
|
|
67
|
-
const { isOpen,
|
|
67
|
+
const { isOpen, onToggle } = this.props;
|
|
68
68
|
const keyCode = event.keyCode || event.which;
|
|
69
|
-
if (isOpen && keyCode === KEY_CODES.ESCAPE_KEY
|
|
69
|
+
if (isOpen && keyCode === KEY_CODES.ESCAPE_KEY) {
|
|
70
70
|
onToggle(null, false);
|
|
71
71
|
this.toggle.current.focus();
|
|
72
72
|
}
|
|
@@ -2,10 +2,9 @@ import * as React from 'react';
|
|
|
2
2
|
import styles from '@patternfly/react-styles/css/components/Dropdown/dropdown';
|
|
3
3
|
import { DropdownPosition, DropdownDirection, DropdownContext } from './dropdownConstants';
|
|
4
4
|
import { DropdownWithContext } from './DropdownWithContext';
|
|
5
|
-
import { ToggleMenuBaseProps } from '../../helpers/Popper/Popper';
|
|
6
5
|
import { OUIAProps, useOUIAId } from '../../helpers';
|
|
7
6
|
|
|
8
|
-
export interface DropdownProps extends
|
|
7
|
+
export interface DropdownProps extends React.HTMLProps<HTMLDivElement>, OUIAProps {
|
|
9
8
|
/** Anything which can be rendered in a dropdown */
|
|
10
9
|
children?: React.ReactNode;
|
|
11
10
|
/** Classes applied to root element of dropdown */
|
|
@@ -32,6 +31,14 @@ export interface DropdownProps extends ToggleMenuBaseProps, React.HTMLProps<HTML
|
|
|
32
31
|
};
|
|
33
32
|
/** Display menu above or below dropdown toggle */
|
|
34
33
|
direction?: DropdownDirection | 'up' | 'down';
|
|
34
|
+
/** The container to append the menu to. Defaults to 'inline'.
|
|
35
|
+
* If your menu is being cut off you can append it to an element higher up the DOM tree.
|
|
36
|
+
* Some examples:
|
|
37
|
+
* menuAppendTo="parent"
|
|
38
|
+
* menuAppendTo={() => document.body}
|
|
39
|
+
* menuAppendTo={document.getElementById('target')}
|
|
40
|
+
*/
|
|
41
|
+
menuAppendTo?: HTMLElement | (() => HTMLElement) | 'inline' | 'parent';
|
|
35
42
|
/** Flag to indicate if dropdown has groups */
|
|
36
43
|
isGrouped?: boolean;
|
|
37
44
|
/** Toggle for the dropdown, examples: <DropdownToggle> or <DropdownToggleCheckbox> */
|
|
@@ -54,6 +61,7 @@ export const Dropdown: React.FunctionComponent<DropdownProps> = ({
|
|
|
54
61
|
ouiaSafe,
|
|
55
62
|
alignments,
|
|
56
63
|
contextProps,
|
|
64
|
+
menuAppendTo = 'inline',
|
|
57
65
|
...props
|
|
58
66
|
}: DropdownProps) => (
|
|
59
67
|
<DropdownContext.Provider
|
|
@@ -79,7 +87,7 @@ export const Dropdown: React.FunctionComponent<DropdownProps> = ({
|
|
|
79
87
|
...contextProps
|
|
80
88
|
}}
|
|
81
89
|
>
|
|
82
|
-
<DropdownWithContext {...props} />
|
|
90
|
+
<DropdownWithContext menuAppendTo={menuAppendTo} {...props} />
|
|
83
91
|
</DropdownContext.Provider>
|
|
84
92
|
);
|
|
85
93
|
Dropdown.displayName = 'Dropdown';
|
|
@@ -3,7 +3,6 @@ import styles from '@patternfly/react-styles/css/components/OptionsMenu/options-
|
|
|
3
3
|
import { DropdownContext } from '../Dropdown';
|
|
4
4
|
import { DropdownWithContext } from '../Dropdown/DropdownWithContext';
|
|
5
5
|
import { OUIAProps, useOUIAId } from '../../helpers';
|
|
6
|
-
import { ToggleMenuBaseProps } from '../../helpers/Popper/Popper';
|
|
7
6
|
|
|
8
7
|
export enum OptionsMenuPosition {
|
|
9
8
|
right = 'right',
|
|
@@ -15,7 +14,7 @@ export enum OptionsMenuDirection {
|
|
|
15
14
|
down = 'down'
|
|
16
15
|
}
|
|
17
16
|
|
|
18
|
-
export interface OptionsMenuProps extends
|
|
17
|
+
export interface OptionsMenuProps extends React.HTMLProps<HTMLDivElement>, OUIAProps {
|
|
19
18
|
/** Classes applied to root element of the options menu */
|
|
20
19
|
className?: string;
|
|
21
20
|
/** Id of the root element of the options menu */
|
|
@@ -36,6 +35,14 @@ export interface OptionsMenuProps extends ToggleMenuBaseProps, React.HTMLProps<H
|
|
|
36
35
|
position?: 'right' | 'left';
|
|
37
36
|
/** Menu will open up or open down from the options menu toggle */
|
|
38
37
|
direction?: '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';
|
|
39
46
|
}
|
|
40
47
|
|
|
41
48
|
export const OptionsMenu: React.FunctionComponent<OptionsMenuProps> = ({
|
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
} from '../../helpers';
|
|
34
34
|
import { KeyTypes } from '../../helpers/constants';
|
|
35
35
|
import { Divider } from '../Divider';
|
|
36
|
-
import {
|
|
36
|
+
import { Popper } from '../../helpers/Popper/Popper';
|
|
37
37
|
import { createRenderableFavorites, extendItemsWithFavorite } from '../../helpers/favorites';
|
|
38
38
|
import { ValidatedOptions } from '../../helpers/constants';
|
|
39
39
|
import { findTabbableElements } from '../../helpers/util';
|
|
@@ -48,8 +48,7 @@ export interface SelectViewMoreObject {
|
|
|
48
48
|
onClick: (event: React.MouseEvent | React.ChangeEvent) => void;
|
|
49
49
|
}
|
|
50
50
|
export interface SelectProps
|
|
51
|
-
extends
|
|
52
|
-
Omit<React.HTMLProps<HTMLDivElement>, 'onSelect' | 'ref' | 'checked' | 'selected'>,
|
|
51
|
+
extends Omit<React.HTMLProps<HTMLDivElement>, 'onSelect' | 'ref' | 'checked' | 'selected'>,
|
|
53
52
|
OUIAProps {
|
|
54
53
|
/** Content rendered inside the Select. Must be React.ReactElement<SelectGroupProps>[] */
|
|
55
54
|
children?: React.ReactElement[];
|
|
@@ -165,6 +164,14 @@ export interface SelectProps
|
|
|
165
164
|
shouldResetOnSelect?: boolean;
|
|
166
165
|
/** Content rendered in the footer of the select menu */
|
|
167
166
|
footer?: React.ReactNode;
|
|
167
|
+
/** The container to append the menu to. Defaults to 'inline'.
|
|
168
|
+
* If your menu is being cut off you can append it to an element higher up the DOM tree.
|
|
169
|
+
* Some examples:
|
|
170
|
+
* menuAppendTo="parent"
|
|
171
|
+
* menuAppendTo={() => document.body}
|
|
172
|
+
* menuAppendTo={document.getElementById('target')}
|
|
173
|
+
*/
|
|
174
|
+
menuAppendTo?: HTMLElement | (() => HTMLElement) | 'inline' | 'parent';
|
|
168
175
|
}
|
|
169
176
|
|
|
170
177
|
export interface SelectState {
|
|
@@ -14,17 +14,6 @@ const getOppositePlacement = (placement: Placement): any =>
|
|
|
14
14
|
(matched: string) => hash[matched as 'left' | 'right' | 'bottom' | 'top'] as BasePlacement
|
|
15
15
|
);
|
|
16
16
|
|
|
17
|
-
export interface ToggleMenuBaseProps {
|
|
18
|
-
/** The container to append the menu to. Defaults to 'inline'
|
|
19
|
-
* If your menu is being cut off you can append it to an element higher up the DOM tree.
|
|
20
|
-
* Some examples:
|
|
21
|
-
* menuAppendTo="parent"
|
|
22
|
-
* menuAppendTo={() => document.body}
|
|
23
|
-
* menuAppendTo={document.getElementById('target')}
|
|
24
|
-
*/
|
|
25
|
-
menuAppendTo?: HTMLElement | (() => HTMLElement) | 'parent' | 'inline';
|
|
26
|
-
}
|
|
27
|
-
|
|
28
17
|
export const getOpacityTransition = (animationDuration: number) =>
|
|
29
18
|
`opacity ${animationDuration}ms cubic-bezier(.54, 1.5, .38, 1.11)`;
|
|
30
19
|
|