@patternfly/react-core 4.208.13 → 4.211.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/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/umd/react-core.js +1 -1
- package/dist/umd/react-core.min.js +1 -1
- 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
|
@@ -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>
|