@patternfly/react-core 6.5.0-prerelease.64 → 6.5.0-prerelease.66
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 +10 -0
- package/components/package.json +1 -1
- package/deprecated/package.json +1 -1
- package/dist/dynamic/components/AboutModal/package.json +1 -1
- package/dist/dynamic/components/Accordion/package.json +1 -1
- package/dist/dynamic/components/ActionList/package.json +1 -1
- package/dist/dynamic/components/Alert/package.json +1 -1
- package/dist/dynamic/components/Avatar/package.json +1 -1
- package/dist/dynamic/components/BackToTop/package.json +1 -1
- package/dist/dynamic/components/Backdrop/package.json +1 -1
- package/dist/dynamic/components/BackgroundImage/package.json +1 -1
- package/dist/dynamic/components/Badge/package.json +1 -1
- package/dist/dynamic/components/Banner/package.json +1 -1
- package/dist/dynamic/components/Brand/package.json +1 -1
- package/dist/dynamic/components/Breadcrumb/package.json +1 -1
- package/dist/dynamic/components/Button/package.json +1 -1
- package/dist/dynamic/components/CalendarMonth/package.json +1 -1
- package/dist/dynamic/components/Card/package.json +1 -1
- package/dist/dynamic/components/Checkbox/package.json +1 -1
- package/dist/dynamic/components/ClipboardCopy/package.json +1 -1
- package/dist/dynamic/components/CodeBlock/package.json +1 -1
- package/dist/dynamic/components/Compass/package.json +1 -1
- package/dist/dynamic/components/Content/package.json +1 -1
- package/dist/dynamic/components/DataList/package.json +1 -1
- package/dist/dynamic/components/DatePicker/package.json +1 -1
- package/dist/dynamic/components/DescriptionList/package.json +1 -1
- package/dist/dynamic/components/Divider/package.json +1 -1
- package/dist/dynamic/components/Drawer/package.json +1 -1
- package/dist/dynamic/components/Dropdown/package.json +1 -1
- package/dist/dynamic/components/DualListSelector/package.json +1 -1
- package/dist/dynamic/components/EmptyState/package.json +1 -1
- package/dist/dynamic/components/ExpandableSection/package.json +1 -1
- package/dist/dynamic/components/FileUpload/package.json +1 -1
- package/dist/dynamic/components/Form/package.json +1 -1
- package/dist/dynamic/components/FormSelect/package.json +1 -1
- package/dist/dynamic/components/HelperText/package.json +1 -1
- package/dist/dynamic/components/Hero/package.json +1 -1
- package/dist/dynamic/components/Hint/package.json +1 -1
- package/dist/dynamic/components/Icon/package.json +1 -1
- package/dist/dynamic/components/InputGroup/package.json +1 -1
- package/dist/dynamic/components/JumpLinks/package.json +1 -1
- package/dist/dynamic/components/Label/package.json +1 -1
- package/dist/dynamic/components/List/package.json +1 -1
- package/dist/dynamic/components/LoginPage/package.json +1 -1
- package/dist/dynamic/components/Masthead/package.json +1 -1
- package/dist/dynamic/components/Menu/package.json +1 -1
- package/dist/dynamic/components/MenuToggle/package.json +1 -1
- package/dist/dynamic/components/Modal/package.json +1 -1
- package/dist/dynamic/components/MultipleFileUpload/package.json +1 -1
- package/dist/dynamic/components/Nav/package.json +1 -1
- package/dist/dynamic/components/NotificationBadge/package.json +1 -1
- package/dist/dynamic/components/NotificationDrawer/package.json +1 -1
- package/dist/dynamic/components/NumberInput/package.json +1 -1
- package/dist/dynamic/components/OverflowMenu/package.json +1 -1
- package/dist/dynamic/components/Page/package.json +1 -1
- package/dist/dynamic/components/Pagination/package.json +1 -1
- package/dist/dynamic/components/Panel/package.json +1 -1
- package/dist/dynamic/components/Popover/package.json +1 -1
- package/dist/dynamic/components/Progress/package.json +1 -1
- package/dist/dynamic/components/ProgressStepper/package.json +1 -1
- package/dist/dynamic/components/Radio/package.json +1 -1
- package/dist/dynamic/components/SearchInput/package.json +1 -1
- package/dist/dynamic/components/Select/package.json +1 -1
- package/dist/dynamic/components/Sidebar/package.json +1 -1
- package/dist/dynamic/components/SimpleList/package.json +1 -1
- package/dist/dynamic/components/Skeleton/package.json +1 -1
- package/dist/dynamic/components/SkipToContent/package.json +1 -1
- package/dist/dynamic/components/Slider/package.json +1 -1
- package/dist/dynamic/components/Spinner/package.json +1 -1
- package/dist/dynamic/components/Switch/package.json +1 -1
- package/dist/dynamic/components/Tabs/package.json +1 -1
- package/dist/dynamic/components/TextArea/package.json +1 -1
- package/dist/dynamic/components/TextInput/package.json +1 -1
- package/dist/dynamic/components/TextInputGroup/package.json +1 -1
- package/dist/dynamic/components/TimePicker/package.json +1 -1
- package/dist/dynamic/components/Timestamp/package.json +1 -1
- package/dist/dynamic/components/Title/package.json +1 -1
- package/dist/dynamic/components/ToggleGroup/package.json +1 -1
- package/dist/dynamic/components/Toolbar/package.json +1 -1
- package/dist/dynamic/components/Tooltip/package.json +1 -1
- package/dist/dynamic/components/TreeView/package.json +1 -1
- package/dist/dynamic/components/Truncate/package.json +1 -1
- package/dist/dynamic/components/Wizard/hooks/package.json +1 -1
- package/dist/dynamic/components/Wizard/package.json +1 -1
- package/dist/dynamic/deprecated/components/Chip/package.json +1 -1
- package/dist/dynamic/deprecated/components/DragDrop/package.json +1 -1
- package/dist/dynamic/deprecated/components/DualListSelector/package.json +1 -1
- package/dist/dynamic/deprecated/components/Modal/package.json +1 -1
- package/dist/dynamic/deprecated/components/Tile/package.json +1 -1
- package/dist/dynamic/deprecated/components/Wizard/package.json +1 -1
- package/dist/dynamic/deprecated/components/package.json +1 -1
- package/dist/dynamic/helpers/AnimationsProvider/AnimationsProvider/package.json +1 -1
- package/dist/dynamic/helpers/AnimationsProvider/package.json +1 -1
- package/dist/dynamic/helpers/FocusTrap/FocusTrap/package.json +1 -1
- package/dist/dynamic/helpers/GenerateId/GenerateId/package.json +1 -1
- package/dist/dynamic/helpers/KeyboardHandler/package.json +1 -1
- package/dist/dynamic/helpers/OUIA/ouia/package.json +1 -1
- package/dist/dynamic/helpers/Popper/Popper/package.json +1 -1
- package/dist/dynamic/helpers/SSRSafeIds/SSRSafeIds/package.json +1 -1
- package/dist/dynamic/helpers/constants/package.json +1 -1
- package/dist/dynamic/helpers/datetimeUtils/package.json +1 -1
- package/dist/dynamic/helpers/fileUtils/package.json +1 -1
- package/dist/dynamic/helpers/htmlConstants/package.json +1 -1
- package/dist/dynamic/helpers/package.json +1 -1
- package/dist/dynamic/helpers/resizeObserver/package.json +1 -1
- package/dist/dynamic/helpers/typeUtils/package.json +1 -1
- package/dist/dynamic/helpers/useInterval/package.json +1 -1
- package/dist/dynamic/helpers/useIsomorphicLayout/package.json +1 -1
- package/dist/dynamic/helpers/useSSRSafeId/package.json +1 -1
- package/dist/dynamic/helpers/useUnmountEffect/package.json +1 -1
- package/dist/dynamic/helpers/util/package.json +1 -1
- package/dist/dynamic/layouts/Bullseye/package.json +1 -1
- package/dist/dynamic/layouts/Flex/package.json +1 -1
- package/dist/dynamic/layouts/Gallery/package.json +1 -1
- package/dist/dynamic/layouts/Grid/package.json +1 -1
- package/dist/dynamic/layouts/Level/package.json +1 -1
- package/dist/dynamic/layouts/Split/package.json +1 -1
- package/dist/dynamic/layouts/Stack/package.json +1 -1
- package/dist/dynamic/styles/package.json +1 -1
- package/dist/dynamic-modules.json +2 -0
- package/dist/esm/components/Label/Label.d.ts +21 -1
- package/dist/esm/components/Label/Label.d.ts.map +1 -1
- package/dist/esm/components/Label/Label.js +37 -15
- package/dist/esm/components/Label/Label.js.map +1 -1
- package/dist/esm/components/TextInputGroup/TextInputGroup.d.ts +6 -2
- package/dist/esm/components/TextInputGroup/TextInputGroup.d.ts.map +1 -1
- package/dist/esm/components/TextInputGroup/TextInputGroup.js +2 -1
- package/dist/esm/components/TextInputGroup/TextInputGroup.js.map +1 -1
- package/dist/esm/components/TextInputGroup/TextInputGroupMain.d.ts.map +1 -1
- package/dist/esm/components/TextInputGroup/TextInputGroupMain.js +15 -3
- package/dist/esm/components/TextInputGroup/TextInputGroupMain.js.map +1 -1
- package/dist/js/components/Label/Label.d.ts +21 -1
- package/dist/js/components/Label/Label.d.ts.map +1 -1
- package/dist/js/components/Label/Label.js +38 -16
- package/dist/js/components/Label/Label.js.map +1 -1
- package/dist/js/components/TextInputGroup/TextInputGroup.d.ts +6 -2
- package/dist/js/components/TextInputGroup/TextInputGroup.d.ts.map +1 -1
- package/dist/js/components/TextInputGroup/TextInputGroup.js +2 -1
- package/dist/js/components/TextInputGroup/TextInputGroup.js.map +1 -1
- package/dist/js/components/TextInputGroup/TextInputGroupMain.d.ts.map +1 -1
- package/dist/js/components/TextInputGroup/TextInputGroupMain.js +14 -2
- package/dist/js/components/TextInputGroup/TextInputGroupMain.js.map +1 -1
- package/dist/umd/assets/{output-BwoQb44a.css → output-BzAdUnEh.css} +19970 -19970
- package/dist/umd/react-core.min.js +1 -1
- package/helpers/package.json +1 -1
- package/layouts/package.json +1 -1
- package/next/package.json +1 -1
- package/package.json +2 -2
- package/src/components/Content/examples/Content.md +1 -1
- package/src/components/Label/Label.tsx +40 -18
- package/src/components/Label/__tests__/Label.test.tsx +6 -6
- package/src/components/Label/__tests__/__snapshots__/Label.test.tsx.snap +36 -0
- package/src/components/Label/examples/LabelCompact.tsx +7 -7
- package/src/components/Label/examples/LabelCustomRender.tsx +2 -2
- package/src/components/Label/examples/LabelEditable.tsx +3 -3
- package/src/components/Label/examples/LabelFilled.tsx +122 -122
- package/src/components/Label/examples/LabelGroupBasic.tsx +3 -3
- package/src/components/Label/examples/LabelGroupCategory.tsx +3 -3
- package/src/components/Label/examples/LabelGroupCategoryRemovable.tsx +2 -2
- package/src/components/Label/examples/LabelGroupEditableAdd.tsx +2 -2
- package/src/components/Label/examples/LabelGroupEditableAddDropdown.tsx +2 -2
- package/src/components/Label/examples/LabelGroupEditableAddModal.tsx +2 -1
- package/src/components/Label/examples/LabelGroupEditableLabels.tsx +5 -5
- package/src/components/Label/examples/LabelGroupOverflow.tsx +6 -6
- package/src/components/Label/examples/LabelGroupVerticalCategoryOverflowRemovable.tsx +2 -2
- package/src/components/Label/examples/LabelOutline.tsx +204 -120
- package/src/components/TextInputGroup/TextInputGroup.tsx +8 -3
- package/src/components/TextInputGroup/TextInputGroupMain.tsx +15 -3
- package/src/components/TextInputGroup/__tests__/TextInputGroup.test.tsx +10 -0
- package/src/components/TextInputGroup/__tests__/TextInputGroupMain.test.tsx +10 -0
- package/src/demos/RTL/examples/PaginatedTable.tsx +5 -4
- package/src/demos/examples/Card/CardHorizontalGrid.tsx +9 -8
- package/src/demos/examples/Card/CardStatus.tsx +6 -5
- package/src/demos/examples/Tabs/TabsOpen.tsx +4 -3
- package/src/demos/examples/Tabs/TabsOpenWithSecondaryTabs.tsx +4 -3
- package/src/demos/examples/TextInputGroup/AttributeValueFiltering.tsx +25 -17
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createContext, useRef } from 'react';
|
|
2
2
|
import styles from '@patternfly/react-styles/css/components/TextInputGroup/text-input-group';
|
|
3
3
|
import { css } from '@patternfly/react-styles';
|
|
4
|
+
import { ValidatedOptions } from '../../helpers/constants';
|
|
4
5
|
|
|
5
6
|
export interface TextInputGroupProps extends React.HTMLProps<HTMLDivElement> {
|
|
6
7
|
/** Content rendered inside the text input group */
|
|
@@ -11,8 +12,11 @@ export interface TextInputGroupProps extends React.HTMLProps<HTMLDivElement> {
|
|
|
11
12
|
isDisabled?: boolean;
|
|
12
13
|
/** Flag to indicate the toggle has no border or background */
|
|
13
14
|
isPlain?: boolean;
|
|
14
|
-
/**
|
|
15
|
-
|
|
15
|
+
/** Value to indicate if the text input group is modified to show that validation state.
|
|
16
|
+
* If set to success, warning, or error, the group will show that state.
|
|
17
|
+
* If set to default, no validation styling is applied (use to clear a prior validation state).
|
|
18
|
+
*/
|
|
19
|
+
validated?: 'success' | 'warning' | 'error' | 'default' | ValidatedOptions;
|
|
16
20
|
/** @hide A reference object to attach to the input box */
|
|
17
21
|
innerRef?: React.RefObject<any>;
|
|
18
22
|
}
|
|
@@ -32,6 +36,7 @@ export const TextInputGroup: React.FunctionComponent<TextInputGroupProps> = ({
|
|
|
32
36
|
}: TextInputGroupProps) => {
|
|
33
37
|
const ref = useRef(null);
|
|
34
38
|
const textInputGroupRef = innerRef || ref;
|
|
39
|
+
const hasValidatedModifier = ['success', 'error', 'warning'].includes(validated);
|
|
35
40
|
|
|
36
41
|
return (
|
|
37
42
|
<TextInputGroupContext.Provider value={{ isDisabled, validated }}>
|
|
@@ -41,7 +46,7 @@ export const TextInputGroup: React.FunctionComponent<TextInputGroupProps> = ({
|
|
|
41
46
|
styles.textInputGroup,
|
|
42
47
|
isDisabled && styles.modifiers.disabled,
|
|
43
48
|
isPlain && styles.modifiers.plain,
|
|
44
|
-
|
|
49
|
+
hasValidatedModifier && styles.modifiers[validated as 'success' | 'warning' | 'error'],
|
|
45
50
|
className
|
|
46
51
|
)}
|
|
47
52
|
{...props}
|
|
@@ -3,7 +3,7 @@ import styles from '@patternfly/react-styles/css/components/TextInputGroup/text-
|
|
|
3
3
|
import { css } from '@patternfly/react-styles';
|
|
4
4
|
import { TextInputGroupContext } from './TextInputGroup';
|
|
5
5
|
import { TextInputGroupIcon } from './TextInputGroupIcon';
|
|
6
|
-
import { statusIcons
|
|
6
|
+
import { statusIcons } from '../../helpers';
|
|
7
7
|
|
|
8
8
|
export interface TextInputGroupMainProps extends Omit<React.HTMLProps<HTMLDivElement>, 'onChange'> {
|
|
9
9
|
/** Content rendered inside the text input group main div */
|
|
@@ -86,7 +86,19 @@ const TextInputGroupMainBase: React.FunctionComponent<TextInputGroupMainProps> =
|
|
|
86
86
|
const { isDisabled, validated } = useContext(TextInputGroupContext);
|
|
87
87
|
const ref = useRef(null);
|
|
88
88
|
const textInputGroupInputInputRef = innerRef || ref;
|
|
89
|
-
const
|
|
89
|
+
const hasStatusIcon = ['success', 'error', 'warning'].includes(validated);
|
|
90
|
+
const StatusIcon = (() => {
|
|
91
|
+
if (!hasStatusIcon) {
|
|
92
|
+
return undefined;
|
|
93
|
+
}
|
|
94
|
+
if (validated === 'error') {
|
|
95
|
+
return statusIcons.danger;
|
|
96
|
+
}
|
|
97
|
+
if (validated === 'success') {
|
|
98
|
+
return statusIcons.success;
|
|
99
|
+
}
|
|
100
|
+
return statusIcons.warning;
|
|
101
|
+
})();
|
|
90
102
|
|
|
91
103
|
const handleChange = (event: React.FormEvent<HTMLInputElement>) => {
|
|
92
104
|
onChange(event, event.currentTarget.value);
|
|
@@ -126,7 +138,7 @@ const TextInputGroupMainBase: React.FunctionComponent<TextInputGroupMainProps> =
|
|
|
126
138
|
{...(ariaControls && { 'aria-controls': ariaControls })}
|
|
127
139
|
{...inputProps}
|
|
128
140
|
/>
|
|
129
|
-
{
|
|
141
|
+
{hasStatusIcon && <TextInputGroupIcon isStatus>{<StatusIcon />}</TextInputGroupIcon>}
|
|
130
142
|
</span>
|
|
131
143
|
</div>
|
|
132
144
|
);
|
|
@@ -72,6 +72,16 @@ describe('TextInputGroup', () => {
|
|
|
72
72
|
expect(inputGroup).toHaveClass(styles.modifiers.error);
|
|
73
73
|
});
|
|
74
74
|
|
|
75
|
+
it('does not apply validation modifiers when validated="default"', () => {
|
|
76
|
+
render(<TextInputGroup validated="default">Test</TextInputGroup>);
|
|
77
|
+
|
|
78
|
+
const inputGroup = screen.getByText('Test');
|
|
79
|
+
|
|
80
|
+
expect(inputGroup).not.toHaveClass(styles.modifiers.success);
|
|
81
|
+
expect(inputGroup).not.toHaveClass(styles.modifiers.warning);
|
|
82
|
+
expect(inputGroup).not.toHaveClass(styles.modifiers.error);
|
|
83
|
+
});
|
|
84
|
+
|
|
75
85
|
it('passes isDisabled=false to children via a context when isDisabled prop is not passed', () => {
|
|
76
86
|
const TestComponent: React.FunctionComponent = () => {
|
|
77
87
|
const context = useContext(TextInputGroupContext);
|
|
@@ -251,6 +251,16 @@ describe('TextInputGroupMain', () => {
|
|
|
251
251
|
expect(screen.getByRole('textbox').nextElementSibling).toHaveClass(styles.modifiers.status);
|
|
252
252
|
});
|
|
253
253
|
|
|
254
|
+
it('does not render a status icon when validated is default', () => {
|
|
255
|
+
render(
|
|
256
|
+
<TextInputGroupContext.Provider value={{ validated: 'default' }}>
|
|
257
|
+
<TextInputGroupMain />
|
|
258
|
+
</TextInputGroupContext.Provider>
|
|
259
|
+
);
|
|
260
|
+
|
|
261
|
+
expect(screen.queryByRole('textbox').nextElementSibling).toBeNull();
|
|
262
|
+
});
|
|
263
|
+
|
|
254
264
|
it('does not call onChange callback when the input does not change', () => {
|
|
255
265
|
const onChangeMock = jest.fn();
|
|
256
266
|
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
DropdownList,
|
|
16
16
|
Icon,
|
|
17
17
|
Label,
|
|
18
|
+
LabelColor,
|
|
18
19
|
Masthead,
|
|
19
20
|
MastheadMain,
|
|
20
21
|
MastheadLogo,
|
|
@@ -180,7 +181,7 @@ export const PaginatedTableAction: React.FunctionComponent = () => {
|
|
|
180
181
|
case 'רץ':
|
|
181
182
|
return (
|
|
182
183
|
<Label
|
|
183
|
-
color=
|
|
184
|
+
color={LabelColor.green}
|
|
184
185
|
icon={
|
|
185
186
|
<Icon shouldMirrorRTL>
|
|
186
187
|
<WalkingIcon />
|
|
@@ -199,7 +200,7 @@ export const PaginatedTableAction: React.FunctionComponent = () => {
|
|
|
199
200
|
<HandPaperIcon />
|
|
200
201
|
</Icon>
|
|
201
202
|
}
|
|
202
|
-
color=
|
|
203
|
+
color={LabelColor.red}
|
|
203
204
|
>
|
|
204
205
|
{translation.table.rows.status.stopped}
|
|
205
206
|
</Label>
|
|
@@ -207,14 +208,14 @@ export const PaginatedTableAction: React.FunctionComponent = () => {
|
|
|
207
208
|
case 'Needs maintenance':
|
|
208
209
|
case 'זקוק לתחזוקה':
|
|
209
210
|
return (
|
|
210
|
-
<Label icon={<ToolsIcon />} color=
|
|
211
|
+
<Label icon={<ToolsIcon />} color={LabelColor.blue}>
|
|
211
212
|
{translation.table.rows.status.needsMaintenance}
|
|
212
213
|
</Label>
|
|
213
214
|
);
|
|
214
215
|
case 'Down':
|
|
215
216
|
case 'מטה':
|
|
216
217
|
return (
|
|
217
|
-
<Label icon={<ClockIcon />} color=
|
|
218
|
+
<Label icon={<ClockIcon />} color={LabelColor.orange}>
|
|
218
219
|
{translation.table.rows.status.down}
|
|
219
220
|
</Label>
|
|
220
221
|
);
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
Level,
|
|
9
9
|
LabelGroup,
|
|
10
10
|
Label,
|
|
11
|
+
LabelColor,
|
|
11
12
|
Grid,
|
|
12
13
|
Flex,
|
|
13
14
|
List,
|
|
@@ -88,16 +89,16 @@ export const CardHorizontalGrid: React.FunctionComponent = () => {
|
|
|
88
89
|
<Level hasGutter>
|
|
89
90
|
<CardTitle id="titleId">Getting Started</CardTitle>
|
|
90
91
|
<LabelGroup isCompact>
|
|
91
|
-
<Label isCompact icon={<RhUiInformationFillIcon />} color=
|
|
92
|
+
<Label isCompact icon={<RhUiInformationFillIcon />} color={LabelColor.blue}>
|
|
92
93
|
Set up your cluster
|
|
93
94
|
</Label>
|
|
94
|
-
<Label isCompact icon={<RhUiInformationFillIcon />} color=
|
|
95
|
+
<Label isCompact icon={<RhUiInformationFillIcon />} color={LabelColor.purple}>
|
|
95
96
|
Guided tours
|
|
96
97
|
</Label>
|
|
97
|
-
<Label isCompact icon={<RhUiInformationFillIcon />} color=
|
|
98
|
+
<Label isCompact icon={<RhUiInformationFillIcon />} color={LabelColor.green}>
|
|
98
99
|
Quick starts
|
|
99
100
|
</Label>
|
|
100
|
-
<Label isCompact icon={<RhUiInformationFillIcon />} color=
|
|
101
|
+
<Label isCompact icon={<RhUiInformationFillIcon />} color={LabelColor.orange}>
|
|
101
102
|
Learning resources
|
|
102
103
|
</Label>
|
|
103
104
|
</LabelGroup>
|
|
@@ -118,7 +119,7 @@ export const CardHorizontalGrid: React.FunctionComponent = () => {
|
|
|
118
119
|
direction={{ default: 'column' }}
|
|
119
120
|
grow={{ default: 'grow' }}
|
|
120
121
|
>
|
|
121
|
-
<Label icon={<RhUiInformationFillIcon />} color=
|
|
122
|
+
<Label icon={<RhUiInformationFillIcon />} color={LabelColor.blue}>
|
|
122
123
|
Set up your cluster
|
|
123
124
|
</Label>
|
|
124
125
|
<p>Continue setting up your cluster to access all you cain in the Console</p>
|
|
@@ -149,7 +150,7 @@ export const CardHorizontalGrid: React.FunctionComponent = () => {
|
|
|
149
150
|
direction={{ default: 'column' }}
|
|
150
151
|
grow={{ default: 'grow' }}
|
|
151
152
|
>
|
|
152
|
-
<Label icon={<RhUiInformationFillIcon />} color=
|
|
153
|
+
<Label icon={<RhUiInformationFillIcon />} color={LabelColor.purple}>
|
|
153
154
|
Guided tours
|
|
154
155
|
</Label>
|
|
155
156
|
<p>Tour some of the key features around the console</p>
|
|
@@ -177,7 +178,7 @@ export const CardHorizontalGrid: React.FunctionComponent = () => {
|
|
|
177
178
|
direction={{ default: 'column' }}
|
|
178
179
|
grow={{ default: 'grow' }}
|
|
179
180
|
>
|
|
180
|
-
<Label icon={<RhUiInformationFillIcon />} color=
|
|
181
|
+
<Label icon={<RhUiInformationFillIcon />} color={LabelColor.green}>
|
|
181
182
|
Quick starts
|
|
182
183
|
</Label>
|
|
183
184
|
<p>Get started with features using our step-by-step documentation</p>
|
|
@@ -208,7 +209,7 @@ export const CardHorizontalGrid: React.FunctionComponent = () => {
|
|
|
208
209
|
direction={{ default: 'column' }}
|
|
209
210
|
grow={{ default: 'grow' }}
|
|
210
211
|
>
|
|
211
|
-
<Label icon={<RhUiInformationFillIcon />} color=
|
|
212
|
+
<Label icon={<RhUiInformationFillIcon />} color={LabelColor.orange}>
|
|
212
213
|
Learning resources
|
|
213
214
|
</Label>
|
|
214
215
|
<p>Learn about new features within the Console and get started with demo apps</p>
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
Grid,
|
|
11
11
|
GridItem,
|
|
12
12
|
Label,
|
|
13
|
+
LabelStatus,
|
|
13
14
|
NotificationDrawer,
|
|
14
15
|
NotificationDrawerBody,
|
|
15
16
|
NotificationDrawerGroup,
|
|
@@ -204,11 +205,11 @@ export const CardStatus: React.FunctionComponent = () => {
|
|
|
204
205
|
<FlexItem spacer={{ default: 'spacerMd' }}>
|
|
205
206
|
<span>Notifications</span>
|
|
206
207
|
</FlexItem>
|
|
207
|
-
<Label status=
|
|
208
|
-
<Label status=
|
|
209
|
-
<Label status=
|
|
210
|
-
<Label status=
|
|
211
|
-
<Label status=
|
|
208
|
+
<Label status={LabelStatus.danger}>1</Label>
|
|
209
|
+
<Label status={LabelStatus.warning}>3</Label>
|
|
210
|
+
<Label status={LabelStatus.success}>3</Label>
|
|
211
|
+
<Label status={LabelStatus.danger}>3</Label>
|
|
212
|
+
<Label status={LabelStatus.info}>3</Label>
|
|
212
213
|
</Flex>
|
|
213
214
|
);
|
|
214
215
|
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
DescriptionListTerm,
|
|
16
16
|
DescriptionListDescription,
|
|
17
17
|
Label,
|
|
18
|
+
LabelColor,
|
|
18
19
|
LabelGroup,
|
|
19
20
|
Flex,
|
|
20
21
|
FlexItem
|
|
@@ -73,7 +74,7 @@ export const TabsOpen: React.FunctionComponent = () => {
|
|
|
73
74
|
<DescriptionListDescription>
|
|
74
75
|
<Flex spaceItems={{ default: 'spaceItemsSm' }}>
|
|
75
76
|
<FlexItem>
|
|
76
|
-
<Label color=
|
|
77
|
+
<Label color={LabelColor.teal}>NS</Label>
|
|
77
78
|
</FlexItem>
|
|
78
79
|
<FlexItem>
|
|
79
80
|
<a href="#">knative-serving-ingress</a>
|
|
@@ -115,7 +116,7 @@ export const TabsOpen: React.FunctionComponent = () => {
|
|
|
115
116
|
<DescriptionListDescription>
|
|
116
117
|
<Flex spaceItems={{ default: 'spaceItemsSm' }}>
|
|
117
118
|
<FlexItem>
|
|
118
|
-
<Label color=
|
|
119
|
+
<Label color={LabelColor.purple}>N</Label>
|
|
119
120
|
</FlexItem>
|
|
120
121
|
<FlexItem>ip-10-0-233-118.us-east-2.computer.external</FlexItem>
|
|
121
122
|
</Flex>
|
|
@@ -142,7 +143,7 @@ export const TabsOpen: React.FunctionComponent = () => {
|
|
|
142
143
|
flexWrap={{ default: 'noWrap' }}
|
|
143
144
|
>
|
|
144
145
|
<FlexItem>
|
|
145
|
-
<Label color=
|
|
146
|
+
<Label color={LabelColor.blue}>N</Label>
|
|
146
147
|
</FlexItem>
|
|
147
148
|
<FlexItem>
|
|
148
149
|
<Title headingLevel="h1" size="2xl">
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
DescriptionListTerm,
|
|
16
16
|
DescriptionListDescription,
|
|
17
17
|
Label,
|
|
18
|
+
LabelColor,
|
|
18
19
|
LabelGroup,
|
|
19
20
|
Flex,
|
|
20
21
|
FlexItem
|
|
@@ -79,7 +80,7 @@ export const TabsOpenWithSecondaryTabs: React.FunctionComponent = () => {
|
|
|
79
80
|
<DescriptionListDescription>
|
|
80
81
|
<Flex spaceItems={{ default: 'spaceItemsSm' }}>
|
|
81
82
|
<FlexItem>
|
|
82
|
-
<Label color=
|
|
83
|
+
<Label color={LabelColor.teal}>NS</Label>
|
|
83
84
|
</FlexItem>
|
|
84
85
|
<FlexItem>
|
|
85
86
|
<a href="#">knative-serving-ingress</a>
|
|
@@ -121,7 +122,7 @@ export const TabsOpenWithSecondaryTabs: React.FunctionComponent = () => {
|
|
|
121
122
|
<DescriptionListDescription>
|
|
122
123
|
<Flex spaceItems={{ default: 'spaceItemsSm' }}>
|
|
123
124
|
<FlexItem>
|
|
124
|
-
<Label color=
|
|
125
|
+
<Label color={LabelColor.purple}>N</Label>
|
|
125
126
|
</FlexItem>
|
|
126
127
|
<FlexItem>ip-10-0-233-118.us-east-2.computer.external</FlexItem>
|
|
127
128
|
</Flex>
|
|
@@ -148,7 +149,7 @@ export const TabsOpenWithSecondaryTabs: React.FunctionComponent = () => {
|
|
|
148
149
|
flexWrap={{ default: 'noWrap' }}
|
|
149
150
|
>
|
|
150
151
|
<FlexItem>
|
|
151
|
-
<Label color=
|
|
152
|
+
<Label color={LabelColor.blue}>N</Label>
|
|
152
153
|
</FlexItem>
|
|
153
154
|
<FlexItem>
|
|
154
155
|
<Title headingLevel="h1" size="2xl">
|
|
@@ -40,8 +40,8 @@ export const AttributeValueFiltering: React.FunctionComponent = () => {
|
|
|
40
40
|
const [menuItems, setMenuItems] = useState<React.ReactElement<any>[]>([]);
|
|
41
41
|
|
|
42
42
|
/** refs used to detect when clicks occur inside vs outside of the textInputGroup and menu popper */
|
|
43
|
-
const menuRef = useRef<HTMLDivElement>(
|
|
44
|
-
const textInputGroupRef = useRef<HTMLDivElement>(
|
|
43
|
+
const menuRef = useRef<HTMLDivElement>(null);
|
|
44
|
+
const textInputGroupRef = useRef<HTMLDivElement>(null);
|
|
45
45
|
|
|
46
46
|
/** callback for updating the inputValue state in this component so that the input can be controlled */
|
|
47
47
|
const handleInputChange = (_event: React.FormEvent<HTMLInputElement>, value: string) => {
|
|
@@ -107,7 +107,7 @@ export const AttributeValueFiltering: React.FunctionComponent = () => {
|
|
|
107
107
|
const divider = <Divider key="divider" />;
|
|
108
108
|
|
|
109
109
|
setMenuItems([headingItem, divider, ...filteredMenuItems]);
|
|
110
|
-
}, [inputValue]);
|
|
110
|
+
}, [inputValue, menuItemsText, selectedKey]);
|
|
111
111
|
|
|
112
112
|
/** add selected key/value pair as a chip in the chip group */
|
|
113
113
|
const selectValue = (selectedValue: string) => {
|
|
@@ -117,22 +117,30 @@ export const AttributeValueFiltering: React.FunctionComponent = () => {
|
|
|
117
117
|
|
|
118
118
|
/** update the input to show the selected key and the menu to show the values associated with that specific key */
|
|
119
119
|
const selectKey = (selectedText: string) => {
|
|
120
|
+
const values = data[selectedText];
|
|
121
|
+
|
|
122
|
+
if (!values) {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
|
|
120
126
|
setInputValue(`${selectedText}: `);
|
|
121
127
|
setSelectedKey(selectedText);
|
|
122
|
-
setMenuItemsText(
|
|
128
|
+
setMenuItemsText(values);
|
|
123
129
|
};
|
|
124
130
|
|
|
125
131
|
const handleEnter = () => {
|
|
126
|
-
/**
|
|
127
|
-
|
|
132
|
+
/** bail if heading + divider + first option are not all present */
|
|
133
|
+
const firstResult = menuItems[2]?.props?.children;
|
|
134
|
+
|
|
135
|
+
if (!firstResult) {
|
|
128
136
|
return;
|
|
129
137
|
}
|
|
130
138
|
|
|
131
139
|
/** perform the appropriate action based on key selection state */
|
|
132
140
|
if (selectedKey.length) {
|
|
133
|
-
selectValue(
|
|
141
|
+
selectValue(firstResult);
|
|
134
142
|
} else {
|
|
135
|
-
selectKey(
|
|
143
|
+
selectKey(firstResult);
|
|
136
144
|
}
|
|
137
145
|
};
|
|
138
146
|
|
|
@@ -144,7 +152,7 @@ export const AttributeValueFiltering: React.FunctionComponent = () => {
|
|
|
144
152
|
};
|
|
145
153
|
|
|
146
154
|
/** allow the user to select a key by simply typing it and entering a colon, exact (case sensitive) matches only */
|
|
147
|
-
const handleColon = () => {
|
|
155
|
+
const handleColon = (event: React.KeyboardEvent) => {
|
|
148
156
|
if (!selectedKey.length && keyNames.includes(inputValue)) {
|
|
149
157
|
selectKey(inputValue);
|
|
150
158
|
event.preventDefault();
|
|
@@ -172,7 +180,7 @@ export const AttributeValueFiltering: React.FunctionComponent = () => {
|
|
|
172
180
|
handleBackspace();
|
|
173
181
|
break;
|
|
174
182
|
case ':':
|
|
175
|
-
handleColon();
|
|
183
|
+
handleColon(event);
|
|
176
184
|
break;
|
|
177
185
|
case 'ArrowUp':
|
|
178
186
|
case 'ArrowDown':
|
|
@@ -182,24 +190,24 @@ export const AttributeValueFiltering: React.FunctionComponent = () => {
|
|
|
182
190
|
};
|
|
183
191
|
|
|
184
192
|
/** perform the proper key or value selection when a menu item is selected */
|
|
185
|
-
const onSelect = (event: React.MouseEvent<Element, MouseEvent
|
|
186
|
-
const selectedText = (event
|
|
193
|
+
const onSelect = (event: React.MouseEvent<Element, MouseEvent> | undefined, _itemId: string | number) => {
|
|
194
|
+
const selectedText = (event?.target as HTMLElement | undefined)?.innerText.trim() || '';
|
|
187
195
|
|
|
188
196
|
if (selectedKey.length) {
|
|
189
197
|
selectValue(selectedText);
|
|
190
198
|
} else {
|
|
191
199
|
selectKey(selectedText);
|
|
192
200
|
}
|
|
193
|
-
event
|
|
194
|
-
textInputGroupRef.current
|
|
201
|
+
event?.stopPropagation();
|
|
202
|
+
textInputGroupRef.current?.querySelector('input')?.focus();
|
|
195
203
|
};
|
|
196
204
|
|
|
197
205
|
/** close the menu when a click occurs outside of the menu or text input group */
|
|
198
|
-
const handleClick = (event: MouseEvent) => {
|
|
206
|
+
const handleClick = (event: MouseEvent | undefined) => {
|
|
199
207
|
if (
|
|
200
208
|
menuRef.current &&
|
|
201
|
-
!menuRef.current.contains(event
|
|
202
|
-
!textInputGroupRef.current
|
|
209
|
+
!menuRef.current.contains(event?.target as HTMLElement) &&
|
|
210
|
+
!textInputGroupRef.current?.contains(event?.target as HTMLElement)
|
|
203
211
|
) {
|
|
204
212
|
setMenuIsOpen(false);
|
|
205
213
|
}
|