@patternfly/react-core 4.165.0 → 4.168.5

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 (123) hide show
  1. package/CHANGELOG.md +145 -0
  2. package/README.md +1 -1
  3. package/dist/esm/components/Dropdown/DropdownToggle.d.ts +1 -1
  4. package/dist/esm/components/Dropdown/DropdownToggle.d.ts.map +1 -1
  5. package/dist/esm/components/Dropdown/KebabToggle.d.ts +1 -1
  6. package/dist/esm/components/Dropdown/KebabToggle.d.ts.map +1 -1
  7. package/dist/esm/components/DualListSelector/DualListSelector.d.ts +1 -0
  8. package/dist/esm/components/DualListSelector/DualListSelector.d.ts.map +1 -1
  9. package/dist/esm/components/DualListSelector/DualListSelector.js +23 -10
  10. package/dist/esm/components/DualListSelector/DualListSelector.js.map +1 -1
  11. package/dist/esm/components/Select/SelectOption.d.ts +1 -1
  12. package/dist/esm/components/Select/SelectOption.d.ts.map +1 -1
  13. package/dist/esm/components/Tabs/TabContentBody.d.ts +11 -0
  14. package/dist/esm/components/Tabs/TabContentBody.d.ts.map +1 -0
  15. package/dist/esm/components/Tabs/TabContentBody.js +10 -0
  16. package/dist/esm/components/Tabs/TabContentBody.js.map +1 -0
  17. package/dist/esm/components/Tabs/index.d.ts +1 -0
  18. package/dist/esm/components/Tabs/index.d.ts.map +1 -1
  19. package/dist/esm/components/Tabs/index.js +1 -0
  20. package/dist/esm/components/Tabs/index.js.map +1 -1
  21. package/dist/esm/components/TextInputGroup/TextInputGroup.d.ts +9 -0
  22. package/dist/esm/components/TextInputGroup/TextInputGroup.d.ts.map +1 -0
  23. package/dist/esm/components/TextInputGroup/TextInputGroup.js +10 -0
  24. package/dist/esm/components/TextInputGroup/TextInputGroup.js.map +1 -0
  25. package/dist/esm/components/TextInputGroup/TextInputGroupMain.d.ts +15 -0
  26. package/dist/esm/components/TextInputGroup/TextInputGroupMain.d.ts.map +1 -0
  27. package/dist/esm/components/TextInputGroup/TextInputGroupMain.js +15 -0
  28. package/dist/esm/components/TextInputGroup/TextInputGroupMain.js.map +1 -0
  29. package/dist/esm/components/TextInputGroup/TextInputGroupUtilities.d.ts +9 -0
  30. package/dist/esm/components/TextInputGroup/TextInputGroupUtilities.d.ts.map +1 -0
  31. package/dist/esm/components/TextInputGroup/TextInputGroupUtilities.js +10 -0
  32. package/dist/esm/components/TextInputGroup/TextInputGroupUtilities.js.map +1 -0
  33. package/dist/esm/components/TextInputGroup/index.d.ts +4 -0
  34. package/dist/esm/components/TextInputGroup/index.d.ts.map +1 -0
  35. package/dist/esm/components/TextInputGroup/index.js +4 -0
  36. package/dist/esm/components/TextInputGroup/index.js.map +1 -0
  37. package/dist/esm/components/Toolbar/Toolbar.d.ts +2 -0
  38. package/dist/esm/components/Toolbar/Toolbar.d.ts.map +1 -1
  39. package/dist/esm/components/Toolbar/Toolbar.js +2 -2
  40. package/dist/esm/components/Toolbar/Toolbar.js.map +1 -1
  41. package/dist/esm/components/index.d.ts +1 -0
  42. package/dist/esm/components/index.d.ts.map +1 -1
  43. package/dist/esm/components/index.js +1 -0
  44. package/dist/esm/components/index.js.map +1 -1
  45. package/dist/js/components/Dropdown/DropdownToggle.d.ts +1 -1
  46. package/dist/js/components/Dropdown/DropdownToggle.d.ts.map +1 -1
  47. package/dist/js/components/Dropdown/KebabToggle.d.ts +1 -1
  48. package/dist/js/components/Dropdown/KebabToggle.d.ts.map +1 -1
  49. package/dist/js/components/DualListSelector/DualListSelector.d.ts +1 -0
  50. package/dist/js/components/DualListSelector/DualListSelector.d.ts.map +1 -1
  51. package/dist/js/components/DualListSelector/DualListSelector.js +23 -10
  52. package/dist/js/components/DualListSelector/DualListSelector.js.map +1 -1
  53. package/dist/js/components/Select/SelectOption.d.ts +1 -1
  54. package/dist/js/components/Select/SelectOption.d.ts.map +1 -1
  55. package/dist/js/components/Tabs/TabContentBody.d.ts +11 -0
  56. package/dist/js/components/Tabs/TabContentBody.d.ts.map +1 -0
  57. package/dist/js/components/Tabs/TabContentBody.js +14 -0
  58. package/dist/js/components/Tabs/TabContentBody.js.map +1 -0
  59. package/dist/js/components/Tabs/index.d.ts +1 -0
  60. package/dist/js/components/Tabs/index.d.ts.map +1 -1
  61. package/dist/js/components/Tabs/index.js +1 -0
  62. package/dist/js/components/Tabs/index.js.map +1 -1
  63. package/dist/js/components/TextInputGroup/TextInputGroup.d.ts +9 -0
  64. package/dist/js/components/TextInputGroup/TextInputGroup.d.ts.map +1 -0
  65. package/dist/js/components/TextInputGroup/TextInputGroup.js +14 -0
  66. package/dist/js/components/TextInputGroup/TextInputGroup.js.map +1 -0
  67. package/dist/js/components/TextInputGroup/TextInputGroupMain.d.ts +15 -0
  68. package/dist/js/components/TextInputGroup/TextInputGroupMain.d.ts.map +1 -0
  69. package/dist/js/components/TextInputGroup/TextInputGroupMain.js +19 -0
  70. package/dist/js/components/TextInputGroup/TextInputGroupMain.js.map +1 -0
  71. package/dist/js/components/TextInputGroup/TextInputGroupUtilities.d.ts +9 -0
  72. package/dist/js/components/TextInputGroup/TextInputGroupUtilities.d.ts.map +1 -0
  73. package/dist/js/components/TextInputGroup/TextInputGroupUtilities.js +14 -0
  74. package/dist/js/components/TextInputGroup/TextInputGroupUtilities.js.map +1 -0
  75. package/dist/js/components/TextInputGroup/index.d.ts +4 -0
  76. package/dist/js/components/TextInputGroup/index.d.ts.map +1 -0
  77. package/dist/js/components/TextInputGroup/index.js +7 -0
  78. package/dist/js/components/TextInputGroup/index.js.map +1 -0
  79. package/dist/js/components/Toolbar/Toolbar.d.ts +2 -0
  80. package/dist/js/components/Toolbar/Toolbar.d.ts.map +1 -1
  81. package/dist/js/components/Toolbar/Toolbar.js +2 -2
  82. package/dist/js/components/Toolbar/Toolbar.js.map +1 -1
  83. package/dist/js/components/index.d.ts +1 -0
  84. package/dist/js/components/index.d.ts.map +1 -1
  85. package/dist/js/components/index.js +1 -0
  86. package/dist/js/components/index.js.map +1 -1
  87. package/dist/styles/assets/pficon/pficon.woff +0 -0
  88. package/dist/styles/assets/pficon/pficon.woff2 +0 -0
  89. package/dist/umd/react-core.css +360 -17
  90. package/dist/umd/react-core.js +959 -884
  91. package/dist/umd/react-core.min.css +360 -17
  92. package/dist/umd/react-core.min.js +3 -3
  93. package/package.json +6 -6
  94. package/src/components/Dropdown/DropdownToggle.tsx +1 -1
  95. package/src/components/Dropdown/KebabToggle.tsx +1 -1
  96. package/src/components/DualListSelector/DualListSelector.tsx +25 -23
  97. package/src/components/Modal/__tests__/ModalBox.test.tsx +11 -21
  98. package/src/components/Modal/__tests__/ModalBoxDescription.test.tsx +12 -0
  99. package/src/components/Modal/__tests__/ModalBoxTitle.test.tsx +59 -0
  100. package/src/components/Modal/__tests__/ModalContent.test.tsx +15 -10
  101. package/src/components/Modal/__tests__/__snapshots__/ModalBox.test.tsx.snap +12 -30
  102. package/src/components/Modal/__tests__/__snapshots__/ModalBoxDescription.test.tsx.snap +10 -0
  103. package/src/components/Modal/__tests__/__snapshots__/ModalBoxTitle.test.tsx.snap +158 -0
  104. package/src/components/Modal/__tests__/__snapshots__/ModalContent.test.tsx.snap +53 -22
  105. package/src/components/Select/SelectOption.tsx +1 -1
  106. package/src/components/Tabs/TabContentBody.tsx +24 -0
  107. package/src/components/Tabs/__tests__/Tabs.test.tsx +4 -3
  108. package/src/components/Tabs/__tests__/__snapshots__/Tabs.test.tsx.snap +10 -2
  109. package/src/components/Tabs/examples/Tabs.md +40 -0
  110. package/src/components/Tabs/index.ts +1 -0
  111. package/src/components/TextInputGroup/TextInputGroup.tsx +22 -0
  112. package/src/components/TextInputGroup/TextInputGroupMain.tsx +43 -0
  113. package/src/components/TextInputGroup/TextInputGroupUtilities.tsx +22 -0
  114. package/src/components/TextInputGroup/__tests__/TextInputGroup.test.tsx +77 -0
  115. package/src/components/TextInputGroup/__tests__/__snapshots__/TextInputGroup.test.tsx.snap +211 -0
  116. package/src/components/TextInputGroup/examples/TextInputGroup.md +138 -0
  117. package/src/components/TextInputGroup/index.ts +3 -0
  118. package/src/components/Toolbar/Toolbar.tsx +4 -0
  119. package/src/components/Wizard/examples/Wizard.md +17 -1
  120. package/src/components/index.ts +1 -0
  121. package/src/demos/ProgressDemo.md +82 -0
  122. package/src/demos/Tabs.md +439 -0
  123. package/src/demos/examples/DashboardWrapper.js +16 -2
@@ -0,0 +1,211 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`TextInputGroup gets custom class and id 1`] = `
4
+ <TextInputGroup
5
+ className="custom-class"
6
+ id="test-id"
7
+ >
8
+ <div
9
+ className="pf-c-text-input-group custom-class"
10
+ id="test-id"
11
+ >
12
+ <TextInputGroupMain
13
+ aria-label="Type to filter"
14
+ >
15
+ <div
16
+ className="pf-c-text-input-group__main"
17
+ >
18
+ Foo
19
+ <span
20
+ className="pf-c-text-input-group__text"
21
+ >
22
+ <input
23
+ aria-label="Type to filter"
24
+ className="pf-c-text-input-group__text-input"
25
+ type="text"
26
+ />
27
+ </span>
28
+ </div>
29
+ </TextInputGroupMain>
30
+ <TextInputGroupUtilities>
31
+ <div
32
+ className="pf-c-text-input-group__utilities"
33
+ />
34
+ </TextInputGroupUtilities>
35
+ </div>
36
+ </TextInputGroup>
37
+ `;
38
+
39
+ exports[`TextInputGroup renders content 1`] = `
40
+ <TextInputGroup>
41
+ <div
42
+ className="pf-c-text-input-group"
43
+ >
44
+ <TextInputGroupMain
45
+ aria-label="Type to filter"
46
+ >
47
+ <div
48
+ className="pf-c-text-input-group__main"
49
+ >
50
+ Foo
51
+ <span
52
+ className="pf-c-text-input-group__text"
53
+ >
54
+ <input
55
+ aria-label="Type to filter"
56
+ className="pf-c-text-input-group__text-input"
57
+ type="text"
58
+ />
59
+ </span>
60
+ </div>
61
+ </TextInputGroupMain>
62
+ <TextInputGroupUtilities>
63
+ <div
64
+ className="pf-c-text-input-group__utilities"
65
+ />
66
+ </TextInputGroupUtilities>
67
+ </div>
68
+ </TextInputGroup>
69
+ `;
70
+
71
+ exports[`TextInputGroup renders with the proper stying for an icon on the left side of the component 1`] = `
72
+ <TextInputGroup>
73
+ <div
74
+ className="pf-c-text-input-group"
75
+ >
76
+ <TextInputGroupMain
77
+ aria-label="Type to filter"
78
+ >
79
+ <div
80
+ className="pf-c-text-input-group__main"
81
+ >
82
+ Foo
83
+ <span
84
+ className="pf-c-text-input-group__text"
85
+ >
86
+ <input
87
+ aria-label="Type to filter"
88
+ className="pf-c-text-input-group__text-input"
89
+ type="text"
90
+ />
91
+ </span>
92
+ </div>
93
+ </TextInputGroupMain>
94
+ <TextInputGroupUtilities>
95
+ <div
96
+ className="pf-c-text-input-group__utilities"
97
+ />
98
+ </TextInputGroupUtilities>
99
+ </div>
100
+ </TextInputGroup>
101
+ `;
102
+
103
+ exports[`TextInputGroupMain renders content 1`] = `
104
+ <TextInputGroupMain
105
+ aria-label="Type to filter"
106
+ >
107
+ <div
108
+ className="pf-c-text-input-group__main"
109
+ >
110
+ Foo
111
+ <span
112
+ className="pf-c-text-input-group__text"
113
+ >
114
+ <input
115
+ aria-label="Type to filter"
116
+ className="pf-c-text-input-group__text-input"
117
+ type="text"
118
+ />
119
+ </span>
120
+ </div>
121
+ </TextInputGroupMain>
122
+ `;
123
+
124
+ exports[`TextInputGroupMain renders given input icon props 1`] = `
125
+ <TextInputGroupMain
126
+ aria-label="Type to filter"
127
+ icon={
128
+ <SearchIcon
129
+ color="currentColor"
130
+ noVerticalAlign={false}
131
+ size="sm"
132
+ />
133
+ }
134
+ >
135
+ <div
136
+ className="pf-c-text-input-group__main pf-m-icon"
137
+ >
138
+ Foo
139
+ <span
140
+ className="pf-c-text-input-group__text"
141
+ >
142
+ <span
143
+ className="pf-c-text-input-group__icon"
144
+ >
145
+ <SearchIcon
146
+ color="currentColor"
147
+ noVerticalAlign={false}
148
+ size="sm"
149
+ >
150
+ <svg
151
+ aria-hidden={true}
152
+ aria-labelledby={null}
153
+ fill="currentColor"
154
+ height="1em"
155
+ role="img"
156
+ style={
157
+ Object {
158
+ "verticalAlign": "-0.125em",
159
+ }
160
+ }
161
+ viewBox="0 0 512 512"
162
+ width="1em"
163
+ >
164
+ <path
165
+ d="M505 442.7L405.3 343c-4.5-4.5-10.6-7-17-7H372c27.6-35.3 44-79.7 44-128C416 93.1 322.9 0 208 0S0 93.1 0 208s93.1 208 208 208c48.3 0 92.7-16.4 128-44v16.3c0 6.4 2.5 12.5 7 17l99.7 99.7c9.4 9.4 24.6 9.4 33.9 0l28.3-28.3c9.4-9.4 9.4-24.6.1-34zM208 336c-70.7 0-128-57.2-128-128 0-70.7 57.2-128 128-128 70.7 0 128 57.2 128 128 0 70.7-57.2 128-128 128z"
166
+ />
167
+ </svg>
168
+ </SearchIcon>
169
+ </span>
170
+ <input
171
+ aria-label="Type to filter"
172
+ className="pf-c-text-input-group__text-input"
173
+ type="text"
174
+ />
175
+ </span>
176
+ </div>
177
+ </TextInputGroupMain>
178
+ `;
179
+
180
+ exports[`TextInputGroupMain renders the input with custom aria label when given 1`] = `
181
+ <TextInputGroupMain
182
+ aria-label="Foo"
183
+ >
184
+ <div
185
+ className="pf-c-text-input-group__main"
186
+ >
187
+ Foo
188
+ <span
189
+ className="pf-c-text-input-group__text"
190
+ >
191
+ <input
192
+ aria-label="Foo"
193
+ className="pf-c-text-input-group__text-input"
194
+ type="text"
195
+ />
196
+ </span>
197
+ </div>
198
+ </TextInputGroupMain>
199
+ `;
200
+
201
+ exports[`TextInputGroupUtilities renders the content 1`] = `
202
+ <TextInputGroupUtilities>
203
+ <div
204
+ className="pf-c-text-input-group__utilities"
205
+ >
206
+ <button>
207
+ Foo
208
+ </button>
209
+ </div>
210
+ </TextInputGroupUtilities>
211
+ `;
@@ -0,0 +1,138 @@
1
+ ---
2
+ id: Text input group
3
+ section: components
4
+ cssPrefix: pf-c-text-input-group
5
+ propComponents: ['TextInputGroup', 'TextInputGroupMain', 'TextInputGroupUtilities']
6
+ beta: true
7
+ ---
8
+
9
+ import SearchIcon from '@patternfly/react-icons/dist/esm/icons/search-icon';
10
+ import TimesIcon from '@patternfly/react-icons/dist/esm/icons/times-icon';
11
+
12
+ ## Examples
13
+
14
+ ### Basic
15
+
16
+ ```js
17
+ import React from 'react';
18
+ import { TextInputGroup, TextInputGroupMain } from '@patternfly/react-core';
19
+
20
+ const BasicTextInputGroup = () => (
21
+ <TextInputGroup>
22
+ <TextInputGroupMain />
23
+ </TextInputGroup>
24
+ );
25
+ ```
26
+
27
+ ### Utilities and icon
28
+
29
+ ```js
30
+ import React from 'react';
31
+ import { TextInputGroup, TextInputGroupMain, TextInputGroupUtilities, Button } from '@patternfly/react-core';
32
+ import SearchIcon from '@patternfly/react-icons/dist/esm/icons/search-icon';
33
+ import TimesIcon from '@patternfly/react-icons/dist/esm/icons/times-icon';
34
+
35
+ const TextInputGroupWithIcons = () => {
36
+ const [inputValue, setInputValue] = React.useState('');
37
+
38
+ /** callback for updating the inputValue state in this component so that the input can be controlled */
39
+ const handleInputChange = event => {
40
+ setInputValue(event.target.value);
41
+ };
42
+
43
+ /** show the input clearing button only when the input is not empty */
44
+ const showClearButton = inputValue;
45
+
46
+ /** callback for clearing the text input */
47
+ const clearInput = () => {
48
+ setInputValue('');
49
+ };
50
+
51
+ return (
52
+ <TextInputGroup>
53
+ <TextInputGroupMain icon={<SearchIcon />} value={inputValue} onChange={handleInputChange} />
54
+ <TextInputGroupUtilities>
55
+ {showClearButton && (
56
+ <Button variant="plain" onClick={clearInput} aria-label="Clear button and input">
57
+ <TimesIcon />
58
+ </Button>
59
+ )}
60
+ </TextInputGroupUtilities>
61
+ </TextInputGroup>
62
+ );
63
+ };
64
+ ```
65
+
66
+ ### Filters
67
+
68
+ ```js
69
+ import React from 'react';
70
+ import { TextInputGroup, TextInputGroupMain, TextInputGroupUtilities, Button } from '@patternfly/react-core';
71
+ import { Chip, ChipGroup } from '@patternfly/react-core';
72
+ import SearchIcon from '@patternfly/react-icons/dist/esm/icons/search-icon';
73
+ import TimesIcon from '@patternfly/react-icons/dist/esm/icons/times-icon';
74
+
75
+ const TextInputGroupWithChips = () => {
76
+ const [inputValue, setInputValue] = React.useState('');
77
+ const [currentChips, setCurrentChips] = React.useState([
78
+ 'chip one',
79
+ 'chip two',
80
+ 'chip three',
81
+ 'chip four',
82
+ 'chip five',
83
+ 'chip six',
84
+ 'chip seven',
85
+ 'chip eight',
86
+ 'chip nine',
87
+ 'chip ten',
88
+ 'chip eleven',
89
+ 'chip twelve',
90
+ 'chip thirteen',
91
+ 'chip fourteen'
92
+ ]);
93
+
94
+ /** show the search icon only when there are no chips to prevent the chips from being displayed behind the icon */
95
+ const showSearchIcon = !currentChips.length;
96
+
97
+ /** callback for updating the inputValue state in this component so that the input can be controlled */
98
+ const handleInputChange = event => {
99
+ setInputValue(event.target.value);
100
+ };
101
+
102
+ /** callback for removing a chip from the chip selections */
103
+ const deleteChip = chipToDelete => {
104
+ const newChips = currentChips.filter(chip => !Object.is(chip, chipToDelete));
105
+ setCurrentChips(newChips);
106
+ };
107
+
108
+ /** show the input/chip clearing button only when either the text input or chip group are not empty */
109
+ const showClearButton = inputValue || !!currentChips.length;
110
+
111
+ /** callback for clearing all selected chips and the text input */
112
+ const clearChipsAndInput = () => {
113
+ setCurrentChips([]);
114
+ setInputValue('');
115
+ };
116
+
117
+ return (
118
+ <TextInputGroup>
119
+ <TextInputGroupMain icon={showSearchIcon && <SearchIcon />} value={inputValue} onChange={handleInputChange}>
120
+ <ChipGroup>
121
+ {currentChips.map(currentChip => (
122
+ <Chip key={currentChip} onClick={() => deleteChip(currentChip)}>
123
+ {currentChip}
124
+ </Chip>
125
+ ))}
126
+ </ChipGroup>
127
+ </TextInputGroupMain>
128
+ <TextInputGroupUtilities>
129
+ {showClearButton && (
130
+ <Button variant="plain" onClick={clearChipsAndInput} aria-label="Clear button and input">
131
+ <TimesIcon />
132
+ </Button>
133
+ )}
134
+ </TextInputGroupUtilities>
135
+ </TextInputGroup>
136
+ );
137
+ };
138
+ ```
@@ -0,0 +1,3 @@
1
+ export * from './TextInputGroup';
2
+ export * from './TextInputGroupMain';
3
+ export * from './TextInputGroupUtilities';
@@ -30,6 +30,8 @@ export interface ToolbarProps extends React.HTMLProps<HTMLDivElement>, OUIAProps
30
30
  isStatic?: boolean;
31
31
  /** Flag indicating the toolbar should use the Page insets */
32
32
  usePageInsets?: boolean;
33
+ /** Flag indicating the toolbar should stick to the top of its container */
34
+ isSticky?: boolean;
33
35
  /** Insets at various breakpoints. */
34
36
  inset?: {
35
37
  default?: 'insetNone' | 'insetSm' | 'insetMd' | 'insetLg' | 'insetXl' | 'inset2xl';
@@ -121,6 +123,7 @@ export class Toolbar extends React.Component<ToolbarProps, ToolbarState> {
121
123
  isStatic,
122
124
  inset,
123
125
  usePageInsets,
126
+ isSticky,
124
127
  ouiaId,
125
128
  ...props
126
129
  } = this.props;
@@ -139,6 +142,7 @@ export class Toolbar extends React.Component<ToolbarProps, ToolbarState> {
139
142
  isFullHeight && styles.modifiers.fullHeight,
140
143
  isStatic && styles.modifiers.static,
141
144
  usePageInsets && styles.modifiers.pageInsets,
145
+ isSticky && styles.modifiers.sticky,
142
146
  formatBreakpointMods(inset, styles),
143
147
  className
144
148
  )}
@@ -318,6 +318,22 @@ class ValidationWizard extends React.Component {
318
318
  ```
319
319
 
320
320
  ### Validate on button press
321
+
322
+ This example demonstrates how to use the `WizardContextConsumer` to consume the `WizardContext`. `WizardContext` can be used to imperatively move to a specific wizard step.
323
+
324
+ The definition of the `WizardContext` is as follows:
325
+
326
+ ```
327
+ interface WizardContext {
328
+ goToStepById: (stepId: number | string) => void;
329
+ goToStepByName: (stepName: string) => void;
330
+ onNext: () => void;
331
+ onBack: () => void;
332
+ onClose: () => void;
333
+ activeStep: WizardStep;
334
+ }
335
+ ```
336
+
321
337
  ```js
322
338
  import React from 'react';
323
339
  import { Button, Wizard, WizardFooter, WizardContextConsumer, Alert } from '@patternfly/react-core';
@@ -333,7 +349,7 @@ class ValidateButtonPressWizard extends React.Component {
333
349
 
334
350
  this.closeWizard = () => {
335
351
  console.log("close wizard");
336
- }
352
+ };
337
353
 
338
354
  this.validateLastStep = onNext => {
339
355
  const { stepsValid } = this.state;
@@ -79,3 +79,4 @@ export * from './NumberInput';
79
79
  export * from './TreeView';
80
80
  export * from './Wizard';
81
81
  export * from './DragDrop';
82
+ export * from './TextInputGroup';
@@ -0,0 +1,82 @@
1
+ ---
2
+ id: Progress
3
+ section: components
4
+ ---
5
+
6
+ ## Demos
7
+
8
+ ### Basic
9
+
10
+ ```js
11
+ import React from 'react';
12
+ import { Progress, Button, Stack, StackItem } from '@patternfly/react-core';
13
+
14
+ ProgressStepperDemo = () => {
15
+ const [currentValue, setCurrentValue] = React.useState(0);
16
+
17
+ const onProgressUpdate = nextValue => {
18
+ setCurrentValue(nextValue);
19
+ };
20
+
21
+ return (
22
+ <Stack>
23
+ <StackItem>
24
+ <Button onClick={() => onProgressUpdate(currentValue - 10)} isDisabled={currentValue === 0}>
25
+ Decrease value
26
+ </Button>{' '}
27
+ <Button onClick={() => onProgressUpdate(currentValue + 10)} isDisabled={currentValue === 100}>
28
+ Increase value
29
+ </Button>
30
+ <br />
31
+ <br />
32
+ </StackItem>
33
+ <StackItem>
34
+ <div className="pf-screen-reader" aria-live="polite">
35
+ {`Progress value is ${currentValue}%.`}
36
+ </div>
37
+ <Progress value={currentValue} title="Title" />
38
+ </StackItem>
39
+ </Stack>
40
+ );
41
+ };
42
+ ```
43
+
44
+ ### With only increasing progress
45
+
46
+ Sometimes a progress bar should only show increases to progress state. In this case, before the next value is set it should be checked against the current progress. The `Decrease progress` button attempts to set a lower progress value, simulating an update to a progress state that isn't desired, but won't change the progress state due to this check.
47
+
48
+ ```js
49
+ import React from 'react';
50
+ import { Progress, Button, Stack, StackItem } from '@patternfly/react-core';
51
+
52
+ ProgressStepperDemo = () => {
53
+ const [currentValue, setCurrentValue] = React.useState(0);
54
+
55
+ const onProgressUpdate = nextValue => {
56
+ if (nextValue > currentValue) {
57
+ setCurrentValue(nextValue);
58
+ }
59
+ };
60
+
61
+ return (
62
+ <Stack>
63
+ <StackItem>
64
+ <Button onClick={() => onProgressUpdate(currentValue - 10)} isDisabled={currentValue === 0}>
65
+ Decrease value
66
+ </Button>{' '}
67
+ <Button onClick={() => onProgressUpdate(currentValue + 10)} isDisabled={currentValue === 100}>
68
+ Increase value
69
+ </Button>
70
+ <br />
71
+ <br />
72
+ </StackItem>
73
+ <StackItem>
74
+ <div className="pf-screen-reader" aria-live="polite">
75
+ {`Progress value is ${currentValue}%.`}
76
+ </div>
77
+ <Progress value={currentValue} title="Title" />
78
+ </StackItem>
79
+ </Stack>
80
+ );
81
+ };
82
+ ```