@patternfly/react-core 4.265.0 → 4.265.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.
Files changed (40) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/esm/components/SearchInput/AdvancedSearchMenu.d.ts.map +1 -1
  3. package/dist/esm/components/SearchInput/AdvancedSearchMenu.js +5 -4
  4. package/dist/esm/components/SearchInput/AdvancedSearchMenu.js.map +1 -1
  5. package/dist/esm/components/SearchInput/SearchInput.d.ts.map +1 -1
  6. package/dist/esm/components/SearchInput/SearchInput.js +23 -3
  7. package/dist/esm/components/SearchInput/SearchInput.js.map +1 -1
  8. package/dist/js/components/SearchInput/AdvancedSearchMenu.d.ts.map +1 -1
  9. package/dist/js/components/SearchInput/AdvancedSearchMenu.js +5 -4
  10. package/dist/js/components/SearchInput/AdvancedSearchMenu.js.map +1 -1
  11. package/dist/js/components/SearchInput/SearchInput.d.ts.map +1 -1
  12. package/dist/js/components/SearchInput/SearchInput.js +23 -3
  13. package/dist/js/components/SearchInput/SearchInput.js.map +1 -1
  14. package/dist/umd/react-core.min.js +1 -1
  15. package/package.json +2 -2
  16. package/src/components/SearchInput/AdvancedSearchMenu.tsx +7 -4
  17. package/src/components/SearchInput/SearchInput.tsx +26 -3
  18. package/src/components/SearchInput/examples/SearchInput.md +4 -0
  19. package/src/components/Tabs/examples/Tabs.md +21 -1557
  20. package/src/components/Tabs/examples/TabsBoxLight.tsx +63 -0
  21. package/src/components/Tabs/examples/TabsChildrenMounting.tsx +33 -0
  22. package/src/components/Tabs/examples/TabsContentWithBodyPadding.tsx +58 -0
  23. package/src/components/Tabs/examples/TabsDefault.tsx +62 -0
  24. package/src/components/Tabs/examples/TabsDefaultOverflow.tsx +74 -0
  25. package/src/components/Tabs/examples/TabsFilled.tsx +51 -0
  26. package/src/components/Tabs/examples/TabsFilledWithIcons.tsx +85 -0
  27. package/src/components/Tabs/examples/TabsIconAndText.tsx +108 -0
  28. package/src/components/Tabs/examples/TabsInset.tsx +65 -0
  29. package/src/components/Tabs/examples/TabsNav.tsx +40 -0
  30. package/src/components/Tabs/examples/TabsNavSecondary.tsx +76 -0
  31. package/src/components/Tabs/examples/TabsPageInsets.tsx +60 -0
  32. package/src/components/Tabs/examples/TabsSeparateContent.tsx +75 -0
  33. package/src/components/Tabs/examples/TabsSubtabs.tsx +115 -0
  34. package/src/components/Tabs/examples/TabsToggledSeparateContent.tsx +67 -0
  35. package/src/components/Tabs/examples/TabsTooltipReactRef.tsx +72 -0
  36. package/src/components/Tabs/examples/TabsUncontrolled.tsx +33 -0
  37. package/src/components/Tabs/examples/TabsUnmountingInvisibleChildren.tsx +33 -0
  38. package/src/components/Tabs/examples/TabsVertical.tsx +72 -0
  39. package/src/components/Tabs/examples/TabsVerticalExpandable.tsx +51 -0
  40. package/src/components/Tabs/examples/TabsVerticalExpandableUncontrolled.tsx +48 -0
@@ -0,0 +1,76 @@
1
+ import React from 'react';
2
+ import { Tabs, Tab, TabsComponent, TabTitleText } from '@patternfly/react-core';
3
+
4
+ export const TabsNavSecondary: React.FunctionComponent = () => {
5
+ const [activeTabKey1, setActiveTabKey1] = React.useState<string | number>(0);
6
+ const [activeTabKey2, setActiveTabKey2] = React.useState<string | number>(0);
7
+
8
+ // Toggle currently active primary tab
9
+ const handleTabClickFirst = (
10
+ event: React.MouseEvent<any> | React.KeyboardEvent | MouseEvent,
11
+ tabIndex: string | number
12
+ ) => {
13
+ setActiveTabKey1(tabIndex);
14
+ };
15
+
16
+ // Toggle currently active secondary tab
17
+ const handleTabClickSecond = (
18
+ event: React.MouseEvent<any> | React.KeyboardEvent | MouseEvent,
19
+ tabIndex: string | number
20
+ ) => {
21
+ setActiveTabKey2(tabIndex);
22
+ };
23
+
24
+ return (
25
+ <Tabs
26
+ activeKey={activeTabKey1}
27
+ onSelect={handleTabClickFirst}
28
+ component={TabsComponent.nav}
29
+ aria-label="Tabs in the sub tabs with nav element example"
30
+ >
31
+ <Tab eventKey={0} title={<TabTitleText>Users</TabTitleText>} href="#" aria-label="Subtabs with nav content users">
32
+ <Tabs
33
+ activeKey={activeTabKey2}
34
+ isSecondary
35
+ onSelect={handleTabClickSecond}
36
+ aria-label="Local secondary"
37
+ component={TabsComponent.nav}
38
+ >
39
+ <Tab eventKey={20} title={<TabTitleText>Item 1</TabTitleText>} href="#">
40
+ Item 1 item section
41
+ </Tab>
42
+ <Tab eventKey={21} title={<TabTitleText>Item 2</TabTitleText>} href="#">
43
+ Item 2 section
44
+ </Tab>
45
+ <Tab eventKey={22} title={<TabTitleText>Item 3</TabTitleText>} href="#">
46
+ Item 3 section
47
+ </Tab>
48
+ <Tab eventKey={3} title={<TabTitleText>Disabled</TabTitleText>} isDisabled href="#">
49
+ Disabled
50
+ </Tab>
51
+ <Tab eventKey={4} title={<TabTitleText>ARIA Disabled</TabTitleText>} isAriaDisabled href="#">
52
+ ARIA Disabled
53
+ </Tab>
54
+ <Tab eventKey={25} title={<TabTitleText>Item 6</TabTitleText>} href="#">
55
+ Item 6 section
56
+ </Tab>
57
+ </Tabs>
58
+ </Tab>
59
+ <Tab eventKey={1} title={<TabTitleText>Containers</TabTitleText>} href="#">
60
+ Containers
61
+ </Tab>
62
+ <Tab eventKey={2} title={<TabTitleText>Database</TabTitleText>} href="#">
63
+ Database
64
+ </Tab>
65
+ <Tab eventKey={3} title={<TabTitleText>Disabled</TabTitleText>} isDisabled href="#">
66
+ Disabled
67
+ </Tab>
68
+ <Tab eventKey={4} title={<TabTitleText>ARIA Disabled</TabTitleText>} isAriaDisabled href="#">
69
+ ARIA Disabled
70
+ </Tab>
71
+ <Tab eventKey={6} title={<TabTitleText>Network</TabTitleText>} href="#">
72
+ Network
73
+ </Tab>
74
+ </Tabs>
75
+ );
76
+ };
@@ -0,0 +1,60 @@
1
+ import React from 'react';
2
+ import { Tabs, Tab, TabTitleText, Checkbox } from '@patternfly/react-core';
3
+
4
+ export const TabsPageInsets: React.FunctionComponent = () => {
5
+ const [activeTabKey, setActiveTabKey] = React.useState<string | number>(0);
6
+ const [isBox, setIsBox] = React.useState<boolean>(false);
7
+ // Toggle currently active tab
8
+ const handleTabClick = (
9
+ event: React.MouseEvent<any> | React.KeyboardEvent | MouseEvent,
10
+ tabIndex: string | number
11
+ ) => {
12
+ setActiveTabKey(tabIndex);
13
+ };
14
+
15
+ const toggleBox = (checked: boolean) => {
16
+ setIsBox(checked);
17
+ };
18
+
19
+ return (
20
+ <div>
21
+ <Tabs
22
+ activeKey={activeTabKey}
23
+ onSelect={handleTabClick}
24
+ usePageInsets
25
+ isBox={isBox}
26
+ aria-label="Tabs in the page insets example"
27
+ role="region"
28
+ >
29
+ <Tab eventKey={0} title={<TabTitleText>Users</TabTitleText>} aria-label="Page insets example content users">
30
+ Users
31
+ </Tab>
32
+ <Tab eventKey={1} title={<TabTitleText>Containers</TabTitleText>}>
33
+ Containers
34
+ </Tab>
35
+ <Tab eventKey={2} title={<TabTitleText>Database</TabTitleText>}>
36
+ Database
37
+ </Tab>
38
+ <Tab eventKey={3} title={<TabTitleText>Server</TabTitleText>}>
39
+ Server
40
+ </Tab>
41
+ <Tab eventKey={4} title={<TabTitleText>System</TabTitleText>}>
42
+ System
43
+ </Tab>
44
+ <Tab eventKey={6} title={<TabTitleText>Network</TabTitleText>}>
45
+ Network
46
+ </Tab>
47
+ </Tabs>
48
+ <div style={{ marginTop: '20px' }}>
49
+ <Checkbox
50
+ label="isBox"
51
+ isChecked={isBox}
52
+ onChange={toggleBox}
53
+ aria-label="show box variation checkbox with inset"
54
+ id="toggle-box-page-inset"
55
+ name="toggle-box-page-inset"
56
+ />
57
+ </div>
58
+ </div>
59
+ );
60
+ };
@@ -0,0 +1,75 @@
1
+ import React from 'react';
2
+ import { Tabs, Tab, TabTitleText, TabContent } from '@patternfly/react-core';
3
+
4
+ export const TabsSeparateContent: React.FunctionComponent = () => {
5
+ const [activeTabKey, setActiveTabKey] = React.useState<string | number>(0);
6
+ // Toggle currently active tab
7
+ const handleTabClick = (
8
+ event: React.MouseEvent<any> | React.KeyboardEvent | MouseEvent,
9
+ tabIndex: string | number
10
+ ) => {
11
+ setActiveTabKey(tabIndex);
12
+ };
13
+
14
+ const contentRef1 = React.createRef<HTMLElement>();
15
+ const contentRef2 = React.createRef<HTMLElement>();
16
+ const contentRef3 = React.createRef<HTMLElement>();
17
+
18
+ return (
19
+ <React.Fragment>
20
+ <Tabs
21
+ activeKey={activeTabKey}
22
+ onSelect={handleTabClick}
23
+ aria-label="Tabs in the seperate content example"
24
+ role="region"
25
+ >
26
+ <Tab
27
+ eventKey={0}
28
+ title={<TabTitleText>Tab item 1</TabTitleText>}
29
+ tabContentId="refTab1Section"
30
+ tabContentRef={contentRef1}
31
+ />
32
+ <Tab
33
+ eventKey={1}
34
+ title={<TabTitleText>Tab item 2</TabTitleText>}
35
+ tabContentId="refTab2Section"
36
+ tabContentRef={contentRef2}
37
+ />
38
+ <Tab
39
+ eventKey={2}
40
+ title={<TabTitleText>Tab item 3</TabTitleText>}
41
+ tabContentId="refTab3Section"
42
+ tabContentRef={contentRef3}
43
+ />
44
+ </Tabs>
45
+ <div>
46
+ <TabContent
47
+ eventKey={0}
48
+ id="refTab1Section"
49
+ ref={contentRef1}
50
+ aria-label="This is content for the first separate content tab"
51
+ >
52
+ Tab 1 section
53
+ </TabContent>
54
+ <TabContent
55
+ eventKey={1}
56
+ id="refTab2Section"
57
+ ref={contentRef2}
58
+ aria-label="This is content for the second separate content tab"
59
+ hidden
60
+ >
61
+ Tab 2 section
62
+ </TabContent>
63
+ <TabContent
64
+ eventKey={2}
65
+ id="refTab3Section"
66
+ ref={contentRef3}
67
+ aria-label="This is content for the third separate content tab"
68
+ hidden
69
+ >
70
+ Tab 3 section
71
+ </TabContent>
72
+ </div>
73
+ </React.Fragment>
74
+ );
75
+ };
@@ -0,0 +1,115 @@
1
+ import React from 'react';
2
+ import { Tabs, Tab, TabTitleText, Checkbox } from '@patternfly/react-core';
3
+
4
+ export const TabsSubtabs: React.FunctionComponent = () => {
5
+ const [activeTabKey1, setActiveTabKey1] = React.useState<string | number>(0);
6
+ const [activeTabKey2, setActiveTabKey2] = React.useState<string | number>(0);
7
+ const [isBox, setIsBox] = React.useState<boolean>(false);
8
+
9
+ // Toggle currently active primary tab
10
+ const handleTabClickFirst = (
11
+ event: React.MouseEvent<any> | React.KeyboardEvent | MouseEvent,
12
+ tabIndex: string | number
13
+ ) => {
14
+ setActiveTabKey1(tabIndex);
15
+ };
16
+
17
+ // Toggle currently active secondary tab
18
+ const handleTabClickSecond = (
19
+ event: React.MouseEvent<any> | React.KeyboardEvent | MouseEvent,
20
+ tabIndex: string | number
21
+ ) => {
22
+ setActiveTabKey2(tabIndex);
23
+ };
24
+
25
+ const toggleBox = (checked: boolean) => {
26
+ setIsBox(checked);
27
+ };
28
+
29
+ return (
30
+ <div>
31
+ <Tabs
32
+ activeKey={activeTabKey1}
33
+ onSelect={handleTabClickFirst}
34
+ isBox={isBox}
35
+ aria-label="Tabs in the tabs with subtabs example"
36
+ role="region"
37
+ >
38
+ <Tab eventKey={0} title={<TabTitleText>Users</TabTitleText>} aria-label="Tabs with subtabs content users">
39
+ <Tabs
40
+ aria-label="secondary tabs for users"
41
+ role="region"
42
+ activeKey={activeTabKey2}
43
+ isSecondary
44
+ onSelect={handleTabClickSecond}
45
+ >
46
+ <Tab eventKey={20} title={<TabTitleText>Secondary tab item 1</TabTitleText>}>
47
+ Secondary tab item 1 item section
48
+ </Tab>
49
+ <Tab eventKey={21} title={<TabTitleText>Secondary tab item 2</TabTitleText>}>
50
+ Secondary tab item 2 section
51
+ </Tab>
52
+ <Tab eventKey={22} title={<TabTitleText>Secondary tab item 3</TabTitleText>}>
53
+ Secondary tab item 3 section
54
+ </Tab>
55
+ <Tab eventKey={23} title={<TabTitleText>Secondary tab item 4</TabTitleText>}>
56
+ Secondary tab item 4 section
57
+ </Tab>
58
+ <Tab eventKey={24} title={<TabTitleText>Secondary tab item 5</TabTitleText>}>
59
+ Secondary tab item 5 section
60
+ </Tab>
61
+ <Tab eventKey={25} title={<TabTitleText>Secondary tab item 6</TabTitleText>}>
62
+ Secondary tab item 6 section
63
+ </Tab>
64
+ <Tab eventKey={26} title={<TabTitleText>Secondary tab item 7</TabTitleText>}>
65
+ Secondary tab item 7 section
66
+ </Tab>
67
+ <Tab eventKey={27} title={<TabTitleText>Secondary tab item 8</TabTitleText>}>
68
+ Secondary tab item 8 section
69
+ </Tab>
70
+ </Tabs>
71
+ </Tab>
72
+ <Tab eventKey={1} title={<TabTitleText>Containers</TabTitleText>}>
73
+ Containers
74
+ </Tab>
75
+ <Tab eventKey={2} title={<TabTitleText>Database</TabTitleText>}>
76
+ Database
77
+ </Tab>
78
+ <Tab eventKey={3} title={<TabTitleText>Server</TabTitleText>}>
79
+ Server
80
+ </Tab>
81
+ <Tab eventKey={4} title={<TabTitleText>System</TabTitleText>}>
82
+ System
83
+ </Tab>
84
+ <Tab eventKey={6} title={<TabTitleText>Network</TabTitleText>}>
85
+ Network
86
+ </Tab>
87
+ <Tab eventKey={7} title={<TabTitleText>Tab item 7</TabTitleText>}>
88
+ Tab 7 section
89
+ </Tab>
90
+ <Tab eventKey={8} title={<TabTitleText>Tab item 8</TabTitleText>}>
91
+ Tab 8 section
92
+ </Tab>
93
+ <Tab eventKey={9} title={<TabTitleText>Tab item 9</TabTitleText>}>
94
+ Tab 9 section
95
+ </Tab>
96
+ <Tab eventKey={10} title={<TabTitleText>Tab item 10</TabTitleText>}>
97
+ Tab 10 section
98
+ </Tab>
99
+ <Tab eventKey={11} title={<TabTitleText>Tab item 11</TabTitleText>}>
100
+ Tab 11 section
101
+ </Tab>
102
+ </Tabs>
103
+ <div style={{ marginTop: '20px' }}>
104
+ <Checkbox
105
+ label="isBox"
106
+ isChecked={isBox}
107
+ onChange={toggleBox}
108
+ aria-label="show box variation checkbox with sub tabs"
109
+ id="toggle-box-secondary"
110
+ name="toggle-box-secondary"
111
+ />
112
+ </div>
113
+ </div>
114
+ );
115
+ };
@@ -0,0 +1,67 @@
1
+ import React from 'react';
2
+ import { Tabs, Tab, TabContent, Button, Divider } from '@patternfly/react-core';
3
+
4
+ export const TabsToggledSeparateContent: React.FunctionComponent = () => {
5
+ const [activeTabKey, setActiveTabKey] = React.useState<string | number>(0);
6
+ const [isTab2Hidden, setisTab2Hidden] = React.useState<boolean>(false);
7
+ // Toggle currently active tab
8
+ const handleTabClick = (
9
+ event: React.MouseEvent<any> | React.KeyboardEvent | MouseEvent,
10
+ tabIndex: string | number
11
+ ) => {
12
+ setActiveTabKey(tabIndex);
13
+ };
14
+
15
+ const contentRef1 = React.createRef<HTMLElement>();
16
+ const contentRef2 = React.createRef<HTMLElement>();
17
+ const contentRef3 = React.createRef<HTMLElement>();
18
+
19
+ return (
20
+ <React.Fragment>
21
+ <Button onClick={() => setisTab2Hidden(!isTab2Hidden)}>{isTab2Hidden ? 'Show' : 'Hide'} tab 2</Button>
22
+ <Divider style={{ paddingTop: '1rem', paddingBottom: '1rem' }} />
23
+ <Tabs
24
+ activeKey={activeTabKey}
25
+ onSelect={handleTabClick}
26
+ aria-label="Tabs in the toggled separate content example"
27
+ role="region"
28
+ >
29
+ <Tab eventKey={0} title="Tab item 1" tabContentId="tab1SectionSeparateContent" tabContentRef={contentRef1} />
30
+ {!isTab2Hidden && (
31
+ <Tab eventKey={1} title="Tab item 2" tabContentId="tab2SectionSeparateContent" tabContentRef={contentRef2} />
32
+ )}
33
+ <Tab eventKey={2} title="Tab item 3" tabContentId="tab3SectionSeparateContent" tabContentRef={contentRef3} />
34
+ </Tabs>
35
+ <div>
36
+ <TabContent
37
+ eventKey={0}
38
+ id="tab1SectionSeparateContent"
39
+ ref={contentRef1}
40
+ aria-label="This is content for the first toggled separate content tab"
41
+ >
42
+ Tab 1 section
43
+ </TabContent>
44
+ {!isTab2Hidden && (
45
+ <TabContent
46
+ eventKey={1}
47
+ id="tab2SectionSeparateContent"
48
+ ref={contentRef2}
49
+ aria-label="This is content for the second toggled separate content tab"
50
+ hidden
51
+ >
52
+ Tab 2 section
53
+ </TabContent>
54
+ )}
55
+ <TabContent
56
+ eventKey={2}
57
+ id="tab3SectionSeparateContent"
58
+ ref={contentRef3}
59
+ aria-label="This is content for the third toggled separate content tab"
60
+ hidden
61
+ >
62
+ Tab 3 section
63
+ </TabContent>
64
+ </div>
65
+ </React.Fragment>
66
+ );
67
+ };
@@ -0,0 +1,72 @@
1
+ import React from 'react';
2
+ import { Tabs, Tab, TabTitleText, Checkbox, Tooltip } from '@patternfly/react-core';
3
+
4
+ export const TabsTooltipReactRef: React.FunctionComponent = () => {
5
+ const [activeTabKey, setActiveTabKey] = React.useState<string | number>(0);
6
+ const [isBox, setIsBox] = React.useState<boolean>(false);
7
+ // Toggle currently active tab
8
+ const handleTabClick = (
9
+ event: React.MouseEvent<any> | React.KeyboardEvent | MouseEvent,
10
+ tabIndex: string | number
11
+ ) => {
12
+ setActiveTabKey(tabIndex);
13
+ };
14
+
15
+ const toggleBox = (checked: boolean) => {
16
+ setIsBox(checked);
17
+ };
18
+
19
+ const tooltipRef = React.createRef<HTMLElement>();
20
+
21
+ return (
22
+ <div>
23
+ <Tabs
24
+ activeKey={activeTabKey}
25
+ onSelect={handleTabClick}
26
+ isBox={isBox}
27
+ aria-label="Tabs in the example with a tooltip ref"
28
+ role="region"
29
+ >
30
+ <Tab eventKey={0} title={<TabTitleText>Users</TabTitleText>} aria-label="Tooltip ref content - users">
31
+ Users
32
+ </Tab>
33
+ <Tab eventKey={1} title={<TabTitleText>Containers</TabTitleText>}>
34
+ Containers
35
+ </Tab>
36
+ <Tab eventKey={2} title={<TabTitleText>Database</TabTitleText>}>
37
+ Database
38
+ </Tab>
39
+ <Tab eventKey={3} title={<TabTitleText>Disabled</TabTitleText>} isDisabled>
40
+ Disabled
41
+ </Tab>
42
+ <Tab eventKey={4} title={<TabTitleText>ARIA Disabled</TabTitleText>} isAriaDisabled>
43
+ ARIA Disabled
44
+ </Tab>
45
+ <Tab
46
+ eventKey={5}
47
+ title={<TabTitleText>ARIA Disabled (Tooltip)</TabTitleText>}
48
+ isAriaDisabled
49
+ ref={tooltipRef}
50
+ aria-describedby="tooltip-ref1"
51
+ >
52
+ ARIA Disabled (Tooltip)
53
+ </Tab>
54
+ </Tabs>
55
+ <Tooltip
56
+ id="tooltip-ref1"
57
+ content="Aria-disabled tabs are like disabled tabs, but focusable. Allows for tooltip support."
58
+ reference={tooltipRef}
59
+ />
60
+ <div style={{ marginTop: '20px' }}>
61
+ <Checkbox
62
+ label="isBox"
63
+ isChecked={isBox}
64
+ onChange={toggleBox}
65
+ aria-label="show box variation checkbox"
66
+ id="toggle-box-tooltip-ref"
67
+ name="toggle-box-tooltip-ref"
68
+ />
69
+ </div>
70
+ </div>
71
+ );
72
+ };
@@ -0,0 +1,33 @@
1
+ import React from 'react';
2
+ import { Tabs, Tab, TabTitleText, Tooltip } from '@patternfly/react-core';
3
+
4
+ export const TabsUncontrolled: React.FunctionComponent = () => {
5
+ const tooltip = (
6
+ <Tooltip content="Aria-disabled tabs are like disabled tabs, but focusable. Allows for tooltip support." />
7
+ );
8
+
9
+ return (
10
+ <>
11
+ <Tabs defaultActiveKey={0} aria-label="Tabs in the uncontrolled example" role="region">
12
+ <Tab eventKey={0} title={<TabTitleText>Users</TabTitleText>} aria-label="Uncontrolled ref content - users">
13
+ Users
14
+ </Tab>
15
+ <Tab eventKey={1} title={<TabTitleText>Containers</TabTitleText>}>
16
+ Containers
17
+ </Tab>
18
+ <Tab eventKey={2} title={<TabTitleText>Database</TabTitleText>}>
19
+ Database
20
+ </Tab>
21
+ <Tab eventKey={3} title={<TabTitleText>Disabled</TabTitleText>} isDisabled>
22
+ Disabled
23
+ </Tab>
24
+ <Tab eventKey={4} title={<TabTitleText>ARIA Disabled</TabTitleText>} isAriaDisabled>
25
+ ARIA Disabled
26
+ </Tab>
27
+ <Tab eventKey={5} title={<TabTitleText>ARIA Disabled (Tooltip)</TabTitleText>} isAriaDisabled tooltip={tooltip}>
28
+ ARIA Disabled (Tooltip)
29
+ </Tab>
30
+ </Tabs>
31
+ </>
32
+ );
33
+ };
@@ -0,0 +1,33 @@
1
+ import React from 'react';
2
+ import { Tabs, Tab, TabTitleText } from '@patternfly/react-core';
3
+
4
+ export const TabsUnmountingInvisibleChildren: React.FunctionComponent = () => {
5
+ const [activeTabKey, setActiveTabKey] = React.useState<string | number>(0);
6
+ // Toggle currently active tab
7
+ const handleTabClick = (
8
+ event: React.MouseEvent<any> | React.KeyboardEvent | MouseEvent,
9
+ tabIndex: string | number
10
+ ) => {
11
+ setActiveTabKey(tabIndex);
12
+ };
13
+
14
+ return (
15
+ <Tabs
16
+ unmountOnExit
17
+ activeKey={activeTabKey}
18
+ onSelect={handleTabClick}
19
+ aria-label="Tabs in the unmounting invisible children example"
20
+ role="region"
21
+ >
22
+ <Tab eventKey={0} title={<TabTitleText>Tab item 1</TabTitleText>} aria-label="Invisible children tab 1">
23
+ Tab 1 section
24
+ </Tab>
25
+ <Tab eventKey={1} title={<TabTitleText>Tab item 2</TabTitleText>} aria-label="Invisible children tab 2">
26
+ Tab 2 section
27
+ </Tab>
28
+ <Tab eventKey={2} title={<TabTitleText>Tab item 3</TabTitleText>} aria-label="Invisible children tab 3">
29
+ Tab 3 section
30
+ </Tab>
31
+ </Tabs>
32
+ );
33
+ };
@@ -0,0 +1,72 @@
1
+ import React from 'react';
2
+ import { Tabs, Tab, TabTitleText, Checkbox, Tooltip } from '@patternfly/react-core';
3
+
4
+ export const TabsVertical: React.FunctionComponent = () => {
5
+ const [activeTabKey, setActiveTabKey] = React.useState<string | number>(0);
6
+ const [isBox, setIsBox] = React.useState<boolean>(false);
7
+ // Toggle currently active tab
8
+ const handleTabClick = (
9
+ event: React.MouseEvent<any> | React.KeyboardEvent | MouseEvent,
10
+ tabIndex: string | number
11
+ ) => {
12
+ setActiveTabKey(tabIndex);
13
+ };
14
+
15
+ const toggleBox = (checked: boolean) => {
16
+ setIsBox(checked);
17
+ };
18
+
19
+ const tooltip = (
20
+ <Tooltip content="Aria-disabled tabs are like disabled tabs, but focusable. Allows for tooltip support." />
21
+ );
22
+
23
+ return (
24
+ <div>
25
+ <Tabs
26
+ activeKey={activeTabKey}
27
+ onSelect={handleTabClick}
28
+ isVertical
29
+ isBox={isBox}
30
+ aria-label="Tabs in the vertical example"
31
+ role="region"
32
+ >
33
+ <Tab
34
+ eventKey={0}
35
+ title={
36
+ <TabTitleText aria-label="vertical" role="region">
37
+ Users
38
+ </TabTitleText>
39
+ }
40
+ aria-label="Vertical example content users"
41
+ >
42
+ Users
43
+ </Tab>
44
+ <Tab eventKey={1} title={<TabTitleText>Containers</TabTitleText>}>
45
+ Containers
46
+ </Tab>
47
+ <Tab eventKey={2} title={<TabTitleText>Database</TabTitleText>}>
48
+ Database
49
+ </Tab>
50
+ <Tab eventKey={3} title={<TabTitleText>Disabled</TabTitleText>} isDisabled>
51
+ Disabled
52
+ </Tab>
53
+ <Tab eventKey={4} title={<TabTitleText>ARIA Disabled</TabTitleText>} isAriaDisabled>
54
+ ARIA Disabled
55
+ </Tab>
56
+ <Tab eventKey={5} title={<TabTitleText>ARIA Disabled (Tooltip)</TabTitleText>} isAriaDisabled tooltip={tooltip}>
57
+ ARIA Disabled (Tooltip)
58
+ </Tab>
59
+ </Tabs>
60
+ <div style={{ marginTop: '20px' }}>
61
+ <Checkbox
62
+ label="isBox"
63
+ isChecked={isBox}
64
+ onChange={toggleBox}
65
+ aria-label="show box variation checkbox with vertical"
66
+ id="toggle-box-vertical"
67
+ name="toggle-box-vertical"
68
+ />
69
+ </div>
70
+ </div>
71
+ );
72
+ };
@@ -0,0 +1,51 @@
1
+ import React from 'react';
2
+ import { Tabs, Tab, TabTitleText } from '@patternfly/react-core';
3
+
4
+ export const TabsVerticalExpandable: React.FunctionComponent = () => {
5
+ const [activeTabKey, setActiveTabKey] = React.useState<string | number>(0);
6
+ const [isExpanded, setIsExpanded] = React.useState<boolean>(false);
7
+ // Toggle currently active tab
8
+ const handleTabClick = (
9
+ event: React.MouseEvent<any> | React.KeyboardEvent | MouseEvent,
10
+ tabIndex: string | number
11
+ ) => {
12
+ setActiveTabKey(tabIndex);
13
+ };
14
+
15
+ const onToggle = (isExpanded: boolean) => {
16
+ setIsExpanded(isExpanded);
17
+ };
18
+
19
+ return (
20
+ <Tabs
21
+ activeKey={activeTabKey}
22
+ onSelect={handleTabClick}
23
+ isVertical
24
+ expandable={{ default: 'expandable', md: 'nonExpandable', lg: 'expandable' }}
25
+ isExpanded={isExpanded}
26
+ onToggle={onToggle}
27
+ toggleText="Containers"
28
+ aria-label="Tabs in the vertical expandable example"
29
+ role="region"
30
+ >
31
+ <Tab eventKey={0} title={<TabTitleText>Users</TabTitleText>} aria-label="Vertical expandable content users">
32
+ Users
33
+ </Tab>
34
+ <Tab eventKey={1} title={<TabTitleText>Containers</TabTitleText>}>
35
+ Containers
36
+ </Tab>
37
+ <Tab eventKey={2} title={<TabTitleText>Database</TabTitleText>}>
38
+ Database
39
+ </Tab>
40
+ <Tab eventKey={3} title={<TabTitleText>Server</TabTitleText>}>
41
+ Server
42
+ </Tab>
43
+ <Tab eventKey={4} title={<TabTitleText>System</TabTitleText>}>
44
+ System
45
+ </Tab>
46
+ <Tab eventKey={6} title={<TabTitleText>Network</TabTitleText>}>
47
+ Network
48
+ </Tab>
49
+ </Tabs>
50
+ );
51
+ };