@patternfly/react-core 5.0.0-alpha.28 → 5.0.0-alpha.29
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 +6 -0
- package/components/Card/Card.js +1 -1
- package/components/Card/Card.js.map +1 -1
- package/components/Card/CardActions.d.ts +2 -2
- package/components/Card/CardActions.js +1 -1
- package/components/Card/CardActions.js.map +1 -1
- package/components/Card/CardBody.js +1 -1
- package/components/Card/CardBody.js.map +1 -1
- package/components/Card/CardExpandableContent.js +1 -1
- package/components/Card/CardExpandableContent.js.map +1 -1
- package/components/Card/CardFooter.js +1 -1
- package/components/Card/CardFooter.js.map +1 -1
- package/components/Card/CardHeader.d.ts +12 -2
- package/components/Card/CardHeader.d.ts.map +1 -1
- package/components/Card/CardHeader.js +9 -3
- package/components/Card/CardHeader.js.map +1 -1
- package/components/Card/CardHeaderMain.d.ts.map +1 -1
- package/components/Card/CardHeaderMain.js +4 -2
- package/components/Card/CardHeaderMain.js.map +1 -1
- package/components/Card/CardTitle.js +1 -1
- package/components/Card/CardTitle.js.map +1 -1
- package/components/Card/index.d.ts +0 -2
- package/components/Card/index.d.ts.map +1 -1
- package/components/Card/index.js +0 -2
- package/components/Card/index.js.map +1 -1
- package/dist/esm/components/Card/Card.js +1 -1
- package/dist/esm/components/Card/Card.js.map +1 -1
- package/dist/esm/components/Card/CardActions.d.ts +2 -2
- package/dist/esm/components/Card/CardActions.js +1 -1
- package/dist/esm/components/Card/CardActions.js.map +1 -1
- package/dist/esm/components/Card/CardBody.js +1 -1
- package/dist/esm/components/Card/CardBody.js.map +1 -1
- package/dist/esm/components/Card/CardExpandableContent.js +1 -1
- package/dist/esm/components/Card/CardExpandableContent.js.map +1 -1
- package/dist/esm/components/Card/CardFooter.js +1 -1
- package/dist/esm/components/Card/CardFooter.js.map +1 -1
- package/dist/esm/components/Card/CardHeader.d.ts +12 -2
- package/dist/esm/components/Card/CardHeader.d.ts.map +1 -1
- package/dist/esm/components/Card/CardHeader.js +9 -3
- package/dist/esm/components/Card/CardHeader.js.map +1 -1
- package/dist/esm/components/Card/CardHeaderMain.d.ts.map +1 -1
- package/dist/esm/components/Card/CardHeaderMain.js +4 -2
- package/dist/esm/components/Card/CardHeaderMain.js.map +1 -1
- package/dist/esm/components/Card/CardTitle.js +1 -1
- package/dist/esm/components/Card/CardTitle.js.map +1 -1
- package/dist/esm/components/Card/index.d.ts +0 -2
- package/dist/esm/components/Card/index.d.ts.map +1 -1
- package/dist/esm/components/Card/index.js +0 -2
- package/dist/esm/components/Card/index.js.map +1 -1
- package/dist/js/components/Card/Card.js +1 -1
- package/dist/js/components/Card/Card.js.map +1 -1
- package/dist/js/components/Card/CardActions.d.ts +2 -2
- package/dist/js/components/Card/CardActions.js +1 -1
- package/dist/js/components/Card/CardActions.js.map +1 -1
- package/dist/js/components/Card/CardBody.js +1 -1
- package/dist/js/components/Card/CardBody.js.map +1 -1
- package/dist/js/components/Card/CardExpandableContent.js +1 -1
- package/dist/js/components/Card/CardExpandableContent.js.map +1 -1
- package/dist/js/components/Card/CardFooter.js +1 -1
- package/dist/js/components/Card/CardFooter.js.map +1 -1
- package/dist/js/components/Card/CardHeader.d.ts +12 -2
- package/dist/js/components/Card/CardHeader.d.ts.map +1 -1
- package/dist/js/components/Card/CardHeader.js +9 -3
- package/dist/js/components/Card/CardHeader.js.map +1 -1
- package/dist/js/components/Card/CardHeaderMain.d.ts.map +1 -1
- package/dist/js/components/Card/CardHeaderMain.js +4 -2
- package/dist/js/components/Card/CardHeaderMain.js.map +1 -1
- package/dist/js/components/Card/CardTitle.js +1 -1
- package/dist/js/components/Card/CardTitle.js.map +1 -1
- package/dist/js/components/Card/index.d.ts +0 -2
- package/dist/js/components/Card/index.d.ts.map +1 -1
- package/dist/js/components/Card/index.js +0 -2
- package/dist/js/components/Card/index.js.map +1 -1
- package/dist/umd/react-core.min.js +1 -1
- package/package.json +2 -2
- package/src/components/Card/Card.tsx +2 -2
- package/src/components/Card/CardActions.tsx +4 -4
- package/src/components/Card/CardBody.tsx +2 -2
- package/src/components/Card/CardExpandableContent.tsx +2 -2
- package/src/components/Card/CardFooter.tsx +2 -2
- package/src/components/Card/CardHeader.tsx +21 -6
- package/src/components/Card/CardHeaderMain.tsx +5 -3
- package/src/components/Card/CardTitle.tsx +2 -2
- package/src/components/Card/__tests__/CardHeader.test.tsx +5 -0
- package/src/components/Card/__tests__/__snapshots__/CardHeader.test.tsx.snap +14 -0
- package/src/components/Card/__tests__/__snapshots__/CardHeaderMain.test.tsx.snap +1 -1
- package/src/components/Card/examples/Card.md +6 -6
- package/src/components/Card/examples/CardBasic.tsx +1 -1
- package/src/components/Card/examples/CardExpandable.tsx +22 -19
- package/src/components/Card/examples/CardExpandableWithIcon.tsx +21 -18
- package/src/components/Card/examples/CardHeaderInCardHead.tsx +21 -19
- package/src/components/Card/examples/CardLegacySelectable.tsx +19 -18
- package/src/components/Card/examples/CardOnlyActionsInCardHead.tsx +21 -20
- package/src/components/Card/examples/CardSelectable.tsx +19 -18
- package/src/components/Card/examples/CardSelectableA11yHighlight.tsx +3 -3
- package/src/components/Card/examples/CardWithBodySectionFills.tsx +1 -1
- package/src/components/Card/examples/CardWithHeadingElement.tsx +1 -1
- package/src/components/Card/examples/CardWithImageAndActions.tsx +23 -24
- package/src/components/Card/examples/CardWithModifiers.tsx +1 -1
- package/src/components/Card/examples/CardWithMultipleBodySections.tsx +1 -1
- package/src/components/Card/examples/CardWithNoFooter.tsx +1 -1
- package/src/components/Card/examples/CardWithNoHeader.tsx +1 -1
- package/src/components/Card/index.ts +0 -2
- package/src/demos/Card/Card.md +55 -52
- package/src/demos/CardDemos.md +73 -71
- package/src/demos/PrimaryDetail.md +66 -68
- package/components/Card/CardHeadMain.d.ts +0 -9
- package/components/Card/CardHeadMain.d.ts.map +0 -1
- package/components/Card/CardHeadMain.js +0 -9
- package/components/Card/CardHeadMain.js.map +0 -1
- package/dist/esm/components/Card/CardHeadMain.d.ts +0 -9
- package/dist/esm/components/Card/CardHeadMain.d.ts.map +0 -1
- package/dist/esm/components/Card/CardHeadMain.js +0 -9
- package/dist/esm/components/Card/CardHeadMain.js.map +0 -1
- package/dist/js/components/Card/CardHeadMain.d.ts +0 -9
- package/dist/js/components/Card/CardHeadMain.d.ts.map +0 -1
- package/dist/js/components/Card/CardHeadMain.js +0 -13
- package/dist/js/components/Card/CardHeadMain.js.map +0 -1
- package/src/components/Card/CardHeadMain.tsx +0 -20
- package/src/components/Card/__tests__/CardHeadMain.test.tsx +0 -22
- package/src/components/Card/__tests__/__snapshots__/CardHeadMain.test.tsx.snap +0 -11
- package/src/components/Card/examples/CardOnlyImageInCardHead.tsx +0 -16
|
@@ -10,18 +10,18 @@ export const CardSelectableA11yHighlight: React.FunctionComponent = () => {
|
|
|
10
10
|
}
|
|
11
11
|
if ([' ', 'Enter'].includes(event.key)) {
|
|
12
12
|
event.preventDefault();
|
|
13
|
-
const newSelected = event.currentTarget.id === selected ?
|
|
13
|
+
const newSelected = event.currentTarget.id === selected ? '' : event.currentTarget.id;
|
|
14
14
|
setSelected(newSelected);
|
|
15
15
|
}
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
const onClick = (event: React.MouseEvent) => {
|
|
19
|
-
const newSelected = event.currentTarget.id === selected ?
|
|
19
|
+
const newSelected = event.currentTarget.id === selected ? '' : event.currentTarget.id;
|
|
20
20
|
setSelected(newSelected);
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
const onChange = (_event: React.FormEvent<HTMLInputElement>, labelledById: string) => {
|
|
24
|
-
const newSelected = labelledById === selected ?
|
|
24
|
+
const newSelected = labelledById === selected ? '' : labelledById;
|
|
25
25
|
setSelected(newSelected);
|
|
26
26
|
};
|
|
27
27
|
|
|
@@ -3,7 +3,7 @@ import { Card, CardTitle, CardBody, CardFooter } from '@patternfly/react-core';
|
|
|
3
3
|
|
|
4
4
|
export const CardWithBodySectionFills: React.FunctionComponent = () => (
|
|
5
5
|
<Card style={{ minHeight: '30em' }}>
|
|
6
|
-
<CardTitle>
|
|
6
|
+
<CardTitle>Title</CardTitle>
|
|
7
7
|
<CardBody isFilled={false}>Body pf-m-no-fill</CardBody>
|
|
8
8
|
<CardBody isFilled={false}>Body pf-m-no-fill</CardBody>
|
|
9
9
|
<CardBody>Body</CardBody>
|
|
@@ -3,7 +3,7 @@ import { Card, CardTitle, CardBody, CardFooter } from '@patternfly/react-core';
|
|
|
3
3
|
|
|
4
4
|
export const CardWithHeadingElement: React.FunctionComponent = () => (
|
|
5
5
|
<Card>
|
|
6
|
-
<CardTitle component="h4">
|
|
6
|
+
<CardTitle component="h4">Title within an {'<h4>'} element</CardTitle>
|
|
7
7
|
<CardBody>Body</CardBody>
|
|
8
8
|
<CardFooter>Footer</CardFooter>
|
|
9
9
|
</Card>
|
|
@@ -3,8 +3,6 @@ import {
|
|
|
3
3
|
Brand,
|
|
4
4
|
Card,
|
|
5
5
|
CardHeader,
|
|
6
|
-
CardHeaderMain,
|
|
7
|
-
CardActions,
|
|
8
6
|
CardTitle,
|
|
9
7
|
CardBody,
|
|
10
8
|
CardFooter,
|
|
@@ -49,32 +47,33 @@ export const CardWithImageAndActions: React.FunctionComponent = () => {
|
|
|
49
47
|
</DropdownItem>
|
|
50
48
|
];
|
|
51
49
|
|
|
50
|
+
const headerActions = (
|
|
51
|
+
<>
|
|
52
|
+
<Dropdown
|
|
53
|
+
onSelect={onSelect}
|
|
54
|
+
toggle={<KebabToggle onToggle={(_event: any, isOpen: boolean) => setIsOpen(isOpen)} />}
|
|
55
|
+
isOpen={isOpen}
|
|
56
|
+
isPlain
|
|
57
|
+
dropdownItems={dropdownItems}
|
|
58
|
+
position={'right'}
|
|
59
|
+
/>
|
|
60
|
+
<Checkbox
|
|
61
|
+
isChecked={isChecked}
|
|
62
|
+
onChange={(_event, checked) => onClick(checked)}
|
|
63
|
+
aria-label="card checkbox example"
|
|
64
|
+
id="check-1"
|
|
65
|
+
name="check1"
|
|
66
|
+
/>
|
|
67
|
+
</>
|
|
68
|
+
);
|
|
69
|
+
|
|
52
70
|
return (
|
|
53
71
|
<>
|
|
54
72
|
<Card>
|
|
55
|
-
<CardHeader>
|
|
56
|
-
<
|
|
57
|
-
<Brand src={pfLogo} alt="PatternFly logo" style={{ height: '50px' }} />
|
|
58
|
-
</CardHeaderMain>
|
|
59
|
-
<CardActions hasNoOffset={hasNoOffset}>
|
|
60
|
-
<Dropdown
|
|
61
|
-
onSelect={onSelect}
|
|
62
|
-
toggle={<KebabToggle onToggle={(_event: any, isOpen: boolean) => setIsOpen(isOpen)} />}
|
|
63
|
-
isOpen={isOpen}
|
|
64
|
-
isPlain
|
|
65
|
-
dropdownItems={dropdownItems}
|
|
66
|
-
position={'right'}
|
|
67
|
-
/>
|
|
68
|
-
<Checkbox
|
|
69
|
-
isChecked={isChecked}
|
|
70
|
-
onChange={(_event, checked) => onClick(checked)}
|
|
71
|
-
aria-label="card checkbox example"
|
|
72
|
-
id="check-1"
|
|
73
|
-
name="check1"
|
|
74
|
-
/>
|
|
75
|
-
</CardActions>
|
|
73
|
+
<CardHeader actions={{actions: headerActions, hasNoOffset}}>
|
|
74
|
+
<Brand src={pfLogo} alt="PatternFly logo" style={{ width: '300px' }} />
|
|
76
75
|
</CardHeader>
|
|
77
|
-
<CardTitle>
|
|
76
|
+
<CardTitle>Title</CardTitle>
|
|
78
77
|
<CardBody>Body</CardBody>
|
|
79
78
|
<CardFooter>Footer</CardFooter>
|
|
80
79
|
</Card>
|
|
@@ -23,7 +23,7 @@ export const CardWithModifiers: React.FunctionComponent = () => {
|
|
|
23
23
|
</div>
|
|
24
24
|
<div style={{ height: '15rem' }}>
|
|
25
25
|
<Card {...modifiers}>
|
|
26
|
-
<CardTitle>
|
|
26
|
+
<CardTitle>Title</CardTitle>
|
|
27
27
|
<CardBody>Body</CardBody>
|
|
28
28
|
<CardFooter>Footer</CardFooter>
|
|
29
29
|
</Card>
|
|
@@ -3,7 +3,7 @@ import { Card, CardTitle, CardBody, CardFooter } from '@patternfly/react-core';
|
|
|
3
3
|
|
|
4
4
|
export const CardWithMultipleBodySections: React.FunctionComponent = () => (
|
|
5
5
|
<Card>
|
|
6
|
-
<CardTitle>
|
|
6
|
+
<CardTitle>Title</CardTitle>
|
|
7
7
|
<CardBody>Body</CardBody>
|
|
8
8
|
<CardBody>Body</CardBody>
|
|
9
9
|
<CardBody>Body</CardBody>
|
|
@@ -3,7 +3,7 @@ import { Card, CardTitle, CardBody } from '@patternfly/react-core';
|
|
|
3
3
|
|
|
4
4
|
export const CardWithNoFooter: React.FunctionComponent = () => (
|
|
5
5
|
<Card>
|
|
6
|
-
<CardTitle>
|
|
6
|
+
<CardTitle>Title</CardTitle>
|
|
7
7
|
<CardBody>This card has no footer</CardBody>
|
|
8
8
|
</Card>
|
|
9
9
|
);
|
|
@@ -3,7 +3,7 @@ import { Card, CardBody, CardFooter } from '@patternfly/react-core';
|
|
|
3
3
|
|
|
4
4
|
export const CardWithNoHeader: React.FunctionComponent = () => (
|
|
5
5
|
<Card>
|
|
6
|
-
<CardBody>This card has no
|
|
6
|
+
<CardBody>This card has no title </CardBody>
|
|
7
7
|
<CardFooter>Footer</CardFooter>
|
|
8
8
|
</Card>
|
|
9
9
|
);
|
package/src/demos/Card/Card.md
CHANGED
|
@@ -32,7 +32,6 @@ import {
|
|
|
32
32
|
Button,
|
|
33
33
|
Card,
|
|
34
34
|
CardHeader,
|
|
35
|
-
CardActions,
|
|
36
35
|
CardTitle,
|
|
37
36
|
CardBody,
|
|
38
37
|
Checkbox,
|
|
@@ -114,7 +113,7 @@ class CardViewBasic extends React.Component {
|
|
|
114
113
|
};
|
|
115
114
|
|
|
116
115
|
this.onToolbarDropdownToggle = (_event, isLowerToolbarDropdownOpen) => {
|
|
117
|
-
this.setState(prevState => ({
|
|
116
|
+
this.setState((prevState) => ({
|
|
118
117
|
isLowerToolbarDropdownOpen
|
|
119
118
|
}));
|
|
120
119
|
};
|
|
@@ -125,7 +124,7 @@ class CardViewBasic extends React.Component {
|
|
|
125
124
|
});
|
|
126
125
|
};
|
|
127
126
|
|
|
128
|
-
this.onToolbarKebabDropdownSelect = event => {
|
|
127
|
+
this.onToolbarKebabDropdownSelect = (event) => {
|
|
129
128
|
this.setState({
|
|
130
129
|
isLowerToolbarKebabDropdownOpen: !this.state.isLowerToolbarKebabDropdownOpen
|
|
131
130
|
});
|
|
@@ -143,11 +142,11 @@ class CardViewBasic extends React.Component {
|
|
|
143
142
|
});
|
|
144
143
|
};
|
|
145
144
|
|
|
146
|
-
this.deleteItem = item => event => {
|
|
147
|
-
const filter = getter => val => getter(val) !== item.id;
|
|
145
|
+
this.deleteItem = (item) => (event) => {
|
|
146
|
+
const filter = (getter) => (val) => getter(val) !== item.id;
|
|
148
147
|
this.setState({
|
|
149
148
|
res: this.state.res.filter(filter(({ id }) => id)),
|
|
150
|
-
selectedItems: this.state.selectedItems.filter(filter(id => id))
|
|
149
|
+
selectedItems: this.state.selectedItems.filter(filter((id) => id))
|
|
151
150
|
});
|
|
152
151
|
};
|
|
153
152
|
|
|
@@ -169,7 +168,7 @@ class CardViewBasic extends React.Component {
|
|
|
169
168
|
});
|
|
170
169
|
};
|
|
171
170
|
|
|
172
|
-
this.onSplitButtonSelect = event => {
|
|
171
|
+
this.onSplitButtonSelect = (event) => {
|
|
173
172
|
this.setState((prevState, props) => {
|
|
174
173
|
return { splitButtonDropdownIsOpen: !prevState.splitButtonDropdownIsOpen };
|
|
175
174
|
});
|
|
@@ -177,12 +176,14 @@ class CardViewBasic extends React.Component {
|
|
|
177
176
|
|
|
178
177
|
this.onNameSelect = (event, selection) => {
|
|
179
178
|
const checked = event.target.checked;
|
|
180
|
-
this.setState(prevState => {
|
|
179
|
+
this.setState((prevState) => {
|
|
181
180
|
const prevSelections = prevState.filters['products'];
|
|
182
181
|
return {
|
|
183
182
|
filters: {
|
|
184
183
|
...prevState.filters,
|
|
185
|
-
['products']: checked
|
|
184
|
+
['products']: checked
|
|
185
|
+
? [...prevSelections, selection]
|
|
186
|
+
: prevSelections.filter((value) => value !== selection)
|
|
186
187
|
}
|
|
187
188
|
};
|
|
188
189
|
});
|
|
@@ -190,8 +191,8 @@ class CardViewBasic extends React.Component {
|
|
|
190
191
|
|
|
191
192
|
this.onDelete = (type = '', id = '') => {
|
|
192
193
|
if (type) {
|
|
193
|
-
this.setState(prevState => {
|
|
194
|
-
prevState.filters[type.toLowerCase()] = prevState.filters[type.toLowerCase()].filter(s => s !== id);
|
|
194
|
+
this.setState((prevState) => {
|
|
195
|
+
prevState.filters[type.toLowerCase()] = prevState.filters[type.toLowerCase()].filter((s) => s !== id);
|
|
195
196
|
return {
|
|
196
197
|
filters: prevState.filters
|
|
197
198
|
};
|
|
@@ -212,10 +213,10 @@ class CardViewBasic extends React.Component {
|
|
|
212
213
|
}
|
|
213
214
|
if ([' ', 'Enter'].includes(event.key)) {
|
|
214
215
|
event.preventDefault();
|
|
215
|
-
this.setState(prevState => {
|
|
216
|
+
this.setState((prevState) => {
|
|
216
217
|
return prevState.selectedItems.includes(productId * 1)
|
|
217
218
|
? {
|
|
218
|
-
selectedItems: [...prevState.selectedItems.filter(id => productId * 1 != id)],
|
|
219
|
+
selectedItems: [...prevState.selectedItems.filter((id) => productId * 1 != id)],
|
|
219
220
|
areAllSelected: this.checkAllSelected(prevState.selectedItems.length - 1, prevState.totalItemCount)
|
|
220
221
|
}
|
|
221
222
|
: {
|
|
@@ -226,11 +227,11 @@ class CardViewBasic extends React.Component {
|
|
|
226
227
|
}
|
|
227
228
|
};
|
|
228
229
|
|
|
229
|
-
this.onClick = productId => {
|
|
230
|
-
this.setState(prevState => {
|
|
230
|
+
this.onClick = (productId) => {
|
|
231
|
+
this.setState((prevState) => {
|
|
231
232
|
return prevState.selectedItems.includes(productId * 1)
|
|
232
233
|
? {
|
|
233
|
-
selectedItems: [...prevState.selectedItems.filter(id => productId * 1 != id)],
|
|
234
|
+
selectedItems: [...prevState.selectedItems.filter((id) => productId * 1 != id)],
|
|
234
235
|
areAllSelected: this.checkAllSelected(prevState.selectedItems.length - 1, prevState.totalItemCount)
|
|
235
236
|
}
|
|
236
237
|
: {
|
|
@@ -248,7 +249,7 @@ class CardViewBasic extends React.Component {
|
|
|
248
249
|
if (checked) {
|
|
249
250
|
selectedItems = [...selectedItems, value];
|
|
250
251
|
} else {
|
|
251
|
-
selectedItems = selectedItems.filter(el => el !== value);
|
|
252
|
+
selectedItems = selectedItems.filter((el) => el !== value);
|
|
252
253
|
if (this.state.areAllSelected) {
|
|
253
254
|
this.setState({
|
|
254
255
|
areAllSelected: !this.state.areAllSelected
|
|
@@ -336,7 +337,7 @@ class CardViewBasic extends React.Component {
|
|
|
336
337
|
|
|
337
338
|
updateSelected() {
|
|
338
339
|
const { res, selectedItems } = this.state;
|
|
339
|
-
let rows = res.map(post => {
|
|
340
|
+
let rows = res.map((post) => {
|
|
340
341
|
post.selected = selectedItems.includes(post.id);
|
|
341
342
|
return post;
|
|
342
343
|
});
|
|
@@ -348,10 +349,10 @@ class CardViewBasic extends React.Component {
|
|
|
348
349
|
|
|
349
350
|
fetch(page, perPage) {
|
|
350
351
|
fetch(`https://my-json-server.typicode.com/jenny-s51/cardviewdata/posts?_page=${page}&_limit=${perPage}`)
|
|
351
|
-
.then(resp => resp.json())
|
|
352
|
-
.then(resp => this.setState({ res: resp, perPage, page }))
|
|
352
|
+
.then((resp) => resp.json())
|
|
353
|
+
.then((resp) => this.setState({ res: resp, perPage, page }))
|
|
353
354
|
.then(() => this.updateSelected())
|
|
354
|
-
.catch(err => this.setState({ error: err }));
|
|
355
|
+
.catch((err) => this.setState({ error: err }));
|
|
355
356
|
}
|
|
356
357
|
|
|
357
358
|
componentDidMount() {
|
|
@@ -539,7 +540,7 @@ class CardViewBasic extends React.Component {
|
|
|
539
540
|
|
|
540
541
|
const filtered =
|
|
541
542
|
filters.products.length > 0
|
|
542
|
-
? res.filter(card => {
|
|
543
|
+
? res.filter((card) => {
|
|
543
544
|
return filters.products.length === 0 || filters.products.includes(card.name);
|
|
544
545
|
})
|
|
545
546
|
: res;
|
|
@@ -557,6 +558,36 @@ class CardViewBasic extends React.Component {
|
|
|
557
558
|
swaggerIcon
|
|
558
559
|
};
|
|
559
560
|
|
|
561
|
+
const headerActions = (
|
|
562
|
+
<>
|
|
563
|
+
<Dropdown
|
|
564
|
+
isPlain
|
|
565
|
+
position="right"
|
|
566
|
+
onSelect={(e) => this.onCardKebabDropdownSelect(key, e)}
|
|
567
|
+
toggle={
|
|
568
|
+
<KebabToggle
|
|
569
|
+
onToggle={(_event, isCardKebabDropdownOpen) =>
|
|
570
|
+
this.onCardKebabDropdownToggle(key, isCardKebabDropdownOpen)
|
|
571
|
+
}
|
|
572
|
+
/>
|
|
573
|
+
}
|
|
574
|
+
isOpen={this.state[key]}
|
|
575
|
+
dropdownItems={[
|
|
576
|
+
<DropdownItem key="trash" onClick={this.deleteItem(product)} position="right">
|
|
577
|
+
<TrashIcon />
|
|
578
|
+
Delete
|
|
579
|
+
</DropdownItem>
|
|
580
|
+
]}
|
|
581
|
+
/>
|
|
582
|
+
<Checkbox
|
|
583
|
+
checked={isChecked}
|
|
584
|
+
value={product.id}
|
|
585
|
+
isChecked={selectedItems.includes(product.id)}
|
|
586
|
+
aria-label="card checkbox example"
|
|
587
|
+
id={`check-${product.id}`}
|
|
588
|
+
/>
|
|
589
|
+
</>
|
|
590
|
+
);
|
|
560
591
|
return (
|
|
561
592
|
<React.Fragment>
|
|
562
593
|
<DashboardWrapper mainContainerId="main-content-card-view-default-nav" breadcrumb={null}>
|
|
@@ -590,41 +621,13 @@ class CardViewBasic extends React.Component {
|
|
|
590
621
|
isCompact
|
|
591
622
|
key={product.name}
|
|
592
623
|
id={product.name.replace(/ /g, '-')}
|
|
593
|
-
onKeyDown={e => this.onKeyDown(e, product.id)}
|
|
624
|
+
onKeyDown={(e) => this.onKeyDown(e, product.id)}
|
|
594
625
|
onClick={() => this.onClick(product.id)}
|
|
595
626
|
onSelectableInputChange={() => this.onClick(product.id)}
|
|
596
627
|
isSelected={selectedItems.includes(product.id)}
|
|
597
628
|
>
|
|
598
|
-
<CardHeader>
|
|
629
|
+
<CardHeader actions={{ actions: headerActions }}>
|
|
599
630
|
<img src={icons[product.icon]} alt={`${product.name} icon`} style={{ maxWidth: '60px' }} />
|
|
600
|
-
<CardActions>
|
|
601
|
-
<Dropdown
|
|
602
|
-
isPlain
|
|
603
|
-
position="right"
|
|
604
|
-
onSelect={e => this.onCardKebabDropdownSelect(key, e)}
|
|
605
|
-
toggle={
|
|
606
|
-
<KebabToggle
|
|
607
|
-
onToggle={(_event, isCardKebabDropdownOpen) =>
|
|
608
|
-
this.onCardKebabDropdownToggle(key, isCardKebabDropdownOpen)
|
|
609
|
-
}
|
|
610
|
-
/>
|
|
611
|
-
}
|
|
612
|
-
isOpen={this.state[key]}
|
|
613
|
-
dropdownItems={[
|
|
614
|
-
<DropdownItem key="trash" onClick={this.deleteItem(product)} position="right">
|
|
615
|
-
<TrashIcon />
|
|
616
|
-
Delete
|
|
617
|
-
</DropdownItem>
|
|
618
|
-
]}
|
|
619
|
-
/>
|
|
620
|
-
<Checkbox
|
|
621
|
-
checked={isChecked}
|
|
622
|
-
value={product.id}
|
|
623
|
-
isChecked={selectedItems.includes(product.id)}
|
|
624
|
-
aria-label="card checkbox example"
|
|
625
|
-
id={`check-${product.id}`}
|
|
626
|
-
/>
|
|
627
|
-
</CardActions>
|
|
628
631
|
</CardHeader>
|
|
629
632
|
<CardTitle>{product.name}</CardTitle>
|
|
630
633
|
<CardBody>{product.description}</CardBody>
|
package/src/demos/CardDemos.md
CHANGED
|
@@ -25,7 +25,6 @@ import React from 'react';
|
|
|
25
25
|
import {
|
|
26
26
|
Card,
|
|
27
27
|
CardHeader,
|
|
28
|
-
CardActions,
|
|
29
28
|
CardTitle,
|
|
30
29
|
CardBody,
|
|
31
30
|
CardExpandableContent,
|
|
@@ -62,7 +61,7 @@ class CardGridDemo extends React.Component {
|
|
|
62
61
|
});
|
|
63
62
|
};
|
|
64
63
|
|
|
65
|
-
this.onActionSelect = event => {
|
|
64
|
+
this.onActionSelect = (event) => {
|
|
66
65
|
this.setState({
|
|
67
66
|
isDropdownOpen: !this.state.isDropdownOpen
|
|
68
67
|
});
|
|
@@ -85,9 +84,22 @@ class CardGridDemo extends React.Component {
|
|
|
85
84
|
Action 4
|
|
86
85
|
</DropdownItem>
|
|
87
86
|
];
|
|
87
|
+
|
|
88
|
+
const headerActions = (
|
|
89
|
+
<Dropdown
|
|
90
|
+
onSelect={this.onActionSelect}
|
|
91
|
+
toggle={<KebabToggle onToggle={this.onActionToggle} />}
|
|
92
|
+
isOpen={isDropdownOpen}
|
|
93
|
+
isPlain
|
|
94
|
+
dropdownItems={dropdownItems}
|
|
95
|
+
position="right"
|
|
96
|
+
/>
|
|
97
|
+
);
|
|
98
|
+
|
|
88
99
|
return (
|
|
89
100
|
<Card id="horizontal card" isExpanded={isCardExpanded}>
|
|
90
101
|
<CardHeader
|
|
102
|
+
actions={{ actions: headerActions }}
|
|
91
103
|
onExpand={this.onCardExpand}
|
|
92
104
|
toggleButtonProps={{
|
|
93
105
|
id: 'toggle-button',
|
|
@@ -96,16 +108,6 @@ class CardGridDemo extends React.Component {
|
|
|
96
108
|
'aria-expanded': isCardExpanded
|
|
97
109
|
}}
|
|
98
110
|
>
|
|
99
|
-
<CardActions>
|
|
100
|
-
<Dropdown
|
|
101
|
-
onSelect={this.onActionSelect}
|
|
102
|
-
toggle={<KebabToggle onToggle={this.onActionToggle} />}
|
|
103
|
-
isOpen={isDropdownOpen}
|
|
104
|
-
isPlain
|
|
105
|
-
dropdownItems={dropdownItems}
|
|
106
|
-
position="right"
|
|
107
|
-
/>
|
|
108
|
-
</CardActions>
|
|
109
111
|
{isCardExpanded && <CardTitle id="titleId">Getting Started</CardTitle>}
|
|
110
112
|
{!isCardExpanded && (
|
|
111
113
|
<Level hasGutter>
|
|
@@ -781,7 +783,7 @@ const StatusPlain: React.FunctionComponent = () => {
|
|
|
781
783
|
</FlexItem>
|
|
782
784
|
<FlexItem>
|
|
783
785
|
<Popover headerContent="Control Panel Status" bodyContent={popoverBodyContent} minWidth="400px">
|
|
784
|
-
<a href="#" onClick={e => e.preventDefault()}>
|
|
786
|
+
<a href="#" onClick={(e) => e.preventDefault()}>
|
|
785
787
|
Control Panel
|
|
786
788
|
</a>
|
|
787
789
|
</Popover>
|
|
@@ -1238,7 +1240,6 @@ import {
|
|
|
1238
1240
|
Card,
|
|
1239
1241
|
CardTitle,
|
|
1240
1242
|
CardHeader,
|
|
1241
|
-
CardActions,
|
|
1242
1243
|
CardBody,
|
|
1243
1244
|
CardFooter,
|
|
1244
1245
|
Title,
|
|
@@ -1269,6 +1270,19 @@ const UtilizationCard3: React.FunctionComponent = () => {
|
|
|
1269
1270
|
<SelectOption value="Last 7 days" key="option4" />
|
|
1270
1271
|
];
|
|
1271
1272
|
|
|
1273
|
+
const headerActions = (
|
|
1274
|
+
<Select
|
|
1275
|
+
onSelect={() => setIsOpen(!isOpen)}
|
|
1276
|
+
onToggle={() => setIsOpen(!isOpen)}
|
|
1277
|
+
isOpen={isOpen}
|
|
1278
|
+
placeholderText="Filter"
|
|
1279
|
+
position="right"
|
|
1280
|
+
isPlain
|
|
1281
|
+
>
|
|
1282
|
+
{selectItems}
|
|
1283
|
+
</Select>
|
|
1284
|
+
);
|
|
1285
|
+
|
|
1272
1286
|
return (
|
|
1273
1287
|
<React.Fragment>
|
|
1274
1288
|
<b>Note:</b> Custom CSS is used in this demo to align the card title and select toggle text to{' '}
|
|
@@ -1278,24 +1292,12 @@ const UtilizationCard3: React.FunctionComponent = () => {
|
|
|
1278
1292
|
<Gallery hasGutter minWidths={{ default: '360px' }}>
|
|
1279
1293
|
<GalleryItem>
|
|
1280
1294
|
<Card id="utilization-card-3-card" component="div">
|
|
1281
|
-
<CardHeader className="pf-u-align-items-flex-start">
|
|
1295
|
+
<CardHeader className="pf-u-align-items-flex-start" actions={{ actions: headerActions, hasNoOffset: true }}>
|
|
1282
1296
|
<CardTitle>
|
|
1283
1297
|
<Title headingLevel="h4" size="lg" style={{ paddingTop: '3px' }}>
|
|
1284
1298
|
Recommendations
|
|
1285
1299
|
</Title>
|
|
1286
1300
|
</CardTitle>
|
|
1287
|
-
<CardActions hasNoOffset>
|
|
1288
|
-
<Select
|
|
1289
|
-
onSelect={() => setIsOpen(!isOpen)}
|
|
1290
|
-
onToggle={() => setIsOpen(!isOpen)}
|
|
1291
|
-
isOpen={isOpen}
|
|
1292
|
-
placeholderText="Filter"
|
|
1293
|
-
position="right"
|
|
1294
|
-
isPlain
|
|
1295
|
-
>
|
|
1296
|
-
{selectItems}
|
|
1297
|
-
</Select>
|
|
1298
|
-
</CardActions>
|
|
1299
1301
|
</CardHeader>
|
|
1300
1302
|
<CardBody>
|
|
1301
1303
|
<Flex direction={{ default: 'column' }}>
|
|
@@ -2511,7 +2513,6 @@ import {
|
|
|
2511
2513
|
CardTitle,
|
|
2512
2514
|
CardBody,
|
|
2513
2515
|
CardHeader,
|
|
2514
|
-
CardActions,
|
|
2515
2516
|
Title,
|
|
2516
2517
|
Gallery,
|
|
2517
2518
|
GalleryItem,
|
|
@@ -2532,6 +2533,20 @@ const TrendCard1: React.FunctionComponent = () => {
|
|
|
2532
2533
|
<SelectOption value="Last 24 hours" key="option3" />,
|
|
2533
2534
|
<SelectOption value="Last 7 days" key="option4" />
|
|
2534
2535
|
];
|
|
2536
|
+
|
|
2537
|
+
const headerActions = (
|
|
2538
|
+
<Select
|
|
2539
|
+
onSelect={() => setIsOpen(!isOpen)}
|
|
2540
|
+
onToggle={() => setIsOpen(!isOpen)}
|
|
2541
|
+
placeholderText="Filter"
|
|
2542
|
+
isOpen={isOpen}
|
|
2543
|
+
position="right"
|
|
2544
|
+
isPlain
|
|
2545
|
+
>
|
|
2546
|
+
{selectItems}
|
|
2547
|
+
</Select>
|
|
2548
|
+
);
|
|
2549
|
+
|
|
2535
2550
|
return (
|
|
2536
2551
|
<React.Fragment>
|
|
2537
2552
|
<b>Note:</b> Custom CSS is used in this demo to align the card title and select toggle text to{' '}
|
|
@@ -2541,7 +2556,7 @@ const TrendCard1: React.FunctionComponent = () => {
|
|
|
2541
2556
|
<Gallery hasGutter minWidths={{ default: '360px' }}>
|
|
2542
2557
|
<GalleryItem>
|
|
2543
2558
|
<Card id="trend-card-1-card" component="div">
|
|
2544
|
-
<CardHeader>
|
|
2559
|
+
<CardHeader actions={{ actions: headerActions, hasNoOffset: true }}>
|
|
2545
2560
|
<Flex direction={{ default: 'column' }} spaceItems={{ default: 'spaceItemsNone' }}>
|
|
2546
2561
|
<FlexItem>
|
|
2547
2562
|
<CardTitle>
|
|
@@ -2554,18 +2569,6 @@ const TrendCard1: React.FunctionComponent = () => {
|
|
|
2554
2569
|
<span className="pf-u-color-200">Workload</span>
|
|
2555
2570
|
</FlexItem>
|
|
2556
2571
|
</Flex>
|
|
2557
|
-
<CardActions hasNoOffset style={{ paddingTop: '1px' }}>
|
|
2558
|
-
<Select
|
|
2559
|
-
onSelect={() => setIsOpen(!isOpen)}
|
|
2560
|
-
onToggle={() => setIsOpen(!isOpen)}
|
|
2561
|
-
placeholderText="Filter"
|
|
2562
|
-
isOpen={isOpen}
|
|
2563
|
-
position="right"
|
|
2564
|
-
isPlain
|
|
2565
|
-
>
|
|
2566
|
-
{selectItems}
|
|
2567
|
-
</Select>
|
|
2568
|
-
</CardActions>
|
|
2569
2572
|
</CardHeader>
|
|
2570
2573
|
<CardBody>
|
|
2571
2574
|
<ChartGroup
|
|
@@ -2685,7 +2688,6 @@ import React from 'react';
|
|
|
2685
2688
|
import {
|
|
2686
2689
|
Card,
|
|
2687
2690
|
CardHeader,
|
|
2688
|
-
CardActions,
|
|
2689
2691
|
CardTitle,
|
|
2690
2692
|
CardBody,
|
|
2691
2693
|
CardFooter,
|
|
@@ -2703,7 +2705,7 @@ import {
|
|
|
2703
2705
|
CardLogViewDemo = () => {
|
|
2704
2706
|
const [isOpen, setIsOpen] = React.useState(false);
|
|
2705
2707
|
|
|
2706
|
-
const onActionSelect = event => {
|
|
2708
|
+
const onActionSelect = (event) => {
|
|
2707
2709
|
setIsOpen(!isOpen);
|
|
2708
2710
|
};
|
|
2709
2711
|
|
|
@@ -2718,6 +2720,19 @@ CardLogViewDemo = () => {
|
|
|
2718
2720
|
<SelectOption value="Last 7 days" key="option4" />
|
|
2719
2721
|
];
|
|
2720
2722
|
|
|
2723
|
+
const headerActions = (
|
|
2724
|
+
<Select
|
|
2725
|
+
onSelect={onActionSelect}
|
|
2726
|
+
onToggle={onActionToggle}
|
|
2727
|
+
placeholderText="Most recent"
|
|
2728
|
+
isOpen={isOpen}
|
|
2729
|
+
position="right"
|
|
2730
|
+
isPlain
|
|
2731
|
+
>
|
|
2732
|
+
{selectItems}
|
|
2733
|
+
</Select>
|
|
2734
|
+
);
|
|
2735
|
+
|
|
2721
2736
|
return (
|
|
2722
2737
|
<React.Fragment>
|
|
2723
2738
|
<b>Note:</b> Custom CSS is used in this demo to align the card title and select toggle text to{' '}
|
|
@@ -2726,19 +2741,7 @@ CardLogViewDemo = () => {
|
|
|
2726
2741
|
<br />
|
|
2727
2742
|
<Gallery hasGutter style={{ '--pf-l-gallery--GridTemplateColumns--min': '360px' }}>
|
|
2728
2743
|
<Card id="card-log-view-example">
|
|
2729
|
-
<CardHeader className="pf-u-align-items-flex-start">
|
|
2730
|
-
<CardActions hasNoOffset>
|
|
2731
|
-
<Select
|
|
2732
|
-
onSelect={onActionSelect}
|
|
2733
|
-
onToggle={onActionToggle}
|
|
2734
|
-
placeholderText="Most recent"
|
|
2735
|
-
isOpen={isOpen}
|
|
2736
|
-
position="right"
|
|
2737
|
-
isPlain
|
|
2738
|
-
>
|
|
2739
|
-
{selectItems}
|
|
2740
|
-
</Select>
|
|
2741
|
-
</CardActions>
|
|
2744
|
+
<CardHeader className="pf-u-align-items-flex-start" actions={{ actions: headerActions, hasNoOffset: true }}>
|
|
2742
2745
|
<CardTitle>
|
|
2743
2746
|
<Title headingLevel="h4" size="xl" style={{ paddingTop: '3px' }}>
|
|
2744
2747
|
Activity
|
|
@@ -2800,7 +2803,6 @@ import React from 'react';
|
|
|
2800
2803
|
import {
|
|
2801
2804
|
Card,
|
|
2802
2805
|
CardHeader,
|
|
2803
|
-
CardActions,
|
|
2804
2806
|
CardTitle,
|
|
2805
2807
|
CardBody,
|
|
2806
2808
|
CardFooter,
|
|
@@ -2823,7 +2825,7 @@ import CheckCircleIcon from '@patternfly/react-icons/dist/esm/icons/check-circle
|
|
|
2823
2825
|
CardEventViewDemo = () => {
|
|
2824
2826
|
const [isOpen, setIsOpen] = React.useState(false);
|
|
2825
2827
|
|
|
2826
|
-
const onActionSelect = event => {
|
|
2828
|
+
const onActionSelect = (event) => {
|
|
2827
2829
|
setIsOpen(!isOpen);
|
|
2828
2830
|
};
|
|
2829
2831
|
|
|
@@ -2837,6 +2839,18 @@ CardEventViewDemo = () => {
|
|
|
2837
2839
|
<SelectOption value="Warning" key="option3" />
|
|
2838
2840
|
];
|
|
2839
2841
|
|
|
2842
|
+
const headerActions = (
|
|
2843
|
+
<Select
|
|
2844
|
+
onSelect={onActionSelect}
|
|
2845
|
+
onToggle={onActionToggle}
|
|
2846
|
+
placeholderText="Status"
|
|
2847
|
+
isOpen={isOpen}
|
|
2848
|
+
position="right"
|
|
2849
|
+
isPlain
|
|
2850
|
+
>
|
|
2851
|
+
{selectItems}
|
|
2852
|
+
</Select>
|
|
2853
|
+
);
|
|
2840
2854
|
return (
|
|
2841
2855
|
<React.Fragment>
|
|
2842
2856
|
<b>Note:</b> Custom CSS is used in this demo to align the card title and select toggle text to{' '}
|
|
@@ -2845,19 +2859,7 @@ CardEventViewDemo = () => {
|
|
|
2845
2859
|
<br />
|
|
2846
2860
|
<Gallery hasGutter style={{ '--pf-l-gallery--GridTemplateColumns--min': '360px' }}>
|
|
2847
2861
|
<Card id="card-events-view-example">
|
|
2848
|
-
<CardHeader className="pf-u-align-items-flex-start">
|
|
2849
|
-
<CardActions hasNoOffset>
|
|
2850
|
-
<Select
|
|
2851
|
-
onSelect={onActionSelect}
|
|
2852
|
-
onToggle={onActionToggle}
|
|
2853
|
-
placeholderText="Status"
|
|
2854
|
-
isOpen={isOpen}
|
|
2855
|
-
position="right"
|
|
2856
|
-
isPlain
|
|
2857
|
-
>
|
|
2858
|
-
{selectItems}
|
|
2859
|
-
</Select>
|
|
2860
|
-
</CardActions>
|
|
2862
|
+
<CardHeader className="pf-u-align-items-flex-start" actions={{ actions: headerActions, hasNoOffset: true }}>
|
|
2861
2863
|
<CardTitle>
|
|
2862
2864
|
<Title headingLevel="h4" size="xl" style={{ paddingTop: '3px' }}>
|
|
2863
2865
|
Events
|