@patternfly/react-core 4.215.0 → 4.217.0
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 +33 -0
- package/dist/esm/components/HelperText/HelperTextItem.d.ts +4 -0
- package/dist/esm/components/HelperText/HelperTextItem.d.ts.map +1 -1
- package/dist/esm/components/HelperText/HelperTextItem.js +7 -2
- package/dist/esm/components/HelperText/HelperTextItem.js.map +1 -1
- package/dist/esm/components/Select/Select.js +2 -2
- package/dist/esm/components/Select/Select.js.map +1 -1
- package/dist/js/components/HelperText/HelperTextItem.d.ts +4 -0
- package/dist/js/components/HelperText/HelperTextItem.d.ts.map +1 -1
- package/dist/js/components/HelperText/HelperTextItem.js +7 -2
- package/dist/js/components/HelperText/HelperTextItem.js.map +1 -1
- package/dist/js/components/Select/Select.js +2 -2
- package/dist/js/components/Select/Select.js.map +1 -1
- package/dist/umd/react-core.js +9 -4
- package/dist/umd/react-core.min.js +2 -2
- package/package.json +5 -5
- package/src/components/HelperText/HelperTextItem.tsx +10 -1
- package/src/components/HelperText/__tests__/__snapshots__/HelperText.test.tsx.snap +5 -0
- package/src/components/Select/Select.tsx +2 -2
- package/src/demos/examples/DashboardHeader.js +50 -50
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-core",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.217.0",
|
|
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.
|
|
38
|
-
"@patternfly/react-styles": "^4.
|
|
39
|
-
"@patternfly/react-tokens": "^4.
|
|
37
|
+
"@patternfly/react-icons": "^4.68.0",
|
|
38
|
+
"@patternfly/react-styles": "^4.67.0",
|
|
39
|
+
"@patternfly/react-tokens": "^4.69.0",
|
|
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": "a1b1c66e6c186a78cc60ce3182959cc771fc27c9"
|
|
64
64
|
}
|
|
@@ -29,6 +29,10 @@ export interface HelperTextItemProps extends React.HTMLProps<HTMLDivElement | HT
|
|
|
29
29
|
* assistive technologies.
|
|
30
30
|
*/
|
|
31
31
|
id?: string;
|
|
32
|
+
/** Text that is only accessible to screen readers in order to announce the status of a helper text item.
|
|
33
|
+
* This prop can only be used when the isDynamic prop is also passed in.
|
|
34
|
+
*/
|
|
35
|
+
screenReaderText?: string;
|
|
32
36
|
}
|
|
33
37
|
|
|
34
38
|
const variantStyle = {
|
|
@@ -48,6 +52,7 @@ export const HelperTextItem: React.FunctionComponent<HelperTextItemProps> = ({
|
|
|
48
52
|
isDynamic = false,
|
|
49
53
|
hasIcon = isDynamic,
|
|
50
54
|
id,
|
|
55
|
+
screenReaderText = `${variant} status`,
|
|
51
56
|
...props
|
|
52
57
|
}: HelperTextItemProps) => {
|
|
53
58
|
const Component = component as any;
|
|
@@ -70,7 +75,11 @@ export const HelperTextItem: React.FunctionComponent<HelperTextItemProps> = ({
|
|
|
70
75
|
{variant === 'error' && <ExclamationCircleIcon />}
|
|
71
76
|
</span>
|
|
72
77
|
)}
|
|
73
|
-
|
|
78
|
+
|
|
79
|
+
<span className={css(styles.helperTextItemText)}>
|
|
80
|
+
{children}
|
|
81
|
+
{isDynamic && <span className="pf-u-screen-reader">: {screenReaderText};</span>}
|
|
82
|
+
</span>
|
|
74
83
|
</Component>
|
|
75
84
|
);
|
|
76
85
|
};
|
|
@@ -679,13 +679,13 @@ export class Select extends React.Component<SelectProps & OUIAProps, SelectState
|
|
|
679
679
|
};
|
|
680
680
|
|
|
681
681
|
handleTypeaheadKeys = (position: string, shiftKey: boolean = false) => {
|
|
682
|
-
const { isOpen, onFavorite } = this.props;
|
|
682
|
+
const { isOpen, onFavorite, isCreatable } = this.props;
|
|
683
683
|
const { typeaheadCurrIndex, tabbedIntoFavoritesMenu } = this.state;
|
|
684
684
|
const typeaheadActiveChild = this.getTypeaheadActiveChild(typeaheadCurrIndex);
|
|
685
685
|
if (isOpen) {
|
|
686
686
|
if (position === 'enter') {
|
|
687
687
|
if (
|
|
688
|
-
typeaheadCurrIndex !== -1 && // do not allow selection without moving to an initial option
|
|
688
|
+
(typeaheadCurrIndex !== -1 || (isCreatable && this.refCollection.length === 1)) && // do not allow selection without moving to an initial option unless it is a single create option
|
|
689
689
|
(typeaheadActiveChild || (this.refCollection[0] && this.refCollection[0][0]))
|
|
690
690
|
) {
|
|
691
691
|
if (typeaheadActiveChild) {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import {
|
|
3
|
+
ApplicationLauncher,
|
|
4
|
+
ApplicationLauncherItem,
|
|
3
5
|
Avatar,
|
|
4
6
|
Brand,
|
|
5
7
|
Button,
|
|
@@ -18,14 +20,13 @@ import {
|
|
|
18
20
|
ToolbarContent,
|
|
19
21
|
ToolbarGroup,
|
|
20
22
|
ToolbarItem,
|
|
21
|
-
PageToggleButton
|
|
22
|
-
Divider
|
|
23
|
+
PageToggleButton
|
|
23
24
|
} from '@patternfly/react-core';
|
|
24
25
|
import BarsIcon from '@patternfly/react-icons/dist/esm/icons/bars-icon';
|
|
25
26
|
import CogIcon from '@patternfly/react-icons/dist/esm/icons/cog-icon';
|
|
26
27
|
import HelpIcon from '@patternfly/react-icons/dist/esm/icons/help-icon';
|
|
27
28
|
import QuestionCircleIcon from '@patternfly/react-icons/dist/esm/icons/question-circle-icon';
|
|
28
|
-
import
|
|
29
|
+
import BellIcon from '@patternfly/react-icons/dist/esm/icons/bell-icon';
|
|
29
30
|
import imgBrand from './pfColorLogo.svg';
|
|
30
31
|
import imgAvatar from '@patternfly/react-core/src/components/Avatar/examples/avatarImg.svg';
|
|
31
32
|
|
|
@@ -36,6 +37,7 @@ export default class DashboardHeader extends React.Component {
|
|
|
36
37
|
isDropdownOpen: false,
|
|
37
38
|
isKebabDropdownOpen: false,
|
|
38
39
|
isFullKebabDropdownOpen: false,
|
|
40
|
+
isAppLauncherOpen: false,
|
|
39
41
|
activeItem: 0
|
|
40
42
|
};
|
|
41
43
|
|
|
@@ -74,10 +76,22 @@ export default class DashboardHeader extends React.Component {
|
|
|
74
76
|
isFullKebabDropdownOpen: !this.state.isFullKebabDropdownOpen
|
|
75
77
|
});
|
|
76
78
|
};
|
|
79
|
+
|
|
80
|
+
this.onAppLauncherToggle = isAppLauncherOpen => {
|
|
81
|
+
this.setState({
|
|
82
|
+
isAppLauncherOpen
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
this.onAppLauncherSelect = () => {
|
|
87
|
+
this.setState({
|
|
88
|
+
isAppLauncherOpen: !this.state.isAppLauncherOpen
|
|
89
|
+
});
|
|
90
|
+
};
|
|
77
91
|
}
|
|
78
92
|
|
|
79
93
|
render() {
|
|
80
|
-
const { isDropdownOpen, isKebabDropdownOpen,
|
|
94
|
+
const { isDropdownOpen, isKebabDropdownOpen, isAppLauncherOpen } = this.state;
|
|
81
95
|
|
|
82
96
|
const kebabDropdownItems = [
|
|
83
97
|
<DropdownItem key="kebab-1">
|
|
@@ -97,21 +111,13 @@ export default class DashboardHeader extends React.Component {
|
|
|
97
111
|
</DropdownGroup>
|
|
98
112
|
];
|
|
99
113
|
|
|
100
|
-
const
|
|
101
|
-
<
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
</DropdownGroup>,
|
|
108
|
-
<Divider key="divider" />,
|
|
109
|
-
<DropdownItem key="kebab-1">
|
|
110
|
-
<CogIcon /> Settings
|
|
111
|
-
</DropdownItem>,
|
|
112
|
-
<DropdownItem key="kebab-2">
|
|
113
|
-
<HelpIcon /> Help
|
|
114
|
-
</DropdownItem>
|
|
114
|
+
const appLauncherItems = [
|
|
115
|
+
<ApplicationLauncherItem key="application_1a" href="#">
|
|
116
|
+
Application 1 (anchor link)
|
|
117
|
+
</ApplicationLauncherItem>,
|
|
118
|
+
<ApplicationLauncherItem key="application_2a" component="button" onClick={() => alert('Clicked item 2')}>
|
|
119
|
+
Application 2 (button with onClick)
|
|
120
|
+
</ApplicationLauncherItem>
|
|
115
121
|
];
|
|
116
122
|
|
|
117
123
|
const headerToolbar = (
|
|
@@ -123,51 +129,45 @@ export default class DashboardHeader extends React.Component {
|
|
|
123
129
|
spacer={{ default: 'spacerNone', md: 'spacerMd' }}
|
|
124
130
|
>
|
|
125
131
|
<ToolbarItem>
|
|
126
|
-
<Button aria-label="Notifications" variant={ButtonVariant.plain}
|
|
127
|
-
<AttentionBellIcon />
|
|
128
|
-
</Button>
|
|
132
|
+
<Button aria-label="Notifications" variant={ButtonVariant.plain} icon={<BellIcon />} />
|
|
129
133
|
</ToolbarItem>
|
|
130
134
|
<ToolbarGroup variant="icon-button-group" visibility={{ default: 'hidden', lg: 'visible' }}>
|
|
135
|
+
<ToolbarItem visibility={{ default: 'hidden', sm: 'hidden', lg: 'visible' }}>
|
|
136
|
+
<ApplicationLauncher
|
|
137
|
+
onSelect={this.onAppLauncherSelect}
|
|
138
|
+
onToggle={this.onAppLauncherToggle}
|
|
139
|
+
isOpen={isAppLauncherOpen}
|
|
140
|
+
items={appLauncherItems}
|
|
141
|
+
/>
|
|
142
|
+
</ToolbarItem>
|
|
131
143
|
<ToolbarItem>
|
|
132
|
-
<Button aria-label="Settings
|
|
133
|
-
<CogIcon />
|
|
134
|
-
</Button>
|
|
144
|
+
<Button aria-label="Settings" variant={ButtonVariant.plain} icon={<CogIcon />} />
|
|
135
145
|
</ToolbarItem>
|
|
136
146
|
<ToolbarItem>
|
|
137
|
-
<Button aria-label="Help
|
|
138
|
-
<QuestionCircleIcon />
|
|
139
|
-
</Button>
|
|
147
|
+
<Button aria-label="Help" variant={ButtonVariant.plain} icon={<QuestionCircleIcon />} />
|
|
140
148
|
</ToolbarItem>
|
|
141
149
|
</ToolbarGroup>
|
|
150
|
+
<ToolbarItem visibility={{ default: 'hidden', sm: 'visible', md: 'visible', lg: 'hidden' }}>
|
|
151
|
+
<Dropdown
|
|
152
|
+
isPlain
|
|
153
|
+
position="right"
|
|
154
|
+
onSelect={this.onKebabDropdownSelect}
|
|
155
|
+
toggle={<KebabToggle onToggle={this.onKebabDropdownToggle} />}
|
|
156
|
+
isOpen={isKebabDropdownOpen}
|
|
157
|
+
dropdownItems={kebabDropdownItems}
|
|
158
|
+
/>
|
|
159
|
+
</ToolbarItem>
|
|
142
160
|
</ToolbarGroup>
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
isPlain
|
|
146
|
-
position="right"
|
|
147
|
-
onSelect={this.onKebabDropdownSelect}
|
|
148
|
-
toggle={<KebabToggle onToggle={this.onKebabDropdownToggle} />}
|
|
149
|
-
isOpen={isKebabDropdownOpen}
|
|
150
|
-
dropdownItems={kebabDropdownItems}
|
|
151
|
-
/>
|
|
152
|
-
</ToolbarItem>
|
|
153
|
-
<ToolbarItem visibility={{ default: 'visible', md: 'hidden', lg: 'hidden', xl: 'hidden', '2xl': 'hidden' }}>
|
|
154
|
-
<Dropdown
|
|
155
|
-
isPlain
|
|
156
|
-
position="right"
|
|
157
|
-
onSelect={this.onFullKebabSelect}
|
|
158
|
-
toggle={<KebabToggle onToggle={this.onFullKebabToggle} />}
|
|
159
|
-
isOpen={isFullKebabDropdownOpen}
|
|
160
|
-
dropdownItems={fullKebabItems}
|
|
161
|
-
/>
|
|
162
|
-
</ToolbarItem>
|
|
163
|
-
<ToolbarItem visibility={{ default: 'hidden', md: 'visible' }}>
|
|
161
|
+
|
|
162
|
+
<ToolbarItem visibility={{ default: 'hidden', sm: 'visible' }}>
|
|
164
163
|
<Dropdown
|
|
165
164
|
position="right"
|
|
165
|
+
isFullHeight
|
|
166
166
|
onSelect={this.onDropdownSelect}
|
|
167
167
|
isOpen={isDropdownOpen}
|
|
168
168
|
toggle={
|
|
169
169
|
<DropdownToggle icon={<Avatar src={imgAvatar} alt="Avatar" />} onToggle={this.onDropdownToggle}>
|
|
170
|
-
|
|
170
|
+
Ned Username
|
|
171
171
|
</DropdownToggle>
|
|
172
172
|
}
|
|
173
173
|
dropdownItems={userDropdownItems}
|