@patternfly/react-core 6.0.0-alpha.5 → 6.0.0-alpha.6

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 (154) hide show
  1. package/CHANGELOG.md +100 -0
  2. package/components/package.json +1 -1
  3. package/deprecated/package.json +1 -1
  4. package/dist/dynamic/components/AboutModal/package.json +1 -1
  5. package/dist/dynamic/components/Accordion/package.json +1 -1
  6. package/dist/dynamic/components/ActionList/package.json +1 -1
  7. package/dist/dynamic/components/Alert/package.json +1 -1
  8. package/dist/dynamic/components/Avatar/package.json +1 -1
  9. package/dist/dynamic/components/BackToTop/package.json +1 -1
  10. package/dist/dynamic/components/Backdrop/package.json +1 -1
  11. package/dist/dynamic/components/BackgroundImage/package.json +1 -1
  12. package/dist/dynamic/components/Badge/package.json +1 -1
  13. package/dist/dynamic/components/Banner/package.json +1 -1
  14. package/dist/dynamic/components/Brand/package.json +1 -1
  15. package/dist/dynamic/components/Breadcrumb/package.json +1 -1
  16. package/dist/dynamic/components/Button/package.json +1 -1
  17. package/dist/dynamic/components/CalendarMonth/package.json +1 -1
  18. package/dist/dynamic/components/Card/package.json +1 -1
  19. package/dist/dynamic/components/Checkbox/package.json +1 -1
  20. package/dist/dynamic/components/Chip/package.json +1 -1
  21. package/dist/dynamic/components/ClipboardCopy/package.json +1 -1
  22. package/dist/dynamic/components/CodeBlock/package.json +1 -1
  23. package/dist/dynamic/components/DataList/package.json +1 -1
  24. package/dist/dynamic/components/DatePicker/package.json +1 -1
  25. package/dist/dynamic/components/DescriptionList/package.json +1 -1
  26. package/dist/dynamic/components/Divider/package.json +1 -1
  27. package/dist/dynamic/components/DragDrop/package.json +1 -1
  28. package/dist/dynamic/components/Drawer/package.json +1 -1
  29. package/dist/dynamic/components/Dropdown/package.json +1 -1
  30. package/dist/dynamic/components/DualListSelector/package.json +1 -1
  31. package/dist/dynamic/components/EmptyState/package.json +1 -1
  32. package/dist/dynamic/components/ExpandableSection/package.json +1 -1
  33. package/dist/dynamic/components/FileUpload/package.json +1 -1
  34. package/dist/dynamic/components/Form/package.json +1 -1
  35. package/dist/dynamic/components/FormSelect/package.json +1 -1
  36. package/dist/dynamic/components/HelperText/package.json +1 -1
  37. package/dist/dynamic/components/Hint/package.json +1 -1
  38. package/dist/dynamic/components/Icon/package.json +1 -1
  39. package/dist/dynamic/components/InputGroup/package.json +1 -1
  40. package/dist/dynamic/components/JumpLinks/package.json +1 -1
  41. package/dist/dynamic/components/Label/package.json +1 -1
  42. package/dist/dynamic/components/List/package.json +1 -1
  43. package/dist/dynamic/components/LoginPage/package.json +1 -1
  44. package/dist/dynamic/components/Masthead/package.json +1 -1
  45. package/dist/dynamic/components/Menu/package.json +1 -1
  46. package/dist/dynamic/components/MenuToggle/package.json +1 -1
  47. package/dist/dynamic/components/Modal/package.json +1 -1
  48. package/dist/dynamic/components/MultipleFileUpload/package.json +1 -1
  49. package/dist/dynamic/components/Nav/package.json +1 -1
  50. package/dist/dynamic/components/NotificationBadge/package.json +1 -1
  51. package/dist/dynamic/components/NotificationDrawer/package.json +1 -1
  52. package/dist/dynamic/components/NumberInput/package.json +1 -1
  53. package/dist/dynamic/components/OverflowMenu/package.json +1 -1
  54. package/dist/dynamic/components/Page/package.json +1 -1
  55. package/dist/dynamic/components/Pagination/package.json +1 -1
  56. package/dist/dynamic/components/Panel/package.json +1 -1
  57. package/dist/dynamic/components/Popover/package.json +1 -1
  58. package/dist/dynamic/components/Progress/package.json +1 -1
  59. package/dist/dynamic/components/ProgressStepper/package.json +1 -1
  60. package/dist/dynamic/components/Radio/package.json +1 -1
  61. package/dist/dynamic/components/SearchInput/package.json +1 -1
  62. package/dist/dynamic/components/Select/package.json +1 -1
  63. package/dist/dynamic/components/Sidebar/package.json +1 -1
  64. package/dist/dynamic/components/SimpleList/package.json +1 -1
  65. package/dist/dynamic/components/Skeleton/package.json +1 -1
  66. package/dist/dynamic/components/SkipToContent/package.json +1 -1
  67. package/dist/dynamic/components/Slider/package.json +1 -1
  68. package/dist/dynamic/components/Spinner/package.json +1 -1
  69. package/dist/dynamic/components/Switch/package.json +1 -1
  70. package/dist/dynamic/components/Tabs/package.json +1 -1
  71. package/dist/dynamic/components/Text/package.json +1 -1
  72. package/dist/dynamic/components/TextArea/package.json +1 -1
  73. package/dist/dynamic/components/TextInput/package.json +1 -1
  74. package/dist/dynamic/components/TextInputGroup/package.json +1 -1
  75. package/dist/dynamic/components/Tile/package.json +1 -1
  76. package/dist/dynamic/components/TimePicker/package.json +1 -1
  77. package/dist/dynamic/components/Timestamp/package.json +1 -1
  78. package/dist/dynamic/components/Title/package.json +1 -1
  79. package/dist/dynamic/components/ToggleGroup/package.json +1 -1
  80. package/dist/dynamic/components/Toolbar/package.json +1 -1
  81. package/dist/dynamic/components/Tooltip/package.json +1 -1
  82. package/dist/dynamic/components/TreeView/package.json +1 -1
  83. package/dist/dynamic/components/Truncate/package.json +1 -1
  84. package/dist/dynamic/components/Wizard/hooks/package.json +1 -1
  85. package/dist/dynamic/components/Wizard/package.json +1 -1
  86. package/dist/dynamic/deprecated/components/ApplicationLauncher/package.json +1 -1
  87. package/dist/dynamic/deprecated/components/ContextSelector/package.json +1 -1
  88. package/dist/dynamic/deprecated/components/Dropdown/package.json +1 -1
  89. package/dist/dynamic/deprecated/components/OptionsMenu/package.json +1 -1
  90. package/dist/dynamic/deprecated/components/PageHeader/package.json +1 -1
  91. package/dist/dynamic/deprecated/components/Select/package.json +1 -1
  92. package/dist/dynamic/deprecated/components/Wizard/package.json +1 -1
  93. package/dist/dynamic/deprecated/components/package.json +1 -1
  94. package/dist/dynamic/helpers/FocusTrap/FocusTrap/package.json +1 -1
  95. package/dist/dynamic/helpers/GenerateId/GenerateId/package.json +1 -1
  96. package/dist/dynamic/helpers/KeyboardHandler/package.json +1 -1
  97. package/dist/dynamic/helpers/OUIA/ouia/package.json +1 -1
  98. package/dist/dynamic/helpers/Popper/Popper/package.json +1 -1
  99. package/dist/dynamic/helpers/constants/package.json +1 -1
  100. package/dist/dynamic/helpers/datetimeUtils/package.json +1 -1
  101. package/dist/dynamic/helpers/favorites/package.json +1 -1
  102. package/dist/dynamic/helpers/fileUtils/package.json +1 -1
  103. package/dist/dynamic/helpers/htmlConstants/package.json +1 -1
  104. package/dist/dynamic/helpers/package.json +1 -1
  105. package/dist/dynamic/helpers/resizeObserver/package.json +1 -1
  106. package/dist/dynamic/helpers/typeUtils/package.json +1 -1
  107. package/dist/dynamic/helpers/useInterval/package.json +1 -1
  108. package/dist/dynamic/helpers/useIsomorphicLayout/package.json +1 -1
  109. package/dist/dynamic/helpers/useUnmountEffect/package.json +1 -1
  110. package/dist/dynamic/helpers/util/package.json +1 -1
  111. package/dist/dynamic/layouts/Bullseye/package.json +1 -1
  112. package/dist/dynamic/layouts/Flex/package.json +1 -1
  113. package/dist/dynamic/layouts/Gallery/package.json +1 -1
  114. package/dist/dynamic/layouts/Grid/package.json +1 -1
  115. package/dist/dynamic/layouts/Level/package.json +1 -1
  116. package/dist/dynamic/layouts/Split/package.json +1 -1
  117. package/dist/dynamic/layouts/Stack/package.json +1 -1
  118. package/dist/dynamic/next/components/package.json +1 -1
  119. package/dist/esm/components/Banner/Banner.d.ts +16 -3
  120. package/dist/esm/components/Banner/Banner.d.ts.map +1 -1
  121. package/dist/esm/components/Banner/Banner.js +10 -2
  122. package/dist/esm/components/Banner/Banner.js.map +1 -1
  123. package/dist/esm/components/Menu/MenuItem.d.ts +2 -0
  124. package/dist/esm/components/Menu/MenuItem.d.ts.map +1 -1
  125. package/dist/esm/components/Menu/MenuItem.js +3 -2
  126. package/dist/esm/components/Menu/MenuItem.js.map +1 -1
  127. package/dist/esm/components/Popover/Popover.js +1 -1
  128. package/dist/esm/components/Popover/Popover.js.map +1 -1
  129. package/dist/js/components/Banner/Banner.d.ts +16 -3
  130. package/dist/js/components/Banner/Banner.d.ts.map +1 -1
  131. package/dist/js/components/Banner/Banner.js +10 -2
  132. package/dist/js/components/Banner/Banner.js.map +1 -1
  133. package/dist/js/components/Menu/MenuItem.d.ts +2 -0
  134. package/dist/js/components/Menu/MenuItem.d.ts.map +1 -1
  135. package/dist/js/components/Menu/MenuItem.js +3 -2
  136. package/dist/js/components/Menu/MenuItem.js.map +1 -1
  137. package/dist/js/components/Popover/Popover.js +1 -1
  138. package/dist/js/components/Popover/Popover.js.map +1 -1
  139. package/dist/umd/react-core.min.js +1 -1
  140. package/helpers/package.json +1 -1
  141. package/layouts/package.json +1 -1
  142. package/next/package.json +1 -1
  143. package/package.json +5 -5
  144. package/src/components/Banner/Banner.tsx +41 -18
  145. package/src/components/Banner/__tests__/Banner.test.tsx +56 -11
  146. package/src/components/Banner/examples/Banner.md +4 -2
  147. package/src/components/Banner/examples/BannerBasic.tsx +12 -4
  148. package/src/components/Banner/examples/BannerStatus.tsx +13 -13
  149. package/src/components/Menu/MenuItem.tsx +5 -1
  150. package/src/components/Popover/Popover.tsx +1 -1
  151. package/src/components/Select/examples/Select.md +49 -9
  152. package/src/demos/DataList/examples/DataListExpandableControlInToolbar.tsx +397 -0
  153. package/src/demos/DataListDemo.md +1 -407
  154. package/src/demos/examples/AlertGroup/AlertGroupToastWithNotificationDrawer.tsx +3 -3
@@ -1 +1 @@
1
- {"name":"@patternfly/react-core-helpers","main":"../dist/js/helpers/index.js","module":"../dist/esm/helpers/index.js","typings":"../dist/esm/helpers/index.d.ts","version":"6.0.0-alpha.4","private":true}
1
+ {"name":"@patternfly/react-core-helpers","main":"../dist/js/helpers/index.js","module":"../dist/esm/helpers/index.js","typings":"../dist/esm/helpers/index.d.ts","version":"6.0.0-alpha.5","private":true}
@@ -1 +1 @@
1
- {"name":"@patternfly/react-core-layouts","main":"../dist/js/layouts/index.js","module":"../dist/esm/layouts/index.js","typings":"../dist/esm/layouts/index.d.ts","version":"6.0.0-alpha.4","private":true}
1
+ {"name":"@patternfly/react-core-layouts","main":"../dist/js/layouts/index.js","module":"../dist/esm/layouts/index.js","typings":"../dist/esm/layouts/index.d.ts","version":"6.0.0-alpha.5","private":true}
package/next/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@patternfly/react-core-next","main":"../dist/js/next/index.js","module":"../dist/esm/next/index.js","typings":"../dist/esm/next/index.d.ts","version":"6.0.0-alpha.4","private":true}
1
+ {"name":"@patternfly/react-core-next","main":"../dist/js/next/index.js","module":"../dist/esm/next/index.js","typings":"../dist/esm/next/index.d.ts","version":"6.0.0-alpha.5","private":true}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patternfly/react-core",
3
- "version": "6.0.0-alpha.5",
3
+ "version": "6.0.0-alpha.6",
4
4
  "description": "This library provides a set of common React components for use with the PatternFly reference implementation.",
5
5
  "main": "dist/js/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -46,9 +46,9 @@
46
46
  "subpaths": "node ../../scripts/exportSubpaths.js --config subpaths.config.json"
47
47
  },
48
48
  "dependencies": {
49
- "@patternfly/react-icons": "^6.0.0-alpha.4",
50
- "@patternfly/react-styles": "^6.0.0-alpha.4",
51
- "@patternfly/react-tokens": "^6.0.0-alpha.4",
49
+ "@patternfly/react-icons": "^6.0.0-alpha.5",
50
+ "@patternfly/react-styles": "^6.0.0-alpha.5",
51
+ "@patternfly/react-tokens": "^6.0.0-alpha.5",
52
52
  "focus-trap": "7.5.2",
53
53
  "react-dropzone": "^14.2.3",
54
54
  "tslib": "^2.5.0"
@@ -72,5 +72,5 @@
72
72
  "react": "^17 || ^18",
73
73
  "react-dom": "^17 || ^18"
74
74
  },
75
- "gitHead": "0213323de9e62364f8cd3f401bec86f1f34ee4fe"
75
+ "gitHead": "cddbcdf996451d6157f6c191f67b736ddeb073b0"
76
76
  }
@@ -2,6 +2,10 @@ import * as React from 'react';
2
2
  import styles from '@patternfly/react-styles/css/components/Banner/banner';
3
3
  import { css } from '@patternfly/react-styles';
4
4
 
5
+ export type BannerColor = 'red' | 'orangered' | 'orange' | 'gold' | 'green' | 'cyan' | 'blue' | 'purple';
6
+
7
+ export type BannerStatus = 'success' | 'warning' | 'danger' | 'info' | 'custom';
8
+
5
9
  export interface BannerProps extends React.HTMLProps<HTMLDivElement> {
6
10
  /** Content rendered inside the banner. */
7
11
  children?: React.ReactNode;
@@ -13,29 +17,48 @@ export interface BannerProps extends React.HTMLProps<HTMLDivElement> {
13
17
  * be passed in when the banner conveys status/severity.
14
18
  */
15
19
  screenReaderText?: string;
16
- /** Variant styles for the banner. */
17
- variant?: 'default' | 'blue' | 'red' | 'green' | 'gold';
20
+ /** Color options for the banner, will be overwritten by any applied using the status prop. */
21
+ color?: BannerColor;
22
+ /** Status style options for the banner, will overwrite any color applied using the color prop. */
23
+ status?: BannerStatus;
24
+ }
25
+ interface StatusBanner extends BannerProps {
26
+ color?: never;
27
+ status?: BannerStatus;
18
28
  }
19
29
 
20
- export const Banner: React.FunctionComponent<BannerProps> = ({
30
+ interface NonStatusBanner extends BannerProps {
31
+ color?: BannerColor;
32
+ status?: never;
33
+ }
34
+
35
+ export const Banner: React.FunctionComponent<StatusBanner | NonStatusBanner> = ({
21
36
  children,
22
37
  className,
23
- variant = 'default',
24
38
  screenReaderText,
25
39
  isSticky = false,
40
+ color,
41
+ status,
26
42
  ...props
27
- }: BannerProps) => (
28
- <div
29
- className={css(
30
- styles.banner,
31
- styles.modifiers[variant as 'green' | 'red' | 'gold' | 'blue'],
32
- isSticky && styles.modifiers.sticky,
33
- className
34
- )}
35
- {...props}
36
- >
37
- {screenReaderText && <span className="pf-v5-screen-reader">{screenReaderText}</span>}
38
- {children}
39
- </div>
40
- );
43
+ }: BannerProps) => {
44
+ const getStatusOrColorModifier = () => {
45
+ if (status) {
46
+ return styles.modifiers[status];
47
+ }
48
+
49
+ if (color) {
50
+ return styles.modifiers[color];
51
+ }
52
+ };
53
+
54
+ return (
55
+ <div
56
+ className={css(styles.banner, getStatusOrColorModifier(), isSticky && styles.modifiers.sticky, className)}
57
+ {...props}
58
+ >
59
+ {screenReaderText && <span className="pf-v5-screen-reader">{screenReaderText}</span>}
60
+ {children}
61
+ </div>
62
+ );
63
+ };
41
64
  Banner.displayName = 'Banner';
@@ -27,31 +27,76 @@ test('Renders with custom class name when className prop is provided', () => {
27
27
  expect(screen.getByText('Test')).toHaveClass('custom-class');
28
28
  });
29
29
 
30
- test('Renders without any modifier class when variant prop is not passed', () => {
30
+ test('Renders without any modifier class when color and status props are not passed', () => {
31
31
  render(<Banner>Test</Banner>);
32
32
  expect(screen.getByText('Test')).toHaveClass(styles.banner, { exact: true });
33
33
  });
34
34
 
35
- test('Renders with class name pf-m-green when "green" is passed to variant prop', () => {
36
- render(<Banner variant="green">Test</Banner>);
37
- expect(screen.getByText('Test')).toHaveClass('pf-m-green');
35
+ test('Renders with class name pf-m-red when "red" is passed to color prop', () => {
36
+ render(<Banner color="red">Test</Banner>);
37
+ expect(screen.getByText('Test')).toHaveClass('pf-m-red');
38
38
  });
39
39
 
40
- test('Renders with class name pf-m-red when "red" is passed to variant prop', () => {
41
- render(<Banner variant="red">Test</Banner>);
42
- expect(screen.getByText('Test')).toHaveClass('pf-m-red');
40
+ test('Renders with class name pf-m-orangered when "orangered" is passed to color prop', () => {
41
+ render(<Banner color="orangered">Test</Banner>);
42
+ expect(screen.getByText('Test')).toHaveClass('pf-m-orangered');
43
43
  });
44
44
 
45
- test('Renders with class name pf-m-gold when "gold" is passed to variant prop', () => {
46
- render(<Banner variant="gold">Test</Banner>);
45
+ test('Renders with class name pf-m-orange when "orange" is passed to color prop', () => {
46
+ render(<Banner color="orange">Test</Banner>);
47
+ expect(screen.getByText('Test')).toHaveClass('pf-m-orange');
48
+ });
49
+
50
+ test('Renders with class name pf-m-gold when "gold" is passed to color prop', () => {
51
+ render(<Banner color="gold">Test</Banner>);
47
52
  expect(screen.getByText('Test')).toHaveClass('pf-m-gold');
48
53
  });
49
54
 
50
- test('Renders with class name pf-m-blue when "blue" is passed to variant prop', () => {
51
- render(<Banner variant="blue">Test</Banner>);
55
+ test('Renders with class name pf-m-green when "green" is passed to color prop', () => {
56
+ render(<Banner color="green">Test</Banner>);
57
+ expect(screen.getByText('Test')).toHaveClass('pf-m-green');
58
+ });
59
+
60
+ test('Renders with class name pf-m-cyan when "cyan" is passed to color prop', () => {
61
+ render(<Banner color="cyan">Test</Banner>);
62
+ expect(screen.getByText('Test')).toHaveClass('pf-m-cyan');
63
+ });
64
+
65
+ test('Renders with class name pf-m-blue when "blue" is passed to color prop', () => {
66
+ render(<Banner color="blue">Test</Banner>);
52
67
  expect(screen.getByText('Test')).toHaveClass('pf-m-blue');
53
68
  });
54
69
 
70
+ test('Renders with class name pf-m-purple when "purple" is passed to color prop', () => {
71
+ render(<Banner color="purple">Test</Banner>);
72
+ expect(screen.getByText('Test')).toHaveClass('pf-m-purple');
73
+ });
74
+
75
+ test('Renders with class name pf-m-success when "success" is passed to status prop', () => {
76
+ render(<Banner status="success">Test</Banner>);
77
+ expect(screen.getByText('Test')).toHaveClass('pf-m-success');
78
+ });
79
+
80
+ test('Renders with class name pf-m-warning when "warning" is passed to status prop', () => {
81
+ render(<Banner status="warning">Test</Banner>);
82
+ expect(screen.getByText('Test')).toHaveClass('pf-m-warning');
83
+ });
84
+
85
+ test('Renders with class name pf-m-danger when "danger" is passed to status prop', () => {
86
+ render(<Banner status="danger">Test</Banner>);
87
+ expect(screen.getByText('Test')).toHaveClass('pf-m-danger');
88
+ });
89
+
90
+ test('Renders with class name pf-m-info when "info" is passed to status prop', () => {
91
+ render(<Banner status="info">Test</Banner>);
92
+ expect(screen.getByText('Test')).toHaveClass('pf-m-info');
93
+ });
94
+
95
+ test('Renders with class name pf-m-custom when "custom" is passed to status prop', () => {
96
+ render(<Banner status="custom">Test</Banner>);
97
+ expect(screen.getByText('Test')).toHaveClass('pf-m-custom');
98
+ });
99
+
55
100
  test('Does not render pf-v5-screen-reader class by default', () => {
56
101
  render(<Banner>Test</Banner>);
57
102
  expect(screen.getByText('Test')).not.toContainHTML('<span class="pf-v5-screen-reader"></span>');
@@ -15,7 +15,7 @@ import BellIcon from '@patternfly/react-icons/dist/esm/icons/bell-icon';
15
15
 
16
16
  ### Basic
17
17
 
18
- Banners can be styled with one of 5 different colors. A basic banner should only be used when the banner color does not represent status or severity.
18
+ Banners can be styled with one of 9 different colors using the `color` prop. A basic banner should only be used when the banner color does not represent status or severity.
19
19
 
20
20
  ```ts file="./BannerBasic.tsx"
21
21
 
@@ -23,7 +23,9 @@ Banners can be styled with one of 5 different colors. A basic banner should only
23
23
 
24
24
  ### Status
25
25
 
26
- When a banner is used to convey status, it is advised to pass in an icon inside the banner to convey the status in a way besides just color. The `screenReaderText` prop should also be passed in to convey the status/severity of the banner to users of certain assistive technologies such as screen readers.
26
+ When a banner is used to convey status it should be styled using the `status` prop. Additionally, it is advised to pass an icon inside the banner to convey the status in a way besides just color.
27
+
28
+ The `screenReaderText` prop should also be passed in to convey the status/severity of the banner to users of certain assistive technologies such as screen readers.
27
29
 
28
30
  In the following example, a flex layout is used inside the banner content to show one possible way to create spacing between the icons and banner text.
29
31
 
@@ -5,12 +5,20 @@ export const BannerBasic: React.FunctionComponent = () => (
5
5
  <>
6
6
  <Banner>Default banner</Banner>
7
7
  <br />
8
- <Banner variant="blue">Blue banner</Banner>
8
+ <Banner color="red">Red banner</Banner>
9
9
  <br />
10
- <Banner variant="red">Red banner</Banner>
10
+ <Banner color="orangered">Orangered banner</Banner>
11
11
  <br />
12
- <Banner variant="green">Green banner</Banner>
12
+ <Banner color="orange">Orange banner</Banner>
13
13
  <br />
14
- <Banner variant="gold">Gold banner</Banner>
14
+ <Banner color="gold">Gold banner</Banner>
15
+ <br />
16
+ <Banner color="green">Green banner</Banner>
17
+ <br />
18
+ <Banner color="cyan">Cyan banner</Banner>
19
+ <br />
20
+ <Banner color="blue">Blue banner</Banner>
21
+ <br />
22
+ <Banner color="purple">Purple banner</Banner>
15
23
  </>
16
24
  );
@@ -8,25 +8,25 @@ import BellIcon from '@patternfly/react-icons/dist/esm/icons/bell-icon';
8
8
 
9
9
  export const BannerStatus: React.FunctionComponent = () => (
10
10
  <>
11
- <Banner screenReaderText="Default banner">
11
+ <Banner screenReaderText="Success banner" status="success">
12
12
  <Flex spaceItems={{ default: 'spaceItemsSm' }}>
13
13
  <FlexItem>
14
- <BellIcon />
14
+ <CheckCircleIcon />
15
15
  </FlexItem>
16
- <FlexItem>Default banner</FlexItem>
16
+ <FlexItem>Success banner</FlexItem>
17
17
  </Flex>
18
18
  </Banner>
19
19
  <br />
20
- <Banner screenReaderText="Info banner" variant="blue">
20
+ <Banner screenReaderText="Warning banner" status="warning">
21
21
  <Flex spaceItems={{ default: 'spaceItemsSm' }}>
22
22
  <FlexItem>
23
- <InfoCircleIcon />
23
+ <ExclamationTriangleIcon />
24
24
  </FlexItem>
25
- <FlexItem>Info banner</FlexItem>
25
+ <FlexItem>Warning banner</FlexItem>
26
26
  </Flex>
27
27
  </Banner>
28
28
  <br />
29
- <Banner screenReaderText="Danger banner" variant="red">
29
+ <Banner screenReaderText="Danger banner" status="danger">
30
30
  <Flex spaceItems={{ default: 'spaceItemsSm' }}>
31
31
  <FlexItem>
32
32
  <ExclamationCircleIcon />
@@ -35,21 +35,21 @@ export const BannerStatus: React.FunctionComponent = () => (
35
35
  </Flex>
36
36
  </Banner>
37
37
  <br />
38
- <Banner screenReaderText="Success banner" variant="green">
38
+ <Banner screenReaderText="Info banner" status="info">
39
39
  <Flex spaceItems={{ default: 'spaceItemsSm' }}>
40
40
  <FlexItem>
41
- <CheckCircleIcon />
41
+ <InfoCircleIcon />
42
42
  </FlexItem>
43
- <FlexItem>Success banner</FlexItem>
43
+ <FlexItem>Info banner</FlexItem>
44
44
  </Flex>
45
45
  </Banner>
46
46
  <br />
47
- <Banner screenReaderText="Warning banner" variant="gold">
47
+ <Banner screenReaderText="Custom banner" status="custom">
48
48
  <Flex spaceItems={{ default: 'spaceItemsSm' }}>
49
49
  <FlexItem>
50
- <ExclamationTriangleIcon />
50
+ <BellIcon />
51
51
  </FlexItem>
52
- <FlexItem>Warning banner</FlexItem>
52
+ <FlexItem>Custom banner</FlexItem>
53
53
  </Flex>
54
54
  </Banner>
55
55
  </>
@@ -29,6 +29,8 @@ export interface MenuItemProps extends Omit<React.HTMLProps<HTMLLIElement>, 'onC
29
29
  target?: string;
30
30
  /** Navigation link relationship. Only set when the to property is present. */
31
31
  rel?: string;
32
+ /** Navigation link download. Only set when the to property is present. */
33
+ download?: string;
32
34
  /** Flag indicating the item has a checkbox */
33
35
  hasCheckbox?: boolean;
34
36
  /** Flag indicating whether the item is active */
@@ -119,6 +121,7 @@ const MenuItemBase: React.FunctionComponent<MenuItemProps> = ({
119
121
  tooltipProps,
120
122
  rel,
121
123
  target,
124
+ download,
122
125
  ...props
123
126
  }: MenuItemProps) => {
124
127
  const {
@@ -271,7 +274,8 @@ const MenuItemBase: React.FunctionComponent<MenuItemProps> = ({
271
274
  // prevent invalid 'disabled' attribute on <a> tags
272
275
  disabled: null,
273
276
  target: isExternalLink ? '_blank' : target,
274
- rel
277
+ rel,
278
+ download
275
279
  };
276
280
  } else if (Component === 'button') {
277
281
  additionalProps = {
@@ -415,7 +415,7 @@ export const Popover: React.FunctionComponent<PopoverProps> = ({
415
415
  ref={popoverRef}
416
416
  active={focusTrapActive}
417
417
  focusTrapOptions={{
418
- returnFocusOnDeactivate: true,
418
+ returnFocusOnDeactivate: propWithFocusTrap !== false,
419
419
  clickOutsideDeactivates: true,
420
420
  // FocusTrap's initialFocus can accept false as a value to prevent initial focus.
421
421
  // We want to prevent this in case false is ever passed in.
@@ -13,72 +13,112 @@ import BellIcon from '@patternfly/react-icons/dist/esm/icons/bell-icon';
13
13
 
14
14
  ## Examples
15
15
 
16
- `Select` builds off of the Menu component suite to wrap commonly used properties and functions for a select menu. See the [Menu documentation](/components/menus/menu) for a full list of properties that may be passed through `Select` to further customize the select menu, or the [custom menu examples](/components/menus/custom-menus) for additional examples of fully functional menus.
16
+ Select builds off of the menu component suite to adapt commonly used properties and functions to create a select menu. See the [menu documentation](/components/menus/menu) for a full list of properties that may be used to further customize a select menu. View the [custom menu examples](/components/menus/custom-menus) to see examples of fully functional select menus.
17
17
 
18
- ### Single
18
+ ### Single select
19
+ To let users select a single item from a list, use a single select menu.
20
+
21
+ You can add multiple `<SelectOption>` components to build out a list of menu items. For each select option, pass a relevant option label to the `value` property.
22
+
23
+ To disable the select menu toggle, use the `isDisabled` property. In the following example, select the checkbox to observe this behavior.
19
24
 
20
25
  ```ts file="./SelectBasic.tsx"
21
26
 
22
27
  ```
23
28
 
24
- ### Option variations
29
+ ### Select option variants
30
+
31
+ The following example showcases different option variants and customizations that are commonly used in a select menu.
32
+
33
+ To create these variants, you can pass different properties into a `<SelectOption>` component.
25
34
 
26
- Showcases different option variants and customizations that are commonly used in a select menu. For a more complete list, see the [Menu documentation](/components/menus/menu).
35
+ This example provides examples of:
36
+
37
+ - An option with a description, which is created by using the `description` property.
38
+ - An option with a link, which is created by passing a URL into the `to` property. For external links, use the `isExternalLink` property so that the option is styled with an outbound link icon.
39
+ - An option with an icon, which is created by using the `icon` property.
40
+ - An option that is disabled by using the `isDisabled` property.
27
41
 
28
42
  ```ts file="./SelectOptionVariations.tsx"
29
43
 
30
44
  ```
31
45
 
32
- ### Grouped single
46
+ ### With grouped items
47
+ To group related select options together, use 1 or more `<SelectGroup>` components and title each group using the `label` property.
33
48
 
34
49
  ```ts file="./SelectGrouped.tsx"
35
50
 
36
51
  ```
37
52
 
38
- ### Checkbox
53
+ ### Checkbox select
54
+ To let users select multiple list options via checkbox input, use a checkbox select.
55
+
56
+ To create a checkbox select, pass `role="menu"` to the `<Select>`, and `hasCheckbox` into each `<SelectOption>` component. To indicate that an option is selected, use the `isSelected` property.
57
+
58
+ By default, the menu toggle will display a badge to indicate the number of items that a user has selected.
39
59
 
40
60
  ```ts file="./SelectCheckbox.tsx"
41
61
 
42
62
  ```
43
63
 
44
64
  ### Typeahead
65
+ Typeahead is a select variant that replaces the typical button toggle for opening the select menu with a text input and button toggle combo. As a user enters characters into the text input, the menu options will be filtered to match.
66
+
67
+ To make a typeahead, pass `variant=typeahead` into the `<MenuToggle>` component and link an `onClick` function to the `<TextInputGroupMain>` component.
45
68
 
46
69
  ```ts file="./SelectTypeahead.tsx"
47
70
 
48
71
  ```
49
72
 
50
73
  ### Typeahead with create option
74
+ If a user enters a value into a typeahead select menu that does not exist, you can allow them to create an option of that value.
75
+
76
+ To enable the creation ability, pass a predetermined `value` into a `<SelectOption>` component. You can use the `placeholder` property to change the default text shown in the text input.
77
+
78
+ The following example outlines the code implementation required to create a working typeahead menu that allows for creation.
51
79
 
52
80
  ```ts file="./SelectTypeaheadCreatable.tsx"
53
81
 
54
82
  ```
55
83
 
56
84
  ### Multiple typeahead with chips
85
+ A multiple typeahead can be used to allow users to select multiple options from a list. Additionally, you can render a chip group to be placed in the select toggle.
86
+
87
+ When more items than the allowed limit are selected, overflowing items will be hidden under a "more" button. The following example hides items after more than 3 are selected. To show hidden items, select the “more” button. Select "show less" to hide extra items again.
57
88
 
58
89
  ```ts file="./SelectMultiTypeahead.tsx"
59
90
 
60
91
  ```
61
92
 
62
93
  ### Multiple typeahead with create option
94
+ If the text that is entered into a typeahead doesn't match a menu item, users can choose to create a new option that matches the text input. You can also combine this create functionality with a chip group to display created items as chips."
63
95
 
64
96
  ```ts file="./SelectMultiTypeaheadCreatable.tsx"
65
97
 
66
98
  ```
67
99
 
68
100
  ### Multiple typeahead with checkboxes
101
+ By default, a multiple typeahead select allows you to select multiple menu items, placing a checkmark beside selected items. Like basic checkbox select menus, you can add checkboxes to your menu items. This approach may be more accurate and comprehensive for more complex menu scenarios like filtering.
69
102
 
70
103
  ```ts file="./SelectMultiTypeaheadCheckbox.tsx"
71
104
 
72
105
  ```
73
106
 
74
- ### View more
107
+ ### With view more
108
+
109
+ To reduce the processing load for long select lists, you can add a "View more" action to load additional items.
110
+
111
+ The following example shows 3 items before the "View more" link, but you can adjust the number of visible items for your use case.
75
112
 
76
113
  ```ts file="./SelectViewMore.tsx"
77
114
 
78
115
  ```
79
116
 
80
- ### Footer
117
+ ### With a footer
118
+
119
+ You can add a `<MenuFooter>` component to a select menu to hold additional actions that users can take on menu items, through elements such as link buttons. A footer will be placed beneath a divider at the end of the select menu.
120
+
81
121
 
82
122
  ```ts file="./SelectFooter.tsx"
83
123
 
84
- ```
124
+ ```