@patternfly/react-core 6.0.0-alpha.24 → 6.0.0-alpha.25

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 (158) hide show
  1. package/CHANGELOG.md +7 -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/Modal/package.json +1 -1
  119. package/dist/dynamic/next/components/package.json +1 -1
  120. package/dist/dynamic/styles/package.json +1 -1
  121. package/dist/esm/components/HelperText/HelperTextItem.d.ts +12 -11
  122. package/dist/esm/components/HelperText/HelperTextItem.d.ts.map +1 -1
  123. package/dist/esm/components/HelperText/HelperTextItem.js +18 -15
  124. package/dist/esm/components/HelperText/HelperTextItem.js.map +1 -1
  125. package/dist/js/components/HelperText/HelperTextItem.d.ts +12 -11
  126. package/dist/js/components/HelperText/HelperTextItem.d.ts.map +1 -1
  127. package/dist/js/components/HelperText/HelperTextItem.js +19 -16
  128. package/dist/js/components/HelperText/HelperTextItem.js.map +1 -1
  129. package/dist/umd/react-core.min.js +2 -2
  130. package/helpers/package.json +1 -1
  131. package/layouts/package.json +1 -1
  132. package/next/package.json +1 -1
  133. package/package.json +2 -2
  134. package/src/components/Brand/examples/Brand.css +12 -0
  135. package/src/components/Brand/examples/Brand.md +9 -7
  136. package/src/components/Brand/examples/BrandBasic.tsx +10 -2
  137. package/src/components/Brand/examples/BrandResponsive.tsx +26 -13
  138. package/src/components/Button/__tests__/Button.test.tsx +1 -1
  139. package/src/components/Button/__tests__/__snapshots__/Button.test.tsx.snap +1 -1
  140. package/src/components/HelperText/HelperTextItem.tsx +24 -31
  141. package/src/components/HelperText/__tests__/HelperTextItem.test.tsx +38 -24
  142. package/src/components/HelperText/examples/HelperText.md +7 -17
  143. package/src/components/HelperText/examples/{HelperTextStatic.tsx → HelperTextBasic.tsx} +1 -1
  144. package/src/components/HelperText/examples/HelperTextMultipleItems.tsx +10 -0
  145. package/src/components/HelperText/examples/{HelperTextStaticWithCustomIcon.tsx → HelperTextWithCustomIcon.tsx} +1 -1
  146. package/src/components/MultipleFileUpload/examples/MultipleFileUploadBasic.tsx +2 -2
  147. package/src/components/assets/PF-HorizontalLogo-Reverse.svg +28 -0
  148. package/src/components/assets/PF-IconLogo-Reverse.svg +16 -0
  149. package/src/components/assets/PF-IconLogo-color.svg +17 -0
  150. package/src/demos/HelperText.md +14 -11
  151. package/src/demos/examples/HelperText/{HelperTextStaticVariantDynamicText.tsx → HelperTextDynamic.tsx} +2 -2
  152. package/src/demos/examples/HelperText/{HelperTextStaticVariantStaticText.tsx → HelperTextStatic.tsx} +2 -2
  153. package/src/demos/examples/HelperText/{HelperTextDynamicVariantStaticText.tsx → HelperTextStaticTextDynamicVariant.tsx} +10 -10
  154. package/src/demos/examples/PasswordStrength/PasswordStrengthDemo.tsx +3 -3
  155. package/src/components/HelperText/examples/HelperTextDynamic.tsx +0 -41
  156. package/src/components/HelperText/examples/HelperTextDynamicList.tsx +0 -16
  157. package/src/components/HelperText/examples/HelperTextMultipleStatic.tsx +0 -10
  158. package/src/components/HelperText/examples/HelperTextStaticWithDefaultIcon.tsx +0 -30
@@ -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.23","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.24","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.23","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.24","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.23","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.24","private":true}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patternfly/react-core",
3
- "version": "6.0.0-alpha.24",
3
+ "version": "6.0.0-alpha.25",
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",
@@ -73,5 +73,5 @@
73
73
  "react": "^17 || ^18",
74
74
  "react-dom": "^17 || ^18"
75
75
  },
76
- "gitHead": "8ea069949f2c22f8122ffecab5451f278edfb8f7"
76
+ "gitHead": "251bb4ff8328de0dd6b6b6302329e6b15854b802"
77
77
  }
@@ -0,0 +1,12 @@
1
+ .show-dark,
2
+ :where(.pf-v5-theme-dark) .show-light {
3
+ display: none;
4
+ }
5
+
6
+ :where(.pf-v5-theme-dark) .show-dark {
7
+ display: revert;
8
+ }
9
+
10
+ :where(.pf-v5-theme-dark) .show-dark .pf-m-picture {
11
+ display: inline-flex;
12
+ }
@@ -5,16 +5,18 @@ cssPrefix: null
5
5
  propComponents: ['Brand']
6
6
  ---
7
7
 
8
- import pfLogo from '../../assets/pfLogo.svg';
9
- import logoXl from '../../assets/pf-c-brand--logo-on-xl.svg';
10
- import logoLg from '../../assets/pf-c-brand--logo-on-lg.svg';
11
- import logoMd from '../../assets/pf-c-brand--logo-on-md.svg';
12
- import logoSm from '../../assets/pf-c-brand--logo-on-sm.svg';
13
- import logo from '../../assets/pf-c-brand--logo.svg';
14
- import logoBase from '../../assets/pf-c-brand--logo-base.jpg';
8
+ import './Brand.css';
9
+ import pfLogo from '../../assets/PF-HorizontalLogo-Color.svg';
10
+ import pfLogoDark from '../../assets/PF-HorizontalLogo-Reverse.svg';
11
+ import pfLogoSm from '../../assets/PF-IconLogo-color.svg';
12
+ import pfLogoSmDark from '../../assets/PF-IconLogo-Reverse.svg';
15
13
 
16
14
  ## Examples
17
15
 
16
+ The brand component does not have any built-in theme support. If a brand should be dynamically styled, you must manually set up the necessary logic on your own.
17
+
18
+ These examples adjust styling when the PatternFly website is toggled between the light and dark theme.
19
+
18
20
  ### Basic
19
21
 
20
22
  ```ts file="./BrandBasic.tsx"
@@ -1,7 +1,15 @@
1
1
  import React from 'react';
2
2
  import { Brand } from '@patternfly/react-core';
3
- import pfLogo from '../../assets/pfLogo.svg';
3
+ import pfLogo from '../../assets/PF-HorizontalLogo-Color.svg';
4
+ import pfLogoDark from '../../assets/PF-HorizontalLogo-Reverse.svg';
4
5
 
5
6
  export const BrandBasic: React.FunctionComponent = () => (
6
- <Brand src={pfLogo} alt="Patternfly Logo" widths={{ default: '200px', md: '400px', xl: '600px' }} />
7
+ <>
8
+ <div className="show-light">
9
+ <Brand src={pfLogo} alt="Patternfly" widths={{ default: '200px', md: '400px', xl: '600px' }} />
10
+ </div>
11
+ <div className="show-dark">
12
+ <Brand src={pfLogoDark} alt="Patternfly" widths={{ default: '200px', md: '400px', xl: '600px' }} />
13
+ </div>
14
+ </>
7
15
  );
@@ -1,19 +1,32 @@
1
1
  import React from 'react';
2
2
  import { Brand } from '@patternfly/react-core';
3
- import logoXl from '../../assets/pf-c-brand--logo-on-xl.svg';
4
3
 
5
- import logoLg from '../../assets/pf-c-brand--logo-on-lg.svg';
6
- import logoMd from '../../assets/pf-c-brand--logo-on-md.svg';
7
- import logoSm from '../../assets/pf-c-brand--logo-on-sm.svg';
8
- import logo from '../../assets/pf-c-brand--logo.svg';
9
- import logoBase from '../../assets/pf-c-brand--logo-base.jpg';
4
+ import pfLogo from '../../assets/PF-HorizontalLogo-Color.svg';
5
+ import pfLogoDark from '../../assets/PF-HorizontalLogo-Reverse.svg';
6
+ import pfLogoSm from '../../assets/PF-IconLogo-color.svg';
7
+ import pfLogoSmDark from '../../assets/PF-IconLogo-Reverse.svg';
10
8
 
11
9
  export const BrandBasic: React.FunctionComponent = () => (
12
- <Brand src={logoBase} alt="Fallback patternfly default logo" widths={{ default: '40px', sm: '60px', md: '220px' }}>
13
- <source media="(min-width: 1200px)" srcSet={logoXl} />
14
- <source media="(min-width: 992px)" srcSet={logoLg} />
15
- <source media="(min-width: 768px)" srcSet={logoMd} />
16
- <source media="(min-width: 576px)" srcSet={logoSm} />
17
- <source srcSet={logo} />
18
- </Brand>
10
+ <>
11
+ <div className="show-light">
12
+ <Brand src={pfLogo} alt="Patternfly" widths={{ default: '40px', sm: '60px', md: '220px' }}>
13
+ <source media="(min-width: 1200px)" srcSet={pfLogo} />
14
+ <source media="(min-width: 992px)" srcSet={pfLogo} />
15
+ <source media="(min-width: 768px)" srcSet={pfLogo} />
16
+ <source media="(min-width: 576px)" srcSet={pfLogoSm} />
17
+ <source media="(min-width: 320px)" srcSet={pfLogoSm} />
18
+ <source srcSet={pfLogo} />
19
+ </Brand>
20
+ </div>
21
+ <div className="show-dark">
22
+ <Brand src={pfLogoDark} alt="Patternfly" widths={{ default: '40px', sm: '60px', md: '220px' }}>
23
+ <source media="(min-width: 1200px)" srcSet={pfLogoDark} />
24
+ <source media="(min-width: 992px)" srcSet={pfLogoDark} />
25
+ <source media="(min-width: 768px)" srcSet={pfLogoDark} />
26
+ <source media="(min-width: 576px)" srcSet={pfLogoSmDark} />
27
+ <source media="(min-width: 320px)" srcSet={pfLogoSmDark} />
28
+ <source srcSet={pfLogoDark} />
29
+ </Brand>
30
+ </div>
31
+ </>
19
32
  );
@@ -55,7 +55,7 @@ test('Renders with class pf-m-block when isBlock = true', () => {
55
55
  expect(screen.getByRole('button')).toHaveClass('pf-m-block');
56
56
  });
57
57
 
58
- xtest('Renders with class pf-m-clicked when isClicked = true', () => {
58
+ test('Renders with class pf-m-clicked when isClicked = true', () => {
59
59
  render(<Button isClicked>Clicked Button</Button>);
60
60
  expect(screen.getByRole('button')).toHaveClass('pf-m-clicked');
61
61
  });
@@ -6,7 +6,7 @@ exports[`Renders basic button 1`] = `
6
6
  aria-disabled="false"
7
7
  aria-label="basic button"
8
8
  class="pf-v5-c-button pf-m-primary"
9
- data-ouia-component-id="OUIA-Generated-Button-primary-27"
9
+ data-ouia-component-id="OUIA-Generated-Button-primary-28"
10
10
  data-ouia-component-type="PF5/Button"
11
11
  data-ouia-safe="true"
12
12
  type="button"
@@ -6,6 +6,13 @@ import ExclamationTriangleIcon from '@patternfly/react-icons/dist/esm/icons/excl
6
6
  import CheckCircleIcon from '@patternfly/react-icons/dist/esm/icons/check-circle-icon';
7
7
  import ExclamationCircleIcon from '@patternfly/react-icons/dist/esm/icons/exclamation-circle-icon';
8
8
 
9
+ export enum HelperTextItemVariant {
10
+ default = 'default',
11
+ warning = 'warning',
12
+ error = 'error',
13
+ success = 'success'
14
+ }
15
+
9
16
  export interface HelperTextItemProps extends React.HTMLProps<HTMLDivElement | HTMLLIElement> {
10
17
  /** Content rendered inside the helper text item. */
11
18
  children?: React.ReactNode;
@@ -13,34 +20,28 @@ export interface HelperTextItemProps extends React.HTMLProps<HTMLDivElement | HT
13
20
  className?: string;
14
21
  /** Sets the component type of the helper text item. */
15
22
  component?: 'div' | 'li';
16
- /** Variant styling of the helper text item. */
23
+ /** Variant styling of the helper text item. Will also render a default icon, which can be overridden
24
+ * with the icon prop.
25
+ */
17
26
  variant?: 'default' | 'indeterminate' | 'warning' | 'success' | 'error';
18
- /** Custom icon prefixing the helper text. This property will override the default icon paired with each helper text variant. */
27
+ /** Custom icon prefixing the helper text. This property will override the default icon when the variant property is passed in. */
19
28
  icon?: React.ReactNode;
20
- /** Flag indicating the helper text item is dynamic. This prop should be used when the
21
- * text content of the helper text item will never change, but the icon and styling will
22
- * be dynamically updated via the `variant` prop.
23
- */
24
- isDynamic?: boolean;
25
- /** Flag indicating the helper text should have an icon. Dynamic helper texts include icons by default while static helper texts do not. */
26
- hasIcon?: boolean;
27
29
  /** ID for the helper text item. The value of this prop can be passed into a form component's
28
30
  * aria-describedby prop when you intend for only specific helper text items to be announced to
29
31
  * assistive technologies.
30
32
  */
31
33
  id?: string;
32
- /** Text that is only accessible to screen readers in order to announce the status of a helper text item.
33
- * This prop can only be used when the isDynamic prop is also passed in.
34
+ /** Text that is only accessible to screen readers in order to announce the variant of a helper text item.
35
+ * This prop can only be used when the variant prop has a value other than "default".
34
36
  */
35
37
  screenReaderText?: string;
36
38
  }
37
39
 
38
- const variantStyle = {
39
- default: '',
40
- indeterminate: styles.modifiers.indeterminate,
41
- warning: styles.modifiers.warning,
42
- success: styles.modifiers.success,
43
- error: styles.modifiers.error
40
+ const defaultVariantIcons = {
41
+ indeterminate: <MinusIcon />,
42
+ warning: <ExclamationTriangleIcon />,
43
+ success: <CheckCircleIcon />,
44
+ error: <ExclamationCircleIcon />
44
45
  };
45
46
 
46
47
  export const HelperTextItem: React.FunctionComponent<HelperTextItemProps> = ({
@@ -49,36 +50,28 @@ export const HelperTextItem: React.FunctionComponent<HelperTextItemProps> = ({
49
50
  component = 'div',
50
51
  variant = 'default',
51
52
  icon,
52
- isDynamic = false,
53
- hasIcon = isDynamic,
54
53
  id,
55
54
  screenReaderText = `${variant} status`,
56
55
  ...props
57
56
  }: HelperTextItemProps) => {
58
57
  const Component = component as any;
58
+ const isNotDefaultVariant = variant !== 'default';
59
+ const defaultIcon = isNotDefaultVariant && defaultVariantIcons[variant];
59
60
  return (
60
61
  <Component
61
- className={css(styles.helperTextItem, variantStyle[variant], isDynamic && styles.modifiers.dynamic, className)}
62
+ className={css(styles.helperTextItem, isNotDefaultVariant && styles.modifiers[variant], className)}
62
63
  id={id}
63
64
  {...props}
64
65
  >
65
- {icon && (
66
- <span className={css(styles.helperTextItemIcon)} aria-hidden>
67
- {icon}
68
- </span>
69
- )}
70
- {hasIcon && !icon && (
66
+ {(defaultIcon || icon) && (
71
67
  <span className={css(styles.helperTextItemIcon)} aria-hidden>
72
- {(variant === 'default' || variant === 'indeterminate') && <MinusIcon />}
73
- {variant === 'warning' && <ExclamationTriangleIcon />}
74
- {variant === 'success' && <CheckCircleIcon />}
75
- {variant === 'error' && <ExclamationCircleIcon />}
68
+ {icon || defaultIcon}
76
69
  </span>
77
70
  )}
78
71
 
79
72
  <span className={css(styles.helperTextItemText)}>
80
73
  {children}
81
- {isDynamic && <span className="pf-v5-screen-reader">: {screenReaderText};</span>}
74
+ {isNotDefaultVariant && <span className="pf-v5-screen-reader">: {screenReaderText};</span>}
82
75
  </span>
83
76
  </Component>
84
77
  );
@@ -30,6 +30,12 @@ test('Renders custom className', () => {
30
30
  expect(screen.getByText('help test text 1').parentElement).toHaveClass('custom');
31
31
  });
32
32
 
33
+ test('Does not render screen reader text by default', () => {
34
+ render(<HelperTextItem>help test text 1</HelperTextItem>);
35
+
36
+ expect(screen.queryByText('status', { exact: false })).not.toBeInTheDocument();
37
+ });
38
+
33
39
  Object.values(['indeterminate', 'warning', 'success', 'error']).forEach((variant) => {
34
40
  test(`Renders with class ${styles.modifiers[variant]} when variant = ${variant}`, () => {
35
41
  render(
@@ -39,6 +45,26 @@ Object.values(['indeterminate', 'warning', 'success', 'error']).forEach((variant
39
45
  );
40
46
  expect(screen.getByText('text').parentElement).toHaveClass(styles.modifiers[variant]);
41
47
  });
48
+
49
+ test(`Renders default screenreader text when variant = ${variant}`, () => {
50
+ render(
51
+ <HelperTextItem variant={variant as 'default' | 'indeterminate' | 'warning' | 'success' | 'error'}>
52
+ text
53
+ </HelperTextItem>
54
+ );
55
+ expect(screen.getByText(`: ${variant} status;`)).toBeInTheDocument();
56
+ });
57
+ });
58
+
59
+ test('Renders custom screen reader text', () => {
60
+ render(
61
+ <HelperTextItem variant="error" screenReaderText="danger">
62
+ help test text 1
63
+ </HelperTextItem>
64
+ );
65
+
66
+ expect(screen.queryByText(': error status;')).not.toBeInTheDocument();
67
+ expect(screen.getByText(': danger;')).toBeInTheDocument();
42
68
  });
43
69
 
44
70
  test('Renders id when id is passed', () => {
@@ -56,38 +82,26 @@ test('Renders with element passed to component prop', () => {
56
82
  expect(screen.getByText('help test text 1').parentElement?.tagName).toBe('LI');
57
83
  });
58
84
 
59
- test('Renders custom icon', () => {
60
- render(<HelperTextItem icon={<div>test</div>}>help test text</HelperTextItem>);
61
- expect(screen.getByText('test').parentElement).toHaveClass(styles.helperTextItemIcon);
62
- });
63
-
64
- test('Renders default icon when hasIcon = true and icon is not passed', () => {
65
- render(<HelperTextItem hasIcon>help test text</HelperTextItem>);
66
- expect(screen.getByText('help test text').parentElement?.querySelector('span')).toHaveClass(
67
- styles.helperTextItemIcon
68
- );
85
+ test('Does not render an icon by default', () => {
86
+ render(<HelperTextItem>help test text</HelperTextItem>);
87
+ expect(screen.queryByText('help test text')?.previousSibling).not.toBeInTheDocument();
69
88
  });
70
89
 
71
- test('Renders custom icon when icon is passed and hasIcon = true', () => {
72
- render(
73
- <HelperTextItem hasIcon icon={<div>test</div>}>
74
- help test text
75
- </HelperTextItem>
76
- );
77
- expect(screen.getByText('test').parentElement).toHaveClass(styles.helperTextItemIcon);
90
+ test('Renders a default icon when variant is passed and icon is not passed', () => {
91
+ render(<HelperTextItem variant="success">help test text</HelperTextItem>);
92
+ expect(screen.getByText('help test text').previousSibling).toHaveClass(styles.helperTextItemIcon);
78
93
  });
79
94
 
80
- test('Renders dynamic helper text', () => {
81
- render(<HelperTextItem isDynamic>help test text</HelperTextItem>);
82
- expect(screen.getByText('help test text').parentElement).toHaveClass(styles.modifiers.dynamic);
83
- expect(screen.getByText('help test text').querySelector('span')).toHaveClass('pf-v5-screen-reader');
95
+ test('Renders custom icon when icon prop is passed', () => {
96
+ render(<HelperTextItem icon={<div>icon content</div>}>help test text</HelperTextItem>);
97
+ expect(screen.getByText('icon content').parentElement).toHaveClass(styles.helperTextItemIcon);
84
98
  });
85
99
 
86
- test('Renders custom screenreader text when isDynamic = true and screenReaderText is passed', () => {
100
+ test('Renders custom icon instead of variant icon when icon and variant are passed', () => {
87
101
  render(
88
- <HelperTextItem isDynamic screenReaderText="sr test">
102
+ <HelperTextItem icon={<div>icon content</div>} variant="success">
89
103
  help test text
90
104
  </HelperTextItem>
91
105
  );
92
- expect(screen.getByText('help test text').querySelector('span')).toHaveTextContent('sr test');
106
+ expect(screen.getByText('icon content').parentElement).toHaveClass(styles.helperTextItemIcon);
93
107
  });
@@ -13,32 +13,22 @@ import ExclamationIcon from '@patternfly/react-icons/dist/esm/icons/exclamation-
13
13
 
14
14
  ## Examples
15
15
 
16
- ### Static
16
+ ### Basic
17
17
 
18
- ```ts file="HelperTextStatic.tsx"
19
- ```
20
-
21
- ### Static with default icons
18
+ ```ts file="HelperTextBasic.tsx"
22
19
 
23
- ```ts file="HelperTextStaticWithDefaultIcon.tsx"
24
20
  ```
25
21
 
26
- ### Static with custom icons
22
+ ### With custom icons
27
23
 
28
- ```ts file="HelperTextStaticWithCustomIcon.tsx"
29
- ```
24
+ ```ts file="HelperTextWithCustomIcon.tsx"
30
25
 
31
- ### Multiple static
32
-
33
- ```ts file="HelperTextMultipleStatic.tsx"
34
26
  ```
35
27
 
36
- ### Dynamic
28
+ ### Multiple items
37
29
 
38
- ```ts file="HelperTextDynamic.tsx"
39
- ```
30
+ You can pass multiple `<HelperTextItem>` components inside a single `<Helpertext>` container.
40
31
 
41
- ### Dynamic list
32
+ ```ts file="HelperTextMultipleItems.tsx"
42
33
 
43
- ```ts file="HelperTextDynamicList.tsx"
44
34
  ```
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { HelperText, HelperTextItem } from '@patternfly/react-core';
3
3
 
4
- export const HelperTextStatic: React.FunctionComponent = () => (
4
+ export const HelperTextBasic: React.FunctionComponent = () => (
5
5
  <React.Fragment>
6
6
  <HelperText>
7
7
  <HelperTextItem>This is default helper text</HelperTextItem>
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { HelperText, HelperTextItem } from '@patternfly/react-core';
3
+
4
+ export const HelperTextMultipleItems: React.FunctionComponent = () => (
5
+ <HelperText component="ul">
6
+ <HelperTextItem component="li">This is default helper text</HelperTextItem>
7
+ <HelperTextItem component="li">This is another default helper text in the same HelperText block</HelperTextItem>
8
+ <HelperTextItem component="li">And this is more default text in the same HelperText block</HelperTextItem>
9
+ </HelperText>
10
+ );
@@ -6,7 +6,7 @@ import ExclamationIcon from '@patternfly/react-icons/dist/esm/icons/exclamation-
6
6
  import CheckIcon from '@patternfly/react-icons/dist/esm/icons/check-icon';
7
7
  import TimesIcon from '@patternfly/react-icons/dist/esm/icons/times-icon';
8
8
 
9
- export const HelperTextStaticWithCustomIcon: React.FunctionComponent = () => (
9
+ export const HelperTextWithCustomIcon: React.FunctionComponent = () => (
10
10
  <React.Fragment>
11
11
  <HelperText>
12
12
  <HelperTextItem icon={<InfoIcon />}>This is default helper text</HelperTextItem>
@@ -63,7 +63,7 @@ export const MultipleFileUploadBasic: React.FunctionComponent = () => {
63
63
  if (fileUploadShouldFail) {
64
64
  const corruptedFiles = files.map((file) => ({ ...file, lastModified: 'foo' as unknown as number }));
65
65
  // eslint-disable-next-line
66
- setCurrentFiles((prevFiles) => [...prevFiles, ...corruptedFiles as any]);
66
+ setCurrentFiles((prevFiles) => [...prevFiles, ...(corruptedFiles as any)]);
67
67
  } else {
68
68
  setCurrentFiles((prevFiles) => [...prevFiles, ...files]);
69
69
  }
@@ -101,7 +101,7 @@ export const MultipleFileUploadBasic: React.FunctionComponent = () => {
101
101
  if (fileResult?.loadError) {
102
102
  return (
103
103
  <HelperText isLiveRegion>
104
- <HelperTextItem variant={'error'}>{fileResult.loadError.toString()}</HelperTextItem>
104
+ <HelperTextItem variant="error">{fileResult.loadError.toString()}</HelperTextItem>
105
105
  </HelperText>
106
106
  );
107
107
  }
@@ -0,0 +1,28 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg width="679px" height="158px" viewBox="0 0 679 158" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
3
+ <title>PF-HorizontalLogo-Reverse </title>
4
+ <defs>
5
+ <linearGradient x1="100%" y1="1.31838984e-13%" x2="40.4021492%" y2="59.4473677%" id="linearGradient-1">
6
+ <stop stop-color="#FFFFFF" offset="0%"></stop>
7
+ <stop stop-color="#FFFFFF" stop-opacity="0.498497596" offset="100%"></stop>
8
+ </linearGradient>
9
+ </defs>
10
+ <g id="PF-HorizontalLogo-Reverse" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
11
+ <g id="Group" transform="translate(-0.000000, 0.000000)">
12
+ <path d="M61.7658863,0 L157.846154,0 L157.846154,96.0802676 C104.782487,96.0802676 61.7658863,53.0636665 61.7658863,0 L61.7658863,0 L61.7658863,0 Z" id="Rectangle-Copy-15" fill="#FFFFFF" opacity="0.401297433"></path>
13
+ <path d="M158,1.84777167 L158,138 C158,149.045695 149.045695,158 138,158 L66.3656919,158 L158,1.84777167 Z M156.152228,3.55271368e-13 L-9.37916411e-13,91.6343081 L-9.37916411e-13,20 C-9.09494702e-13,8.954305 8.954305,3.55271368e-13 20,3.41060513e-13 L156.152228,3.55271368e-13 Z" id="Combined-Shape-Copy-4" fill="url(#linearGradient-1)"></path>
14
+ </g>
15
+ <g id="PatternFly-Copy-11" transform="translate(206.000000, 45.750000)" fill="#FFFFFF" fill-rule="nonzero">
16
+ <path d="M0,65.25 L0,2.25 L33.21,2.25 C37.35,2.25 41.025,3.135 44.235,4.905 C47.445,6.675 49.98,9.09 51.84,12.15 C53.7,15.21 54.63,18.72 54.63,22.68 C54.63,26.46 53.7,29.865 51.84,32.895 C49.98,35.925 47.43,38.31 44.19,40.05 C40.95,41.79 37.29,42.66 33.21,42.66 L15.48,42.66 L15.48,65.25 L0,65.25 Z M15.48,29.88 L31.41,29.88 C33.69,29.88 35.52,29.22 36.9,27.9 C38.28,26.58 38.97,24.87 38.97,22.77 C38.97,20.61 38.28,18.855 36.9,17.505 C35.52,16.155 33.69,15.48 31.41,15.48 L15.48,15.48 L15.48,29.88 Z" id="Shape"></path>
17
+ <path d="M77.04,66.06 C73.68,66.06 70.695,65.43 68.085,64.17 C65.475,62.91 63.435,61.17 61.965,58.95 C60.495,56.73 59.76,54.18 59.76,51.3 C59.76,46.74 61.485,43.215 64.935,40.725 C68.385,38.235 73.2,36.99 79.38,36.99 C83.1,36.99 86.7,37.44 90.18,38.34 L90.18,36 C90.18,31.26 87.15,28.89 81.09,28.89 C77.49,28.89 72.69,30.15 66.69,32.67 L61.47,21.96 C69.15,18.48 76.56,16.74 83.7,16.74 C90.3,16.74 95.43,18.315 99.09,21.465 C102.75,24.615 104.58,29.04 104.58,34.74 L104.58,65.25 L90.18,65.25 L90.18,62.37 C88.26,63.69 86.235,64.635 84.105,65.205 C81.975,65.775 79.62,66.06 77.04,66.06 Z M73.62,51.03 C73.62,52.53 74.28,53.7 75.6,54.54 C76.92,55.38 78.75,55.8 81.09,55.8 C84.69,55.8 87.72,55.05 90.18,53.55 L90.18,47.43 C87.42,46.71 84.54,46.35 81.54,46.35 C79.02,46.35 77.07,46.755 75.69,47.565 C74.31,48.375 73.62,49.53 73.62,51.03 Z" id="Shape"></path>
18
+ <path d="M137.25,65.88 C125.73,65.88 119.97,60.84 119.97,50.76 L119.97,29.79 L110.34,29.79 L110.34,17.64 L119.97,17.64 L119.97,5.4 L134.55,2.25 L134.55,17.64 L147.87,17.64 L147.87,29.79 L134.55,29.79 L134.55,47.88 C134.55,49.98 135.015,51.465 135.945,52.335 C136.875,53.205 138.51,53.64 140.85,53.64 C143.01,53.64 145.2,53.31 147.42,52.65 L147.42,64.44 C146.1,64.86 144.42,65.205 142.38,65.475 C140.34,65.745 138.63,65.88 137.25,65.88 Z" id="Path"></path>
19
+ <path d="M177.57,65.88 C166.05,65.88 160.29,60.84 160.29,50.76 L160.29,29.79 L150.66,29.79 L150.66,17.64 L160.29,17.64 L160.29,5.4 L174.87,2.25 L174.87,17.64 L188.19,17.64 L188.19,29.79 L174.87,29.79 L174.87,47.88 C174.87,49.98 175.335,51.465 176.265,52.335 C177.195,53.205 178.83,53.64 181.17,53.64 C183.33,53.64 185.52,53.31 187.74,52.65 L187.74,64.44 C186.42,64.86 184.74,65.205 182.7,65.475 C180.66,65.745 178.95,65.88 177.57,65.88 Z" id="Path"></path>
20
+ <path d="M217.62,66.15 C212.76,66.15 208.365,65.055 204.435,62.865 C200.505,60.675 197.4,57.72 195.12,54 C192.84,50.28 191.7,46.11 191.7,41.49 C191.7,36.87 192.795,32.7 194.985,28.98 C197.175,25.26 200.16,22.305 203.94,20.115 C207.72,17.925 211.92,16.83 216.54,16.83 C221.22,16.83 225.36,17.955 228.96,20.205 C232.56,22.455 235.395,25.53 237.465,29.43 C239.535,33.33 240.57,37.8 240.57,42.84 L240.57,46.44 L206.64,46.44 C207.6,48.66 209.1,50.475 211.14,51.885 C213.18,53.295 215.58,54 218.34,54 C222.42,54 225.6,52.8 227.88,50.4 L237.51,58.95 C234.51,61.47 231.435,63.3 228.285,64.44 C225.135,65.58 221.58,66.15 217.62,66.15 Z M206.37,36.27 L226.26,36.27 C225.48,33.99 224.205,32.16 222.435,30.78 C220.665,29.4 218.61,28.71 216.27,28.71 C213.87,28.71 211.8,29.37 210.06,30.69 C208.32,32.01 207.09,33.87 206.37,36.27 Z" id="Shape"></path>
21
+ <path d="M247.41,65.25 L247.41,17.64 L261.99,17.64 L261.99,22.41 C265.23,18.51 269.4,16.56 274.5,16.56 C277.08,16.62 278.91,17.01 279.99,17.73 L279.99,30.42 C277.95,29.46 275.64,28.98 273.06,28.98 C270.78,28.98 268.665,29.505 266.715,30.555 C264.765,31.605 263.19,33.09 261.99,35.01 L261.99,65.25 L247.41,65.25 Z" id="Path"></path>
22
+ <path d="M286.29,65.25 L286.29,17.64 L300.87,17.64 L300.87,20.88 C304.47,18.12 308.73,16.74 313.65,16.74 C317.37,16.74 320.655,17.55 323.505,19.17 C326.355,20.79 328.59,23.04 330.21,25.92 C331.83,28.8 332.64,32.13 332.64,35.91 L332.64,65.25 L318.06,65.25 L318.06,37.89 C318.06,35.25 317.28,33.15 315.72,31.59 C314.16,30.03 312.06,29.25 309.42,29.25 C305.76,29.25 302.91,30.51 300.87,33.03 L300.87,65.25 L286.29,65.25 Z" id="Path"></path>
23
+ <polygon id="Path" points="342 65.25 342 2.25 392.04 2.25 392.04 15.66 357.48 15.66 357.48 27.45 380.52 27.45 380.52 40.41 357.48 40.41 357.48 65.25"></polygon>
24
+ <polygon id="Path" points="399.96 65.25 399.96 2.25 414.54 0 414.54 65.25"></polygon>
25
+ <path d="M429.21,84.69 C428.07,84.69 426.96,84.645 425.88,84.555 C424.8,84.465 423.9,84.33 423.18,84.15 L423.18,71.73 C424.38,71.97 425.88,72.09 427.68,72.09 C432.36,72.09 435.51,70.05 437.13,65.97 L437.13,65.88 L418.86,17.64 L434.97,17.64 L445.5,47.61 L457.74,17.64 L473.49,17.64 L452.16,67.68 C450.42,71.82 448.5,75.135 446.4,77.625 C444.3,80.115 441.87,81.915 439.11,83.025 C436.35,84.135 433.05,84.69 429.21,84.69 Z" id="Path"></path>
26
+ </g>
27
+ </g>
28
+ </svg>
@@ -0,0 +1,16 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg width="158px" height="158px" viewBox="0 0 158 158" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
3
+ <title>PF-IconLogo-Reverse </title>
4
+ <defs>
5
+ <linearGradient x1="100%" y1="1.31838984e-13%" x2="40.4021492%" y2="59.4473677%" id="linearGradient-1">
6
+ <stop stop-color="#FFFFFF" offset="0%"></stop>
7
+ <stop stop-color="#FFFFFF" stop-opacity="0.498497596" offset="100%"></stop>
8
+ </linearGradient>
9
+ </defs>
10
+ <g id="PF-IconLogo-Reverse" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
11
+ <g id="Group">
12
+ <path d="M61.7658863,0 L157.846154,0 L157.846154,96.0802676 C104.782487,96.0802676 61.7658863,53.0636665 61.7658863,0 L61.7658863,0 L61.7658863,0 Z" id="Rectangle-Copy-15" fill="#FFFFFF" opacity="0.4"></path>
13
+ <path d="M158,1.84777167 L158,138 C158,149.045695 149.045695,158 138,158 L66.3656919,158 L158,1.84777167 Z M156.152228,3.55271368e-13 L-9.37916411e-13,91.6343081 L-9.37916411e-13,20 C-9.09494702e-13,8.954305 8.954305,3.55271368e-13 20,3.41060513e-13 L156.152228,3.55271368e-13 Z" id="Combined-Shape-Copy-4" fill="url(#linearGradient-1)"></path>
14
+ </g>
15
+ </g>
16
+ </svg>
@@ -0,0 +1,17 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg width="158px" height="158px" viewBox="0 0 158 158" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
3
+ <title>PF-IconLogo-color </title>
4
+ <defs>
5
+ <linearGradient x1="68%" y1="2.25860997e-13%" x2="32%" y2="100%" id="linearGradient-1">
6
+ <stop stop-color="#2B9AF3" offset="0%"></stop>
7
+ <stop stop-color="#73BCF7" stop-opacity="0.502212631" offset="100%"></stop>
8
+ </linearGradient>
9
+ </defs>
10
+ <g id="PF-IconLogo-color" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
11
+ <g id="Logo">
12
+ <path d="M61.826087,0 L158,0 L158,96.173913 L147.695652,96.173913 C100.271201,96.173913 61.826087,57.7287992 61.826087,10.3043478 L61.826087,0 L61.826087,0 Z" id="Rectangle-Copy-17" fill="#0066CC"></path>
13
+ <path d="M158,3.43478261 L65.2608696,158 L138,158 C149.045695,158 158,149.045695 158,138 L158,3.43478261 L158,3.43478261 Z" id="Path-2" fill="url(#linearGradient-1)"></path>
14
+ <path d="M123.652174,-30.9130435 L30.9130435,123.652174 L103.652174,123.652174 C114.697869,123.652174 123.652174,114.697869 123.652174,103.652174 L123.652174,-30.9130435 L123.652174,-30.9130435 Z" id="Path-2" fill="url(#linearGradient-1)" transform="translate(77.282609, 46.369565) scale(1, -1) rotate(90.000000) translate(-77.282609, -46.369565) "></path>
15
+ </g>
16
+ </g>
17
+ </svg>
@@ -12,20 +12,21 @@ import TimesIcon from '@patternfly/react-icons/dist/esm/icons/times-icon';
12
12
 
13
13
  ## Demos
14
14
 
15
- ### Static variant with static text
15
+ ### Static helper text
16
16
 
17
- In this demo, the static variant of the helper text item component (the default) is used, and the text itself will always be visible to users and will never change.
17
+ In this demo the text content of the helper text item will always be visible to users and will never change.
18
18
 
19
19
  The `aria-describedby` attribute is passed into the text input component and is linked to the `id` of the helper text component. This allows assistive technologies to notify users of the helper text content when the input receives focus, which can be helpful if a user navigates away from and then back to the input.
20
20
 
21
21
  Note that this demo does not validate the text input component. When it would need to be validated, there are other steps that would need to be taken to make it accessible, such as passing in `aria-invalid` and `aria-live` attributes to the appropriate components.
22
22
 
23
- ```ts file='./examples/HelperText/HelperTextStaticVariantStaticText.tsx'
23
+ ```ts file='./examples/HelperText/HelperTextStatic.tsx'
24
+
24
25
  ```
25
26
 
26
- ### Static variant with dynamic text
27
+ ### Dynamic helper text
27
28
 
28
- In this demo, the static variant of the helper text item component (the default) is used with the `hasIcon` prop passed in when there is an error, and the text itself dynamically updates based on the input value. When the input has a value of `johndoe`, an error is rendered to simulate a username already being taken, while an empty input renders other helper text. When the input is valid, no helper text is rendered.
29
+ In this demo the text content of the helper text item dynamically updates based on the input value. When the input has a value of `johndoe`, an error is rendered to simulate a username already being taken, while an empty input renders default text. When the input is valid, no helper text is rendered.
29
30
 
30
31
  The `aria-describedby` attribute is passed into the text input component and is linked to the `id` of the helper text component. Similar to the static variant with static text demo, this allows assistive technologies to notify users of the helper text content when the navigating to the input.
31
32
 
@@ -33,16 +34,18 @@ An `aria-live` region is passed into the helper text component, which allows ass
33
34
 
34
35
  The `aria-invalid` attribute is also passed into the text input, which allows assistive technologies to notify users that an input is invalid. When this attribute is true, it's important that users are notified of what is causing the input to be invalid; in this case, `aria-describedby` and `aria-live` help accomplish this.
35
36
 
36
- ```ts file='./examples/HelperText/HelperTextStaticVariantDynamicText.tsx'
37
+ ```ts file='./examples/HelperText/HelperTextDynamic.tsx'
38
+
37
39
  ```
38
40
 
39
- ### Dynamic variant with static text
41
+ ### Static text and dynamic status
42
+
43
+ In this demo the text content of the helper text item remains static and never changes, but the icons and styling will change as the validation of the input changes.
40
44
 
41
- In this demo, the helper text item components have the `isDynamic` prop passed in. While the text content of the components is static, the icons and styling will change as the validation of the input changes.
45
+ The `aria-describedby` attribute is passed into the text input component and is linked to the `id` attribute of a helper text item that results in an invalid input. This will allow assistive technologies to only be notified of any outstanding criteria that has not been met when the input receives focus.
42
46
 
43
- The `aria-describedby` attribute is passed into the text input component and is linked to the id attribute of a helper text item that results in an invalid input. This will allow assistive technologies to only be notified of any outstanding criteria that has not been met when the input receives focus.
47
+ Similar to the [with dynamic text example](/components/helper-text/react-demos#with-dynamic-text), the `aria-invalid` attribute is passed in, allowing assistive technologies to announce to users when at least 1 item is causing the input to be invalid.
44
48
 
45
- Similar to the static variant with dynamic text example, the `aria-invalid` attribute is passed in, allowing assistive technologies to announce to users when at least 1 item is causing the input to be invalid.
49
+ ```ts file='./examples/HelperText/HelperTextStaticTextDynamicVariant.tsx'
46
50
 
47
- ```ts file='./examples/HelperText/HelperTextDynamicVariantStaticText.tsx'
48
51
  ```
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { Form, FormGroup, FormHelperText, TextInput, HelperText, HelperTextItem } from '@patternfly/react-core';
3
3
 
4
- export const HelperTextStaticVariantDynamicText: React.FunctionComponent = () => {
4
+ export const HelperTextDynamic: React.FunctionComponent = () => {
5
5
  const [value, setValue] = React.useState('');
6
6
  const [inputValidation, setInputValidation] = React.useState('default');
7
7
 
@@ -35,7 +35,7 @@ export const HelperTextStaticVariantDynamicText: React.FunctionComponent = () =>
35
35
  <FormHelperText>
36
36
  <HelperText id="helper-text2" aria-live="polite">
37
37
  {inputValidation !== 'success' && (
38
- <HelperTextItem variant={inputValidation as any} hasIcon={inputValidation === 'error'}>
38
+ <HelperTextItem variant={inputValidation as any}>
39
39
  {inputValidation === 'default' ? 'Please enter a username' : 'Username already exists'}
40
40
  </HelperTextItem>
41
41
  )}
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { Form, FormGroup, FormHelperText, TextInput, HelperText, HelperTextItem } from '@patternfly/react-core';
3
3
 
4
- export const HelperTextStaticVariantStaticText: React.FunctionComponent = () => {
4
+ export const HelperTextStaticText: React.FunctionComponent = () => {
5
5
  const [value, setValue] = React.useState('');
6
6
 
7
7
  const handleInputChange = (_event, inputValue: string) => {
@@ -21,7 +21,7 @@ export const HelperTextStaticVariantStaticText: React.FunctionComponent = () =>
21
21
  />
22
22
  <FormHelperText>
23
23
  <HelperText id="helper-text1">
24
- <HelperTextItem variant={'default'}>Enter your middle name or your middle initial</HelperTextItem>
24
+ <HelperTextItem>Enter your middle name or your middle initial</HelperTextItem>
25
25
  </HelperText>
26
26
  </FormHelperText>
27
27
  </FormGroup>