@patternfly/react-core 4.237.11 → 4.239.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 +22 -0
- package/dist/esm/components/SearchInput/SearchInput.d.ts +10 -0
- package/dist/esm/components/SearchInput/SearchInput.d.ts.map +1 -1
- package/dist/esm/components/SearchInput/SearchInput.js +48 -6
- package/dist/esm/components/SearchInput/SearchInput.js.map +1 -1
- package/dist/esm/next/components/Dropdown/Dropdown.d.ts +25 -0
- package/dist/esm/next/components/Dropdown/Dropdown.d.ts.map +1 -0
- package/dist/esm/next/components/Dropdown/Dropdown.js +59 -0
- package/dist/esm/next/components/Dropdown/Dropdown.js.map +1 -0
- package/dist/esm/next/components/Dropdown/DropdownGroup.d.ts +12 -0
- package/dist/esm/next/components/Dropdown/DropdownGroup.d.ts.map +1 -0
- package/dist/esm/next/components/Dropdown/DropdownGroup.js +10 -0
- package/dist/esm/next/components/Dropdown/DropdownGroup.js.map +1 -0
- package/dist/esm/next/components/Dropdown/DropdownItem.d.ts +12 -0
- package/dist/esm/next/components/Dropdown/DropdownItem.d.ts.map +1 -0
- package/dist/esm/next/components/Dropdown/DropdownItem.js +10 -0
- package/dist/esm/next/components/Dropdown/DropdownItem.js.map +1 -0
- package/dist/esm/next/components/Dropdown/DropdownList.d.ts +10 -0
- package/dist/esm/next/components/Dropdown/DropdownList.d.ts.map +1 -0
- package/dist/esm/next/components/Dropdown/DropdownList.js +10 -0
- package/dist/esm/next/components/Dropdown/DropdownList.js.map +1 -0
- package/dist/esm/next/components/Dropdown/index.d.ts +5 -0
- package/dist/esm/next/components/Dropdown/index.d.ts.map +1 -0
- package/dist/esm/next/components/Dropdown/index.js +5 -0
- package/dist/esm/next/components/Dropdown/index.js.map +1 -0
- package/dist/esm/next/components/index.d.ts +1 -0
- package/dist/esm/next/components/index.d.ts.map +1 -1
- package/dist/esm/next/components/index.js +1 -0
- package/dist/esm/next/components/index.js.map +1 -1
- package/dist/js/components/SearchInput/SearchInput.d.ts +10 -0
- package/dist/js/components/SearchInput/SearchInput.d.ts.map +1 -1
- package/dist/js/components/SearchInput/SearchInput.js +48 -6
- package/dist/js/components/SearchInput/SearchInput.js.map +1 -1
- package/dist/js/next/components/Dropdown/Dropdown.d.ts +25 -0
- package/dist/js/next/components/Dropdown/Dropdown.d.ts.map +1 -0
- package/dist/js/next/components/Dropdown/Dropdown.js +63 -0
- package/dist/js/next/components/Dropdown/Dropdown.js.map +1 -0
- package/dist/js/next/components/Dropdown/DropdownGroup.d.ts +12 -0
- package/dist/js/next/components/Dropdown/DropdownGroup.d.ts.map +1 -0
- package/dist/js/next/components/Dropdown/DropdownGroup.js +14 -0
- package/dist/js/next/components/Dropdown/DropdownGroup.js.map +1 -0
- package/dist/js/next/components/Dropdown/DropdownItem.d.ts +12 -0
- package/dist/js/next/components/Dropdown/DropdownItem.d.ts.map +1 -0
- package/dist/js/next/components/Dropdown/DropdownItem.js +14 -0
- package/dist/js/next/components/Dropdown/DropdownItem.js.map +1 -0
- package/dist/js/next/components/Dropdown/DropdownList.d.ts +10 -0
- package/dist/js/next/components/Dropdown/DropdownList.d.ts.map +1 -0
- package/dist/js/next/components/Dropdown/DropdownList.js +14 -0
- package/dist/js/next/components/Dropdown/DropdownList.js.map +1 -0
- package/dist/js/next/components/Dropdown/index.d.ts +5 -0
- package/dist/js/next/components/Dropdown/index.d.ts.map +1 -0
- package/dist/js/next/components/Dropdown/index.js +8 -0
- package/dist/js/next/components/Dropdown/index.js.map +1 -0
- package/dist/js/next/components/index.d.ts +1 -0
- package/dist/js/next/components/index.d.ts.map +1 -1
- package/dist/js/next/components/index.js +1 -0
- package/dist/js/next/components/index.js.map +1 -1
- package/dist/umd/react-core.min.css +1262 -1262
- package/dist/umd/react-core.min.js +1 -1
- package/package.json +5 -5
- package/src/components/SearchInput/SearchInput.tsx +73 -7
- package/src/components/SearchInput/__tests__/SearchInput.test.tsx +82 -0
- package/src/components/SearchInput/examples/SearchInput.md +6 -1
- package/src/components/SearchInput/examples/SearchInputWithExpandable.tsx +25 -0
- package/src/next/components/Dropdown/Dropdown.tsx +115 -0
- package/src/next/components/Dropdown/DropdownGroup.tsx +25 -0
- package/src/next/components/Dropdown/DropdownItem.tsx +24 -0
- package/src/next/components/Dropdown/DropdownList.tsx +21 -0
- package/src/next/components/Dropdown/examples/Dropdown.md +31 -0
- package/src/next/components/Dropdown/examples/DropdownBasic.tsx +54 -0
- package/src/next/components/Dropdown/examples/DropdownWithDescriptions.tsx +60 -0
- package/src/next/components/Dropdown/examples/DropdownWithGroups.tsx +65 -0
- package/src/next/components/Dropdown/examples/DropdownWithKebabToggle.tsx +62 -0
- package/src/next/components/Dropdown/index.ts +4 -0
- package/src/next/components/index.ts +1 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Dropdown, DropdownGroup, DropdownItem, DropdownList } from '@patternfly/react-core/next';
|
|
3
|
+
import { MenuToggle, Divider } from '@patternfly/react-core';
|
|
4
|
+
|
|
5
|
+
export const DropdownWithGroups: React.FunctionComponent = () => {
|
|
6
|
+
const [isOpen, setIsOpen] = React.useState(false);
|
|
7
|
+
const menuRef = React.useRef<HTMLDivElement>(null);
|
|
8
|
+
|
|
9
|
+
const onToggleClick = () => {
|
|
10
|
+
setIsOpen(!isOpen);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const onSelect = (_event: React.MouseEvent<Element, MouseEvent> | undefined, itemId: string | number | undefined) => {
|
|
14
|
+
// eslint-disable-next-line no-console
|
|
15
|
+
console.log('selected', itemId);
|
|
16
|
+
setIsOpen(false);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<Dropdown
|
|
21
|
+
innerRef={menuRef}
|
|
22
|
+
isOpen={isOpen}
|
|
23
|
+
onSelect={onSelect}
|
|
24
|
+
onOpenChange={isOpen => setIsOpen(isOpen)}
|
|
25
|
+
toggle={toggleRef => (
|
|
26
|
+
<MenuToggle ref={toggleRef} onClick={onToggleClick} isExpanded={isOpen}>
|
|
27
|
+
Dropdown
|
|
28
|
+
</MenuToggle>
|
|
29
|
+
)}
|
|
30
|
+
>
|
|
31
|
+
<DropdownGroup>
|
|
32
|
+
<DropdownList>
|
|
33
|
+
<DropdownItem itemId={0} key="link">
|
|
34
|
+
Link
|
|
35
|
+
</DropdownItem>
|
|
36
|
+
<DropdownItem itemId={1} key="action" to="#default-link2" onClick={ev => ev.preventDefault()}>
|
|
37
|
+
Action
|
|
38
|
+
</DropdownItem>
|
|
39
|
+
</DropdownList>
|
|
40
|
+
</DropdownGroup>
|
|
41
|
+
<Divider />
|
|
42
|
+
<DropdownGroup label="Group 2" labelHeadingLevel="h3">
|
|
43
|
+
<DropdownList>
|
|
44
|
+
<DropdownItem itemId={2} key="group2 link">
|
|
45
|
+
Group 2 link
|
|
46
|
+
</DropdownItem>
|
|
47
|
+
<DropdownItem itemId={3} key="group2 action" to="#default-link4">
|
|
48
|
+
group 2 action
|
|
49
|
+
</DropdownItem>
|
|
50
|
+
</DropdownList>
|
|
51
|
+
</DropdownGroup>
|
|
52
|
+
<Divider />
|
|
53
|
+
<DropdownGroup label="Group 3" labelHeadingLevel="h3">
|
|
54
|
+
<DropdownList>
|
|
55
|
+
<DropdownItem itemId={4} key="group3 link">
|
|
56
|
+
Group 3 link
|
|
57
|
+
</DropdownItem>
|
|
58
|
+
<DropdownItem itemId={5} key="group3 action">
|
|
59
|
+
Group 3 action
|
|
60
|
+
</DropdownItem>
|
|
61
|
+
</DropdownList>
|
|
62
|
+
</DropdownGroup>
|
|
63
|
+
</Dropdown>
|
|
64
|
+
);
|
|
65
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Dropdown, DropdownItem, DropdownList } from '@patternfly/react-core/next';
|
|
3
|
+
import { Divider, MenuToggle } from '@patternfly/react-core';
|
|
4
|
+
import EllipsisVIcon from '@patternfly/react-icons/dist/esm/icons/ellipsis-v-icon';
|
|
5
|
+
|
|
6
|
+
export const DropdownWithKebab: React.FunctionComponent = () => {
|
|
7
|
+
const [isOpen, setIsOpen] = React.useState(false);
|
|
8
|
+
const menuRef = React.useRef<HTMLDivElement>(null);
|
|
9
|
+
|
|
10
|
+
const onToggleClick = () => {
|
|
11
|
+
setIsOpen(!isOpen);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const onSelect = (_event: React.MouseEvent<Element, MouseEvent> | undefined, itemId: string | number | undefined) => {
|
|
15
|
+
// eslint-disable-next-line no-console
|
|
16
|
+
console.log('selected', itemId);
|
|
17
|
+
setIsOpen(false);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<Dropdown
|
|
22
|
+
innerRef={menuRef}
|
|
23
|
+
isOpen={isOpen}
|
|
24
|
+
onSelect={onSelect}
|
|
25
|
+
minWidth="150px"
|
|
26
|
+
onOpenChange={isOpen => setIsOpen(isOpen)}
|
|
27
|
+
toggle={toggleRef => (
|
|
28
|
+
<MenuToggle
|
|
29
|
+
ref={toggleRef}
|
|
30
|
+
aria-label="kebab dropdown toggle"
|
|
31
|
+
variant="plain"
|
|
32
|
+
onClick={onToggleClick}
|
|
33
|
+
isExpanded={isOpen}
|
|
34
|
+
>
|
|
35
|
+
<EllipsisVIcon />
|
|
36
|
+
</MenuToggle>
|
|
37
|
+
)}
|
|
38
|
+
>
|
|
39
|
+
<DropdownList>
|
|
40
|
+
<DropdownItem itemId={0} key="link">
|
|
41
|
+
Link
|
|
42
|
+
</DropdownItem>
|
|
43
|
+
<DropdownItem itemId={1} key="action" to="#default-link2" onClick={ev => ev.preventDefault()}>
|
|
44
|
+
Action
|
|
45
|
+
</DropdownItem>
|
|
46
|
+
<DropdownItem itemId={2} isDisabled key="disabled link">
|
|
47
|
+
Disabled link
|
|
48
|
+
</DropdownItem>
|
|
49
|
+
<DropdownItem itemId={3} isDisabled key="disabled action" to="#default-link4">
|
|
50
|
+
Disabled action
|
|
51
|
+
</DropdownItem>
|
|
52
|
+
<Divider key="separator" />,
|
|
53
|
+
<DropdownItem itemId={4} key="separated link">
|
|
54
|
+
Separated link
|
|
55
|
+
</DropdownItem>
|
|
56
|
+
<DropdownItem itemId={5} key="separated action">
|
|
57
|
+
Separated action
|
|
58
|
+
</DropdownItem>
|
|
59
|
+
</DropdownList>
|
|
60
|
+
</Dropdown>
|
|
61
|
+
);
|
|
62
|
+
};
|