@patternfly/react-core 4.234.2 → 4.235.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 (191) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/dist/esm/components/LoginPage/LoginFooterItem.d.ts +3 -3
  3. package/dist/esm/components/LoginPage/LoginForm.d.ts +18 -18
  4. package/dist/esm/components/LoginPage/LoginHeader.d.ts +1 -1
  5. package/dist/esm/components/LoginPage/LoginMainBody.d.ts +2 -2
  6. package/dist/esm/components/LoginPage/LoginMainFooter.d.ts +5 -5
  7. package/dist/esm/components/LoginPage/LoginMainFooterBandItem.d.ts +2 -2
  8. package/dist/esm/components/LoginPage/LoginMainFooterLinksItem.d.ts +5 -5
  9. package/dist/esm/components/LoginPage/LoginMainHeader.d.ts +6 -4
  10. package/dist/esm/components/LoginPage/LoginMainHeader.d.ts.map +1 -1
  11. package/dist/esm/components/LoginPage/LoginMainHeader.js +2 -1
  12. package/dist/esm/components/LoginPage/LoginMainHeader.js.map +1 -1
  13. package/dist/esm/components/LoginPage/LoginPage.d.ts +16 -14
  14. package/dist/esm/components/LoginPage/LoginPage.d.ts.map +1 -1
  15. package/dist/esm/components/LoginPage/LoginPage.js +2 -2
  16. package/dist/esm/components/LoginPage/LoginPage.js.map +1 -1
  17. package/dist/esm/next/components/Wizard/Wizard.d.ts +40 -0
  18. package/dist/esm/next/components/Wizard/Wizard.d.ts.map +1 -0
  19. package/dist/esm/next/components/Wizard/Wizard.js +86 -0
  20. package/dist/esm/next/components/Wizard/Wizard.js.map +1 -0
  21. package/dist/esm/next/components/Wizard/WizardBody.d.ts +20 -0
  22. package/dist/esm/next/components/Wizard/WizardBody.d.ts.map +1 -0
  23. package/dist/esm/next/components/Wizard/WizardBody.js +7 -0
  24. package/dist/esm/next/components/Wizard/WizardBody.js.map +1 -0
  25. package/dist/esm/next/components/Wizard/WizardContext.d.ts +49 -0
  26. package/dist/esm/next/components/Wizard/WizardContext.d.ts.map +1 -0
  27. package/dist/esm/next/components/Wizard/WizardContext.js +34 -0
  28. package/dist/esm/next/components/Wizard/WizardContext.js.map +1 -0
  29. package/dist/esm/next/components/Wizard/WizardFooter.d.ts +28 -0
  30. package/dist/esm/next/components/Wizard/WizardFooter.d.ts.map +1 -0
  31. package/dist/esm/next/components/Wizard/WizardFooter.js +11 -0
  32. package/dist/esm/next/components/Wizard/WizardFooter.js.map +1 -0
  33. package/dist/esm/next/components/Wizard/WizardHeader.d.ts +21 -0
  34. package/dist/esm/next/components/Wizard/WizardHeader.d.ts.map +1 -0
  35. package/dist/esm/next/components/Wizard/WizardHeader.js +13 -0
  36. package/dist/esm/next/components/Wizard/WizardHeader.js.map +1 -0
  37. package/dist/esm/next/components/Wizard/WizardNav.d.ts +15 -0
  38. package/dist/esm/next/components/Wizard/WizardNav.d.ts.map +1 -0
  39. package/dist/esm/next/components/Wizard/WizardNav.js +13 -0
  40. package/dist/esm/next/components/Wizard/WizardNav.js.map +1 -0
  41. package/dist/esm/next/components/Wizard/WizardNavItem.d.ts +25 -0
  42. package/dist/esm/next/components/Wizard/WizardNavItem.d.ts.map +1 -0
  43. package/dist/esm/next/components/Wizard/WizardNavItem.js +33 -0
  44. package/dist/esm/next/components/Wizard/WizardNavItem.js.map +1 -0
  45. package/dist/esm/next/components/Wizard/WizardStep.d.ts +20 -0
  46. package/dist/esm/next/components/Wizard/WizardStep.d.ts.map +1 -0
  47. package/dist/esm/next/components/Wizard/WizardStep.js +5 -0
  48. package/dist/esm/next/components/Wizard/WizardStep.js.map +1 -0
  49. package/dist/esm/next/components/Wizard/WizardToggle.d.ts +26 -0
  50. package/dist/esm/next/components/Wizard/WizardToggle.d.ts.map +1 -0
  51. package/dist/esm/next/components/Wizard/WizardToggle.js +81 -0
  52. package/dist/esm/next/components/Wizard/WizardToggle.js.map +1 -0
  53. package/dist/esm/next/components/Wizard/hooks/index.d.ts +2 -0
  54. package/dist/esm/next/components/Wizard/hooks/index.d.ts.map +1 -0
  55. package/dist/esm/next/components/Wizard/hooks/index.js +2 -0
  56. package/dist/esm/next/components/Wizard/hooks/index.js.map +1 -0
  57. package/dist/esm/next/components/Wizard/hooks/useWizardFooter.d.ts +8 -0
  58. package/dist/esm/next/components/Wizard/hooks/useWizardFooter.d.ts.map +1 -0
  59. package/dist/esm/next/components/Wizard/hooks/useWizardFooter.js +20 -0
  60. package/dist/esm/next/components/Wizard/hooks/useWizardFooter.js.map +1 -0
  61. package/dist/esm/next/components/Wizard/index.d.ts +12 -0
  62. package/dist/esm/next/components/Wizard/index.d.ts.map +1 -0
  63. package/dist/esm/next/components/Wizard/index.js +12 -0
  64. package/dist/esm/next/components/Wizard/index.js.map +1 -0
  65. package/dist/esm/next/components/Wizard/types.d.ts +69 -0
  66. package/dist/esm/next/components/Wizard/types.d.ts.map +1 -0
  67. package/dist/esm/next/components/Wizard/types.js +20 -0
  68. package/dist/esm/next/components/Wizard/types.js.map +1 -0
  69. package/dist/esm/next/components/Wizard/utils.d.ts +15 -0
  70. package/dist/esm/next/components/Wizard/utils.d.ts.map +1 -0
  71. package/dist/esm/next/components/Wizard/utils.js +35 -0
  72. package/dist/esm/next/components/Wizard/utils.js.map +1 -0
  73. package/dist/esm/next/components/index.d.ts +1 -1
  74. package/dist/esm/next/components/index.d.ts.map +1 -1
  75. package/dist/esm/next/components/index.js +1 -1
  76. package/dist/esm/next/components/index.js.map +1 -1
  77. package/dist/js/components/LoginPage/LoginFooterItem.d.ts +3 -3
  78. package/dist/js/components/LoginPage/LoginForm.d.ts +18 -18
  79. package/dist/js/components/LoginPage/LoginHeader.d.ts +1 -1
  80. package/dist/js/components/LoginPage/LoginMainBody.d.ts +2 -2
  81. package/dist/js/components/LoginPage/LoginMainFooter.d.ts +5 -5
  82. package/dist/js/components/LoginPage/LoginMainFooterBandItem.d.ts +2 -2
  83. package/dist/js/components/LoginPage/LoginMainFooterLinksItem.d.ts +5 -5
  84. package/dist/js/components/LoginPage/LoginMainHeader.d.ts +6 -4
  85. package/dist/js/components/LoginPage/LoginMainHeader.d.ts.map +1 -1
  86. package/dist/js/components/LoginPage/LoginMainHeader.js +2 -1
  87. package/dist/js/components/LoginPage/LoginMainHeader.js.map +1 -1
  88. package/dist/js/components/LoginPage/LoginPage.d.ts +16 -14
  89. package/dist/js/components/LoginPage/LoginPage.d.ts.map +1 -1
  90. package/dist/js/components/LoginPage/LoginPage.js +2 -2
  91. package/dist/js/components/LoginPage/LoginPage.js.map +1 -1
  92. package/dist/js/next/components/Wizard/Wizard.d.ts +40 -0
  93. package/dist/js/next/components/Wizard/Wizard.d.ts.map +1 -0
  94. package/dist/js/next/components/Wizard/Wizard.js +90 -0
  95. package/dist/js/next/components/Wizard/Wizard.js.map +1 -0
  96. package/dist/js/next/components/Wizard/WizardBody.d.ts +20 -0
  97. package/dist/js/next/components/Wizard/WizardBody.d.ts.map +1 -0
  98. package/dist/js/next/components/Wizard/WizardBody.js +12 -0
  99. package/dist/js/next/components/Wizard/WizardBody.js.map +1 -0
  100. package/dist/js/next/components/Wizard/WizardContext.d.ts +49 -0
  101. package/dist/js/next/components/Wizard/WizardContext.d.ts.map +1 -0
  102. package/dist/js/next/components/Wizard/WizardContext.js +40 -0
  103. package/dist/js/next/components/Wizard/WizardContext.js.map +1 -0
  104. package/dist/js/next/components/Wizard/WizardFooter.d.ts +28 -0
  105. package/dist/js/next/components/Wizard/WizardFooter.d.ts.map +1 -0
  106. package/dist/js/next/components/Wizard/WizardFooter.js +16 -0
  107. package/dist/js/next/components/Wizard/WizardFooter.js.map +1 -0
  108. package/dist/js/next/components/Wizard/WizardHeader.d.ts +21 -0
  109. package/dist/js/next/components/Wizard/WizardHeader.d.ts.map +1 -0
  110. package/dist/js/next/components/Wizard/WizardHeader.js +18 -0
  111. package/dist/js/next/components/Wizard/WizardHeader.js.map +1 -0
  112. package/dist/js/next/components/Wizard/WizardNav.d.ts +15 -0
  113. package/dist/js/next/components/Wizard/WizardNav.d.ts.map +1 -0
  114. package/dist/js/next/components/Wizard/WizardNav.js +18 -0
  115. package/dist/js/next/components/Wizard/WizardNav.js.map +1 -0
  116. package/dist/js/next/components/Wizard/WizardNavItem.d.ts +25 -0
  117. package/dist/js/next/components/Wizard/WizardNavItem.d.ts.map +1 -0
  118. package/dist/js/next/components/Wizard/WizardNavItem.js +37 -0
  119. package/dist/js/next/components/Wizard/WizardNavItem.js.map +1 -0
  120. package/dist/js/next/components/Wizard/WizardStep.d.ts +20 -0
  121. package/dist/js/next/components/Wizard/WizardStep.d.ts.map +1 -0
  122. package/dist/js/next/components/Wizard/WizardStep.js +10 -0
  123. package/dist/js/next/components/Wizard/WizardStep.js.map +1 -0
  124. package/dist/js/next/components/Wizard/WizardToggle.d.ts +26 -0
  125. package/dist/js/next/components/Wizard/WizardToggle.d.ts.map +1 -0
  126. package/dist/js/next/components/Wizard/WizardToggle.js +86 -0
  127. package/dist/js/next/components/Wizard/WizardToggle.js.map +1 -0
  128. package/dist/js/next/components/Wizard/hooks/index.d.ts +2 -0
  129. package/dist/js/next/components/Wizard/hooks/index.d.ts.map +1 -0
  130. package/dist/js/next/components/Wizard/hooks/index.js +6 -0
  131. package/dist/js/next/components/Wizard/hooks/index.js.map +1 -0
  132. package/dist/js/next/components/Wizard/hooks/useWizardFooter.d.ts +8 -0
  133. package/dist/js/next/components/Wizard/hooks/useWizardFooter.d.ts.map +1 -0
  134. package/dist/js/next/components/Wizard/hooks/useWizardFooter.js +25 -0
  135. package/dist/js/next/components/Wizard/hooks/useWizardFooter.js.map +1 -0
  136. package/dist/js/next/components/Wizard/index.d.ts +12 -0
  137. package/dist/js/next/components/Wizard/index.d.ts.map +1 -0
  138. package/dist/js/next/components/Wizard/index.js +17 -0
  139. package/dist/js/next/components/Wizard/index.js.map +1 -0
  140. package/dist/js/next/components/Wizard/types.d.ts +69 -0
  141. package/dist/js/next/components/Wizard/types.d.ts.map +1 -0
  142. package/dist/js/next/components/Wizard/types.js +29 -0
  143. package/dist/js/next/components/Wizard/types.js.map +1 -0
  144. package/dist/js/next/components/Wizard/utils.d.ts +15 -0
  145. package/dist/js/next/components/Wizard/utils.d.ts.map +1 -0
  146. package/dist/js/next/components/Wizard/utils.js +41 -0
  147. package/dist/js/next/components/Wizard/utils.js.map +1 -0
  148. package/dist/js/next/components/index.d.ts +1 -1
  149. package/dist/js/next/components/index.d.ts.map +1 -1
  150. package/dist/js/next/components/index.js +1 -1
  151. package/dist/js/next/components/index.js.map +1 -1
  152. package/dist/umd/react-core.css +208 -208
  153. package/dist/umd/react-core.js +4 -3
  154. package/dist/umd/react-core.min.js +4 -4
  155. package/package.json +6 -6
  156. package/src/components/Card/examples/Card.md +67 -38
  157. package/src/components/LoginPage/LoginFooterItem.tsx +3 -3
  158. package/src/components/LoginPage/LoginForm.tsx +18 -18
  159. package/src/components/LoginPage/LoginHeader.tsx +1 -1
  160. package/src/components/LoginPage/LoginMainBody.tsx +2 -2
  161. package/src/components/LoginPage/LoginMainFooter.tsx +5 -5
  162. package/src/components/LoginPage/LoginMainFooterBandItem.tsx +2 -2
  163. package/src/components/LoginPage/LoginMainFooterLinksItem.tsx +5 -5
  164. package/src/components/LoginPage/LoginMainHeader.tsx +8 -4
  165. package/src/components/LoginPage/LoginPage.tsx +18 -15
  166. package/src/components/LoginPage/examples/LoginPage.md +8 -0
  167. package/src/components/LoginPage/examples/LoginPageBasic.tsx +0 -1
  168. package/src/components/LoginPage/examples/LoginPageLanguageSelect.tsx +194 -0
  169. package/src/components/LoginPage/examples/LoginPageShowHidePassword.tsx +0 -1
  170. package/src/components/Wizard/examples/Wizard.md +21 -4
  171. package/src/demos/CardDemos.md +4 -0
  172. package/src/next/components/Wizard/Wizard.tsx +184 -0
  173. package/src/next/components/Wizard/WizardBody.tsx +34 -0
  174. package/src/next/components/Wizard/WizardContext.tsx +104 -0
  175. package/src/next/components/Wizard/WizardFooter.tsx +63 -0
  176. package/src/next/components/Wizard/WizardHeader.tsx +53 -0
  177. package/src/next/components/Wizard/WizardNav.tsx +41 -0
  178. package/src/next/components/Wizard/WizardNavItem.tsx +103 -0
  179. package/src/next/components/Wizard/WizardStep.tsx +23 -0
  180. package/src/next/components/Wizard/WizardToggle.tsx +209 -0
  181. package/src/next/components/Wizard/__tests__/Wizard.test.tsx +298 -0
  182. package/src/next/components/Wizard/examples/Wizard.md +125 -0
  183. package/src/next/components/Wizard/examples/WizardBasic.tsx +22 -0
  184. package/src/next/components/Wizard/examples/WizardCustomNav.tsx +46 -0
  185. package/src/next/components/Wizard/examples/WizardKitchenSink.tsx +170 -0
  186. package/src/next/components/Wizard/hooks/index.ts +1 -0
  187. package/src/next/components/Wizard/hooks/useWizardFooter.tsx +22 -0
  188. package/src/next/components/Wizard/index.ts +11 -0
  189. package/src/next/components/Wizard/types.tsx +101 -0
  190. package/src/next/components/Wizard/utils.ts +47 -0
  191. package/src/next/components/index.ts +1 -1
@@ -0,0 +1,194 @@
1
+ import React from 'react';
2
+ import brandImg2 from './brandImgColor2.svg';
3
+ import {
4
+ LoginFooterItem,
5
+ LoginForm,
6
+ LoginMainFooterBandItem,
7
+ LoginMainFooterLinksItem,
8
+ LoginPage,
9
+ ListItem,
10
+ ListVariant,
11
+ Select,
12
+ SelectOption,
13
+ SelectOptionObject
14
+ } from '@patternfly/react-core';
15
+ import ExclamationCircleIcon from '@patternfly/react-icons/dist/esm/icons/exclamation-circle-icon';
16
+
17
+ export const LoginPageLanguageSelect: React.FunctionComponent = () => {
18
+ const [showHelperText, setShowHelperText] = React.useState(false);
19
+ const [username, setUsername] = React.useState('');
20
+ const [isValidUsername, setIsValidUsername] = React.useState(true);
21
+ const [password, setPassword] = React.useState('');
22
+ const [isValidPassword, setIsValidPassword] = React.useState(true);
23
+ const [isRememberMeChecked, setIsRememberMeChecked] = React.useState(false);
24
+ const [isHeaderUtilsOpen, setIsHeaderUtilsOpen] = React.useState(false);
25
+ const [selectedHeaderUtils, setSelectedHeaderUtils] = React.useState<string | SelectOptionObject>('English');
26
+
27
+ /** i18n object is used to simulate i18n integration of native language translation */
28
+ const i18n = {
29
+ English: 'English',
30
+ Mandarin: '普通话',
31
+ Hindi: 'हिन्दी',
32
+ Spanish: 'Español',
33
+ Portuguese: 'Português',
34
+ Arabic: 'عربى',
35
+ Bengali: 'বাংলা'
36
+ };
37
+
38
+ const headerUtilsOptions = [
39
+ <SelectOption key={0} value={i18n.English} />,
40
+ <SelectOption key={1} value={i18n.Mandarin} />,
41
+ <SelectOption key={2} value={i18n.Hindi} />,
42
+ <SelectOption key={3} value={i18n.Spanish} />,
43
+ <SelectOption key={4} value={i18n.Portuguese} />,
44
+ <SelectOption key={5} value={i18n.Arabic} />,
45
+ <SelectOption key={6} value={i18n.Bengali} />
46
+ ];
47
+
48
+ const onHeaderUtilsToggle = (isExpanded: boolean) => {
49
+ setIsHeaderUtilsOpen(isExpanded);
50
+ };
51
+
52
+ const onHeaderUtilsSelect = (
53
+ _event: React.MouseEvent<Element, MouseEvent> | React.ChangeEvent<Element>,
54
+ value: string | SelectOptionObject
55
+ ) => {
56
+ setSelectedHeaderUtils(value);
57
+ setIsHeaderUtilsOpen(false);
58
+ };
59
+
60
+ const headerUtils = (
61
+ <Select
62
+ aria-label="Select Language"
63
+ onToggle={onHeaderUtilsToggle}
64
+ onSelect={onHeaderUtilsSelect}
65
+ selections={selectedHeaderUtils}
66
+ isOpen={isHeaderUtilsOpen}
67
+ >
68
+ {headerUtilsOptions}
69
+ </Select>
70
+ );
71
+
72
+ const handleUsernameChange = (value: string) => {
73
+ setUsername(value);
74
+ };
75
+
76
+ const handlePasswordChange = (value: string) => {
77
+ setPassword(value);
78
+ };
79
+
80
+ const onRememberMeClick = () => {
81
+ setIsRememberMeChecked(!isRememberMeChecked);
82
+ };
83
+
84
+ const onLoginButtonClick = (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {
85
+ event.preventDefault();
86
+ setIsValidUsername(!!username);
87
+ setIsValidPassword(!!password);
88
+ setShowHelperText(!username || !password);
89
+ };
90
+
91
+ const socialMediaLoginContent = (
92
+ <React.Fragment>
93
+ <LoginMainFooterLinksItem href="#" linkComponentProps={{ 'aria-label': 'Login with Google' }}>
94
+ <svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 488 512">
95
+ <path d="M488 261.8C488 403.3 391.1 504 248 504 110.8 504 0 393.2 0 256S110.8 8 248 8c66.8 0 123 24.5 166.3 64.9l-67.5 64.9C258.5 52.6 94.3 116.6 94.3 256c0 86.5 69.1 156.6 153.7 156.6 98.2 0 135-70.4 140.8-106.9H248v-85.3h236.1c2.3 12.7 3.9 24.9 3.9 41.4z" />
96
+ </svg>
97
+ </LoginMainFooterLinksItem>
98
+ <LoginMainFooterLinksItem href="#" linkComponentProps={{ 'aria-label': 'Login with Github' }}>
99
+ <svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512">
100
+ <path d="M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3zm44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z" />
101
+ </svg>
102
+ </LoginMainFooterLinksItem>
103
+ <LoginMainFooterLinksItem href="#" linkComponentProps={{ 'aria-label': 'Login with Dropbox' }}>
104
+ <svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 528 512">
105
+ <path d="M264.4 116.3l-132 84.3 132 84.3-132 84.3L0 284.1l132.3-84.3L0 116.3 132.3 32l132.1 84.3zM131.6 395.7l132-84.3 132 84.3-132 84.3-132-84.3zm132.8-111.6l132-84.3-132-83.6L395.7 32 528 116.3l-132.3 84.3L528 284.8l-132.3 84.3-131.3-85z" />
106
+ </svg>
107
+ </LoginMainFooterLinksItem>
108
+ <LoginMainFooterLinksItem href="#" linkComponentProps={{ 'aria-label': 'Login with Facebook' }}>
109
+ <svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512">
110
+ <path d="M448 56.7v398.5c0 13.7-11.1 24.7-24.7 24.7H309.1V306.5h58.2l8.7-67.6h-67v-43.2c0-19.6 5.4-32.9 33.5-32.9h35.8v-60.5c-6.2-.8-27.4-2.7-52.2-2.7-51.6 0-87 31.5-87 89.4v49.9h-58.4v67.6h58.4V480H24.7C11.1 480 0 468.9 0 455.3V56.7C0 43.1 11.1 32 24.7 32h398.5c13.7 0 24.8 11.1 24.8 24.7z" />
111
+ </svg>
112
+ </LoginMainFooterLinksItem>
113
+ <LoginMainFooterLinksItem href="#" linkComponentProps={{ 'aria-label': 'Login with Gitlab' }}>
114
+ <svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
115
+ <path d="M29.782 199.732L256 493.714 8.074 309.699c-6.856-5.142-9.712-13.996-7.141-21.993l28.849-87.974zm75.405-174.806c-3.142-8.854-15.709-8.854-18.851 0L29.782 199.732h131.961L105.187 24.926zm56.556 174.806L256 493.714l94.257-293.982H161.743zm349.324 87.974l-28.849-87.974L256 493.714l247.926-184.015c6.855-5.142 9.711-13.996 7.141-21.993zm-85.404-262.78c-3.142-8.854-15.709-8.854-18.851 0l-56.555 174.806h131.961L425.663 24.926z" />
116
+ </svg>
117
+ </LoginMainFooterLinksItem>
118
+ </React.Fragment>
119
+ );
120
+
121
+ const signUpForAccountMessage = (
122
+ <LoginMainFooterBandItem>
123
+ Need an account? <a href="#">Sign up.</a>
124
+ </LoginMainFooterBandItem>
125
+ );
126
+
127
+ const forgotCredentials = (
128
+ <LoginMainFooterBandItem>
129
+ <a href="#">Forgot username or password?</a>
130
+ </LoginMainFooterBandItem>
131
+ );
132
+
133
+ const listItem = (
134
+ <React.Fragment>
135
+ <ListItem>
136
+ <LoginFooterItem href="#">Terms of Use </LoginFooterItem>
137
+ </ListItem>
138
+ <ListItem>
139
+ <LoginFooterItem href="#">Help</LoginFooterItem>
140
+ </ListItem>
141
+ <ListItem>
142
+ <LoginFooterItem href="#">Privacy Policy</LoginFooterItem>
143
+ </ListItem>
144
+ </React.Fragment>
145
+ );
146
+
147
+ const loginForm = (
148
+ <LoginForm
149
+ showHelperText={showHelperText}
150
+ helperText="Invalid login credentials."
151
+ helperTextIcon={<ExclamationCircleIcon />}
152
+ usernameLabel="Username"
153
+ usernameValue={username}
154
+ onChangeUsername={handleUsernameChange}
155
+ isValidUsername={isValidUsername}
156
+ passwordLabel="Password"
157
+ passwordValue={password}
158
+ onChangePassword={handlePasswordChange}
159
+ isValidPassword={isValidPassword}
160
+ rememberMeLabel="Keep me logged in for 30 days."
161
+ isRememberMeChecked={isRememberMeChecked}
162
+ onChangeRememberMe={onRememberMeClick}
163
+ onLoginButtonClick={onLoginButtonClick}
164
+ loginButtonLabel="Log in"
165
+ />
166
+ );
167
+
168
+ const images = {
169
+ lg: '/assets/images/pfbg_1200.jpg',
170
+ sm: '/assets/images/pfbg_768.jpg',
171
+ sm2x: '/assets/images/pfbg_768@2x.jpg',
172
+ xs: '/assets/images/pfbg_576.jpg',
173
+ xs2x: '/assets/images/pfbg_576@2x.jpg'
174
+ };
175
+
176
+ return (
177
+ <LoginPage
178
+ footerListVariants={ListVariant.inline}
179
+ brandImgSrc={brandImg2}
180
+ brandImgAlt="PatternFly logo"
181
+ backgroundImgSrc={images}
182
+ footerListItems={listItem}
183
+ textContent="This is placeholder text only. Use this area to place any information or introductory message about your application that may be relevant to users."
184
+ loginTitle="Log in to your account"
185
+ loginSubtitle="Enter your single sign-on LDAP credentials."
186
+ headerUtilities={headerUtils}
187
+ socialMediaLoginContent={socialMediaLoginContent}
188
+ signUpForAccountMessage={signUpForAccountMessage}
189
+ forgotCredentials={forgotCredentials}
190
+ >
191
+ {loginForm}
192
+ </LoginPage>
193
+ );
194
+ };
@@ -130,7 +130,6 @@ export const LoginPageHideShowPassword: React.FunctionComponent = () => {
130
130
  brandImgSrc={brandImg2}
131
131
  brandImgAlt="PatternFly logo"
132
132
  backgroundImgSrc={images}
133
- backgroundImgAlt="Images"
134
133
  footerListItems={listItem}
135
134
  textContent="This is placeholder text only. Use this area to place any information or introductory message about your application that may be relevant to users."
136
135
  loginTitle="Log in to your account"
@@ -13,6 +13,8 @@ import SlackHashIcon from '@patternfly/react-icons/dist/esm/icons/slack-hash-ico
13
13
  import FinishedStep from './FinishedStep';
14
14
  import SampleForm from './SampleForm';
15
15
 
16
+ If you seek a wizard solution that allows for more composition, see the [React next](/components/wizard/react-next) tab.
17
+
16
18
  ## Examples
17
19
 
18
20
  ### Basic
@@ -54,7 +56,7 @@ class SimpleWizard extends React.Component {
54
56
  render() {
55
57
  const steps = [
56
58
  { name: 'First step', component: <p>Step 1 content</p> },
57
- { name: 'Second step', component: <p>Step 2 content</p>, isDisabled: true},
59
+ { name: 'Second step', component: <p>Step 2 content</p>, isDisabled: true },
58
60
  { name: 'Third step', component: <p>Step 3 content</p> },
59
61
  { name: 'Fourth step', component: <p>Step 4 content</p>, isDisabled: true },
60
62
  { name: 'Review', component: <p>Review step content</p>, nextButtonText: 'Finish' }
@@ -145,9 +147,24 @@ class IncrementallyEnabledStepsWizard extends React.Component {
145
147
 
146
148
  const steps = [
147
149
  { id: 'incrementally-enabled-1', name: 'First step', component: <p>Step 1 content</p> },
148
- { id: 'incrementally-enabled-2', name: 'Second step', component: <p>Step 2 content</p>, canJumpTo: stepIdReached >= 2 },
149
- { id: 'incrementally-enabled-3', name: 'Third step', component: <p>Step 3 content</p>, canJumpTo: stepIdReached >= 3 },
150
- { id: 'incrementally-enabled-4', name: 'Fourth step', component: <p>Step 4 content</p>, canJumpTo: stepIdReached >= 4 },
150
+ {
151
+ id: 'incrementally-enabled-2',
152
+ name: 'Second step',
153
+ component: <p>Step 2 content</p>,
154
+ canJumpTo: stepIdReached >= 2
155
+ },
156
+ {
157
+ id: 'incrementally-enabled-3',
158
+ name: 'Third step',
159
+ component: <p>Step 3 content</p>,
160
+ canJumpTo: stepIdReached >= 3
161
+ },
162
+ {
163
+ id: 'incrementally-enabled-4',
164
+ name: 'Fourth step',
165
+ component: <p>Step 4 content</p>,
166
+ canJumpTo: stepIdReached >= 4
167
+ },
151
168
  {
152
169
  id: 'incrementally-enabled-5',
153
170
  name: 'Review',
@@ -18,6 +18,8 @@ import chart_color_red_100 from '@patternfly/react-tokens/dist/esm/chart_color_r
18
18
 
19
19
  ### Horizontal card grid
20
20
 
21
+ The following demo shows how you may use a `<Grid>` within a card for scenarios that require multiple subsections.
22
+
21
23
  ```js
22
24
  import React from 'react';
23
25
  import {
@@ -263,6 +265,8 @@ class CardGridDemo extends React.Component {
263
265
 
264
266
  ### Horizontal split
265
267
 
268
+ The following demo shows how you may utilize `<Grid>` to split a card into two halves, one with an image, and one with text content.
269
+
266
270
  ```js
267
271
  import React from 'react';
268
272
  import { Card, CardTitle, CardBody, CardFooter, Grid, GridItem, Button } from '@patternfly/react-core';
@@ -0,0 +1,184 @@
1
+ import React from 'react';
2
+
3
+ import { css } from '@patternfly/react-styles';
4
+ import styles from '@patternfly/react-styles/css/components/Wizard/wizard';
5
+
6
+ import {
7
+ DefaultWizardFooterProps,
8
+ DefaultWizardNavProps,
9
+ isCustomWizardFooter,
10
+ isWizardParentStep,
11
+ WizardNavStepFunction,
12
+ CustomWizardNavFunction
13
+ } from './types';
14
+ import { buildSteps, normalizeNavStep } from './utils';
15
+ import { useWizardContext, WizardContextProvider } from './WizardContext';
16
+ import { WizardStepProps } from './WizardStep';
17
+ import { WizardFooter } from './WizardFooter';
18
+ import { WizardToggle } from './WizardToggle';
19
+
20
+ /**
21
+ * Wrapper for all steps and hosts state, including navigation helpers, within context.
22
+ * The WizardContext provided by default gives any child of wizard access to those resources.
23
+ */
24
+
25
+ export interface WizardProps extends React.HTMLProps<HTMLDivElement> {
26
+ /** Step components */
27
+ children: React.ReactElement<WizardStepProps> | React.ReactElement<WizardStepProps>[];
28
+ /** Wizard header */
29
+ header?: React.ReactNode;
30
+ /** Wizard footer */
31
+ footer?: DefaultWizardFooterProps | React.ReactElement;
32
+ /** Default wizard nav props or a custom WizardNav (with callback) */
33
+ nav?: DefaultWizardNavProps | CustomWizardNavFunction;
34
+ /** The initial index the wizard is to start on (1 or higher). Defaults to 1. */
35
+ startIndex?: number;
36
+ /** Additional classes spread to the wizard */
37
+ className?: string;
38
+ /** Custom width of the wizard */
39
+ width?: number | string;
40
+ /** Custom height of the wizard */
41
+ height?: number | string;
42
+ /** Callback function when a step in the nav is clicked */
43
+ onNavByIndex?: WizardNavStepFunction;
44
+ /** Callback function after next button is clicked */
45
+ onNext?: WizardNavStepFunction;
46
+ /** Callback function after back button is clicked */
47
+ onBack?: WizardNavStepFunction;
48
+ /** Callback function to save at the end of the wizard, if not specified uses onClose */
49
+ onSave?: () => void;
50
+ /** Callback function to close the wizard */
51
+ onClose?: () => void;
52
+ }
53
+
54
+ export const Wizard = (props: WizardProps) => {
55
+ const { startIndex = 1, children, footer, onNavByIndex, onNext, onBack, onSave, onClose, ...internalProps } = props;
56
+ const [currentStepIndex, setCurrentStepIndex] = React.useState(startIndex);
57
+ const steps = buildSteps(children);
58
+
59
+ const goToStepByIndex = (index: number) => {
60
+ const lastStepIndex = steps.length;
61
+
62
+ if (index < 1) {
63
+ index = 1;
64
+ } else if (index > lastStepIndex) {
65
+ index = lastStepIndex;
66
+ }
67
+
68
+ const currStep = steps[index - 1];
69
+ const prevStep = steps[currentStepIndex - 1];
70
+ setCurrentStepIndex(index);
71
+
72
+ return onNavByIndex?.(normalizeNavStep(currStep), normalizeNavStep(prevStep));
73
+ };
74
+
75
+ const goToNextStep = () => {
76
+ // Save when on the last step, otherwise close
77
+ if (currentStepIndex >= steps.length) {
78
+ if (onSave) {
79
+ return onSave();
80
+ }
81
+
82
+ return onClose?.();
83
+ }
84
+
85
+ let currStep = steps[currentStepIndex];
86
+ let newStepIndex = currentStepIndex + 1;
87
+ const prevStep = steps[currentStepIndex - 1];
88
+
89
+ // Skip parent step and focus on the first sub-step if they exist
90
+ if (isWizardParentStep(currStep)) {
91
+ newStepIndex += 1;
92
+ currStep = steps[currentStepIndex + 1];
93
+ }
94
+
95
+ setCurrentStepIndex(newStepIndex);
96
+ return onNext?.(normalizeNavStep(currStep), normalizeNavStep(prevStep));
97
+ };
98
+
99
+ const goToPrevStep = () => {
100
+ if (steps.length < currentStepIndex) {
101
+ // Previous step was removed, just update the currentStep state
102
+ setCurrentStepIndex(steps.length);
103
+ } else {
104
+ let currStep = steps[currentStepIndex - 2];
105
+ let newStepIndex = currentStepIndex - 1;
106
+ const prevStep = steps[currentStepIndex - 1];
107
+
108
+ // // Skip parent step and focus on the step prior
109
+ if (isWizardParentStep(currStep)) {
110
+ newStepIndex -= 1;
111
+ currStep = steps[currentStepIndex - 3];
112
+ }
113
+
114
+ setCurrentStepIndex(newStepIndex);
115
+ return onBack?.(normalizeNavStep(currStep), normalizeNavStep(prevStep));
116
+ }
117
+ };
118
+
119
+ const goToStepById = (id: number | string) => {
120
+ const stepIndex = steps.findIndex(step => step.id === id) + 1;
121
+ stepIndex > 0 && setCurrentStepIndex(stepIndex);
122
+ };
123
+
124
+ const goToStepByName = (name: string) => {
125
+ const stepIndex = steps.findIndex(step => step.name === name) + 1;
126
+ stepIndex > 0 && setCurrentStepIndex(stepIndex);
127
+ };
128
+
129
+ return (
130
+ <WizardContextProvider
131
+ steps={steps}
132
+ currentStepIndex={currentStepIndex}
133
+ footer={isCustomWizardFooter(footer) && footer}
134
+ onNext={goToNextStep}
135
+ onBack={goToPrevStep}
136
+ onClose={onClose}
137
+ goToStepById={goToStepById}
138
+ goToStepByName={goToStepByName}
139
+ goToStepByIndex={goToStepByIndex}
140
+ >
141
+ <WizardInternal {...internalProps} footer={footer}>
142
+ {children}
143
+ </WizardInternal>
144
+ </WizardContextProvider>
145
+ );
146
+ };
147
+
148
+ // eslint-disable-next-line patternfly-react/no-anonymous-functions
149
+ const WizardInternal = ({ height, width, className, header, footer, nav, ...divProps }: WizardProps) => {
150
+ const { activeStep, steps, footer: customFooter, onNext, onBack, onClose, goToStepByIndex } = useWizardContext();
151
+
152
+ const wizardFooter = customFooter || (
153
+ <WizardFooter
154
+ activeStep={activeStep}
155
+ onNext={onNext}
156
+ onBack={onBack}
157
+ onClose={onClose}
158
+ disableBackButton={activeStep?.id === steps[0]?.id}
159
+ {...footer}
160
+ />
161
+ );
162
+
163
+ return (
164
+ <div
165
+ className={css(styles.wizard, className)}
166
+ style={{
167
+ ...(height ? { height } : {}),
168
+ ...(width ? { width } : {})
169
+ }}
170
+ {...divProps}
171
+ >
172
+ {header}
173
+ <WizardToggle
174
+ steps={steps}
175
+ activeStep={activeStep}
176
+ footer={wizardFooter}
177
+ nav={nav}
178
+ goToStepByIndex={goToStepByIndex}
179
+ />
180
+ </div>
181
+ );
182
+ };
183
+
184
+ Wizard.displayName = 'Wizard';
@@ -0,0 +1,34 @@
1
+ import React from 'react';
2
+
3
+ import styles from '@patternfly/react-styles/css/components/Wizard/wizard';
4
+ import { css } from '@patternfly/react-styles';
5
+
6
+ /**
7
+ * Used as a wrapper for WizardStep content, where the wrapping element is customizable.
8
+ */
9
+
10
+ export interface WizardBodyProps {
11
+ children?: React.ReactNode | React.ReactNode[];
12
+ /** Set to true to remove the default body padding */
13
+ hasNoBodyPadding?: boolean;
14
+ /** An aria-label to use for the wrapper element */
15
+ 'aria-label'?: string;
16
+ /** Sets the aria-labelledby attribute for the wrapper element */
17
+ 'aria-labelledby'?: string;
18
+ /** Component used as the wrapping content container */
19
+ wrapperElement?: React.ElementType;
20
+ }
21
+
22
+ export const WizardBody = ({
23
+ children,
24
+ hasNoBodyPadding = false,
25
+ 'aria-label': ariaLabel,
26
+ 'aria-labelledby': ariaLabelledBy,
27
+ wrapperElement: Wrapper = 'div'
28
+ }: WizardBodyProps) => (
29
+ <Wrapper aria-label={ariaLabel} aria-labelledby={ariaLabelledBy} className={css(styles.wizardMain)}>
30
+ <div className={css(styles.wizardMainBody, hasNoBodyPadding && styles.modifiers.noPadding)}>{children}</div>
31
+ </Wrapper>
32
+ );
33
+
34
+ WizardBody.displayName = 'WizardBody';
@@ -0,0 +1,104 @@
1
+ import React from 'react';
2
+ import { WizardControlStep } from './types';
3
+ import { getActiveStep } from './utils';
4
+
5
+ export interface WizardContextProps {
6
+ /** List of steps */
7
+ steps: WizardControlStep[];
8
+ /** Active step */
9
+ activeStep: WizardControlStep;
10
+ /** Footer element */
11
+ footer: React.ReactElement;
12
+ /** Navigate to the next step */
13
+ onNext: () => void;
14
+ /** Navigate to the previous step */
15
+ onBack: () => void;
16
+ /** Close the wizard */
17
+ onClose: () => void;
18
+ /** Navigate to step by ID */
19
+ goToStepById: (id: number | string) => void;
20
+ /** Navigate to step by name */
21
+ goToStepByName: (name: string) => void;
22
+ /** Navigate to step by index */
23
+ goToStepByIndex: (index: number) => void;
24
+ /** Update the footer with any react element */
25
+ setFooter: (footer: React.ReactElement) => void;
26
+ }
27
+
28
+ export const WizardContext = React.createContext({} as WizardContextProps);
29
+
30
+ interface WizardContextRenderProps {
31
+ steps: WizardControlStep[];
32
+ activeStep: WizardControlStep;
33
+ footer: React.ReactElement;
34
+ onNext(): void;
35
+ onBack(): void;
36
+ onClose(): void;
37
+ }
38
+
39
+ export interface WizardContextProviderProps {
40
+ steps: WizardControlStep[];
41
+ currentStepIndex: number;
42
+ footer: React.ReactElement;
43
+ children: React.ReactElement | ((props: WizardContextRenderProps) => React.ReactElement);
44
+ onNext(): void;
45
+ onBack(): void;
46
+ onClose(): void;
47
+ goToStepById(id: number | string): void;
48
+ goToStepByName(name: string): void;
49
+ goToStepByIndex(index: number): void;
50
+ }
51
+
52
+ // eslint-disable-next-line patternfly-react/no-anonymous-functions
53
+ export const WizardContextProvider: React.FunctionComponent<WizardContextProviderProps> = ({
54
+ steps: initialSteps,
55
+ footer: initialFooter,
56
+ currentStepIndex,
57
+ children,
58
+ onNext,
59
+ onBack,
60
+ onClose,
61
+ goToStepById,
62
+ goToStepByName,
63
+ goToStepByIndex
64
+ }) => {
65
+ const [steps, setSteps] = React.useState(initialSteps);
66
+ const [footer, setFooter] = React.useState(initialFooter);
67
+ const activeStep = getActiveStep(steps, currentStepIndex);
68
+
69
+ // When the active step changes and the newly active step isn't visited, set the visited flag to true.
70
+ React.useEffect(() => {
71
+ if (activeStep && !activeStep?.visited) {
72
+ setSteps(prevSteps =>
73
+ prevSteps.map(step => {
74
+ if (step.id === activeStep.id) {
75
+ return { ...step, visited: true };
76
+ }
77
+
78
+ return step;
79
+ })
80
+ );
81
+ }
82
+ }, [activeStep]);
83
+
84
+ return (
85
+ <WizardContext.Provider
86
+ value={{
87
+ steps,
88
+ activeStep,
89
+ footer,
90
+ onNext,
91
+ onBack,
92
+ onClose,
93
+ goToStepById,
94
+ goToStepByName,
95
+ goToStepByIndex,
96
+ setFooter
97
+ }}
98
+ >
99
+ {typeof children === 'function' ? children({ activeStep, steps, footer, onNext, onBack, onClose }) : children}
100
+ </WizardContext.Provider>
101
+ );
102
+ };
103
+
104
+ export const useWizardContext = () => React.useContext(WizardContext);
@@ -0,0 +1,63 @@
1
+ import React from 'react';
2
+
3
+ import { css } from '@patternfly/react-styles';
4
+ import styles from '@patternfly/react-styles/css/components/Wizard/wizard';
5
+
6
+ import { Button, ButtonVariant } from '../../../components/Button';
7
+ import { WizardControlStep, WizardNavStepFunction } from './types';
8
+
9
+ /**
10
+ * Hosts the standard structure of a footer with ties to the active step so that text for buttons can vary from step to step.
11
+ */
12
+
13
+ export interface WizardFooterProps {
14
+ /** The currently active WizardStep */
15
+ activeStep: WizardControlStep;
16
+ /** Next button callback */
17
+ onNext: () => WizardNavStepFunction | void;
18
+ /** Back button callback */
19
+ onBack: () => WizardNavStepFunction | void;
20
+ /** Cancel link callback */
21
+ onClose: () => void;
22
+ /** Custom text for the Next button. The activeStep's nextButtonText takes precedence. */
23
+ nextButtonText?: React.ReactNode;
24
+ /** Custom text for the Back button */
25
+ backButtonText?: React.ReactNode;
26
+ /** Custom text for the Cancel link */
27
+ cancelButtonText?: React.ReactNode;
28
+ /** Optional flag to disable the first step's back button */
29
+ disableBackButton?: boolean;
30
+ }
31
+
32
+ export const WizardFooter = ({
33
+ onNext,
34
+ onBack,
35
+ onClose,
36
+ activeStep,
37
+ disableBackButton,
38
+ nextButtonText = 'Next',
39
+ backButtonText = 'Back',
40
+ cancelButtonText = 'Cancel'
41
+ }: WizardFooterProps) => (
42
+ <footer className={css(styles.wizardFooter)}>
43
+ <Button variant={ButtonVariant.primary} type="submit" onClick={onNext} isDisabled={activeStep?.disableNext}>
44
+ {activeStep?.nextButtonText || nextButtonText}
45
+ </Button>
46
+
47
+ {!activeStep?.hideBackButton && (
48
+ <Button variant={ButtonVariant.secondary} onClick={onBack} isDisabled={disableBackButton}>
49
+ {backButtonText}
50
+ </Button>
51
+ )}
52
+
53
+ {!activeStep?.hideCancelButton && (
54
+ <div className={styles.wizardFooterCancel}>
55
+ <Button variant={ButtonVariant.link} onClick={onClose}>
56
+ {cancelButtonText}
57
+ </Button>
58
+ </div>
59
+ )}
60
+ </footer>
61
+ );
62
+
63
+ WizardFooter.displayName = 'WizardFooter';