@patternfly/react-core 4.208.12 → 4.210.0
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 +33 -0
- package/dist/esm/components/ClipboardCopy/ClipboardCopyButton.d.ts.map +1 -1
- package/dist/esm/components/ClipboardCopy/ClipboardCopyButton.js +1 -1
- package/dist/esm/components/ClipboardCopy/ClipboardCopyButton.js.map +1 -1
- package/dist/esm/components/Select/SelectMenu.d.ts +3 -1
- package/dist/esm/components/Select/SelectMenu.d.ts.map +1 -1
- package/dist/esm/components/Select/SelectMenu.js.map +1 -1
- package/dist/esm/components/Tabs/Tabs.d.ts +3 -1
- package/dist/esm/components/Tabs/Tabs.d.ts.map +1 -1
- package/dist/esm/components/Tabs/Tabs.js +2 -2
- package/dist/esm/components/Tabs/Tabs.js.map +1 -1
- package/dist/esm/components/Wizard/Wizard.d.ts.map +1 -1
- package/dist/esm/components/Wizard/Wizard.js +3 -3
- package/dist/esm/components/Wizard/Wizard.js.map +1 -1
- package/dist/esm/components/Wizard/WizardNavItem.d.ts +2 -0
- package/dist/esm/components/Wizard/WizardNavItem.d.ts.map +1 -1
- package/dist/esm/components/Wizard/WizardNavItem.js +2 -2
- package/dist/esm/components/Wizard/WizardNavItem.js.map +1 -1
- package/dist/js/components/ClipboardCopy/ClipboardCopyButton.d.ts.map +1 -1
- package/dist/js/components/ClipboardCopy/ClipboardCopyButton.js +1 -1
- package/dist/js/components/ClipboardCopy/ClipboardCopyButton.js.map +1 -1
- package/dist/js/components/Select/SelectMenu.d.ts +3 -1
- package/dist/js/components/Select/SelectMenu.d.ts.map +1 -1
- package/dist/js/components/Select/SelectMenu.js.map +1 -1
- package/dist/js/components/Tabs/Tabs.d.ts +3 -1
- package/dist/js/components/Tabs/Tabs.d.ts.map +1 -1
- package/dist/js/components/Tabs/Tabs.js +2 -2
- package/dist/js/components/Tabs/Tabs.js.map +1 -1
- package/dist/js/components/Wizard/Wizard.d.ts.map +1 -1
- package/dist/js/components/Wizard/Wizard.js +3 -3
- package/dist/js/components/Wizard/Wizard.js.map +1 -1
- package/dist/js/components/Wizard/WizardNavItem.d.ts +2 -0
- package/dist/js/components/Wizard/WizardNavItem.d.ts.map +1 -1
- package/dist/js/components/Wizard/WizardNavItem.js +2 -2
- package/dist/js/components/Wizard/WizardNavItem.js.map +1 -1
- package/dist/umd/react-core.js +8 -8
- package/dist/umd/react-core.min.css +75 -75
- package/dist/umd/react-core.min.js +2 -2
- package/package.json +5 -5
- package/src/components/ClipboardCopy/ClipboardCopyButton.tsx +2 -0
- package/src/components/Drawer/examples/Drawer.md +19 -1354
- package/src/components/Drawer/examples/DrawerAdditionalSectionAboveContent.tsx +59 -0
- package/src/components/Drawer/examples/DrawerBasic.tsx +57 -0
- package/src/components/Drawer/examples/DrawerBasicInline.tsx +57 -0
- package/src/components/Drawer/examples/DrawerBreakpoint.tsx +57 -0
- package/src/components/Drawer/examples/DrawerInlinePanelLeft.tsx +57 -0
- package/src/components/Drawer/examples/DrawerInlinePanelRight.tsx +57 -0
- package/src/components/Drawer/examples/DrawerLightGray.tsx +107 -0
- package/src/components/Drawer/examples/DrawerModifiedContentPadding.tsx +59 -0
- package/src/components/Drawer/examples/DrawerModifiedPanelPadding.tsx +57 -0
- package/src/components/Drawer/examples/DrawerPanelBottom.tsx +59 -0
- package/src/components/Drawer/examples/DrawerPanelLeft.tsx +57 -0
- package/src/components/Drawer/examples/DrawerPanelRight.tsx +57 -0
- package/src/components/Drawer/examples/DrawerResizableOnBottom.tsx +58 -0
- package/src/components/Drawer/examples/DrawerResizableOnInline.tsx +56 -0
- package/src/components/Drawer/examples/DrawerResizableOnLeft.tsx +57 -0
- package/src/components/Drawer/examples/DrawerResizableOnRight.tsx +62 -0
- package/src/components/Drawer/examples/DrawerStackedContentBodyElements.tsx +60 -0
- package/src/components/Drawer/examples/DrawerStatic.tsx +57 -0
- package/src/components/Select/SelectMenu.tsx +1 -1
- package/src/components/Tabs/Tabs.tsx +5 -1
- package/src/components/Tabs/__tests__/Tabs.test.tsx +40 -1
- package/src/components/Wizard/Wizard.tsx +3 -0
- package/src/components/Wizard/WizardNavItem.tsx +4 -0
- package/src/components/Wizard/__tests__/Wizard.test.tsx +6 -3
- package/src/components/Wizard/__tests__/__snapshots__/Wizard.test.tsx.snap +6 -0
- package/src/demos/Tabs.md +53 -57
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Drawer,
|
|
4
|
+
DrawerPanelContent,
|
|
5
|
+
DrawerContent,
|
|
6
|
+
DrawerContentBody,
|
|
7
|
+
DrawerHead,
|
|
8
|
+
DrawerActions,
|
|
9
|
+
DrawerCloseButton,
|
|
10
|
+
Button
|
|
11
|
+
} from '@patternfly/react-core';
|
|
12
|
+
|
|
13
|
+
export const DrawerPanelLeft: React.FunctionComponent = () => {
|
|
14
|
+
const [isExpanded, setIsExpanded] = React.useState(false);
|
|
15
|
+
const drawerRef = React.useRef<HTMLDivElement>();
|
|
16
|
+
|
|
17
|
+
const onExpand = () => {
|
|
18
|
+
drawerRef.current && drawerRef.current.focus();
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const onClick = () => {
|
|
22
|
+
setIsExpanded(!isExpanded);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const onCloseClick = () => {
|
|
26
|
+
setIsExpanded(false);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const panelContent = (
|
|
30
|
+
<DrawerPanelContent>
|
|
31
|
+
<DrawerHead>
|
|
32
|
+
<span tabIndex={isExpanded ? 0 : -1} ref={drawerRef}>
|
|
33
|
+
drawer-panel
|
|
34
|
+
</span>
|
|
35
|
+
<DrawerActions>
|
|
36
|
+
<DrawerCloseButton onClick={onCloseClick} />
|
|
37
|
+
</DrawerActions>
|
|
38
|
+
</DrawerHead>
|
|
39
|
+
</DrawerPanelContent>
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
const drawerContent =
|
|
43
|
+
'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus pretium est a porttitor vehicula. Quisque vel commodo urna. Morbi mattis rutrum ante, id vehicula ex accumsan ut. Morbi viverra, eros vel porttitor facilisis, eros purus aliquet erat,nec lobortis felis elit pulvinar sem. Vivamus vulputate, risus eget commodo eleifend, eros nibh porta quam, vitae lacinia leo libero at magna. Maecenas aliquam sagittis orci, et posuere nisi ultrices sit amet. Aliquam ex odio, malesuada sed posuere quis, pellentesque at mauris. Phasellus venenatis massa ex, eget pulvinar libero auctor pretium. Aliquam erat volutpat. Duis euismod justo in quam ullamcorper, in commodo massa vulputate.';
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<React.Fragment>
|
|
47
|
+
<Button aria-expanded={isExpanded} onClick={onClick}>
|
|
48
|
+
Toggle drawer
|
|
49
|
+
</Button>
|
|
50
|
+
<Drawer isExpanded={isExpanded} position="left" onExpand={onExpand}>
|
|
51
|
+
<DrawerContent panelContent={panelContent}>
|
|
52
|
+
<DrawerContentBody>{drawerContent}</DrawerContentBody>
|
|
53
|
+
</DrawerContent>
|
|
54
|
+
</Drawer>
|
|
55
|
+
</React.Fragment>
|
|
56
|
+
);
|
|
57
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Drawer,
|
|
4
|
+
DrawerPanelContent,
|
|
5
|
+
DrawerContent,
|
|
6
|
+
DrawerContentBody,
|
|
7
|
+
DrawerHead,
|
|
8
|
+
DrawerActions,
|
|
9
|
+
DrawerCloseButton,
|
|
10
|
+
Button
|
|
11
|
+
} from '@patternfly/react-core';
|
|
12
|
+
|
|
13
|
+
export const DrawerPanelRight: React.FunctionComponent = () => {
|
|
14
|
+
const [isExpanded, setIsExpanded] = React.useState(false);
|
|
15
|
+
const drawerRef = React.useRef<HTMLDivElement>();
|
|
16
|
+
|
|
17
|
+
const onExpand = () => {
|
|
18
|
+
drawerRef.current && drawerRef.current.focus();
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const onClick = () => {
|
|
22
|
+
setIsExpanded(!isExpanded);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const onCloseClick = () => {
|
|
26
|
+
setIsExpanded(false);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const panelContent = (
|
|
30
|
+
<DrawerPanelContent>
|
|
31
|
+
<DrawerHead>
|
|
32
|
+
<span tabIndex={isExpanded ? 0 : -1} ref={drawerRef}>
|
|
33
|
+
drawer-panel
|
|
34
|
+
</span>
|
|
35
|
+
<DrawerActions>
|
|
36
|
+
<DrawerCloseButton onClick={onCloseClick} />
|
|
37
|
+
</DrawerActions>
|
|
38
|
+
</DrawerHead>
|
|
39
|
+
</DrawerPanelContent>
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
const drawerContent =
|
|
43
|
+
'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus pretium est a porttitor vehicula. Quisque vel commodo urna. Morbi mattis rutrum ante, id vehicula ex accumsan ut. Morbi viverra, eros vel porttitor facilisis, eros purus aliquet erat,nec lobortis felis elit pulvinar sem. Vivamus vulputate, risus eget commodo eleifend, eros nibh porta quam, vitae lacinia leo libero at magna. Maecenas aliquam sagittis orci, et posuere nisi ultrices sit amet. Aliquam ex odio, malesuada sed posuere quis, pellentesque at mauris. Phasellus venenatis massa ex, eget pulvinar libero auctor pretium. Aliquam erat volutpat. Duis euismod justo in quam ullamcorper, in commodo massa vulputate.';
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<React.Fragment>
|
|
47
|
+
<Button aria-expanded={isExpanded} onClick={onClick}>
|
|
48
|
+
Toggle drawer
|
|
49
|
+
</Button>
|
|
50
|
+
<Drawer isExpanded={isExpanded} position="right" onExpand={onExpand}>
|
|
51
|
+
<DrawerContent panelContent={panelContent}>
|
|
52
|
+
<DrawerContentBody>{drawerContent}</DrawerContentBody>
|
|
53
|
+
</DrawerContent>
|
|
54
|
+
</Drawer>
|
|
55
|
+
</React.Fragment>
|
|
56
|
+
);
|
|
57
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Drawer,
|
|
4
|
+
DrawerPanelContent,
|
|
5
|
+
DrawerHead,
|
|
6
|
+
DrawerActions,
|
|
7
|
+
DrawerCloseButton,
|
|
8
|
+
Button,
|
|
9
|
+
DrawerContent,
|
|
10
|
+
DrawerContentBody
|
|
11
|
+
} from '@patternfly/react-core';
|
|
12
|
+
|
|
13
|
+
export const DrawerResizableOnBottom: React.FunctionComponent = () => {
|
|
14
|
+
const [isExpanded, setIsExpanded] = React.useState(false);
|
|
15
|
+
const drawerRef = React.useRef<HTMLDivElement>();
|
|
16
|
+
|
|
17
|
+
const onExpand = () => {
|
|
18
|
+
drawerRef.current && drawerRef.current.focus();
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const onClick = () => {
|
|
22
|
+
setIsExpanded(!isExpanded);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const onCloseClick = () => {
|
|
26
|
+
setIsExpanded(false);
|
|
27
|
+
};
|
|
28
|
+
const panelContent = (
|
|
29
|
+
<DrawerPanelContent isResizable defaultSize={'200px'} minSize={'100px'}>
|
|
30
|
+
<DrawerHead>
|
|
31
|
+
<span tabIndex={isExpanded ? 0 : -1} ref={drawerRef}>
|
|
32
|
+
drawer-panel
|
|
33
|
+
</span>
|
|
34
|
+
<DrawerActions>
|
|
35
|
+
<DrawerCloseButton onClick={onCloseClick} />
|
|
36
|
+
</DrawerActions>
|
|
37
|
+
</DrawerHead>
|
|
38
|
+
</DrawerPanelContent>
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
const drawerContent =
|
|
42
|
+
'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus pretium est a porttitor vehicula. Quisque vel commodo urna. Morbi mattis rutrum ante, id vehicula ex accumsan ut. Morbi viverra, eros vel porttitor facilisis, eros purus aliquet erat,nec lobortis felis elit pulvinar sem. Vivamus vulputate, risus eget commodo eleifend, eros nibh porta quam, vitae lacinia leo libero at magna. Maecenas aliquam sagittis orci, et posuere nisi ultrices sit amet. Aliquam ex odio, malesuada sed posuere quis, pellentesque at mauris. Phasellus venenatis massa ex, eget pulvinar libero auctor pretium. Aliquam erat volutpat. Duis euismod justo in quam ullamcorper, in commodo massa vulputate.';
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<React.Fragment>
|
|
46
|
+
<Button aria-expanded={isExpanded} onClick={onClick}>
|
|
47
|
+
Toggle drawer
|
|
48
|
+
</Button>
|
|
49
|
+
<div style={{ height: '400px' }}>
|
|
50
|
+
<Drawer isExpanded={isExpanded} onExpand={onExpand} position="bottom">
|
|
51
|
+
<DrawerContent panelContent={panelContent}>
|
|
52
|
+
<DrawerContentBody>{drawerContent}</DrawerContentBody>
|
|
53
|
+
</DrawerContent>
|
|
54
|
+
</Drawer>
|
|
55
|
+
</div>
|
|
56
|
+
</React.Fragment>
|
|
57
|
+
);
|
|
58
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Drawer,
|
|
4
|
+
DrawerPanelContent,
|
|
5
|
+
DrawerHead,
|
|
6
|
+
DrawerActions,
|
|
7
|
+
DrawerCloseButton,
|
|
8
|
+
Button,
|
|
9
|
+
DrawerContent,
|
|
10
|
+
DrawerContentBody
|
|
11
|
+
} from '@patternfly/react-core';
|
|
12
|
+
|
|
13
|
+
export const DrawerResizableOnInline: React.FunctionComponent = () => {
|
|
14
|
+
const [isExpanded, setIsExpanded] = React.useState(false);
|
|
15
|
+
const drawerRef = React.useRef<HTMLDivElement>();
|
|
16
|
+
|
|
17
|
+
const onExpand = () => {
|
|
18
|
+
drawerRef.current && drawerRef.current.focus();
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const onClick = () => {
|
|
22
|
+
setIsExpanded(!isExpanded);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const onCloseClick = () => {
|
|
26
|
+
setIsExpanded(false);
|
|
27
|
+
};
|
|
28
|
+
const panelContent = (
|
|
29
|
+
<DrawerPanelContent isResizable defaultSize={'500px'} minSize={'150px'}>
|
|
30
|
+
<DrawerHead>
|
|
31
|
+
<span tabIndex={isExpanded ? 0 : -1} ref={drawerRef}>
|
|
32
|
+
drawer-panel
|
|
33
|
+
</span>
|
|
34
|
+
<DrawerActions>
|
|
35
|
+
<DrawerCloseButton onClick={onCloseClick} />
|
|
36
|
+
</DrawerActions>
|
|
37
|
+
</DrawerHead>
|
|
38
|
+
</DrawerPanelContent>
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
const drawerContent =
|
|
42
|
+
'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus pretium est a porttitor vehicula. Quisque vel commodo urna. Morbi mattis rutrum ante, id vehicula ex accumsan ut. Morbi viverra, eros vel porttitor facilisis, eros purus aliquet erat,nec lobortis felis elit pulvinar sem. Vivamus vulputate, risus eget commodo eleifend, eros nibh porta quam, vitae lacinia leo libero at magna. Maecenas aliquam sagittis orci, et posuere nisi ultrices sit amet. Aliquam ex odio, malesuada sed posuere quis, pellentesque at mauris. Phasellus venenatis massa ex, eget pulvinar libero auctor pretium. Aliquam erat volutpat. Duis euismod justo in quam ullamcorper, in commodo massa vulputate.';
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<React.Fragment>
|
|
46
|
+
<Button aria-expanded={isExpanded} onClick={onClick}>
|
|
47
|
+
Toggle drawer
|
|
48
|
+
</Button>
|
|
49
|
+
<Drawer isExpanded={isExpanded} onExpand={onExpand} isInline>
|
|
50
|
+
<DrawerContent panelContent={panelContent}>
|
|
51
|
+
<DrawerContentBody>{drawerContent}</DrawerContentBody>
|
|
52
|
+
</DrawerContent>
|
|
53
|
+
</Drawer>
|
|
54
|
+
</React.Fragment>
|
|
55
|
+
);
|
|
56
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Drawer,
|
|
4
|
+
DrawerPanelContent,
|
|
5
|
+
DrawerContent,
|
|
6
|
+
DrawerContentBody,
|
|
7
|
+
DrawerHead,
|
|
8
|
+
DrawerActions,
|
|
9
|
+
DrawerCloseButton,
|
|
10
|
+
Button
|
|
11
|
+
} from '@patternfly/react-core';
|
|
12
|
+
|
|
13
|
+
export const DrawerResizableOnLeft: React.FunctionComponent = () => {
|
|
14
|
+
const [isExpanded, setIsExpanded] = React.useState(false);
|
|
15
|
+
const drawerRef = React.useRef<HTMLDivElement>();
|
|
16
|
+
|
|
17
|
+
const onExpand = () => {
|
|
18
|
+
drawerRef.current && drawerRef.current.focus();
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const onClick = () => {
|
|
22
|
+
setIsExpanded(!isExpanded);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const onCloseClick = () => {
|
|
26
|
+
setIsExpanded(false);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const panelContent = (
|
|
30
|
+
<DrawerPanelContent isResizable defaultSize={'500px'} minSize={'200px'}>
|
|
31
|
+
<DrawerHead>
|
|
32
|
+
<span tabIndex={isExpanded ? 0 : -1} ref={drawerRef}>
|
|
33
|
+
drawer-panel
|
|
34
|
+
</span>
|
|
35
|
+
<DrawerActions>
|
|
36
|
+
<DrawerCloseButton onClick={onCloseClick} />
|
|
37
|
+
</DrawerActions>
|
|
38
|
+
</DrawerHead>
|
|
39
|
+
</DrawerPanelContent>
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
const drawerContent =
|
|
43
|
+
'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus pretium est a porttitor vehicula. Quisque vel commodo urna. Morbi mattis rutrum ante, id vehicula ex accumsan ut. Morbi viverra, eros vel porttitor facilisis, eros purus aliquet erat,nec lobortis felis elit pulvinar sem. Vivamus vulputate, risus eget commodo eleifend, eros nibh porta quam, vitae lacinia leo libero at magna. Maecenas aliquam sagittis orci, et posuere nisi ultrices sit amet. Aliquam ex odio, malesuada sed posuere quis, pellentesque at mauris. Phasellus venenatis massa ex, eget pulvinar libero auctor pretium. Aliquam erat volutpat. Duis euismod justo in quam ullamcorper, in commodo massa vulputate.';
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<React.Fragment>
|
|
47
|
+
<Button aria-expanded={isExpanded} onClick={onClick}>
|
|
48
|
+
Toggle drawer
|
|
49
|
+
</Button>
|
|
50
|
+
<Drawer isExpanded={isExpanded} onExpand={onExpand} position="left">
|
|
51
|
+
<DrawerContent panelContent={panelContent}>
|
|
52
|
+
<DrawerContentBody>{drawerContent}</DrawerContentBody>
|
|
53
|
+
</DrawerContent>
|
|
54
|
+
</Drawer>
|
|
55
|
+
</React.Fragment>
|
|
56
|
+
);
|
|
57
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Drawer,
|
|
4
|
+
DrawerPanelContent,
|
|
5
|
+
DrawerContent,
|
|
6
|
+
DrawerContentBody,
|
|
7
|
+
DrawerHead,
|
|
8
|
+
DrawerActions,
|
|
9
|
+
DrawerCloseButton,
|
|
10
|
+
Button
|
|
11
|
+
} from '@patternfly/react-core';
|
|
12
|
+
|
|
13
|
+
export const DrawerResizableOnRight: React.FunctionComponent = () => {
|
|
14
|
+
const [isExpanded, setIsExpanded] = React.useState(false);
|
|
15
|
+
const drawerRef = React.useRef<HTMLDivElement>();
|
|
16
|
+
|
|
17
|
+
const onExpand = () => {
|
|
18
|
+
drawerRef.current && drawerRef.current.focus();
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const onClick = () => {
|
|
22
|
+
setIsExpanded(!isExpanded);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const onCloseClick = () => {
|
|
26
|
+
setIsExpanded(false);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const onResize = (newWidth: number, id: string) => {
|
|
30
|
+
// eslint-disable-next-line no-console
|
|
31
|
+
console.log(`${id} has new width of: ${newWidth}`);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const panelContent = (
|
|
35
|
+
<DrawerPanelContent isResizable onResize={onResize} id="right-resize-panel" defaultSize={'500px'} minSize={'150px'}>
|
|
36
|
+
<DrawerHead>
|
|
37
|
+
<span tabIndex={isExpanded ? 0 : -1} ref={drawerRef}>
|
|
38
|
+
drawer-panel
|
|
39
|
+
</span>
|
|
40
|
+
<DrawerActions>
|
|
41
|
+
<DrawerCloseButton onClick={onCloseClick} />
|
|
42
|
+
</DrawerActions>
|
|
43
|
+
</DrawerHead>
|
|
44
|
+
</DrawerPanelContent>
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
const drawerContent =
|
|
48
|
+
'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus pretium est a porttitor vehicula. Quisque vel commodo urna. Morbi mattis rutrum ante, id vehicula ex accumsan ut. Morbi viverra, eros vel porttitor facilisis, eros purus aliquet erat,nec lobortis felis elit pulvinar sem. Vivamus vulputate, risus eget commodo eleifend, eros nibh porta quam, vitae lacinia leo libero at magna. Maecenas aliquam sagittis orci, et posuere nisi ultrices sit amet. Aliquam ex odio, malesuada sed posuere quis, pellentesque at mauris. Phasellus venenatis massa ex, eget pulvinar libero auctor pretium. Aliquam erat volutpat. Duis euismod justo in quam ullamcorper, in commodo massa vulputate.';
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<React.Fragment>
|
|
52
|
+
<Button aria-expanded={isExpanded} onClick={onClick}>
|
|
53
|
+
Toggle drawer
|
|
54
|
+
</Button>
|
|
55
|
+
<Drawer isExpanded={isExpanded} onExpand={onExpand} position="right">
|
|
56
|
+
<DrawerContent panelContent={panelContent}>
|
|
57
|
+
<DrawerContentBody>{drawerContent}</DrawerContentBody>
|
|
58
|
+
</DrawerContent>
|
|
59
|
+
</Drawer>
|
|
60
|
+
</React.Fragment>
|
|
61
|
+
);
|
|
62
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Drawer,
|
|
4
|
+
DrawerPanelContent,
|
|
5
|
+
DrawerContent,
|
|
6
|
+
DrawerContentBody,
|
|
7
|
+
DrawerHead,
|
|
8
|
+
DrawerActions,
|
|
9
|
+
DrawerCloseButton,
|
|
10
|
+
DrawerPanelBody,
|
|
11
|
+
Button
|
|
12
|
+
} from '@patternfly/react-core';
|
|
13
|
+
|
|
14
|
+
export const DrawerStackedContentBodyElements: React.FunctionComponent = () => {
|
|
15
|
+
const [isExpanded, setIsExpanded] = React.useState(false);
|
|
16
|
+
const drawerRef = React.useRef<HTMLDivElement>();
|
|
17
|
+
|
|
18
|
+
const onExpand = () => {
|
|
19
|
+
drawerRef.current && drawerRef.current.focus();
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const onClick = () => {
|
|
23
|
+
setIsExpanded(!isExpanded);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const onCloseClick = () => {
|
|
27
|
+
setIsExpanded(false);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const panelContent = (
|
|
31
|
+
<DrawerPanelContent>
|
|
32
|
+
<DrawerHead>
|
|
33
|
+
<h3 className="pf-c-title pf-m-2xl" tabIndex={isExpanded ? 0 : -1} ref={drawerRef}>
|
|
34
|
+
drawer title{' '}
|
|
35
|
+
</h3>
|
|
36
|
+
<DrawerActions>
|
|
37
|
+
<DrawerCloseButton onClick={onCloseClick} />
|
|
38
|
+
</DrawerActions>
|
|
39
|
+
drawer-panel
|
|
40
|
+
</DrawerHead>
|
|
41
|
+
<DrawerPanelBody hasNoPadding>drawer-panel with no padding</DrawerPanelBody>
|
|
42
|
+
<DrawerPanelBody>drawer-panel</DrawerPanelBody>
|
|
43
|
+
</DrawerPanelContent>
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<React.Fragment>
|
|
48
|
+
<Button aria-expanded={isExpanded} onClick={onClick}>
|
|
49
|
+
Toggle drawer
|
|
50
|
+
</Button>
|
|
51
|
+
<Drawer isExpanded={isExpanded} onExpand={onExpand}>
|
|
52
|
+
<DrawerContent panelContent={panelContent}>
|
|
53
|
+
<DrawerContentBody>content-body</DrawerContentBody>
|
|
54
|
+
<DrawerContentBody hasPadding>content-body with padding</DrawerContentBody>
|
|
55
|
+
<DrawerContentBody>content-body</DrawerContentBody>
|
|
56
|
+
</DrawerContent>
|
|
57
|
+
</Drawer>
|
|
58
|
+
</React.Fragment>
|
|
59
|
+
);
|
|
60
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Drawer,
|
|
4
|
+
DrawerPanelContent,
|
|
5
|
+
DrawerContent,
|
|
6
|
+
DrawerContentBody,
|
|
7
|
+
DrawerHead,
|
|
8
|
+
DrawerActions,
|
|
9
|
+
DrawerCloseButton,
|
|
10
|
+
Button
|
|
11
|
+
} from '@patternfly/react-core';
|
|
12
|
+
|
|
13
|
+
export const DrawerStatic: React.FunctionComponent = () => {
|
|
14
|
+
const [isExpanded, setIsExpanded] = React.useState(false);
|
|
15
|
+
const drawerRef = React.useRef<HTMLDivElement>();
|
|
16
|
+
|
|
17
|
+
const onExpand = () => {
|
|
18
|
+
drawerRef.current && drawerRef.current.focus();
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const onClick = () => {
|
|
22
|
+
setIsExpanded(!isExpanded);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const onCloseClick = () => {
|
|
26
|
+
setIsExpanded(false);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const panelContent = (
|
|
30
|
+
<DrawerPanelContent>
|
|
31
|
+
<DrawerHead>
|
|
32
|
+
<span tabIndex={isExpanded ? 0 : -1} ref={drawerRef}>
|
|
33
|
+
drawer-panel
|
|
34
|
+
</span>
|
|
35
|
+
<DrawerActions>
|
|
36
|
+
<DrawerCloseButton onClick={onCloseClick} />
|
|
37
|
+
</DrawerActions>
|
|
38
|
+
</DrawerHead>
|
|
39
|
+
</DrawerPanelContent>
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
const drawerContent =
|
|
43
|
+
'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus pretium est a porttitor vehicula. Quisque vel commodo urna. Morbi mattis rutrum ante, id vehicula ex accumsan ut. Morbi viverra, eros vel porttitor facilisis, eros purus aliquet erat,nec lobortis felis elit pulvinar sem. Vivamus vulputate, risus eget commodo eleifend, eros nibh porta quam, vitae lacinia leo libero at magna. Maecenas aliquam sagittis orci, et posuere nisi ultrices sit amet. Aliquam ex odio, malesuada sed posuere quis, pellentesque at mauris. Phasellus venenatis massa ex, eget pulvinar libero auctor pretium. Aliquam erat volutpat. Duis euismod justo in quam ullamcorper, in commodo massa vulputate.';
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<React.Fragment>
|
|
47
|
+
<Button className="pf-u-hidden-on-md" aria-expanded={isExpanded} onClick={onClick}>
|
|
48
|
+
Toggle drawer
|
|
49
|
+
</Button>
|
|
50
|
+
<Drawer isStatic isExpanded={isExpanded} onExpand={onExpand}>
|
|
51
|
+
<DrawerContent panelContent={panelContent}>
|
|
52
|
+
<DrawerContentBody>{drawerContent}</DrawerContentBody>
|
|
53
|
+
</DrawerContent>
|
|
54
|
+
</Drawer>
|
|
55
|
+
</React.Fragment>
|
|
56
|
+
);
|
|
57
|
+
};
|
|
@@ -268,7 +268,7 @@ class SelectMenuWithRef extends React.Component<SelectMenuProps> {
|
|
|
268
268
|
}
|
|
269
269
|
}
|
|
270
270
|
|
|
271
|
-
export const SelectMenu = React.forwardRef((props, ref) => (
|
|
271
|
+
export const SelectMenu = React.forwardRef<unknown, React.PropsWithChildren<unknown>>((props, ref) => (
|
|
272
272
|
<SelectMenuWithRef innerRef={ref} {...props}>
|
|
273
273
|
{props.children}
|
|
274
274
|
</SelectMenuWithRef>
|
|
@@ -41,8 +41,10 @@ export interface TabsProps extends Omit<React.HTMLProps<HTMLElement | HTMLDivEle
|
|
|
41
41
|
isBox?: boolean;
|
|
42
42
|
/** Enables vertical tab styling */
|
|
43
43
|
isVertical?: boolean;
|
|
44
|
-
/** Enables
|
|
44
|
+
/** Enables border bottom tab styling on tabs. Defaults to true. To remove the bottom border, set this prop to false. */
|
|
45
45
|
hasBorderBottom?: boolean;
|
|
46
|
+
/** Enables border bottom styling for secondary tabs */
|
|
47
|
+
hasSecondaryBorderBottom?: boolean;
|
|
46
48
|
/** Aria-label for the left scroll button */
|
|
47
49
|
leftScrollAriaLabel?: string;
|
|
48
50
|
/** Aria-label for the right scroll button */
|
|
@@ -292,6 +294,7 @@ export class Tabs extends React.Component<TabsProps, TabsState> {
|
|
|
292
294
|
isVertical,
|
|
293
295
|
isBox,
|
|
294
296
|
hasBorderBottom,
|
|
297
|
+
hasSecondaryBorderBottom,
|
|
295
298
|
leftScrollAriaLabel,
|
|
296
299
|
rightScrollAriaLabel,
|
|
297
300
|
'aria-label': ariaLabel,
|
|
@@ -361,6 +364,7 @@ export class Tabs extends React.Component<TabsProps, TabsState> {
|
|
|
361
364
|
showScrollButtons && !isVertical && styles.modifiers.scrollable,
|
|
362
365
|
usePageInsets && styles.modifiers.pageInsets,
|
|
363
366
|
!hasBorderBottom && styles.modifiers.noBorderBottom,
|
|
367
|
+
hasSecondaryBorderBottom && styles.modifiers.borderBottom,
|
|
364
368
|
formatBreakpointMods(inset, styles),
|
|
365
369
|
variantStyle[variant],
|
|
366
370
|
className
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { render } from '@testing-library/react';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
3
|
import { Tabs } from '../Tabs';
|
|
4
4
|
import { Tab } from '../Tab';
|
|
5
5
|
import { TabTitleText } from '../TabTitleText';
|
|
@@ -350,3 +350,42 @@ test('should render tabs with no bottom border', () => {
|
|
|
350
350
|
expect(asFragment()).toMatchSnapshot();
|
|
351
351
|
});
|
|
352
352
|
|
|
353
|
+
test('should not render tabs with secondary border bottom when not passed hasSecondaryBorderBottom', () => {
|
|
354
|
+
render(
|
|
355
|
+
<Tabs id="noBottomBorderTabs" aria-label="Secondary bottom border">
|
|
356
|
+
<Tab id="tab1" eventKey={0} title={<TabTitleText>"Tab item 1"</TabTitleText>}>
|
|
357
|
+
Tab 1 section
|
|
358
|
+
</Tab>
|
|
359
|
+
<Tab id="tab2" eventKey={1} title={<TabTitleText>"Tab item 2"</TabTitleText>}>
|
|
360
|
+
Tab 2 section
|
|
361
|
+
</Tab>
|
|
362
|
+
<Tab id="tab3" eventKey={2} title={<TabTitleText>"Tab item 3"</TabTitleText>}>
|
|
363
|
+
Tab 3 section
|
|
364
|
+
</Tab>
|
|
365
|
+
</Tabs>
|
|
366
|
+
);
|
|
367
|
+
|
|
368
|
+
const tabsContainer = screen.queryByLabelText('Secondary bottom border');
|
|
369
|
+
|
|
370
|
+
expect(tabsContainer).not.toHaveClass('pf-m-border-bottom');
|
|
371
|
+
});
|
|
372
|
+
|
|
373
|
+
test('should render tabs with secondary border bottom when passed hasSecondaryBorderBottom', () => {
|
|
374
|
+
render(
|
|
375
|
+
<Tabs id="noBottomBorderTabs" aria-label="Secondary bottom border" hasSecondaryBorderBottom>
|
|
376
|
+
<Tab id="tab1" eventKey={0} title={<TabTitleText>"Tab item 1"</TabTitleText>}>
|
|
377
|
+
Tab 1 section
|
|
378
|
+
</Tab>
|
|
379
|
+
<Tab id="tab2" eventKey={1} title={<TabTitleText>"Tab item 2"</TabTitleText>}>
|
|
380
|
+
Tab 2 section
|
|
381
|
+
</Tab>
|
|
382
|
+
<Tab id="tab3" eventKey={2} title={<TabTitleText>"Tab item 3"</TabTitleText>}>
|
|
383
|
+
Tab 3 section
|
|
384
|
+
</Tab>
|
|
385
|
+
</Tabs>
|
|
386
|
+
);
|
|
387
|
+
|
|
388
|
+
const tabsContainer = screen.queryByLabelText('Secondary bottom border');
|
|
389
|
+
|
|
390
|
+
expect(tabsContainer).toHaveClass('pf-m-border-bottom');
|
|
391
|
+
});
|
|
@@ -381,6 +381,7 @@ export class Wizard extends React.Component<WizardProps, WizardState> {
|
|
|
381
381
|
return (
|
|
382
382
|
<WizardNavItem
|
|
383
383
|
key={index}
|
|
384
|
+
id={step.id}
|
|
384
385
|
content={step.name}
|
|
385
386
|
isExpandable={isNavExpandable}
|
|
386
387
|
isCurrent={hasActiveChild}
|
|
@@ -399,6 +400,7 @@ export class Wizard extends React.Component<WizardProps, WizardState> {
|
|
|
399
400
|
return (
|
|
400
401
|
<WizardNavItem
|
|
401
402
|
key={`child_${indexChild}`}
|
|
403
|
+
id={childStep.id}
|
|
402
404
|
content={childStep.name}
|
|
403
405
|
isCurrent={activeStep.name === childStep.name}
|
|
404
406
|
isDisabled={!enabled}
|
|
@@ -417,6 +419,7 @@ export class Wizard extends React.Component<WizardProps, WizardState> {
|
|
|
417
419
|
<WizardNavItem
|
|
418
420
|
{...step.stepNavItemProps}
|
|
419
421
|
key={index}
|
|
422
|
+
id={step.id}
|
|
420
423
|
content={step.name}
|
|
421
424
|
isCurrent={activeStep.name === step.name}
|
|
422
425
|
isDisabled={!enabled}
|
|
@@ -22,6 +22,8 @@ export interface WizardNavItemProps {
|
|
|
22
22
|
href?: string;
|
|
23
23
|
/** Flag indicating that this NavItem has child steps and is expandable */
|
|
24
24
|
isExpandable?: boolean;
|
|
25
|
+
/** The id for the nav item */
|
|
26
|
+
id?: string | number;
|
|
25
27
|
}
|
|
26
28
|
|
|
27
29
|
export const WizardNavItem: React.FunctionComponent<WizardNavItemProps> = ({
|
|
@@ -34,6 +36,7 @@ export const WizardNavItem: React.FunctionComponent<WizardNavItemProps> = ({
|
|
|
34
36
|
navItemComponent = 'button',
|
|
35
37
|
href = null,
|
|
36
38
|
isExpandable = false,
|
|
39
|
+
id,
|
|
37
40
|
...rest
|
|
38
41
|
}: WizardNavItemProps) => {
|
|
39
42
|
const NavItemComponent = navItemComponent;
|
|
@@ -69,6 +72,7 @@ export const WizardNavItem: React.FunctionComponent<WizardNavItemProps> = ({
|
|
|
69
72
|
<NavItemComponent
|
|
70
73
|
{...rest}
|
|
71
74
|
{...(navItemComponent === 'a' ? { ...linkProps } : { ...btnProps })}
|
|
75
|
+
{...(id && { id: id.toString() })}
|
|
72
76
|
onClick={() => (isExpandable ? setIsExpanded(!isExpanded || isCurrent) : onNavItemClick(step))}
|
|
73
77
|
className={css(
|
|
74
78
|
styles.wizardNavLink,
|
|
@@ -5,24 +5,27 @@ import { Wizard, WizardStepFunctionType, WizardStep } from '../Wizard';
|
|
|
5
5
|
describe('Wizard', () => {
|
|
6
6
|
test('Wizard should match snapshot', () => {
|
|
7
7
|
const steps: WizardStep[] = [
|
|
8
|
-
{ name: 'A', component: <p>Step 1</p> },
|
|
8
|
+
{ name: 'A', id: "step-A", component: <p>Step 1</p> },
|
|
9
9
|
{
|
|
10
10
|
name: 'B',
|
|
11
|
+
id: "step-B",
|
|
11
12
|
steps: [
|
|
12
13
|
{
|
|
13
14
|
name: 'B-1',
|
|
15
|
+
id: "step-B-1",
|
|
14
16
|
component: <p>Step 2</p>,
|
|
15
17
|
enableNext: true
|
|
16
18
|
},
|
|
17
19
|
{
|
|
18
20
|
name: 'B-2',
|
|
21
|
+
id: "step-B-2",
|
|
19
22
|
component: <p>Step 3</p>,
|
|
20
23
|
enableNext: false
|
|
21
24
|
}
|
|
22
25
|
]
|
|
23
26
|
},
|
|
24
|
-
{ name: 'C', component: <p>Step 4</p> },
|
|
25
|
-
{ name: 'D', component: <p>Step 5</p> }
|
|
27
|
+
{ name: 'C', id: "step-C", component: <p>Step 4</p> },
|
|
28
|
+
{ name: 'D', id: "step-D", component: <p>Step 5</p> }
|
|
26
29
|
];
|
|
27
30
|
const onBack: WizardStepFunctionType = step => {
|
|
28
31
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|