@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,63 @@
1
+ import React from 'react';
2
+ import { Tabs, Tab, TabTitleText, Checkbox, Tooltip } from '@patternfly/react-core';
3
+
4
+ export const TabsBoxLight: React.FunctionComponent = () => {
5
+ const [activeTabKey, setActiveTabKey] = React.useState<string | number>(0);
6
+ const [isTabsLightScheme, setIsTabsLightScheme] = React.useState<boolean>(true);
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 toggleScheme = (checked: boolean) => {
16
+ setIsTabsLightScheme(checked);
17
+ };
18
+
19
+ const tooltip = (
20
+ <Tooltip content="Aria-disabled tabs are like disabled tabs, but focusable. Allows for tooltip support." />
21
+ );
22
+ return (
23
+ <div>
24
+ <Tabs
25
+ activeKey={activeTabKey}
26
+ onSelect={handleTabClick}
27
+ variant={isTabsLightScheme ? 'light300' : 'default'}
28
+ isBox
29
+ aria-label="Tabs in the box light variation example"
30
+ role="region"
31
+ >
32
+ <Tab eventKey={0} title={<TabTitleText>Users</TabTitleText>} aria-label="Box light variation content - users">
33
+ Users
34
+ </Tab>
35
+ <Tab eventKey={1} title={<TabTitleText>Containers</TabTitleText>}>
36
+ Containers
37
+ </Tab>
38
+ <Tab eventKey={2} title={<TabTitleText>Database</TabTitleText>}>
39
+ Database
40
+ </Tab>
41
+ <Tab eventKey={3} title={<TabTitleText>Disabled</TabTitleText>} isDisabled>
42
+ Disabled
43
+ </Tab>
44
+ <Tab eventKey={4} title={<TabTitleText>ARIA Disabled</TabTitleText>} isAriaDisabled>
45
+ ARIA Disabled
46
+ </Tab>
47
+ <Tab eventKey={5} title={<TabTitleText>ARIA Disabled (Tooltip)</TabTitleText>} isAriaDisabled tooltip={tooltip}>
48
+ ARIA Disabled (Tooltip)
49
+ </Tab>
50
+ </Tabs>
51
+ <div style={{ marginTop: '20px' }}>
52
+ <Checkbox
53
+ label="Tabs light variation"
54
+ isChecked={isTabsLightScheme}
55
+ onChange={toggleScheme}
56
+ aria-label="show light scheme variation checkbox"
57
+ id="toggle-scheme"
58
+ name="toggle-scheme"
59
+ />
60
+ </div>
61
+ </div>
62
+ );
63
+ };
@@ -0,0 +1,33 @@
1
+ import React from 'react';
2
+ import { Tabs, Tab, TabTitleText } from '@patternfly/react-core';
3
+
4
+ export const TabsChildrenMounting: 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
+ mountOnEnter
17
+ activeKey={activeTabKey}
18
+ onSelect={handleTabClick}
19
+ aria-label="Tabs in the children mounting on click example"
20
+ role="region"
21
+ >
22
+ <Tab eventKey={0} title={<TabTitleText>Tab item 1</TabTitleText>} aria-label="Tab 1">
23
+ Tab 1 section
24
+ </Tab>
25
+ <Tab eventKey={1} title={<TabTitleText>Tab item 2</TabTitleText>} aria-label="Tab 2">
26
+ Tab 2 section
27
+ </Tab>
28
+ <Tab eventKey={2} title={<TabTitleText>Tab item 3</TabTitleText>} aria-label="Tab 3">
29
+ Tab 3 section
30
+ </Tab>
31
+ </Tabs>
32
+ );
33
+ };
@@ -0,0 +1,58 @@
1
+ import React from 'react';
2
+ import { Tabs, Tab, TabTitleText, TabContent, TabContentBody } from '@patternfly/react-core';
3
+
4
+ export const TabContentWithBodyPadding: 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 body and padding example"
24
+ role="region"
25
+ >
26
+ <Tab
27
+ eventKey={0}
28
+ title={<TabTitleText>Tab item 1</TabTitleText>}
29
+ tabContentId="tab1SectionBodyPadding"
30
+ tabContentRef={contentRef1}
31
+ />
32
+ <Tab
33
+ eventKey={1}
34
+ title={<TabTitleText>Tab item 2</TabTitleText>}
35
+ tabContentId="tab2SectionBodyPadding"
36
+ tabContentRef={contentRef2}
37
+ />
38
+ <Tab
39
+ eventKey={2}
40
+ title={<TabTitleText>Tab item 3</TabTitleText>}
41
+ tabContentId="tab3SectionBodyPadding"
42
+ tabContentRef={contentRef3}
43
+ />
44
+ </Tabs>
45
+ <div>
46
+ <TabContent eventKey={0} id="tab1SectionBodyPadding" ref={contentRef1}>
47
+ <TabContentBody hasPadding> Tab 1 section with body and padding </TabContentBody>
48
+ </TabContent>
49
+ <TabContent eventKey={1} id="tab2SectionBodyPadding" ref={contentRef2} hidden>
50
+ <TabContentBody hasPadding> Tab 2 section with body and padding </TabContentBody>
51
+ </TabContent>
52
+ <TabContent eventKey={2} id="tab3SectionBodyPadding" ref={contentRef3} hidden>
53
+ <TabContentBody hasPadding> Tab 3 section with body and padding </TabContentBody>
54
+ </TabContent>
55
+ </div>
56
+ </React.Fragment>
57
+ );
58
+ };
@@ -0,0 +1,62 @@
1
+ import React from 'react';
2
+ import { Tabs, Tab, TabTitleText, Checkbox, Tooltip } from '@patternfly/react-core';
3
+
4
+ export const TabsDefault: 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
+ return (
23
+ <div>
24
+ <Tabs
25
+ activeKey={activeTabKey}
26
+ onSelect={handleTabClick}
27
+ isBox={isBox}
28
+ aria-label="Tabs in the default example"
29
+ role="region"
30
+ >
31
+ <Tab eventKey={0} title={<TabTitleText>Users</TabTitleText>} aria-label="Default 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>Disabled</TabTitleText>} isDisabled>
41
+ Disabled
42
+ </Tab>
43
+ <Tab eventKey={4} title={<TabTitleText>ARIA Disabled</TabTitleText>} isAriaDisabled>
44
+ ARIA Disabled
45
+ </Tab>
46
+ <Tab tooltip={tooltip} eventKey={5} title={<TabTitleText>ARIA Disabled (Tooltip)</TabTitleText>} isAriaDisabled>
47
+ ARIA Disabled (Tooltip)
48
+ </Tab>
49
+ </Tabs>
50
+ <div style={{ marginTop: '20px' }}>
51
+ <Checkbox
52
+ label="isBox"
53
+ isChecked={isBox}
54
+ onChange={toggleBox}
55
+ aria-label="show box variation checkbox"
56
+ id="toggle-box-default"
57
+ name="toggle-box-default"
58
+ />
59
+ </div>
60
+ </div>
61
+ );
62
+ };
@@ -0,0 +1,74 @@
1
+ import React from 'react';
2
+ import { Tabs, Tab, TabTitleText, Checkbox } from '@patternfly/react-core';
3
+
4
+ export const TabsDefaultOverflow: 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
+ isBox={isBox}
25
+ aria-label="Tabs in the default overflow example"
26
+ role="region"
27
+ >
28
+ <Tab eventKey={0} title={<TabTitleText>Users</TabTitleText>} aria-label="Default overflow content users">
29
+ Users
30
+ </Tab>
31
+ <Tab eventKey={1} title={<TabTitleText>Containers</TabTitleText>}>
32
+ Containers
33
+ </Tab>
34
+ <Tab eventKey={2} title={<TabTitleText>Database</TabTitleText>}>
35
+ Database
36
+ </Tab>
37
+ <Tab eventKey={3} title={<TabTitleText>Server</TabTitleText>}>
38
+ Server
39
+ </Tab>
40
+ <Tab eventKey={4} title={<TabTitleText>System</TabTitleText>}>
41
+ System
42
+ </Tab>
43
+ <Tab eventKey={6} title={<TabTitleText>Network</TabTitleText>}>
44
+ Network
45
+ </Tab>
46
+ <Tab eventKey={7} title={<TabTitleText>Tab item 7</TabTitleText>}>
47
+ Tab 7 section
48
+ </Tab>
49
+ <Tab eventKey={8} title={<TabTitleText>Tab item 8</TabTitleText>}>
50
+ Tab 8 section
51
+ </Tab>
52
+ <Tab eventKey={9} title={<TabTitleText>Tab item 9</TabTitleText>}>
53
+ Tab 9 section
54
+ </Tab>
55
+ <Tab eventKey={10} title={<TabTitleText>Tab item 10</TabTitleText>}>
56
+ Tab 10 section
57
+ </Tab>
58
+ <Tab eventKey={11} title={<TabTitleText>Tab item 11</TabTitleText>}>
59
+ Tab 11 section
60
+ </Tab>
61
+ </Tabs>
62
+ <div style={{ marginTop: '20px' }}>
63
+ <Checkbox
64
+ label="isBox"
65
+ isChecked={isBox}
66
+ onChange={toggleBox}
67
+ aria-label="show box variation checkbox on overflow"
68
+ id="toggle-box-overflow"
69
+ name="toggle-box-overflow"
70
+ />
71
+ </div>
72
+ </div>
73
+ );
74
+ };
@@ -0,0 +1,51 @@
1
+ import React from 'react';
2
+ import { Tabs, Tab, TabTitleText, Checkbox } from '@patternfly/react-core';
3
+
4
+ export const TabsFilled: 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
+ isFilled
23
+ activeKey={activeTabKey}
24
+ onSelect={handleTabClick}
25
+ isBox={isBox}
26
+ aria-label="Tabs in the filled example"
27
+ role="region"
28
+ >
29
+ <Tab eventKey={0} title={<TabTitleText>Users</TabTitleText>} aria-label="Tabs filled 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
+ </Tabs>
39
+ <div style={{ marginTop: '20px' }}>
40
+ <Checkbox
41
+ label="isBox"
42
+ isChecked={isBox}
43
+ onChange={toggleBox}
44
+ aria-label="show box variation checkbox with filled tabs"
45
+ id="toggle-box-filled"
46
+ name="toggle-box-filled"
47
+ />
48
+ </div>
49
+ </div>
50
+ );
51
+ };
@@ -0,0 +1,85 @@
1
+ import React from 'react';
2
+ import { Tabs, Tab, TabTitleText, TabTitleIcon, Checkbox } from '@patternfly/react-core';
3
+ import UsersIcon from '@patternfly/react-icons/dist/esm/icons/users-icon';
4
+ import BoxIcon from '@patternfly/react-icons/dist/esm/icons/box-icon';
5
+ import DatabaseIcon from '@patternfly/react-icons/dist/esm/icons/database-icon';
6
+
7
+ export const TabsFilledWithIcons: React.FunctionComponent = () => {
8
+ const [activeTabKey, setActiveTabKey] = React.useState<string | number>(0);
9
+ const [isBox, setIsBox] = React.useState<boolean>(false);
10
+ // Toggle currently active tab
11
+ const handleTabClick = (
12
+ event: React.MouseEvent<any> | React.KeyboardEvent | MouseEvent,
13
+ tabIndex: string | number
14
+ ) => {
15
+ setActiveTabKey(tabIndex);
16
+ };
17
+
18
+ const toggleBox = (checked: boolean) => {
19
+ setIsBox(checked);
20
+ };
21
+
22
+ return (
23
+ <div>
24
+ <Tabs
25
+ isFilled
26
+ activeKey={activeTabKey}
27
+ onSelect={handleTabClick}
28
+ isBox={isBox}
29
+ aria-label="Tabs in the filled with icons example"
30
+ role="region"
31
+ >
32
+ <Tab
33
+ eventKey={0}
34
+ title={
35
+ <>
36
+ <TabTitleIcon>
37
+ <UsersIcon />
38
+ </TabTitleIcon>{' '}
39
+ <TabTitleText>Users</TabTitleText>{' '}
40
+ </>
41
+ }
42
+ aria-label="filled tabs with icons content users"
43
+ >
44
+ Users
45
+ </Tab>
46
+ <Tab
47
+ eventKey={1}
48
+ title={
49
+ <>
50
+ <TabTitleIcon>
51
+ <BoxIcon />
52
+ </TabTitleIcon>{' '}
53
+ <TabTitleText>Containers</TabTitleText>{' '}
54
+ </>
55
+ }
56
+ >
57
+ Containers
58
+ </Tab>
59
+ <Tab
60
+ eventKey={2}
61
+ title={
62
+ <>
63
+ <TabTitleIcon>
64
+ <DatabaseIcon />
65
+ </TabTitleIcon>{' '}
66
+ <TabTitleText>Database</TabTitleText>{' '}
67
+ </>
68
+ }
69
+ >
70
+ Database
71
+ </Tab>
72
+ </Tabs>
73
+ <div style={{ marginTop: '20px' }}>
74
+ <Checkbox
75
+ label="isBox"
76
+ isChecked={isBox}
77
+ onChange={toggleBox}
78
+ aria-label="show box variation checkbox with filled icon tabs"
79
+ id="toggle-box-filled-icon"
80
+ name="toggle-box-filled-icon"
81
+ />
82
+ </div>
83
+ </div>
84
+ );
85
+ };
@@ -0,0 +1,108 @@
1
+ import React from 'react';
2
+ import { Tabs, Tab, TabTitleText, TabTitleIcon } from '@patternfly/react-core';
3
+ import UsersIcon from '@patternfly/react-icons/dist/esm/icons/users-icon';
4
+ import BoxIcon from '@patternfly/react-icons/dist/esm/icons/box-icon';
5
+ import DatabaseIcon from '@patternfly/react-icons/dist/esm/icons/database-icon';
6
+ import ServerIcon from '@patternfly/react-icons/dist/esm/icons/server-icon';
7
+ import LaptopIcon from '@patternfly/react-icons/dist/esm/icons/laptop-icon';
8
+ import ProjectDiagramIcon from '@patternfly/react-icons/dist/esm/icons/project-diagram-icon';
9
+
10
+ export const TabsIconAndText: React.FunctionComponent = () => {
11
+ const [activeTabKey, setActiveTabKey] = React.useState<string | number>(0);
12
+ // Toggle currently active tab
13
+ const handleTabClick = (
14
+ event: React.MouseEvent<any> | React.KeyboardEvent | MouseEvent,
15
+ tabIndex: string | number
16
+ ) => {
17
+ setActiveTabKey(tabIndex);
18
+ };
19
+
20
+ return (
21
+ <Tabs
22
+ activeKey={activeTabKey}
23
+ onSelect={handleTabClick}
24
+ aria-label="Tabs in the icons and text example"
25
+ role="region"
26
+ >
27
+ <Tab
28
+ eventKey={0}
29
+ title={
30
+ <>
31
+ <TabTitleIcon>
32
+ <UsersIcon />
33
+ </TabTitleIcon>{' '}
34
+ <TabTitleText>Users</TabTitleText>{' '}
35
+ </>
36
+ }
37
+ aria-label="icons and text content"
38
+ >
39
+ Users
40
+ </Tab>
41
+ <Tab
42
+ eventKey={1}
43
+ title={
44
+ <>
45
+ <TabTitleIcon>
46
+ <BoxIcon />
47
+ </TabTitleIcon>{' '}
48
+ <TabTitleText>Containers</TabTitleText>{' '}
49
+ </>
50
+ }
51
+ >
52
+ Containers
53
+ </Tab>
54
+ <Tab
55
+ eventKey={2}
56
+ title={
57
+ <>
58
+ <TabTitleIcon>
59
+ <DatabaseIcon />
60
+ </TabTitleIcon>{' '}
61
+ <TabTitleText>Database</TabTitleText>{' '}
62
+ </>
63
+ }
64
+ >
65
+ Database
66
+ </Tab>
67
+ <Tab
68
+ eventKey={3}
69
+ title={
70
+ <>
71
+ <TabTitleIcon>
72
+ <ServerIcon />
73
+ </TabTitleIcon>{' '}
74
+ <TabTitleText>Server</TabTitleText>{' '}
75
+ </>
76
+ }
77
+ >
78
+ Server
79
+ </Tab>
80
+ <Tab
81
+ eventKey={4}
82
+ title={
83
+ <>
84
+ <TabTitleIcon>
85
+ <LaptopIcon />
86
+ </TabTitleIcon>{' '}
87
+ <TabTitleText>System</TabTitleText>{' '}
88
+ </>
89
+ }
90
+ >
91
+ System
92
+ </Tab>
93
+ <Tab
94
+ eventKey={6}
95
+ title={
96
+ <>
97
+ <TabTitleIcon>
98
+ <ProjectDiagramIcon />
99
+ </TabTitleIcon>{' '}
100
+ <TabTitleText>Network</TabTitleText>{' '}
101
+ </>
102
+ }
103
+ >
104
+ Network
105
+ </Tab>
106
+ </Tabs>
107
+ );
108
+ };
@@ -0,0 +1,65 @@
1
+ import React from 'react';
2
+ import { Tabs, Tab, TabTitleText, Checkbox } from '@patternfly/react-core';
3
+
4
+ export const TabsInset: 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
+ inset={{
25
+ default: 'insetNone',
26
+ md: 'insetSm',
27
+ xl: 'insetLg',
28
+ '2xl': 'inset2xl'
29
+ }}
30
+ isBox={isBox}
31
+ aria-label="Tabs in the inset example"
32
+ role="region"
33
+ >
34
+ <Tab eventKey={0} title={<TabTitleText>Users</TabTitleText>} aria-label="Inset example content users">
35
+ Users
36
+ </Tab>
37
+ <Tab eventKey={1} title={<TabTitleText>Containers</TabTitleText>}>
38
+ Containers
39
+ </Tab>
40
+ <Tab eventKey={2} title={<TabTitleText>Database</TabTitleText>}>
41
+ Database
42
+ </Tab>
43
+ <Tab eventKey={3} title={<TabTitleText>Server</TabTitleText>}>
44
+ Server
45
+ </Tab>
46
+ <Tab eventKey={4} title={<TabTitleText>System</TabTitleText>}>
47
+ System
48
+ </Tab>
49
+ <Tab eventKey={6} title={<TabTitleText>Network</TabTitleText>}>
50
+ Network
51
+ </Tab>
52
+ </Tabs>
53
+ <div style={{ marginTop: '20px' }}>
54
+ <Checkbox
55
+ label="isBox"
56
+ isChecked={isBox}
57
+ onChange={toggleBox}
58
+ aria-label="show box variation checkbox with inset"
59
+ id="toggle-box-inset"
60
+ name="toggle-box-inset"
61
+ />
62
+ </div>
63
+ </div>
64
+ );
65
+ };
@@ -0,0 +1,40 @@
1
+ import React from 'react';
2
+ import { Tabs, Tab, TabsComponent, TabTitleText } from '@patternfly/react-core';
3
+
4
+ export const TabsNav: 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
+ return (
14
+ <Tabs
15
+ activeKey={activeTabKey}
16
+ onSelect={handleTabClick}
17
+ component={TabsComponent.nav}
18
+ aria-label="Tabs in the nav element example"
19
+ >
20
+ <Tab eventKey={0} title={<TabTitleText>Users</TabTitleText>} href="#users" aria-label="Nav element content users">
21
+ Users
22
+ </Tab>
23
+ <Tab eventKey={1} title={<TabTitleText>Containers</TabTitleText>} href="#containers">
24
+ Containers
25
+ </Tab>
26
+ <Tab eventKey={2} title={<TabTitleText>Database</TabTitleText>} href="#database">
27
+ Database
28
+ </Tab>
29
+ <Tab eventKey={3} title={<TabTitleText>Disabled</TabTitleText>} isDisabled href="#disabled">
30
+ Disabled
31
+ </Tab>
32
+ <Tab eventKey={4} title={<TabTitleText>ARIA Disabled</TabTitleText>} isAriaDisabled href="#aria-disabled">
33
+ ARIA Disabled
34
+ </Tab>
35
+ <Tab eventKey={6} title={<TabTitleText>Network</TabTitleText>} href="#network">
36
+ Network
37
+ </Tab>
38
+ </Tabs>
39
+ );
40
+ };