@patternfly/react-core 4.222.4 → 4.222.7
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/Dropdown/InternalDropdownItem.d.ts.map +1 -1
- package/dist/esm/components/Dropdown/InternalDropdownItem.js +3 -3
- package/dist/esm/components/Dropdown/InternalDropdownItem.js.map +1 -1
- package/dist/js/components/Dropdown/InternalDropdownItem.d.ts.map +1 -1
- package/dist/js/components/Dropdown/InternalDropdownItem.js +3 -3
- package/dist/js/components/Dropdown/InternalDropdownItem.js.map +1 -1
- package/dist/umd/react-core.css +69 -1
- package/dist/umd/react-core.js +3 -3
- package/dist/umd/react-core.min.css +69 -1
- package/dist/umd/react-core.min.js +1 -1
- package/package.json +6 -6
- package/src/components/ApplicationLauncher/__tests__/Generated/__snapshots__/ApplicationLauncherSeparator.test.tsx.snap +1 -1
- package/src/components/ApplicationLauncher/__tests__/__snapshots__/ApplicationLauncher.test.tsx.snap +26 -14
- package/src/components/Dropdown/InternalDropdownItem.tsx +3 -2
- package/src/components/Dropdown/__tests__/Generated/__snapshots__/DropdownSeparator.test.tsx.snap +1 -1
- package/src/components/Dropdown/__tests__/__snapshots__/Dropdown.test.tsx.snap +21 -3
- package/src/components/Dropdown/__tests__/__snapshots__/InternalDropdownItem.test.tsx.snap +10 -0
- package/src/components/Dropdown/examples/DropdownBasic.tsx +4 -2
- package/src/components/JumpLinks/examples/JumpLinks.md +6 -69
- package/src/components/JumpLinks/examples/JumpLinksBasic.tsx +10 -0
- package/src/components/JumpLinks/examples/JumpLinksExpandableVerticalWithSubsection.tsx +18 -0
- package/src/components/JumpLinks/examples/JumpLinksVertical.tsx +10 -0
- package/src/components/JumpLinks/examples/JumpLinksVerticalWithLabel.tsx +10 -0
- package/src/components/JumpLinks/examples/JumpLinksWithCenteredList.tsx +10 -0
- package/src/components/JumpLinks/examples/JumpLinksWithLabel.tsx +17 -0
- package/src/components/LabelGroup/examples/LabelGroup.md +6 -172
- package/src/components/LabelGroup/examples/LabelGroupBasic.tsx +15 -0
- package/src/components/LabelGroup/examples/LabelGroupCategory.tsx +15 -0
- package/src/components/LabelGroup/examples/LabelGroupCategoryRemovable.tsx +24 -0
- package/src/components/LabelGroup/examples/LabelGroupEditableLabels.tsx +53 -0
- package/src/components/LabelGroup/examples/LabelGroupOverflow.tsx +24 -0
- package/src/components/LabelGroup/examples/LabelGroupVerticalCategoryOverflowRemovable.tsx +24 -0
- package/src/components/List/examples/List.md +10 -72
- package/src/components/List/examples/ListBasic.tsx +10 -0
- package/src/components/List/examples/ListHorizontalRules.tsx +10 -0
- package/src/components/List/examples/ListIcons.tsx +13 -0
- package/src/components/List/examples/ListInline.tsx +10 -0
- package/src/components/List/examples/ListLargeIcons.tsx +13 -0
- package/src/components/List/examples/ListOrdered.tsx +10 -0
- package/src/components/List/examples/ListPlain.tsx +10 -0
- package/src/components/OptionsMenu/__tests__/Generated/__snapshots__/OptionsMenuItem.test.tsx.snap +2 -1
- package/src/components/OptionsMenu/__tests__/__snapshots__/OptionsMenu.test.tsx.snap +12 -6
- package/src/components/OverflowMenu/__tests__/Generated/__snapshots__/OverflowMenuDropdownItem.test.tsx.snap +2 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { JumpLinks, JumpLinksItem } from '@patternfly/react-core';
|
|
3
|
+
|
|
4
|
+
export const JumpLinksVerticalWithLabel: React.FunctionComponent = () => (
|
|
5
|
+
<JumpLinks isVertical label="Jump to section">
|
|
6
|
+
<JumpLinksItem>Inactive section</JumpLinksItem>
|
|
7
|
+
<JumpLinksItem isActive>Active section</JumpLinksItem>
|
|
8
|
+
<JumpLinksItem>Inactive section</JumpLinksItem>
|
|
9
|
+
</JumpLinks>
|
|
10
|
+
);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { JumpLinks, JumpLinksItem } from '@patternfly/react-core';
|
|
3
|
+
|
|
4
|
+
export const JumpLinksWithCenteredList: React.FunctionComponent = () => (
|
|
5
|
+
<JumpLinks isCentered>
|
|
6
|
+
<JumpLinksItem>Inactive section</JumpLinksItem>
|
|
7
|
+
<JumpLinksItem isActive>Active section</JumpLinksItem>
|
|
8
|
+
<JumpLinksItem>Inactive section</JumpLinksItem>
|
|
9
|
+
</JumpLinks>
|
|
10
|
+
);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { JumpLinks, JumpLinksItem } from '@patternfly/react-core';
|
|
3
|
+
|
|
4
|
+
export const JumpLinksWithLabel: React.FunctionComponent = () => (
|
|
5
|
+
<>
|
|
6
|
+
<JumpLinks label="Jump to section">
|
|
7
|
+
<JumpLinksItem>Inactive section</JumpLinksItem>
|
|
8
|
+
<JumpLinksItem isActive>Active section</JumpLinksItem>
|
|
9
|
+
<JumpLinksItem>Inactive section</JumpLinksItem>
|
|
10
|
+
</JumpLinks>
|
|
11
|
+
<JumpLinks isCentered label="Jump to section">
|
|
12
|
+
<JumpLinksItem>Inactive section</JumpLinksItem>
|
|
13
|
+
<JumpLinksItem isActive>Active section</JumpLinksItem>
|
|
14
|
+
<JumpLinksItem>Inactive section</JumpLinksItem>
|
|
15
|
+
</JumpLinks>
|
|
16
|
+
</>
|
|
17
|
+
);
|
|
@@ -13,196 +13,30 @@ import InfoCircleIcon from '@patternfly/react-icons/dist/esm/icons/info-circle-i
|
|
|
13
13
|
|
|
14
14
|
### Basic
|
|
15
15
|
|
|
16
|
-
```
|
|
17
|
-
import React from 'react';
|
|
18
|
-
import { Label, LabelGroup } from '@patternfly/react-core';
|
|
19
|
-
import InfoCircleIcon from '@patternfly/react-icons/dist/esm/icons/info-circle-icon';
|
|
20
|
-
|
|
21
|
-
<LabelGroup>
|
|
22
|
-
<Label icon={<InfoCircleIcon />}>Label 1</Label>
|
|
23
|
-
<Label icon={<InfoCircleIcon />} color="blue">
|
|
24
|
-
Label 2
|
|
25
|
-
</Label>
|
|
26
|
-
<Label icon={<InfoCircleIcon />} color="green">
|
|
27
|
-
Label 3
|
|
28
|
-
</Label>
|
|
29
|
-
</LabelGroup>;
|
|
16
|
+
```ts file="LabelGroupBasic.tsx"
|
|
30
17
|
```
|
|
31
18
|
|
|
32
19
|
### Overflow
|
|
33
20
|
|
|
34
|
-
```
|
|
35
|
-
import React from 'react';
|
|
36
|
-
import { Label, LabelGroup } from '@patternfly/react-core';
|
|
37
|
-
import InfoCircleIcon from '@patternfly/react-icons/dist/esm/icons/info-circle-icon';
|
|
38
|
-
|
|
39
|
-
<LabelGroup>
|
|
40
|
-
<Label icon={<InfoCircleIcon />}>Label 1</Label>
|
|
41
|
-
<Label icon={<InfoCircleIcon />} color="blue">
|
|
42
|
-
Label 2
|
|
43
|
-
</Label>
|
|
44
|
-
<Label icon={<InfoCircleIcon />} color="green">
|
|
45
|
-
Label 3
|
|
46
|
-
</Label>
|
|
47
|
-
<Label icon={<InfoCircleIcon />} color="orange">
|
|
48
|
-
Label 4
|
|
49
|
-
</Label>
|
|
50
|
-
<Label icon={<InfoCircleIcon />} color="red">
|
|
51
|
-
Label 5
|
|
52
|
-
</Label>
|
|
53
|
-
<Label icon={<InfoCircleIcon />} color="purple">
|
|
54
|
-
Label 6
|
|
55
|
-
</Label>
|
|
56
|
-
</LabelGroup>;
|
|
21
|
+
```ts file="LabelGroupOverflow.tsx"
|
|
57
22
|
```
|
|
58
23
|
|
|
59
24
|
### Category
|
|
60
25
|
|
|
61
|
-
```
|
|
62
|
-
import React from 'react';
|
|
63
|
-
import { Label, LabelGroup } from '@patternfly/react-core';
|
|
64
|
-
import InfoCircleIcon from '@patternfly/react-icons/dist/esm/icons/info-circle-icon';
|
|
65
|
-
|
|
66
|
-
<LabelGroup categoryName="Group label">
|
|
67
|
-
<Label icon={<InfoCircleIcon />}>Label 1</Label>
|
|
68
|
-
<Label icon={<InfoCircleIcon />} color="blue">
|
|
69
|
-
Label 2
|
|
70
|
-
</Label>
|
|
71
|
-
<Label icon={<InfoCircleIcon />} color="green">
|
|
72
|
-
Label 3
|
|
73
|
-
</Label>
|
|
74
|
-
</LabelGroup>;
|
|
26
|
+
```ts file="LabelGroupCategory.tsx"
|
|
75
27
|
```
|
|
76
28
|
|
|
77
29
|
### Category removable
|
|
78
30
|
|
|
79
|
-
```
|
|
80
|
-
import React from 'react';
|
|
81
|
-
import { Label, LabelGroup } from '@patternfly/react-core';
|
|
82
|
-
import InfoCircleIcon from '@patternfly/react-icons/dist/esm/icons/info-circle-icon';
|
|
83
|
-
|
|
84
|
-
CategoryLabelGroupRemovable = () => {
|
|
85
|
-
const [labels, setLabels] = React.useState([
|
|
86
|
-
['Label 1', 'grey'],
|
|
87
|
-
['Label 2', 'blue'],
|
|
88
|
-
['Label 3', 'green'],
|
|
89
|
-
['Label 4', 'orange'],
|
|
90
|
-
['Label 5', 'red']
|
|
91
|
-
]);
|
|
92
|
-
const deleteCategory = () => setLabels([]);
|
|
93
|
-
|
|
94
|
-
return (
|
|
95
|
-
<LabelGroup categoryName="Group label" isClosable onClick={deleteCategory}>
|
|
96
|
-
{labels.map(([labelText, labelColor]) => (
|
|
97
|
-
<Label icon={<InfoCircleIcon />} color={labelColor} key={labelText}>
|
|
98
|
-
{labelText}
|
|
99
|
-
</Label>
|
|
100
|
-
))}
|
|
101
|
-
</LabelGroup>
|
|
102
|
-
);
|
|
103
|
-
};
|
|
31
|
+
```ts file="LabelGroupCategoryRemovable.tsx"
|
|
104
32
|
```
|
|
105
33
|
|
|
106
34
|
### Vertical category overflow removable
|
|
107
35
|
|
|
108
|
-
```
|
|
109
|
-
import React from 'react';
|
|
110
|
-
import { Label, LabelGroup } from '@patternfly/react-core';
|
|
111
|
-
import InfoCircleIcon from '@patternfly/react-icons/dist/esm/icons/info-circle-icon';
|
|
112
|
-
|
|
113
|
-
VerticalCategoryLabelGroupOverflowRemovable = () => {
|
|
114
|
-
const [labels, setLabels] = React.useState([
|
|
115
|
-
['Label 1', 'grey'],
|
|
116
|
-
['Label 2', 'blue'],
|
|
117
|
-
['Label 3', 'green'],
|
|
118
|
-
['Label 4', 'orange'],
|
|
119
|
-
['Label 5', 'red']
|
|
120
|
-
]);
|
|
121
|
-
const deleteCategory = () => setLabels([]);
|
|
122
|
-
|
|
123
|
-
return (
|
|
124
|
-
<LabelGroup categoryName="Group label with a very long name" isVertical isClosable onClick={deleteCategory}>
|
|
125
|
-
{labels.map(([labelText, labelColor]) => (
|
|
126
|
-
<Label icon={<InfoCircleIcon />} color={labelColor} key={labelText}>
|
|
127
|
-
{labelText}
|
|
128
|
-
</Label>
|
|
129
|
-
))}
|
|
130
|
-
</LabelGroup>
|
|
131
|
-
);
|
|
132
|
-
};
|
|
36
|
+
```ts file="LabelGroupVerticalCategoryOverflowRemovable.tsx"
|
|
133
37
|
```
|
|
134
38
|
|
|
135
39
|
### Editable labels
|
|
136
40
|
|
|
137
|
-
```
|
|
138
|
-
import React from 'react';
|
|
139
|
-
import { LabelGroup, Label, TextArea } from '@patternfly/react-core';
|
|
140
|
-
|
|
141
|
-
class EditableLabelGroup extends React.Component {
|
|
142
|
-
constructor(props) {
|
|
143
|
-
super(props);
|
|
144
|
-
this.state = {
|
|
145
|
-
label1: 'Editable label',
|
|
146
|
-
label2: 'Editable label 2',
|
|
147
|
-
label3: 'Editable label 3'
|
|
148
|
-
};
|
|
149
|
-
this.onEditCancel = (prevText, label) => {
|
|
150
|
-
this.setState({
|
|
151
|
-
[label]: prevText
|
|
152
|
-
});
|
|
153
|
-
};
|
|
154
|
-
this.onEditComplete = (newText, label) => {
|
|
155
|
-
this.setState({
|
|
156
|
-
[label]: newText
|
|
157
|
-
});
|
|
158
|
-
};
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
render() {
|
|
162
|
-
return (
|
|
163
|
-
<LabelGroup numLabels={5} isEditable>
|
|
164
|
-
<Label
|
|
165
|
-
color="blue"
|
|
166
|
-
onClose={Function.prototype}
|
|
167
|
-
onEditCancel={prevText => this.onEditCancel(prevText, 'label1')}
|
|
168
|
-
onEditComplete={newText => this.onEditComplete(newText, 'label1')}
|
|
169
|
-
isEditable
|
|
170
|
-
editableProps={{
|
|
171
|
-
'aria-label': 'Editable text',
|
|
172
|
-
id: 'editable-label-1'
|
|
173
|
-
}}
|
|
174
|
-
>
|
|
175
|
-
{this.state.label1}
|
|
176
|
-
</Label>
|
|
177
|
-
<Label color="green">Static label</Label>
|
|
178
|
-
<Label
|
|
179
|
-
color="blue"
|
|
180
|
-
onClose={Function.prototype}
|
|
181
|
-
onEditCancel={prevText => this.onEditCancel(prevText, 'label2')}
|
|
182
|
-
onEditComplete={newText => this.onEditComplete(newText, 'label2')}
|
|
183
|
-
isEditable
|
|
184
|
-
editableProps={{
|
|
185
|
-
'aria-label': 'Editable text 2',
|
|
186
|
-
id: 'editable-label-2'
|
|
187
|
-
}}
|
|
188
|
-
>
|
|
189
|
-
{this.state.label2}
|
|
190
|
-
</Label>
|
|
191
|
-
<Label
|
|
192
|
-
color="blue"
|
|
193
|
-
onClose={Function.prototype}
|
|
194
|
-
onEditCancel={prevText => this.onEditCancel(prevText, 'label3')}
|
|
195
|
-
onEditComplete={newText => this.onEditComplete(newText, 'label3')}
|
|
196
|
-
isEditable
|
|
197
|
-
editableProps={{
|
|
198
|
-
'aria-label': 'Editable text 3',
|
|
199
|
-
id: 'editable-label-3'
|
|
200
|
-
}}
|
|
201
|
-
>
|
|
202
|
-
{this.state.label3}
|
|
203
|
-
</Label>
|
|
204
|
-
</LabelGroup>
|
|
205
|
-
);
|
|
206
|
-
}
|
|
207
|
-
}
|
|
41
|
+
```ts file="LabelGroupEditableLabels.tsx" isBeta
|
|
208
42
|
```
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Label, LabelGroup } from '@patternfly/react-core';
|
|
3
|
+
import InfoCircleIcon from '@patternfly/react-icons/dist/esm/icons/info-circle-icon';
|
|
4
|
+
|
|
5
|
+
export const LabelGroupBasic: React.FunctionComponent = () => (
|
|
6
|
+
<LabelGroup>
|
|
7
|
+
<Label icon={<InfoCircleIcon />}>Label 1</Label>
|
|
8
|
+
<Label icon={<InfoCircleIcon />} color="blue">
|
|
9
|
+
Label 2
|
|
10
|
+
</Label>
|
|
11
|
+
<Label icon={<InfoCircleIcon />} color="green">
|
|
12
|
+
Label 3
|
|
13
|
+
</Label>
|
|
14
|
+
</LabelGroup>
|
|
15
|
+
);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Label, LabelGroup } from '@patternfly/react-core';
|
|
3
|
+
import InfoCircleIcon from '@patternfly/react-icons/dist/esm/icons/info-circle-icon';
|
|
4
|
+
|
|
5
|
+
export const LabelGroupCategory: React.FunctionComponent = () => (
|
|
6
|
+
<LabelGroup categoryName="Group label">
|
|
7
|
+
<Label icon={<InfoCircleIcon />}>Label 1</Label>
|
|
8
|
+
<Label icon={<InfoCircleIcon />} color="blue">
|
|
9
|
+
Label 2
|
|
10
|
+
</Label>
|
|
11
|
+
<Label icon={<InfoCircleIcon />} color="green">
|
|
12
|
+
Label 3
|
|
13
|
+
</Label>
|
|
14
|
+
</LabelGroup>
|
|
15
|
+
);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Label, LabelGroup, LabelProps } from '@patternfly/react-core';
|
|
3
|
+
import InfoCircleIcon from '@patternfly/react-icons/dist/esm/icons/info-circle-icon';
|
|
4
|
+
|
|
5
|
+
export const LabelGroupCategoryRemovable: React.FunctionComponent = () => {
|
|
6
|
+
const [labels, setLabels] = React.useState([
|
|
7
|
+
['Label 1', 'grey'],
|
|
8
|
+
['Label 2', 'blue'],
|
|
9
|
+
['Label 3', 'green'],
|
|
10
|
+
['Label 4', 'orange'],
|
|
11
|
+
['Label 5', 'red']
|
|
12
|
+
]);
|
|
13
|
+
const deleteCategory = () => setLabels([]);
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<LabelGroup categoryName="Group label" isClosable onClick={deleteCategory}>
|
|
17
|
+
{labels.map(([labelText, labelColor]) => (
|
|
18
|
+
<Label icon={<InfoCircleIcon />} color={labelColor as LabelProps['color']} key={labelText}>
|
|
19
|
+
{labelText}
|
|
20
|
+
</Label>
|
|
21
|
+
))}
|
|
22
|
+
</LabelGroup>
|
|
23
|
+
);
|
|
24
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { LabelGroup, Label } from '@patternfly/react-core';
|
|
3
|
+
|
|
4
|
+
export const LabelGroupEditableLabels: React.FunctionComponent = () => {
|
|
5
|
+
const [label1, setLabel1] = React.useState('Editable label');
|
|
6
|
+
const [label2, setLabel2] = React.useState('Editable label 2');
|
|
7
|
+
const [label3, setLabel3] = React.useState('Editable label 3');
|
|
8
|
+
|
|
9
|
+
return (
|
|
10
|
+
<LabelGroup numLabels={5} isEditable>
|
|
11
|
+
<Label
|
|
12
|
+
color="blue"
|
|
13
|
+
onClose={() => Function.prototype}
|
|
14
|
+
onEditCancel={prevText => setLabel1(prevText)}
|
|
15
|
+
onEditComplete={newText => setLabel1(newText)}
|
|
16
|
+
isEditable
|
|
17
|
+
editableProps={{
|
|
18
|
+
'aria-label': 'Editable text',
|
|
19
|
+
id: 'editable-label-1'
|
|
20
|
+
}}
|
|
21
|
+
>
|
|
22
|
+
{label1}
|
|
23
|
+
</Label>
|
|
24
|
+
<Label color="green">Static label</Label>
|
|
25
|
+
<Label
|
|
26
|
+
color="blue"
|
|
27
|
+
onClose={() => Function.prototype}
|
|
28
|
+
onEditCancel={prevText => setLabel2(prevText)}
|
|
29
|
+
onEditComplete={newText => setLabel2(newText)}
|
|
30
|
+
isEditable
|
|
31
|
+
editableProps={{
|
|
32
|
+
'aria-label': 'Editable text 2',
|
|
33
|
+
id: 'editable-label-2'
|
|
34
|
+
}}
|
|
35
|
+
>
|
|
36
|
+
{label2}
|
|
37
|
+
</Label>
|
|
38
|
+
<Label
|
|
39
|
+
color="blue"
|
|
40
|
+
onClose={() => Function.prototype}
|
|
41
|
+
onEditCancel={prevText => setLabel3(prevText)}
|
|
42
|
+
onEditComplete={newText => setLabel3(newText)}
|
|
43
|
+
isEditable
|
|
44
|
+
editableProps={{
|
|
45
|
+
'aria-label': 'Editable text 3',
|
|
46
|
+
id: 'editable-label-3'
|
|
47
|
+
}}
|
|
48
|
+
>
|
|
49
|
+
{label3}
|
|
50
|
+
</Label>
|
|
51
|
+
</LabelGroup>
|
|
52
|
+
);
|
|
53
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Label, LabelGroup } from '@patternfly/react-core';
|
|
3
|
+
import InfoCircleIcon from '@patternfly/react-icons/dist/esm/icons/info-circle-icon';
|
|
4
|
+
|
|
5
|
+
export const LabelGroupOverflow: React.FunctionComponent = () => (
|
|
6
|
+
<LabelGroup>
|
|
7
|
+
<Label icon={<InfoCircleIcon />}>Label 1</Label>
|
|
8
|
+
<Label icon={<InfoCircleIcon />} color="blue">
|
|
9
|
+
Label 2
|
|
10
|
+
</Label>
|
|
11
|
+
<Label icon={<InfoCircleIcon />} color="green">
|
|
12
|
+
Label 3
|
|
13
|
+
</Label>
|
|
14
|
+
<Label icon={<InfoCircleIcon />} color="orange">
|
|
15
|
+
Label 4
|
|
16
|
+
</Label>
|
|
17
|
+
<Label icon={<InfoCircleIcon />} color="red">
|
|
18
|
+
Label 5
|
|
19
|
+
</Label>
|
|
20
|
+
<Label icon={<InfoCircleIcon />} color="purple">
|
|
21
|
+
Label 6
|
|
22
|
+
</Label>
|
|
23
|
+
</LabelGroup>
|
|
24
|
+
);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Label, LabelGroup, LabelProps } from '@patternfly/react-core';
|
|
3
|
+
import InfoCircleIcon from '@patternfly/react-icons/dist/esm/icons/info-circle-icon';
|
|
4
|
+
|
|
5
|
+
export const LabelGroupVerticalCategoryOverflowRemovable: React.FunctionComponent = () => {
|
|
6
|
+
const [labels, setLabels] = React.useState([
|
|
7
|
+
['Label 1', 'grey'],
|
|
8
|
+
['Label 2', 'blue'],
|
|
9
|
+
['Label 3', 'green'],
|
|
10
|
+
['Label 4', 'orange'],
|
|
11
|
+
['Label 5', 'red']
|
|
12
|
+
]);
|
|
13
|
+
const deleteCategory = () => setLabels([]);
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<LabelGroup categoryName="Group label with a very long name" isVertical isClosable onClick={deleteCategory}>
|
|
17
|
+
{labels.map(([labelText, labelColor]) => (
|
|
18
|
+
<Label icon={<InfoCircleIcon />} color={labelColor as LabelProps['color']} key={labelText}>
|
|
19
|
+
{labelText}
|
|
20
|
+
</Label>
|
|
21
|
+
))}
|
|
22
|
+
</LabelGroup>
|
|
23
|
+
);
|
|
24
|
+
};
|
|
@@ -5,97 +5,35 @@ cssPrefix: pf-c-list
|
|
|
5
5
|
propComponents: ['List', 'ListItem']
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
8
|
+
import BookOpenIcon from '@patternfly/react-icons/dist/esm/icons/book-open-icon';
|
|
9
|
+
import KeyIcon from '@patternfly/react-icons/dist/esm/icons/key-icon';
|
|
10
|
+
import DesktopIcon from '@patternfly/react-icons/dist/esm/icons/desktop-icon';
|
|
11
11
|
|
|
12
12
|
## Examples
|
|
13
13
|
### Basic
|
|
14
|
-
```
|
|
15
|
-
import React from 'react';
|
|
16
|
-
import { List, ListItem } from '@patternfly/react-core';
|
|
17
|
-
|
|
18
|
-
<List>
|
|
19
|
-
<ListItem>First</ListItem>
|
|
20
|
-
<ListItem>Second</ListItem>
|
|
21
|
-
<ListItem>Third</ListItem>
|
|
22
|
-
</List>
|
|
14
|
+
```ts file="./ListBasic.tsx"
|
|
23
15
|
```
|
|
24
16
|
|
|
25
17
|
### Inline
|
|
26
|
-
```
|
|
27
|
-
import React from 'react';
|
|
28
|
-
import { List, ListItem, ListVariant } from '@patternfly/react-core';
|
|
29
|
-
|
|
30
|
-
<List variant={ListVariant.inline}>
|
|
31
|
-
<ListItem>First</ListItem>
|
|
32
|
-
<ListItem>Second</ListItem>
|
|
33
|
-
<ListItem>Third</ListItem>
|
|
34
|
-
</List>
|
|
18
|
+
```ts file="./ListInline.tsx"
|
|
35
19
|
```
|
|
36
20
|
|
|
37
21
|
### Ordered
|
|
38
|
-
```
|
|
39
|
-
import React from 'react';
|
|
40
|
-
import { List, ListItem, ListComponent, OrderType } from '@patternfly/react-core';
|
|
41
|
-
|
|
42
|
-
<List component={ListComponent.ol} type={OrderType.number}>
|
|
43
|
-
<ListItem>First</ListItem>
|
|
44
|
-
<ListItem>Second</ListItem>
|
|
45
|
-
<ListItem>Third</ListItem>
|
|
46
|
-
</List>
|
|
22
|
+
```ts file="./ListOrdered.tsx"
|
|
47
23
|
```
|
|
48
24
|
|
|
49
25
|
### Plain
|
|
50
|
-
```
|
|
51
|
-
import React from 'react';
|
|
52
|
-
import { List, ListItem } from '@patternfly/react-core';
|
|
53
|
-
|
|
54
|
-
<List isPlain>
|
|
55
|
-
<ListItem>First</ListItem>
|
|
56
|
-
<ListItem>Second</ListItem>
|
|
57
|
-
<ListItem>Third</ListItem>
|
|
58
|
-
</List>
|
|
26
|
+
```ts file="./ListPlain.tsx"
|
|
59
27
|
```
|
|
60
28
|
|
|
61
29
|
### With horizontal rules
|
|
62
|
-
```
|
|
63
|
-
import React from 'react';
|
|
64
|
-
import { List, ListItem } from '@patternfly/react-core';
|
|
65
|
-
|
|
66
|
-
<List isPlain isBordered>
|
|
67
|
-
<ListItem>First</ListItem>
|
|
68
|
-
<ListItem>Second</ListItem>
|
|
69
|
-
<ListItem>Third</ListItem>
|
|
70
|
-
</List>
|
|
30
|
+
```ts file="./ListHorizontalRules.tsx"
|
|
71
31
|
```
|
|
72
32
|
|
|
73
33
|
### With icons
|
|
74
|
-
```
|
|
75
|
-
import React from 'react';
|
|
76
|
-
import { List, ListItem } from '@patternfly/react-core';
|
|
77
|
-
import BookOpen from '@patternfly/react-icons/dist/esm/icons/book-open-icon';
|
|
78
|
-
import Key from '@patternfly/react-icons/dist/esm/icons/key-icon';
|
|
79
|
-
import Desktop from '@patternfly/react-icons/dist/esm/icons/desktop-icon';
|
|
80
|
-
|
|
81
|
-
<List isPlain>
|
|
82
|
-
<ListItem icon={<BookOpen />}>First</ListItem>
|
|
83
|
-
<ListItem icon={<Key />}>Second</ListItem>
|
|
84
|
-
<ListItem icon={<Desktop />}>Third</ListItem>
|
|
85
|
-
</List>
|
|
34
|
+
```ts file="./ListIcons.tsx"
|
|
86
35
|
```
|
|
87
36
|
|
|
88
37
|
### With large icons
|
|
89
|
-
```
|
|
90
|
-
import React from 'react';
|
|
91
|
-
import { List, ListItem } from '@patternfly/react-core';
|
|
92
|
-
import BookOpen from '@patternfly/react-icons/dist/esm/icons/book-open-icon';
|
|
93
|
-
import Key from '@patternfly/react-icons/dist/esm/icons/key-icon';
|
|
94
|
-
import Desktop from '@patternfly/react-icons/dist/esm/icons/desktop-icon';
|
|
95
|
-
|
|
96
|
-
<List isPlain iconSize="large">
|
|
97
|
-
<ListItem icon={<BookOpen />}>First</ListItem>
|
|
98
|
-
<ListItem icon={<Key />}>Second</ListItem>
|
|
99
|
-
<ListItem icon={<Desktop />}>Third</ListItem>
|
|
100
|
-
</List>
|
|
38
|
+
```ts file="./ListLargeIcons.tsx"
|
|
101
39
|
```
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { List, ListItem } from '@patternfly/react-core';
|
|
3
|
+
|
|
4
|
+
export const ListHorizontalRules: React.FunctionComponent = () => (
|
|
5
|
+
<List isPlain isBordered>
|
|
6
|
+
<ListItem>First</ListItem>
|
|
7
|
+
<ListItem>Second</ListItem>
|
|
8
|
+
<ListItem>Third</ListItem>
|
|
9
|
+
</List>
|
|
10
|
+
);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { List, ListItem } from '@patternfly/react-core';
|
|
3
|
+
import BookOpenIcon from '@patternfly/react-icons/dist/esm/icons/book-open-icon';
|
|
4
|
+
import KeyIcon from '@patternfly/react-icons/dist/esm/icons/key-icon';
|
|
5
|
+
import DesktopIcon from '@patternfly/react-icons/dist/esm/icons/desktop-icon';
|
|
6
|
+
|
|
7
|
+
export const ListIcons: React.FunctionComponent = () => (
|
|
8
|
+
<List isPlain>
|
|
9
|
+
<ListItem icon={<BookOpenIcon />}>First</ListItem>
|
|
10
|
+
<ListItem icon={<KeyIcon />}>Second</ListItem>
|
|
11
|
+
<ListItem icon={<DesktopIcon />}>Third</ListItem>
|
|
12
|
+
</List>
|
|
13
|
+
);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { List, ListItem, ListVariant } from '@patternfly/react-core';
|
|
3
|
+
|
|
4
|
+
export const ListInline: React.FunctionComponent = () => (
|
|
5
|
+
<List variant={ListVariant.inline}>
|
|
6
|
+
<ListItem>First</ListItem>
|
|
7
|
+
<ListItem>Second</ListItem>
|
|
8
|
+
<ListItem>Third</ListItem>
|
|
9
|
+
</List>
|
|
10
|
+
);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { List, ListItem } from '@patternfly/react-core';
|
|
3
|
+
import BookOpenIcon from '@patternfly/react-icons/dist/esm/icons/book-open-icon';
|
|
4
|
+
import KeyIcon from '@patternfly/react-icons/dist/esm/icons/key-icon';
|
|
5
|
+
import DesktopIcon from '@patternfly/react-icons/dist/esm/icons/desktop-icon';
|
|
6
|
+
|
|
7
|
+
export const ListLargeIcons: React.FunctionComponent = () => (
|
|
8
|
+
<List isPlain iconSize="large">
|
|
9
|
+
<ListItem icon={<BookOpenIcon />}>First</ListItem>
|
|
10
|
+
<ListItem icon={<KeyIcon />}>Second</ListItem>
|
|
11
|
+
<ListItem icon={<DesktopIcon />}>Third</ListItem>
|
|
12
|
+
</List>
|
|
13
|
+
);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { List, ListItem, ListComponent, OrderType } from '@patternfly/react-core';
|
|
3
|
+
|
|
4
|
+
export const ListOrdered: React.FunctionComponent = () => (
|
|
5
|
+
<List component={ListComponent.ol} type={OrderType.number}>
|
|
6
|
+
<ListItem>First</ListItem>
|
|
7
|
+
<ListItem>Second</ListItem>
|
|
8
|
+
<ListItem>Third</ListItem>
|
|
9
|
+
</List>
|
|
10
|
+
);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { List, ListItem } from '@patternfly/react-core';
|
|
3
|
+
|
|
4
|
+
export const ListPlain: React.FunctionComponent = () => (
|
|
5
|
+
<List isPlain>
|
|
6
|
+
<ListItem>First</ListItem>
|
|
7
|
+
<ListItem>Second</ListItem>
|
|
8
|
+
<ListItem>Third</ListItem>
|
|
9
|
+
</List>
|
|
10
|
+
);
|
package/src/components/OptionsMenu/__tests__/Generated/__snapshots__/OptionsMenuItem.test.tsx.snap
CHANGED
|
@@ -4,7 +4,7 @@ exports[`OptionsMenuItem should match snapshot 1`] = `
|
|
|
4
4
|
<DocumentFragment>
|
|
5
5
|
<li
|
|
6
6
|
id="''"
|
|
7
|
-
role="
|
|
7
|
+
role="none"
|
|
8
8
|
>
|
|
9
9
|
<button
|
|
10
10
|
aria-disabled="true"
|
|
@@ -12,6 +12,7 @@ exports[`OptionsMenuItem should match snapshot 1`] = `
|
|
|
12
12
|
data-ouia-component-id="OUIA-Generated-DropdownItem-1"
|
|
13
13
|
data-ouia-component-type="PF4/DropdownItem"
|
|
14
14
|
data-ouia-safe="true"
|
|
15
|
+
role="menuitem"
|
|
15
16
|
tabindex="-1"
|
|
16
17
|
type="button"
|
|
17
18
|
>
|