@patternfly/react-core 4.252.0 → 4.252.2
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 +19 -0
- package/dist/esm/components/Dropdown/DropdownWithContext.d.ts.map +1 -1
- package/dist/esm/components/Dropdown/DropdownWithContext.js +1 -1
- package/dist/esm/components/Dropdown/DropdownWithContext.js.map +1 -1
- package/dist/js/components/Dropdown/DropdownWithContext.d.ts.map +1 -1
- package/dist/js/components/Dropdown/DropdownWithContext.js +1 -1
- package/dist/js/components/Dropdown/DropdownWithContext.js.map +1 -1
- package/dist/umd/react-core.min.css +39 -39
- package/dist/umd/react-core.min.js +1 -1
- package/package.json +2 -2
- package/src/components/Dropdown/DropdownWithContext.tsx +1 -0
- package/src/components/SimpleList/examples/SimpleList.md +4 -108
- package/src/components/SimpleList/examples/SimpleListBasic.tsx +16 -0
- package/src/components/SimpleList/examples/SimpleListGrouped.tsx +35 -0
- package/src/components/SimpleList/examples/SimpleListUncontrolled.tsx +31 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-core",
|
|
3
|
-
"version": "4.252.
|
|
3
|
+
"version": "4.252.2",
|
|
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",
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
"react": "^16.8 || ^17 || ^18",
|
|
71
71
|
"react-dom": "^16.8 || ^17 || ^18"
|
|
72
72
|
},
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "5e61ce3e4bc89c664c84c7b2b3608fc40c900c3e"
|
|
74
74
|
}
|
|
@@ -176,6 +176,7 @@ export class DropdownWithContext extends React.Component<DropdownProps & OUIAPro
|
|
|
176
176
|
appendTo={menuAppendTo === 'parent' ? getParentElement() : menuAppendTo}
|
|
177
177
|
isVisible={isOpen}
|
|
178
178
|
removeFindDomNode={removeFindDomNode}
|
|
179
|
+
popperMatchesTriggerWidth={false}
|
|
179
180
|
/>
|
|
180
181
|
);
|
|
181
182
|
}}
|
|
@@ -9,120 +9,16 @@ propComponents: ['SimpleList', 'SimpleListGroup', 'SimpleListItem']
|
|
|
9
9
|
|
|
10
10
|
### Simple list
|
|
11
11
|
|
|
12
|
-
```
|
|
13
|
-
import React from 'react';
|
|
14
|
-
import { SimpleList, SimpleListItem } from '@patternfly/react-core';
|
|
15
|
-
|
|
16
|
-
class SimpleListDemo extends React.Component {
|
|
17
|
-
onSelect(selectedItem, selectedItemProps) {
|
|
18
|
-
console.log('new selection SimpleListDemo', selectedItem, selectedItemProps);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
render() {
|
|
22
|
-
const items = [
|
|
23
|
-
<SimpleListItem key="item1" isActive>
|
|
24
|
-
List item 1
|
|
25
|
-
</SimpleListItem>,
|
|
26
|
-
<SimpleListItem key="item2" component="a" href="#">
|
|
27
|
-
List item 2
|
|
28
|
-
</SimpleListItem>,
|
|
29
|
-
<SimpleListItem key="item3">List item 3</SimpleListItem>
|
|
30
|
-
];
|
|
31
|
-
|
|
32
|
-
return (
|
|
33
|
-
<SimpleList onSelect={this.onSelect} aria-label="Simple List Example">
|
|
34
|
-
{items}
|
|
35
|
-
</SimpleList>
|
|
36
|
-
);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
12
|
+
```ts file="SimpleListBasic.tsx"
|
|
39
13
|
```
|
|
40
14
|
|
|
41
15
|
### Grouped list
|
|
42
16
|
|
|
43
|
-
```
|
|
44
|
-
import React from 'react';
|
|
45
|
-
import { SimpleList, SimpleListItem, SimpleListGroup } from '@patternfly/react-core';
|
|
46
|
-
|
|
47
|
-
class SimpleListGroupDemo extends React.Component {
|
|
48
|
-
onSelect(selectedItem, selectedItemProps) {
|
|
49
|
-
console.log('new selection SimpleListGroupDemo', selectedItem, selectedItemProps);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
render() {
|
|
53
|
-
const group1Items = [
|
|
54
|
-
<SimpleListItem key="item1" isActive>
|
|
55
|
-
List item 1
|
|
56
|
-
</SimpleListItem>,
|
|
57
|
-
<SimpleListItem key="item2" id="test 2">
|
|
58
|
-
List item 2
|
|
59
|
-
</SimpleListItem>,
|
|
60
|
-
<SimpleListItem key="item3">List item 3</SimpleListItem>,
|
|
61
|
-
<SimpleListItem key="item4">List item 4</SimpleListItem>
|
|
62
|
-
];
|
|
63
|
-
|
|
64
|
-
const group2Items = [
|
|
65
|
-
<SimpleListItem key="item5">List item 1</SimpleListItem>,
|
|
66
|
-
<SimpleListItem key="item6" component="a" href="#">
|
|
67
|
-
List item 2
|
|
68
|
-
</SimpleListItem>,
|
|
69
|
-
<SimpleListItem key="item7" component="a" href="#">
|
|
70
|
-
List item 3
|
|
71
|
-
</SimpleListItem>,
|
|
72
|
-
<SimpleListItem key="item8">List item 4</SimpleListItem>
|
|
73
|
-
];
|
|
74
|
-
|
|
75
|
-
return (
|
|
76
|
-
<SimpleList onSelect={this.onSelect} aria-label="Grouped List Example">
|
|
77
|
-
<SimpleListGroup title="Group 1" id="group-1">
|
|
78
|
-
{group1Items}
|
|
79
|
-
</SimpleListGroup>
|
|
80
|
-
<SimpleListGroup title="Group 2" id="group-2">
|
|
81
|
-
{group2Items}
|
|
82
|
-
</SimpleListGroup>
|
|
83
|
-
</SimpleList>
|
|
84
|
-
);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
17
|
+
```ts file="SimpleListGrouped.tsx"
|
|
87
18
|
```
|
|
88
19
|
|
|
89
20
|
### Uncontrolled simple list
|
|
90
21
|
|
|
91
|
-
```
|
|
92
|
-
import React from 'react';
|
|
93
|
-
import { SimpleList, SimpleListItem } from '@patternfly/react-core';
|
|
94
|
-
|
|
95
|
-
class SimpleListUncontrolledDemo extends React.Component {
|
|
96
|
-
constructor(props) {
|
|
97
|
-
super(props);
|
|
98
|
-
this.state = {
|
|
99
|
-
activeItem: 0
|
|
100
|
-
};
|
|
101
|
-
this.onSelect = (selectedItem, selectedItemProps) => {
|
|
102
|
-
console.log('new selection SimpleListUncontrolledDemo', selectedItem, selectedItemProps);
|
|
103
|
-
this.setState({ activeItem: selectedItemProps.itemId });
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
render() {
|
|
108
|
-
const { activeItem } = this.state;
|
|
109
|
-
const items = [
|
|
110
|
-
<SimpleListItem key="item1" itemId={0} isActive={activeItem === 0}>
|
|
111
|
-
List item 1
|
|
112
|
-
</SimpleListItem>,
|
|
113
|
-
<SimpleListItem key="item2" itemId={1} isActive={activeItem === 1}>
|
|
114
|
-
List item 2
|
|
115
|
-
</SimpleListItem>,
|
|
116
|
-
<SimpleListItem key="item3" itemId={2} isActive={activeItem === 2}>
|
|
117
|
-
List item 3
|
|
118
|
-
</SimpleListItem>
|
|
119
|
-
];
|
|
120
|
-
|
|
121
|
-
return (
|
|
122
|
-
<SimpleList onSelect={this.onSelect} isControlled={false} aria-label="Uncontrolled Simple List Example">
|
|
123
|
-
{items}
|
|
124
|
-
</SimpleList>
|
|
125
|
-
);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
22
|
+
```ts file="SimpleListUncontrolled.tsx"
|
|
128
23
|
```
|
|
24
|
+
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SimpleList, SimpleListItem } from '@patternfly/react-core';
|
|
3
|
+
|
|
4
|
+
export const SimpleListBasic: React.FunctionComponent = () => {
|
|
5
|
+
const items = [
|
|
6
|
+
<SimpleListItem key="item1" isActive>
|
|
7
|
+
List item 1
|
|
8
|
+
</SimpleListItem>,
|
|
9
|
+
<SimpleListItem key="item2" component="a" href="#">
|
|
10
|
+
List item 2
|
|
11
|
+
</SimpleListItem>,
|
|
12
|
+
<SimpleListItem key="item3">List item 3</SimpleListItem>
|
|
13
|
+
];
|
|
14
|
+
|
|
15
|
+
return <SimpleList aria-label="Simple List Example">{items}</SimpleList>;
|
|
16
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SimpleList, SimpleListItem, SimpleListGroup } from '@patternfly/react-core';
|
|
3
|
+
|
|
4
|
+
export const SimpleListGrouped: React.FunctionComponent = () => {
|
|
5
|
+
const group1Items = [
|
|
6
|
+
<SimpleListItem key="item1" isActive>
|
|
7
|
+
List item 1
|
|
8
|
+
</SimpleListItem>,
|
|
9
|
+
<SimpleListItem key="item2">List item 2</SimpleListItem>,
|
|
10
|
+
<SimpleListItem key="item3">List item 3</SimpleListItem>,
|
|
11
|
+
<SimpleListItem key="item4">List item 4</SimpleListItem>
|
|
12
|
+
];
|
|
13
|
+
|
|
14
|
+
const group2Items = [
|
|
15
|
+
<SimpleListItem key="item5">List item 1</SimpleListItem>,
|
|
16
|
+
<SimpleListItem key="item6" component="a" href="#">
|
|
17
|
+
List item 2
|
|
18
|
+
</SimpleListItem>,
|
|
19
|
+
<SimpleListItem key="item7" component="a" href="#">
|
|
20
|
+
List item 3
|
|
21
|
+
</SimpleListItem>,
|
|
22
|
+
<SimpleListItem key="item8">List item 4</SimpleListItem>
|
|
23
|
+
];
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<SimpleList aria-label="Grouped simple list example">
|
|
27
|
+
<SimpleListGroup title="Group 1" id="group-1">
|
|
28
|
+
{group1Items}
|
|
29
|
+
</SimpleListGroup>
|
|
30
|
+
<SimpleListGroup title="Group 2" id="group-2">
|
|
31
|
+
{group2Items}
|
|
32
|
+
</SimpleListGroup>
|
|
33
|
+
</SimpleList>
|
|
34
|
+
);
|
|
35
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SimpleList, SimpleListItem, SimpleListItemProps } from '@patternfly/react-core';
|
|
3
|
+
|
|
4
|
+
export const SimpleListUncontrolled: React.FunctionComponent = () => {
|
|
5
|
+
const [activeItem, setActiveItem] = React.useState(0);
|
|
6
|
+
|
|
7
|
+
const onSelect = (
|
|
8
|
+
selectedItem: React.RefObject<HTMLButtonElement> | React.RefObject<HTMLAnchorElement>,
|
|
9
|
+
selectedItemProps: SimpleListItemProps
|
|
10
|
+
) => {
|
|
11
|
+
setActiveItem(selectedItemProps.itemId as number);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const items = [
|
|
15
|
+
<SimpleListItem key="item1" itemId={0} isActive={activeItem === 0}>
|
|
16
|
+
List item 1
|
|
17
|
+
</SimpleListItem>,
|
|
18
|
+
<SimpleListItem key="item2" itemId={1} isActive={activeItem === 1}>
|
|
19
|
+
List item 2
|
|
20
|
+
</SimpleListItem>,
|
|
21
|
+
<SimpleListItem key="item3" itemId={2} isActive={activeItem === 2}>
|
|
22
|
+
List item 3
|
|
23
|
+
</SimpleListItem>
|
|
24
|
+
];
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<SimpleList onSelect={onSelect} isControlled={false} aria-label="Uncontrolled Simple List Example">
|
|
28
|
+
{items}
|
|
29
|
+
</SimpleList>
|
|
30
|
+
);
|
|
31
|
+
};
|