@patternfly/react-core 4.217.0 → 4.217.3
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 +27 -0
- package/dist/esm/components/ApplicationLauncher/ApplicationLauncher.d.ts +9 -1
- 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 +14 -1
- package/dist/esm/components/ContextSelector/ContextSelector.d.ts.map +1 -1
- package/dist/esm/components/ContextSelector/ContextSelector.js +4 -3
- package/dist/esm/components/ContextSelector/ContextSelector.js.map +1 -1
- package/dist/esm/components/Dropdown/Dropdown.d.ts +14 -1
- 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/Dropdown/DropdownWithContext.d.ts.map +1 -1
- package/dist/esm/components/Dropdown/DropdownWithContext.js +7 -3
- package/dist/esm/components/Dropdown/DropdownWithContext.js.map +1 -1
- package/dist/esm/components/OptionsMenu/OptionsMenu.d.ts +9 -1
- 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 +14 -1
- package/dist/esm/components/Select/Select.d.ts.map +1 -1
- package/dist/esm/components/Select/Select.js +7 -3
- package/dist/esm/components/Select/Select.js.map +1 -1
- package/dist/esm/helpers/Popper/Popper.d.ts +1 -0
- 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 -1
- 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 +14 -1
- package/dist/js/components/ContextSelector/ContextSelector.d.ts.map +1 -1
- package/dist/js/components/ContextSelector/ContextSelector.js +4 -3
- package/dist/js/components/ContextSelector/ContextSelector.js.map +1 -1
- package/dist/js/components/Dropdown/Dropdown.d.ts +14 -1
- 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/Dropdown/DropdownWithContext.d.ts.map +1 -1
- package/dist/js/components/Dropdown/DropdownWithContext.js +7 -3
- package/dist/js/components/Dropdown/DropdownWithContext.js.map +1 -1
- package/dist/js/components/OptionsMenu/OptionsMenu.d.ts +9 -1
- 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 +14 -1
- package/dist/js/components/Select/Select.d.ts.map +1 -1
- package/dist/js/components/Select/Select.js +7 -3
- package/dist/js/components/Select/Select.js.map +1 -1
- package/dist/js/helpers/Popper/Popper.d.ts +1 -0
- 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 +20 -11
- package/dist/umd/react-core.min.js +1 -1
- package/package.json +5 -5
- package/src/components/ApplicationLauncher/ApplicationLauncher.tsx +11 -1
- package/src/components/ContextSelector/ContextSelector.tsx +23 -3
- package/src/components/Dropdown/Dropdown.tsx +20 -2
- package/src/components/Dropdown/DropdownWithContext.tsx +6 -1
- package/src/components/OptionsMenu/OptionsMenu.tsx +12 -1
- package/src/components/Select/Select.tsx +20 -2
- package/src/helpers/Popper/Popper.tsx +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-core",
|
|
3
|
-
"version": "4.217.
|
|
3
|
+
"version": "4.217.3",
|
|
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.68.
|
|
38
|
-
"@patternfly/react-styles": "^4.67.
|
|
39
|
-
"@patternfly/react-tokens": "^4.69.
|
|
37
|
+
"@patternfly/react-icons": "^4.68.3",
|
|
38
|
+
"@patternfly/react-styles": "^4.67.3",
|
|
39
|
+
"@patternfly/react-tokens": "^4.69.3",
|
|
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": "cb169f61276aee6fc695408537310c10cfb5f1f0"
|
|
64
64
|
}
|
|
@@ -12,7 +12,9 @@ import { ApplicationLauncherContext } from './ApplicationLauncherContext';
|
|
|
12
12
|
import { ToggleMenuBaseProps } from '../../helpers/Popper/Popper';
|
|
13
13
|
import { createRenderableFavorites, extendItemsWithFavorite } from '../../helpers/favorites';
|
|
14
14
|
|
|
15
|
-
export interface ApplicationLauncherProps
|
|
15
|
+
export interface ApplicationLauncherProps
|
|
16
|
+
extends Omit<ToggleMenuBaseProps, 'menuAppendTo'>,
|
|
17
|
+
React.HTMLProps<HTMLDivElement> {
|
|
16
18
|
/** Additional element css classes */
|
|
17
19
|
className?: string;
|
|
18
20
|
/** Display menu above or below dropdown toggle */
|
|
@@ -35,6 +37,14 @@ export interface ApplicationLauncherProps extends ToggleMenuBaseProps, React.HTM
|
|
|
35
37
|
isGrouped?: boolean;
|
|
36
38
|
/** Toggle Icon, optional to override the icon used for the toggle */
|
|
37
39
|
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';
|
|
38
48
|
/** ID list of favorited ApplicationLauncherItems */
|
|
39
49
|
favorites?: string[];
|
|
40
50
|
/** Enables favorites. Callback called when an ApplicationLauncherItem's favorite button is clicked */
|
|
@@ -18,7 +18,7 @@ import { getOUIAProps, OUIAProps, getDefaultOUIAId } from '../../helpers';
|
|
|
18
18
|
let currentId = 0;
|
|
19
19
|
const newId = currentId++;
|
|
20
20
|
|
|
21
|
-
export interface ContextSelectorProps extends ToggleMenuBaseProps, OUIAProps {
|
|
21
|
+
export interface ContextSelectorProps extends Omit<ToggleMenuBaseProps, 'menuAppendTo'>, OUIAProps {
|
|
22
22
|
/** content rendered inside the Context Selector */
|
|
23
23
|
children?: React.ReactNode;
|
|
24
24
|
/** Classes applied to root element of Context Selector */
|
|
@@ -29,6 +29,14 @@ export interface ContextSelectorProps extends ToggleMenuBaseProps, OUIAProps {
|
|
|
29
29
|
onToggle?: (event: any, value: boolean) => void;
|
|
30
30
|
/** Function callback called when user selects item */
|
|
31
31
|
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';
|
|
32
40
|
/** Flag indicating that the context selector should expand to full height */
|
|
33
41
|
isFullHeight?: boolean;
|
|
34
42
|
/** Labels the Context Selector for Screen Readers */
|
|
@@ -53,6 +61,11 @@ export interface ContextSelectorProps extends ToggleMenuBaseProps, OUIAProps {
|
|
|
53
61
|
isText?: boolean;
|
|
54
62
|
/** Flag to disable focus trap */
|
|
55
63
|
disableFocusTrap?: boolean;
|
|
64
|
+
/** Flag for indicating that the context selector menu should automatically flip vertically when
|
|
65
|
+
* it reaches the boundary. This prop can only be used when the context selector component is not
|
|
66
|
+
* appended inline, e.g. `menuAppendTo="parent"`
|
|
67
|
+
*/
|
|
68
|
+
isFlipEnabled?: boolean;
|
|
56
69
|
}
|
|
57
70
|
|
|
58
71
|
export class ContextSelector extends React.Component<ContextSelectorProps, { ouiaStateId: string }> {
|
|
@@ -75,7 +88,8 @@ export class ContextSelector extends React.Component<ContextSelectorProps, { oui
|
|
|
75
88
|
disableFocusTrap: false,
|
|
76
89
|
footer: null as React.ReactNode,
|
|
77
90
|
isPlain: false,
|
|
78
|
-
isText: false
|
|
91
|
+
isText: false,
|
|
92
|
+
isFlipEnabled: false
|
|
79
93
|
};
|
|
80
94
|
constructor(props: ContextSelectorProps) {
|
|
81
95
|
super(props);
|
|
@@ -118,10 +132,16 @@ export class ContextSelector extends React.Component<ContextSelectorProps, { oui
|
|
|
118
132
|
isText,
|
|
119
133
|
footer,
|
|
120
134
|
disableFocusTrap,
|
|
135
|
+
isFlipEnabled,
|
|
121
136
|
...props
|
|
122
137
|
} = this.props;
|
|
123
138
|
const menuContainer = (
|
|
124
|
-
<div
|
|
139
|
+
<div
|
|
140
|
+
className={css(styles.contextSelectorMenu)}
|
|
141
|
+
// This removes the `position: absolute`styling from the `.pf-c-context-selector__menu`
|
|
142
|
+
// allowing the menu to flip correctly
|
|
143
|
+
{...(isFlipEnabled && { style: { position: 'revert' } })}
|
|
144
|
+
>
|
|
125
145
|
{isOpen && (
|
|
126
146
|
<FocusTrap active={!disableFocusTrap} focusTrapOptions={{ clickOutsideDeactivates: true }}>
|
|
127
147
|
<div className={css(styles.contextSelectorMenuSearch)}>
|
|
@@ -5,7 +5,10 @@ import { DropdownWithContext } from './DropdownWithContext';
|
|
|
5
5
|
import { ToggleMenuBaseProps } from '../../helpers/Popper/Popper';
|
|
6
6
|
import { OUIAProps, useOUIAId } from '../../helpers';
|
|
7
7
|
|
|
8
|
-
export interface DropdownProps
|
|
8
|
+
export interface DropdownProps
|
|
9
|
+
extends Omit<ToggleMenuBaseProps, 'menuAppendTo'>,
|
|
10
|
+
React.HTMLProps<HTMLDivElement>,
|
|
11
|
+
OUIAProps {
|
|
9
12
|
/** Anything which can be rendered in a dropdown */
|
|
10
13
|
children?: React.ReactNode;
|
|
11
14
|
/** Classes applied to root element of dropdown */
|
|
@@ -32,6 +35,14 @@ export interface DropdownProps extends ToggleMenuBaseProps, React.HTMLProps<HTML
|
|
|
32
35
|
};
|
|
33
36
|
/** Display menu above or below dropdown toggle */
|
|
34
37
|
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';
|
|
35
46
|
/** Flag to indicate if dropdown has groups */
|
|
36
47
|
isGrouped?: boolean;
|
|
37
48
|
/** Toggle for the dropdown, examples: <DropdownToggle> or <DropdownToggleCheckbox> */
|
|
@@ -44,6 +55,11 @@ export interface DropdownProps extends ToggleMenuBaseProps, React.HTMLProps<HTML
|
|
|
44
55
|
autoFocus?: boolean;
|
|
45
56
|
/** Props for extreme customization of dropdown */
|
|
46
57
|
contextProps?: typeof DropdownContext;
|
|
58
|
+
/** Flag for indicating that the dropdown menu should automatically flip vertically when
|
|
59
|
+
* it reaches the boundary. This prop can only be used when the dropdown component is not
|
|
60
|
+
* appended inline, e.g. `menuAppendTo="parent"`
|
|
61
|
+
*/
|
|
62
|
+
isFlipEnabled?: boolean;
|
|
47
63
|
}
|
|
48
64
|
|
|
49
65
|
export const Dropdown: React.FunctionComponent<DropdownProps> = ({
|
|
@@ -54,6 +70,8 @@ export const Dropdown: React.FunctionComponent<DropdownProps> = ({
|
|
|
54
70
|
ouiaSafe,
|
|
55
71
|
alignments,
|
|
56
72
|
contextProps,
|
|
73
|
+
menuAppendTo = 'inline',
|
|
74
|
+
isFlipEnabled = false,
|
|
57
75
|
...props
|
|
58
76
|
}: DropdownProps) => (
|
|
59
77
|
<DropdownContext.Provider
|
|
@@ -79,7 +97,7 @@ export const Dropdown: React.FunctionComponent<DropdownProps> = ({
|
|
|
79
97
|
...contextProps
|
|
80
98
|
}}
|
|
81
99
|
>
|
|
82
|
-
<DropdownWithContext {...props} />
|
|
100
|
+
<DropdownWithContext menuAppendTo={menuAppendTo} isFlipEnabled={isFlipEnabled} {...props} />
|
|
83
101
|
</DropdownContext.Provider>
|
|
84
102
|
);
|
|
85
103
|
Dropdown.displayName = 'Dropdown';
|
|
@@ -29,7 +29,8 @@ export class DropdownWithContext extends React.Component<DropdownProps & OUIAPro
|
|
|
29
29
|
direction: DropdownDirection.down,
|
|
30
30
|
onSelect: (): void => undefined,
|
|
31
31
|
autoFocus: true,
|
|
32
|
-
menuAppendTo: 'inline'
|
|
32
|
+
menuAppendTo: 'inline',
|
|
33
|
+
isFlipEnabled: false
|
|
33
34
|
};
|
|
34
35
|
|
|
35
36
|
constructor(props: DropdownProps & OUIAProps) {
|
|
@@ -75,6 +76,7 @@ export class DropdownWithContext extends React.Component<DropdownProps & OUIAPro
|
|
|
75
76
|
toggle,
|
|
76
77
|
autoFocus,
|
|
77
78
|
menuAppendTo,
|
|
79
|
+
isFlipEnabled,
|
|
78
80
|
...props
|
|
79
81
|
} = this.props;
|
|
80
82
|
const id = toggle.props.id || `pf-dropdown-toggle-id-${DropdownWithContext.currentId++}`;
|
|
@@ -96,6 +98,9 @@ export class DropdownWithContext extends React.Component<DropdownProps & OUIAPro
|
|
|
96
98
|
const BaseComponent = baseComponent as any;
|
|
97
99
|
const menuContainer = (
|
|
98
100
|
<DropdownMenu
|
|
101
|
+
// This removes the `position: absolute` styling from the `.pf-c-dropdown__menu`
|
|
102
|
+
// allowing the menu to flip correctly
|
|
103
|
+
{...(isFlipEnabled && { style: { position: 'revert', minWidth: 'min-content' } })}
|
|
99
104
|
setMenuComponentRef={this.setMenuComponentRef}
|
|
100
105
|
component={component}
|
|
101
106
|
isOpen={isOpen}
|
|
@@ -15,7 +15,10 @@ export enum OptionsMenuDirection {
|
|
|
15
15
|
down = 'down'
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
export interface OptionsMenuProps
|
|
18
|
+
export interface OptionsMenuProps
|
|
19
|
+
extends Omit<ToggleMenuBaseProps, 'menuAppendTo'>,
|
|
20
|
+
React.HTMLProps<HTMLDivElement>,
|
|
21
|
+
OUIAProps {
|
|
19
22
|
/** Classes applied to root element of the options menu */
|
|
20
23
|
className?: string;
|
|
21
24
|
/** Id of the root element of the options menu */
|
|
@@ -36,6 +39,14 @@ export interface OptionsMenuProps extends ToggleMenuBaseProps, React.HTMLProps<H
|
|
|
36
39
|
position?: 'right' | 'left';
|
|
37
40
|
/** Menu will open up or open down from the options menu toggle */
|
|
38
41
|
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';
|
|
39
50
|
}
|
|
40
51
|
|
|
41
52
|
export const OptionsMenu: React.FunctionComponent<OptionsMenuProps> = ({
|
|
@@ -48,7 +48,7 @@ export interface SelectViewMoreObject {
|
|
|
48
48
|
onClick: (event: React.MouseEvent | React.ChangeEvent) => void;
|
|
49
49
|
}
|
|
50
50
|
export interface SelectProps
|
|
51
|
-
extends ToggleMenuBaseProps,
|
|
51
|
+
extends Omit<ToggleMenuBaseProps, 'menuAppendTo'>,
|
|
52
52
|
Omit<React.HTMLProps<HTMLDivElement>, 'onSelect' | 'ref' | 'checked' | 'selected'>,
|
|
53
53
|
OUIAProps {
|
|
54
54
|
/** Content rendered inside the Select. Must be React.ReactElement<SelectGroupProps>[] */
|
|
@@ -165,6 +165,19 @@ export interface SelectProps
|
|
|
165
165
|
shouldResetOnSelect?: boolean;
|
|
166
166
|
/** Content rendered in the footer of the select menu */
|
|
167
167
|
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';
|
|
176
|
+
/** Flag for indicating that the select menu should automatically flip vertically when
|
|
177
|
+
* it reaches the boundary. This prop can only be used when the select component is not
|
|
178
|
+
* appended inline, e.g. `menuAppendTo="parent"`
|
|
179
|
+
*/
|
|
180
|
+
isFlipEnabled?: boolean;
|
|
168
181
|
}
|
|
169
182
|
|
|
170
183
|
export interface SelectState {
|
|
@@ -237,7 +250,8 @@ export class Select extends React.Component<SelectProps & OUIAProps, SelectState
|
|
|
237
250
|
isInputValuePersisted: false,
|
|
238
251
|
isInputFilterPersisted: false,
|
|
239
252
|
isCreateSelectOptionObject: false,
|
|
240
|
-
shouldResetOnSelect: true
|
|
253
|
+
shouldResetOnSelect: true,
|
|
254
|
+
isFlipEnabled: false
|
|
241
255
|
};
|
|
242
256
|
|
|
243
257
|
state: SelectState = {
|
|
@@ -970,6 +984,7 @@ export class Select extends React.Component<SelectProps & OUIAProps, SelectState
|
|
|
970
984
|
loadingVariant,
|
|
971
985
|
isCreateSelectOptionObject,
|
|
972
986
|
shouldResetOnSelect,
|
|
987
|
+
isFlipEnabled,
|
|
973
988
|
...props
|
|
974
989
|
} = this.props;
|
|
975
990
|
const {
|
|
@@ -1196,6 +1211,9 @@ export class Select extends React.Component<SelectProps & OUIAProps, SelectState
|
|
|
1196
1211
|
|
|
1197
1212
|
const innerMenu = (
|
|
1198
1213
|
<SelectMenu
|
|
1214
|
+
// This removes the `position: absolute` styling from the `.pf-c-select__menu`
|
|
1215
|
+
// allowing the menu to flip correctly
|
|
1216
|
+
{...(isFlipEnabled && { style: { position: 'revert' } })}
|
|
1199
1217
|
{...props}
|
|
1200
1218
|
isGrouped={isGrouped}
|
|
1201
1219
|
selected={selections}
|
|
@@ -14,6 +14,7 @@ const getOppositePlacement = (placement: Placement): any =>
|
|
|
14
14
|
(matched: string) => hash[matched as 'left' | 'right' | 'bottom' | 'top'] as BasePlacement
|
|
15
15
|
);
|
|
16
16
|
|
|
17
|
+
/** @deprecated Please use the menuAppendTo prop directly from within the PF component which uses it. */
|
|
17
18
|
export interface ToggleMenuBaseProps {
|
|
18
19
|
/** The container to append the menu to. Defaults to 'inline'
|
|
19
20
|
* If your menu is being cut off you can append it to an element higher up the DOM tree.
|