@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.
Files changed (75) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/esm/components/SearchInput/SearchInput.d.ts +10 -0
  3. package/dist/esm/components/SearchInput/SearchInput.d.ts.map +1 -1
  4. package/dist/esm/components/SearchInput/SearchInput.js +48 -6
  5. package/dist/esm/components/SearchInput/SearchInput.js.map +1 -1
  6. package/dist/esm/next/components/Dropdown/Dropdown.d.ts +25 -0
  7. package/dist/esm/next/components/Dropdown/Dropdown.d.ts.map +1 -0
  8. package/dist/esm/next/components/Dropdown/Dropdown.js +59 -0
  9. package/dist/esm/next/components/Dropdown/Dropdown.js.map +1 -0
  10. package/dist/esm/next/components/Dropdown/DropdownGroup.d.ts +12 -0
  11. package/dist/esm/next/components/Dropdown/DropdownGroup.d.ts.map +1 -0
  12. package/dist/esm/next/components/Dropdown/DropdownGroup.js +10 -0
  13. package/dist/esm/next/components/Dropdown/DropdownGroup.js.map +1 -0
  14. package/dist/esm/next/components/Dropdown/DropdownItem.d.ts +12 -0
  15. package/dist/esm/next/components/Dropdown/DropdownItem.d.ts.map +1 -0
  16. package/dist/esm/next/components/Dropdown/DropdownItem.js +10 -0
  17. package/dist/esm/next/components/Dropdown/DropdownItem.js.map +1 -0
  18. package/dist/esm/next/components/Dropdown/DropdownList.d.ts +10 -0
  19. package/dist/esm/next/components/Dropdown/DropdownList.d.ts.map +1 -0
  20. package/dist/esm/next/components/Dropdown/DropdownList.js +10 -0
  21. package/dist/esm/next/components/Dropdown/DropdownList.js.map +1 -0
  22. package/dist/esm/next/components/Dropdown/index.d.ts +5 -0
  23. package/dist/esm/next/components/Dropdown/index.d.ts.map +1 -0
  24. package/dist/esm/next/components/Dropdown/index.js +5 -0
  25. package/dist/esm/next/components/Dropdown/index.js.map +1 -0
  26. package/dist/esm/next/components/index.d.ts +1 -0
  27. package/dist/esm/next/components/index.d.ts.map +1 -1
  28. package/dist/esm/next/components/index.js +1 -0
  29. package/dist/esm/next/components/index.js.map +1 -1
  30. package/dist/js/components/SearchInput/SearchInput.d.ts +10 -0
  31. package/dist/js/components/SearchInput/SearchInput.d.ts.map +1 -1
  32. package/dist/js/components/SearchInput/SearchInput.js +48 -6
  33. package/dist/js/components/SearchInput/SearchInput.js.map +1 -1
  34. package/dist/js/next/components/Dropdown/Dropdown.d.ts +25 -0
  35. package/dist/js/next/components/Dropdown/Dropdown.d.ts.map +1 -0
  36. package/dist/js/next/components/Dropdown/Dropdown.js +63 -0
  37. package/dist/js/next/components/Dropdown/Dropdown.js.map +1 -0
  38. package/dist/js/next/components/Dropdown/DropdownGroup.d.ts +12 -0
  39. package/dist/js/next/components/Dropdown/DropdownGroup.d.ts.map +1 -0
  40. package/dist/js/next/components/Dropdown/DropdownGroup.js +14 -0
  41. package/dist/js/next/components/Dropdown/DropdownGroup.js.map +1 -0
  42. package/dist/js/next/components/Dropdown/DropdownItem.d.ts +12 -0
  43. package/dist/js/next/components/Dropdown/DropdownItem.d.ts.map +1 -0
  44. package/dist/js/next/components/Dropdown/DropdownItem.js +14 -0
  45. package/dist/js/next/components/Dropdown/DropdownItem.js.map +1 -0
  46. package/dist/js/next/components/Dropdown/DropdownList.d.ts +10 -0
  47. package/dist/js/next/components/Dropdown/DropdownList.d.ts.map +1 -0
  48. package/dist/js/next/components/Dropdown/DropdownList.js +14 -0
  49. package/dist/js/next/components/Dropdown/DropdownList.js.map +1 -0
  50. package/dist/js/next/components/Dropdown/index.d.ts +5 -0
  51. package/dist/js/next/components/Dropdown/index.d.ts.map +1 -0
  52. package/dist/js/next/components/Dropdown/index.js +8 -0
  53. package/dist/js/next/components/Dropdown/index.js.map +1 -0
  54. package/dist/js/next/components/index.d.ts +1 -0
  55. package/dist/js/next/components/index.d.ts.map +1 -1
  56. package/dist/js/next/components/index.js +1 -0
  57. package/dist/js/next/components/index.js.map +1 -1
  58. package/dist/umd/react-core.min.css +1262 -1262
  59. package/dist/umd/react-core.min.js +1 -1
  60. package/package.json +5 -5
  61. package/src/components/SearchInput/SearchInput.tsx +73 -7
  62. package/src/components/SearchInput/__tests__/SearchInput.test.tsx +82 -0
  63. package/src/components/SearchInput/examples/SearchInput.md +6 -1
  64. package/src/components/SearchInput/examples/SearchInputWithExpandable.tsx +25 -0
  65. package/src/next/components/Dropdown/Dropdown.tsx +115 -0
  66. package/src/next/components/Dropdown/DropdownGroup.tsx +25 -0
  67. package/src/next/components/Dropdown/DropdownItem.tsx +24 -0
  68. package/src/next/components/Dropdown/DropdownList.tsx +21 -0
  69. package/src/next/components/Dropdown/examples/Dropdown.md +31 -0
  70. package/src/next/components/Dropdown/examples/DropdownBasic.tsx +54 -0
  71. package/src/next/components/Dropdown/examples/DropdownWithDescriptions.tsx +60 -0
  72. package/src/next/components/Dropdown/examples/DropdownWithGroups.tsx +65 -0
  73. package/src/next/components/Dropdown/examples/DropdownWithKebabToggle.tsx +62 -0
  74. package/src/next/components/Dropdown/index.ts +4 -0
  75. 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
+ };
@@ -0,0 +1,4 @@
1
+ export * from './Dropdown';
2
+ export * from './DropdownGroup';
3
+ export * from './DropdownItem';
4
+ export * from './DropdownList';
@@ -1 +1,2 @@
1
1
  export * from './Wizard';
2
+ export * from './Dropdown';