@patternfly/react-core 4.183.6 → 4.183.10
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 +35 -0
- package/dist/esm/components/Tabs/Tabs.d.ts.map +1 -1
- package/dist/esm/components/Tabs/Tabs.js +0 -2
- package/dist/esm/components/Tabs/Tabs.js.map +1 -1
- package/dist/js/components/Tabs/Tabs.d.ts.map +1 -1
- package/dist/js/components/Tabs/Tabs.js +0 -2
- package/dist/js/components/Tabs/Tabs.js.map +1 -1
- package/dist/umd/react-core.js +0 -2
- package/dist/umd/react-core.min.js +1 -1
- package/package.json +5 -5
- package/src/components/AboutModal/examples/AboutModal.md +4 -222
- package/src/components/AboutModal/examples/AboutModalBasic.tsx +46 -0
- package/src/components/AboutModal/examples/AboutModalComplexUserPositionedContent.tsx +52 -0
- package/src/components/AboutModal/examples/AboutModalCustomBackgroundImage.tsx +35 -0
- package/src/components/AboutModal/examples/AboutModalWithoutProductName.tsx +45 -0
- package/src/components/Accordion/examples/Accordion.md +4 -469
- package/src/components/Accordion/examples/AccordionBordered.tsx +134 -0
- package/src/components/Accordion/examples/AccordionDefinitionList.tsx +107 -0
- package/src/components/Accordion/examples/AccordionFixedWithMultipleExpandBehavior.tsx +92 -0
- package/src/components/Accordion/examples/AccordionSingleExpandBehavior.tsx +107 -0
- package/src/components/Tabs/Tabs.tsx +0 -2
- package/src/components/Tabs/examples/Tabs.md +6 -6
- package/src/components/TextInputGroup/examples/TextInputGroup.md +4 -123
- package/src/components/TextInputGroup/examples/TextInputGroupBasic.tsx +8 -0
- package/src/components/TextInputGroup/examples/TextInputGroupDisabled.tsx +8 -0
- package/src/components/TextInputGroup/examples/TextInputGroupFilters.tsx +69 -0
- package/src/components/TextInputGroup/examples/TextInputGroupUtilitiesAndIcon.tsx +34 -0
- package/src/demos/TextInputGroupDemo.md +2 -2
- package/src/demos/examples/TextInputGroup/{AttributeValueFiltering.js → AttributeValueFiltering.tsx} +22 -18
- package/src/demos/examples/TextInputGroup/{AutoCompleteSearch.js → AutoCompleteSearch.tsx} +18 -18
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Accordion, AccordionItem, AccordionContent, AccordionToggle } from '@patternfly/react-core';
|
|
3
|
+
|
|
4
|
+
export const AccordionDefinitionList: React.FunctionComponent = () => {
|
|
5
|
+
const [expanded, setExpanded] = React.useState('ex-toggle2');
|
|
6
|
+
|
|
7
|
+
const onToggle = (id: string) => {
|
|
8
|
+
if (id === expanded) {
|
|
9
|
+
setExpanded('');
|
|
10
|
+
} else {
|
|
11
|
+
setExpanded(id);
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<Accordion asDefinitionList>
|
|
17
|
+
<AccordionItem>
|
|
18
|
+
<AccordionToggle
|
|
19
|
+
onClick={() => {
|
|
20
|
+
onToggle('ex-toggle1');
|
|
21
|
+
}}
|
|
22
|
+
isExpanded={expanded === 'ex-toggle1'}
|
|
23
|
+
id="ex-toggle1"
|
|
24
|
+
>
|
|
25
|
+
Item one
|
|
26
|
+
</AccordionToggle>
|
|
27
|
+
<AccordionContent id="ex-expand1" isHidden={expanded !== 'ex-toggle1'}>
|
|
28
|
+
<p>
|
|
29
|
+
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et
|
|
30
|
+
dolore magna aliqua.
|
|
31
|
+
</p>
|
|
32
|
+
</AccordionContent>
|
|
33
|
+
</AccordionItem>
|
|
34
|
+
|
|
35
|
+
<AccordionItem>
|
|
36
|
+
<AccordionToggle
|
|
37
|
+
onClick={() => {
|
|
38
|
+
onToggle('ex-toggle2');
|
|
39
|
+
}}
|
|
40
|
+
isExpanded={expanded === 'ex-toggle2'}
|
|
41
|
+
id="ex-toggle2"
|
|
42
|
+
>
|
|
43
|
+
Item two
|
|
44
|
+
</AccordionToggle>
|
|
45
|
+
<AccordionContent id="ex-expand2" isHidden={expanded !== 'ex-toggle2'}>
|
|
46
|
+
<p>
|
|
47
|
+
Vivamus et tortor sed arcu congue vehicula eget et diam. Praesent nec dictum lorem. Aliquam id diam
|
|
48
|
+
ultrices, faucibus erat id, maximus nunc.
|
|
49
|
+
</p>
|
|
50
|
+
</AccordionContent>
|
|
51
|
+
</AccordionItem>
|
|
52
|
+
|
|
53
|
+
<AccordionItem>
|
|
54
|
+
<AccordionToggle
|
|
55
|
+
onClick={() => {
|
|
56
|
+
onToggle('ex-toggle3');
|
|
57
|
+
}}
|
|
58
|
+
isExpanded={expanded === 'ex-toggle3'}
|
|
59
|
+
id="ex-toggle3"
|
|
60
|
+
>
|
|
61
|
+
Item three
|
|
62
|
+
</AccordionToggle>
|
|
63
|
+
<AccordionContent id="ex-expand3" isHidden={expanded !== 'ex-toggle3'}>
|
|
64
|
+
<p>Morbi vitae urna quis nunc convallis hendrerit. Aliquam congue orci quis ultricies tempus.</p>
|
|
65
|
+
</AccordionContent>
|
|
66
|
+
</AccordionItem>
|
|
67
|
+
|
|
68
|
+
<AccordionItem>
|
|
69
|
+
<AccordionToggle
|
|
70
|
+
onClick={() => {
|
|
71
|
+
onToggle('ex-toggle4');
|
|
72
|
+
}}
|
|
73
|
+
isExpanded={expanded === 'ex-toggle4'}
|
|
74
|
+
id="ex-toggle4"
|
|
75
|
+
>
|
|
76
|
+
Item four
|
|
77
|
+
</AccordionToggle>
|
|
78
|
+
<AccordionContent id="ex-expand4" isHidden={expanded !== 'ex-toggle4'}>
|
|
79
|
+
<p>
|
|
80
|
+
Donec vel posuere orci. Phasellus quis tortor a ex hendrerit efficitur. Aliquam lacinia ligula pharetra,
|
|
81
|
+
sagittis ex ut, pellentesque diam. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere
|
|
82
|
+
cubilia Curae; Vestibulum ultricies nulla nibh. Etiam vel dui fermentum ligula ullamcorper eleifend non quis
|
|
83
|
+
tortor. Morbi tempus ornare tempus. Orci varius natoque penatibus et magnis dis parturient montes, nascetur
|
|
84
|
+
ridiculus mus. Mauris et velit neque. Donec ultricies condimentum mauris, pellentesque imperdiet libero
|
|
85
|
+
convallis convallis. Aliquam erat volutpat. Donec rutrum semper tempus. Proin dictum imperdiet nibh, quis
|
|
86
|
+
dapibus nulla. Integer sed tincidunt lectus, sit amet auctor eros.
|
|
87
|
+
</p>
|
|
88
|
+
</AccordionContent>
|
|
89
|
+
</AccordionItem>
|
|
90
|
+
|
|
91
|
+
<AccordionItem>
|
|
92
|
+
<AccordionToggle
|
|
93
|
+
onClick={() => {
|
|
94
|
+
onToggle('ex-toggle5');
|
|
95
|
+
}}
|
|
96
|
+
isExpanded={expanded === 'ex-toggle5'}
|
|
97
|
+
id="ex-toggle5"
|
|
98
|
+
>
|
|
99
|
+
Item five
|
|
100
|
+
</AccordionToggle>
|
|
101
|
+
<AccordionContent id="ex-expand5" isHidden={expanded !== 'ex-toggle5'}>
|
|
102
|
+
<p>Vivamus finibus dictum ex id ultrices. Mauris dictum neque a iaculis blandit.</p>
|
|
103
|
+
</AccordionContent>
|
|
104
|
+
</AccordionItem>
|
|
105
|
+
</Accordion>
|
|
106
|
+
);
|
|
107
|
+
};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Accordion, AccordionItem, AccordionContent, AccordionToggle } from '@patternfly/react-core';
|
|
3
|
+
|
|
4
|
+
export const AccordionFixedWithMultipleExpandBehavior: React.FunctionComponent = () => {
|
|
5
|
+
const [expanded, setExpanded] = React.useState(['ex2-toggle4']);
|
|
6
|
+
|
|
7
|
+
const toggle = id => {
|
|
8
|
+
const index = expanded.indexOf(id);
|
|
9
|
+
const newExpanded: string[] =
|
|
10
|
+
index >= 0 ? [...expanded.slice(0, index), ...expanded.slice(index + 1, expanded.length)] : [...expanded, id];
|
|
11
|
+
setExpanded(newExpanded);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<Accordion asDefinitionList={false}>
|
|
16
|
+
<AccordionItem>
|
|
17
|
+
<AccordionToggle
|
|
18
|
+
onClick={() => toggle('ex2-toggle1')}
|
|
19
|
+
isExpanded={expanded.includes('ex2-toggle1')}
|
|
20
|
+
id="ex2-toggle1"
|
|
21
|
+
>
|
|
22
|
+
Item one
|
|
23
|
+
</AccordionToggle>
|
|
24
|
+
<AccordionContent id="ex2-expand1" isHidden={!expanded.includes('ex2-toggle1')} isFixed>
|
|
25
|
+
<p>
|
|
26
|
+
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et
|
|
27
|
+
dolore magna aliqua.
|
|
28
|
+
</p>
|
|
29
|
+
</AccordionContent>
|
|
30
|
+
</AccordionItem>
|
|
31
|
+
<AccordionItem>
|
|
32
|
+
<AccordionToggle
|
|
33
|
+
onClick={() => toggle('ex2-toggle2')}
|
|
34
|
+
isExpanded={expanded.includes('ex2-toggle2')}
|
|
35
|
+
id="ex2-toggle2"
|
|
36
|
+
>
|
|
37
|
+
Item two
|
|
38
|
+
</AccordionToggle>
|
|
39
|
+
<AccordionContent id="ex2-expand2" isHidden={!expanded.includes('ex2-toggle2')} isFixed>
|
|
40
|
+
<p>
|
|
41
|
+
Vivamus et tortor sed arcu congue vehicula eget et diam. Praesent nec dictum lorem. Aliquam id diam
|
|
42
|
+
ultrices, faucibus erat id, maximus nunc.
|
|
43
|
+
</p>
|
|
44
|
+
</AccordionContent>
|
|
45
|
+
</AccordionItem>
|
|
46
|
+
<AccordionItem>
|
|
47
|
+
<AccordionToggle
|
|
48
|
+
onClick={() => toggle('ex2-toggle3')}
|
|
49
|
+
isExpanded={expanded.includes('ex2-toggle3')}
|
|
50
|
+
id="ex2-toggle3"
|
|
51
|
+
>
|
|
52
|
+
Item three
|
|
53
|
+
</AccordionToggle>
|
|
54
|
+
<AccordionContent id="ex2-expand3" isHidden={!expanded.includes('ex2-toggle3')} isFixed>
|
|
55
|
+
<p>Morbi vitae urna quis nunc convallis hendrerit. Aliquam congue orci quis ultricies tempus.</p>
|
|
56
|
+
</AccordionContent>
|
|
57
|
+
</AccordionItem>
|
|
58
|
+
<AccordionItem>
|
|
59
|
+
<AccordionToggle
|
|
60
|
+
onClick={() => toggle('ex2-toggle4')}
|
|
61
|
+
isExpanded={expanded.includes('ex2-toggle4')}
|
|
62
|
+
id="ex2-toggle4"
|
|
63
|
+
>
|
|
64
|
+
Item four
|
|
65
|
+
</AccordionToggle>
|
|
66
|
+
<AccordionContent id="ex2-expand4" isHidden={!expanded.includes('ex2-toggle4')} isFixed>
|
|
67
|
+
<p>
|
|
68
|
+
Donec vel posuere orci. Phasellus quis tortor a ex hendrerit efficitur. Aliquam lacinia ligula pharetra,
|
|
69
|
+
sagittis ex ut, pellentesque diam. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere
|
|
70
|
+
cubilia Curae; Vestibulum ultricies nulla nibh. Etiam vel dui fermentum ligula ullamcorper eleifend non quis
|
|
71
|
+
tortor. Morbi tempus ornare tempus. Orci varius natoque penatibus et magnis dis parturient montes, nascetur
|
|
72
|
+
ridiculus mus. Mauris et velit neque. Donec ultricies condimentum mauris, pellentesque imperdiet libero
|
|
73
|
+
convallis convallis. Aliquam erat volutpat. Donec rutrum semper tempus. Proin dictum imperdiet nibh, quis
|
|
74
|
+
dapibus nulla. Integer sed tincidunt lectus, sit amet auctor eros.
|
|
75
|
+
</p>
|
|
76
|
+
</AccordionContent>
|
|
77
|
+
</AccordionItem>
|
|
78
|
+
<AccordionItem>
|
|
79
|
+
<AccordionToggle
|
|
80
|
+
onClick={() => toggle('ex2-toggle5')}
|
|
81
|
+
isExpanded={expanded.includes('ex2-toggle5')}
|
|
82
|
+
id="ex2-toggle5"
|
|
83
|
+
>
|
|
84
|
+
Item five
|
|
85
|
+
</AccordionToggle>
|
|
86
|
+
<AccordionContent id="ex2-expand5" isHidden={!expanded.includes('ex2-toggle5')} isFixed>
|
|
87
|
+
<p>Vivamus finibus dictum ex id ultrices. Mauris dictum neque a iaculis blandit.</p>
|
|
88
|
+
</AccordionContent>
|
|
89
|
+
</AccordionItem>
|
|
90
|
+
</Accordion>
|
|
91
|
+
);
|
|
92
|
+
};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Accordion, AccordionItem, AccordionContent, AccordionToggle } from '@patternfly/react-core';
|
|
3
|
+
|
|
4
|
+
export const AccordionSingleExpandBehavior: React.FunctionComponent = () => {
|
|
5
|
+
const [expanded, setExpanded] = React.useState('ex-toggle2');
|
|
6
|
+
|
|
7
|
+
const onToggle = (id: string) => {
|
|
8
|
+
if (id === expanded) {
|
|
9
|
+
setExpanded('');
|
|
10
|
+
} else {
|
|
11
|
+
setExpanded(id);
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<Accordion asDefinitionList={false}>
|
|
17
|
+
<AccordionItem>
|
|
18
|
+
<AccordionToggle
|
|
19
|
+
onClick={() => {
|
|
20
|
+
onToggle('ex-toggle1');
|
|
21
|
+
}}
|
|
22
|
+
isExpanded={expanded === 'ex-toggle1'}
|
|
23
|
+
id="ex-toggle1"
|
|
24
|
+
>
|
|
25
|
+
Item one
|
|
26
|
+
</AccordionToggle>
|
|
27
|
+
<AccordionContent id="ex-expand1" isHidden={expanded !== 'ex-toggle1'}>
|
|
28
|
+
<p>
|
|
29
|
+
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et
|
|
30
|
+
dolore magna aliqua.
|
|
31
|
+
</p>
|
|
32
|
+
</AccordionContent>
|
|
33
|
+
</AccordionItem>
|
|
34
|
+
|
|
35
|
+
<AccordionItem>
|
|
36
|
+
<AccordionToggle
|
|
37
|
+
onClick={() => {
|
|
38
|
+
onToggle('ex-toggle2');
|
|
39
|
+
}}
|
|
40
|
+
isExpanded={expanded === 'ex-toggle2'}
|
|
41
|
+
id="ex-toggle2"
|
|
42
|
+
>
|
|
43
|
+
Item two
|
|
44
|
+
</AccordionToggle>
|
|
45
|
+
<AccordionContent id="ex-expand2" isHidden={expanded !== 'ex-toggle2'}>
|
|
46
|
+
<p>
|
|
47
|
+
Vivamus et tortor sed arcu congue vehicula eget et diam. Praesent nec dictum lorem. Aliquam id diam
|
|
48
|
+
ultrices, faucibus erat id, maximus nunc.
|
|
49
|
+
</p>
|
|
50
|
+
</AccordionContent>
|
|
51
|
+
</AccordionItem>
|
|
52
|
+
|
|
53
|
+
<AccordionItem>
|
|
54
|
+
<AccordionToggle
|
|
55
|
+
onClick={() => {
|
|
56
|
+
onToggle('ex-toggle3');
|
|
57
|
+
}}
|
|
58
|
+
isExpanded={expanded === 'ex-toggle3'}
|
|
59
|
+
id="ex-toggle3"
|
|
60
|
+
>
|
|
61
|
+
Item three
|
|
62
|
+
</AccordionToggle>
|
|
63
|
+
<AccordionContent id="ex-expand3" isHidden={expanded !== 'ex-toggle3'}>
|
|
64
|
+
<p>Morbi vitae urna quis nunc convallis hendrerit. Aliquam congue orci quis ultricies tempus.</p>
|
|
65
|
+
</AccordionContent>
|
|
66
|
+
</AccordionItem>
|
|
67
|
+
|
|
68
|
+
<AccordionItem>
|
|
69
|
+
<AccordionToggle
|
|
70
|
+
onClick={() => {
|
|
71
|
+
onToggle('ex-toggle4');
|
|
72
|
+
}}
|
|
73
|
+
isExpanded={expanded === 'ex-toggle4'}
|
|
74
|
+
id="ex-toggle4"
|
|
75
|
+
>
|
|
76
|
+
Item four
|
|
77
|
+
</AccordionToggle>
|
|
78
|
+
<AccordionContent id="ex-expand4" isHidden={expanded !== 'ex-toggle4'}>
|
|
79
|
+
<p>
|
|
80
|
+
Donec vel posuere orci. Phasellus quis tortor a ex hendrerit efficitur. Aliquam lacinia ligula pharetra,
|
|
81
|
+
sagittis ex ut, pellentesque diam. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere
|
|
82
|
+
cubilia Curae; Vestibulum ultricies nulla nibh. Etiam vel dui fermentum ligula ullamcorper eleifend non quis
|
|
83
|
+
tortor. Morbi tempus ornare tempus. Orci varius natoque penatibus et magnis dis parturient montes, nascetur
|
|
84
|
+
ridiculus mus. Mauris et velit neque. Donec ultricies condimentum mauris, pellentesque imperdiet libero
|
|
85
|
+
convallis convallis. Aliquam erat volutpat. Donec rutrum semper tempus. Proin dictum imperdiet nibh, quis
|
|
86
|
+
dapibus nulla. Integer sed tincidunt lectus, sit amet auctor eros.
|
|
87
|
+
</p>
|
|
88
|
+
</AccordionContent>
|
|
89
|
+
</AccordionItem>
|
|
90
|
+
|
|
91
|
+
<AccordionItem>
|
|
92
|
+
<AccordionToggle
|
|
93
|
+
onClick={() => {
|
|
94
|
+
onToggle('ex-toggle5');
|
|
95
|
+
}}
|
|
96
|
+
isExpanded={expanded === 'ex-toggle5'}
|
|
97
|
+
id="ex-toggle5"
|
|
98
|
+
>
|
|
99
|
+
Item five
|
|
100
|
+
</AccordionToggle>
|
|
101
|
+
<AccordionContent id="ex-expand5" isHidden={expanded !== 'ex-toggle5'}>
|
|
102
|
+
<p>Vivamus finibus dictum ex id ultrices. Mauris dictum neque a iaculis blandit.</p>
|
|
103
|
+
</AccordionContent>
|
|
104
|
+
</AccordionItem>
|
|
105
|
+
</Accordion>
|
|
106
|
+
);
|
|
107
|
+
};
|
|
@@ -149,8 +149,6 @@ export class Tabs extends React.Component<TabsProps, TabsState> {
|
|
|
149
149
|
eventKey: number | string,
|
|
150
150
|
tabContentRef: React.RefObject<any>
|
|
151
151
|
) {
|
|
152
|
-
// When tab is an achor tag with href, cancel navigation event
|
|
153
|
-
event.preventDefault();
|
|
154
152
|
const { shownKeys } = this.state;
|
|
155
153
|
const { onSelect, defaultActiveKey } = this.props;
|
|
156
154
|
// if defaultActiveKey Tabs are uncontrolled, set new active key internally
|
|
@@ -890,22 +890,22 @@ class TabsNav extends React.Component {
|
|
|
890
890
|
aria-label="Local"
|
|
891
891
|
component={TabsComponent.nav}
|
|
892
892
|
>
|
|
893
|
-
<Tab eventKey={0} title={<TabTitleText>Users</TabTitleText>} href="#">
|
|
893
|
+
<Tab eventKey={0} title={<TabTitleText>Users</TabTitleText>} href="#users">
|
|
894
894
|
Users
|
|
895
895
|
</Tab>
|
|
896
|
-
<Tab eventKey={1} title={<TabTitleText>Containers</TabTitleText>} href="#">
|
|
896
|
+
<Tab eventKey={1} title={<TabTitleText>Containers</TabTitleText>} href="#containers">
|
|
897
897
|
Containers
|
|
898
898
|
</Tab>
|
|
899
|
-
<Tab eventKey={2} title={<TabTitleText>Database</TabTitleText>} href="#">
|
|
899
|
+
<Tab eventKey={2} title={<TabTitleText>Database</TabTitleText>} href="#database">
|
|
900
900
|
Database
|
|
901
901
|
</Tab>
|
|
902
|
-
<Tab eventKey={3} title={<TabTitleText>Disabled</TabTitleText>} isDisabled href="#">
|
|
902
|
+
<Tab eventKey={3} title={<TabTitleText>Disabled</TabTitleText>} isDisabled href="#disabled">
|
|
903
903
|
Disabled
|
|
904
904
|
</Tab>
|
|
905
|
-
<Tab eventKey={4} title={<TabTitleText>ARIA Disabled</TabTitleText>} isAriaDisabled href="#">
|
|
905
|
+
<Tab eventKey={4} title={<TabTitleText>ARIA Disabled</TabTitleText>} isAriaDisabled href="#aria-disabled">
|
|
906
906
|
ARIA Disabled
|
|
907
907
|
</Tab>
|
|
908
|
-
<Tab eventKey={6} title={<TabTitleText>Network</TabTitleText>} href="#">
|
|
908
|
+
<Tab eventKey={6} title={<TabTitleText>Network</TabTitleText>} href="#network">
|
|
909
909
|
Network
|
|
910
910
|
</Tab>
|
|
911
911
|
</Tabs>
|
|
@@ -13,139 +13,20 @@ import TimesIcon from '@patternfly/react-icons/dist/esm/icons/times-icon';
|
|
|
13
13
|
|
|
14
14
|
### Basic
|
|
15
15
|
|
|
16
|
-
```
|
|
17
|
-
import React from 'react';
|
|
18
|
-
import { TextInputGroup, TextInputGroupMain } from '@patternfly/react-core';
|
|
19
|
-
|
|
20
|
-
const BasicTextInputGroup = () => (
|
|
21
|
-
<TextInputGroup>
|
|
22
|
-
<TextInputGroupMain />
|
|
23
|
-
</TextInputGroup>
|
|
24
|
-
);
|
|
16
|
+
```ts file="./TextInputGroupBasic.tsx"
|
|
25
17
|
```
|
|
26
18
|
|
|
27
19
|
### Disabled
|
|
28
20
|
|
|
29
|
-
```
|
|
30
|
-
import React from 'react';
|
|
31
|
-
import { TextInputGroup, TextInputGroupMain } from '@patternfly/react-core';
|
|
32
|
-
|
|
33
|
-
const DisabledTextInputGroup = () => (
|
|
34
|
-
<TextInputGroup isDisabled>
|
|
35
|
-
<TextInputGroupMain value="Disabled" type="text" aria-label="Disabled text input group example input" />
|
|
36
|
-
</TextInputGroup>
|
|
37
|
-
);
|
|
21
|
+
```ts file="./TextInputGroupDisabled.tsx"
|
|
38
22
|
```
|
|
39
23
|
|
|
40
24
|
### Utilities and icon
|
|
41
25
|
|
|
42
|
-
```
|
|
43
|
-
import React from 'react';
|
|
44
|
-
import { TextInputGroup, TextInputGroupMain, TextInputGroupUtilities, Button } from '@patternfly/react-core';
|
|
45
|
-
import SearchIcon from '@patternfly/react-icons/dist/esm/icons/search-icon';
|
|
46
|
-
import TimesIcon from '@patternfly/react-icons/dist/esm/icons/times-icon';
|
|
47
|
-
|
|
48
|
-
const TextInputGroupWithIcons = () => {
|
|
49
|
-
const [inputValue, setInputValue] = React.useState('');
|
|
50
|
-
|
|
51
|
-
/** callback for updating the inputValue state in this component so that the input can be controlled */
|
|
52
|
-
const handleInputChange = (value, _event) => {
|
|
53
|
-
setInputValue(value);
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
/** show the input clearing button only when the input is not empty */
|
|
57
|
-
const showClearButton = inputValue;
|
|
58
|
-
|
|
59
|
-
/** callback for clearing the text input */
|
|
60
|
-
const clearInput = () => {
|
|
61
|
-
setInputValue('');
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
return (
|
|
65
|
-
<TextInputGroup>
|
|
66
|
-
<TextInputGroupMain icon={<SearchIcon />} value={inputValue} onChange={handleInputChange} />
|
|
67
|
-
<TextInputGroupUtilities>
|
|
68
|
-
{showClearButton && (
|
|
69
|
-
<Button variant="plain" onClick={clearInput} aria-label="Clear button and input">
|
|
70
|
-
<TimesIcon />
|
|
71
|
-
</Button>
|
|
72
|
-
)}
|
|
73
|
-
</TextInputGroupUtilities>
|
|
74
|
-
</TextInputGroup>
|
|
75
|
-
);
|
|
76
|
-
};
|
|
26
|
+
```ts file="./TextInputGroupUtilitiesAndIcon.tsx"
|
|
77
27
|
```
|
|
78
28
|
|
|
79
29
|
### Filters
|
|
80
30
|
|
|
81
|
-
```
|
|
82
|
-
import React from 'react';
|
|
83
|
-
import { TextInputGroup, TextInputGroupMain, TextInputGroupUtilities, Button } from '@patternfly/react-core';
|
|
84
|
-
import { Chip, ChipGroup } from '@patternfly/react-core';
|
|
85
|
-
import SearchIcon from '@patternfly/react-icons/dist/esm/icons/search-icon';
|
|
86
|
-
import TimesIcon from '@patternfly/react-icons/dist/esm/icons/times-icon';
|
|
87
|
-
|
|
88
|
-
const TextInputGroupWithChips = () => {
|
|
89
|
-
const [inputValue, setInputValue] = React.useState('');
|
|
90
|
-
const [currentChips, setCurrentChips] = React.useState([
|
|
91
|
-
'chip one',
|
|
92
|
-
'chip two',
|
|
93
|
-
'chip three',
|
|
94
|
-
'chip four',
|
|
95
|
-
'chip five',
|
|
96
|
-
'chip six',
|
|
97
|
-
'chip seven',
|
|
98
|
-
'chip eight',
|
|
99
|
-
'chip nine',
|
|
100
|
-
'chip ten',
|
|
101
|
-
'chip eleven',
|
|
102
|
-
'chip twelve',
|
|
103
|
-
'chip thirteen',
|
|
104
|
-
'chip fourteen'
|
|
105
|
-
]);
|
|
106
|
-
|
|
107
|
-
/** show the search icon only when there are no chips to prevent the chips from being displayed behind the icon */
|
|
108
|
-
const showSearchIcon = !currentChips.length;
|
|
109
|
-
|
|
110
|
-
/** callback for updating the inputValue state in this component so that the input can be controlled */
|
|
111
|
-
const handleInputChange = (value, _event) => {
|
|
112
|
-
setInputValue(value);
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
/** callback for removing a chip from the chip selections */
|
|
116
|
-
const deleteChip = chipToDelete => {
|
|
117
|
-
const newChips = currentChips.filter(chip => !Object.is(chip, chipToDelete));
|
|
118
|
-
setCurrentChips(newChips);
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
/** show the input/chip clearing button only when either the text input or chip group are not empty */
|
|
122
|
-
const showClearButton = inputValue || !!currentChips.length;
|
|
123
|
-
|
|
124
|
-
/** callback for clearing all selected chips and the text input */
|
|
125
|
-
const clearChipsAndInput = () => {
|
|
126
|
-
setCurrentChips([]);
|
|
127
|
-
setInputValue('');
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
return (
|
|
131
|
-
<TextInputGroup>
|
|
132
|
-
<TextInputGroupMain icon={showSearchIcon && <SearchIcon />} value={inputValue} onChange={handleInputChange}>
|
|
133
|
-
<ChipGroup>
|
|
134
|
-
{currentChips.map(currentChip => (
|
|
135
|
-
<Chip key={currentChip} onClick={() => deleteChip(currentChip)}>
|
|
136
|
-
{currentChip}
|
|
137
|
-
</Chip>
|
|
138
|
-
))}
|
|
139
|
-
</ChipGroup>
|
|
140
|
-
</TextInputGroupMain>
|
|
141
|
-
<TextInputGroupUtilities>
|
|
142
|
-
{showClearButton && (
|
|
143
|
-
<Button variant="plain" onClick={clearChipsAndInput} aria-label="Clear button and input">
|
|
144
|
-
<TimesIcon />
|
|
145
|
-
</Button>
|
|
146
|
-
)}
|
|
147
|
-
</TextInputGroupUtilities>
|
|
148
|
-
</TextInputGroup>
|
|
149
|
-
);
|
|
150
|
-
};
|
|
31
|
+
```ts file="./TextInputGroupFilters.tsx"
|
|
151
32
|
```
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TextInputGroup, TextInputGroupMain } from '@patternfly/react-core';
|
|
3
|
+
|
|
4
|
+
export const TextInputGroupDisabled: React.FunctionComponent = () => (
|
|
5
|
+
<TextInputGroup isDisabled>
|
|
6
|
+
<TextInputGroupMain value="Disabled" type="text" aria-label="Disabled text input group example input" />
|
|
7
|
+
</TextInputGroup>
|
|
8
|
+
);
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TextInputGroup, TextInputGroupMain, TextInputGroupUtilities, Button } from '@patternfly/react-core';
|
|
3
|
+
import { Chip, ChipGroup } from '@patternfly/react-core';
|
|
4
|
+
import SearchIcon from '@patternfly/react-icons/dist/esm/icons/search-icon';
|
|
5
|
+
import TimesIcon from '@patternfly/react-icons/dist/esm/icons/times-icon';
|
|
6
|
+
|
|
7
|
+
export const TextInputGroupFilters: React.FunctionComponent = () => {
|
|
8
|
+
const [inputValue, setInputValue] = React.useState('');
|
|
9
|
+
const [currentChips, setCurrentChips] = React.useState([
|
|
10
|
+
'chip one',
|
|
11
|
+
'chip two',
|
|
12
|
+
'chip three',
|
|
13
|
+
'chip four',
|
|
14
|
+
'chip five',
|
|
15
|
+
'chip six',
|
|
16
|
+
'chip seven',
|
|
17
|
+
'chip eight',
|
|
18
|
+
'chip nine',
|
|
19
|
+
'chip ten',
|
|
20
|
+
'chip eleven',
|
|
21
|
+
'chip twelve',
|
|
22
|
+
'chip thirteen',
|
|
23
|
+
'chip fourteen'
|
|
24
|
+
]);
|
|
25
|
+
|
|
26
|
+
/** show the search icon only when there are no chips to prevent the chips from being displayed behind the icon */
|
|
27
|
+
const showSearchIcon = !currentChips.length;
|
|
28
|
+
|
|
29
|
+
/** callback for updating the inputValue state in this component so that the input can be controlled */
|
|
30
|
+
const handleInputChange = (value: string, _event: React.FormEvent<HTMLInputElement>) => {
|
|
31
|
+
setInputValue(value);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/** callback for removing a chip from the chip selections */
|
|
35
|
+
const deleteChip = (chipToDelete: string) => {
|
|
36
|
+
const newChips = currentChips.filter(chip => !Object.is(chip, chipToDelete));
|
|
37
|
+
setCurrentChips(newChips);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
/** show the input/chip clearing button only when either the text input or chip group are not empty */
|
|
41
|
+
const showClearButton = !!inputValue || !!currentChips.length;
|
|
42
|
+
|
|
43
|
+
/** callback for clearing all selected chips and the text input */
|
|
44
|
+
const clearChipsAndInput = () => {
|
|
45
|
+
setCurrentChips([]);
|
|
46
|
+
setInputValue('');
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<TextInputGroup>
|
|
51
|
+
<TextInputGroupMain icon={showSearchIcon && <SearchIcon />} value={inputValue} onChange={handleInputChange}>
|
|
52
|
+
<ChipGroup>
|
|
53
|
+
{currentChips.map(currentChip => (
|
|
54
|
+
<Chip key={currentChip} onClick={() => deleteChip(currentChip)}>
|
|
55
|
+
{currentChip}
|
|
56
|
+
</Chip>
|
|
57
|
+
))}
|
|
58
|
+
</ChipGroup>
|
|
59
|
+
</TextInputGroupMain>
|
|
60
|
+
<TextInputGroupUtilities>
|
|
61
|
+
{showClearButton && (
|
|
62
|
+
<Button variant="plain" onClick={clearChipsAndInput} aria-label="Clear button and input">
|
|
63
|
+
<TimesIcon />
|
|
64
|
+
</Button>
|
|
65
|
+
)}
|
|
66
|
+
</TextInputGroupUtilities>
|
|
67
|
+
</TextInputGroup>
|
|
68
|
+
);
|
|
69
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TextInputGroup, TextInputGroupMain, TextInputGroupUtilities, Button } from '@patternfly/react-core';
|
|
3
|
+
import SearchIcon from '@patternfly/react-icons/dist/esm/icons/search-icon';
|
|
4
|
+
import TimesIcon from '@patternfly/react-icons/dist/esm/icons/times-icon';
|
|
5
|
+
|
|
6
|
+
export const TextInputGroupUtilitiesAndIcon: React.FunctionComponent = () => {
|
|
7
|
+
const [inputValue, setInputValue] = React.useState('');
|
|
8
|
+
|
|
9
|
+
/** callback for updating the inputValue state in this component so that the input can be controlled */
|
|
10
|
+
const handleInputChange = (value: string, _event: React.FormEvent<HTMLInputElement>) => {
|
|
11
|
+
setInputValue(value);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
/** show the input clearing button only when the input is not empty */
|
|
15
|
+
const showClearButton = !!inputValue;
|
|
16
|
+
|
|
17
|
+
/** callback for clearing the text input */
|
|
18
|
+
const clearInput = () => {
|
|
19
|
+
setInputValue('');
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<TextInputGroup>
|
|
24
|
+
<TextInputGroupMain icon={<SearchIcon />} value={inputValue} onChange={handleInputChange} />
|
|
25
|
+
<TextInputGroupUtilities>
|
|
26
|
+
{showClearButton && (
|
|
27
|
+
<Button variant="plain" onClick={clearInput} aria-label="Clear button and input">
|
|
28
|
+
<TimesIcon />
|
|
29
|
+
</Button>
|
|
30
|
+
)}
|
|
31
|
+
</TextInputGroupUtilities>
|
|
32
|
+
</TextInputGroup>
|
|
33
|
+
);
|
|
34
|
+
};
|
|
@@ -24,7 +24,7 @@ Additionally, attributes can be selected by typing the full (case sensitive) nam
|
|
|
24
24
|
|
|
25
25
|
Attributes can be deselected (returning you to attribute selection mode) by hitting `escape`, or by hitting `backspace` when the only text in the text input is the attribute.
|
|
26
26
|
|
|
27
|
-
```
|
|
27
|
+
```ts file="./examples/TextInputGroup/AttributeValueFiltering.tsx"
|
|
28
28
|
```
|
|
29
29
|
### Auto-complete search
|
|
30
30
|
|
|
@@ -36,5 +36,5 @@ Hitting `escape` while focused on the input or menu will close the menu, and the
|
|
|
36
36
|
|
|
37
37
|
When only one item remains in the suggestion list, tab can be used to auto-complete the typing of that item.
|
|
38
38
|
|
|
39
|
-
```
|
|
39
|
+
```ts file="./examples/TextInputGroup/AutoCompleteSearch.tsx"
|
|
40
40
|
```
|