@patternfly/react-core 4.166.0 → 4.168.4

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 (100) hide show
  1. package/CHANGELOG.md +115 -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/TextInputGroup/TextInputGroup.d.ts +9 -0
  14. package/dist/esm/components/TextInputGroup/TextInputGroup.d.ts.map +1 -0
  15. package/dist/esm/components/TextInputGroup/TextInputGroup.js +10 -0
  16. package/dist/esm/components/TextInputGroup/TextInputGroup.js.map +1 -0
  17. package/dist/esm/components/TextInputGroup/TextInputGroupMain.d.ts +15 -0
  18. package/dist/esm/components/TextInputGroup/TextInputGroupMain.d.ts.map +1 -0
  19. package/dist/esm/components/TextInputGroup/TextInputGroupMain.js +15 -0
  20. package/dist/esm/components/TextInputGroup/TextInputGroupMain.js.map +1 -0
  21. package/dist/esm/components/TextInputGroup/TextInputGroupUtilities.d.ts +9 -0
  22. package/dist/esm/components/TextInputGroup/TextInputGroupUtilities.d.ts.map +1 -0
  23. package/dist/esm/components/TextInputGroup/TextInputGroupUtilities.js +10 -0
  24. package/dist/esm/components/TextInputGroup/TextInputGroupUtilities.js.map +1 -0
  25. package/dist/esm/components/TextInputGroup/index.d.ts +4 -0
  26. package/dist/esm/components/TextInputGroup/index.d.ts.map +1 -0
  27. package/dist/esm/components/TextInputGroup/index.js +4 -0
  28. package/dist/esm/components/TextInputGroup/index.js.map +1 -0
  29. package/dist/esm/components/Toolbar/Toolbar.d.ts +2 -0
  30. package/dist/esm/components/Toolbar/Toolbar.d.ts.map +1 -1
  31. package/dist/esm/components/Toolbar/Toolbar.js +2 -2
  32. package/dist/esm/components/Toolbar/Toolbar.js.map +1 -1
  33. package/dist/esm/components/index.d.ts +1 -0
  34. package/dist/esm/components/index.d.ts.map +1 -1
  35. package/dist/esm/components/index.js +1 -0
  36. package/dist/esm/components/index.js.map +1 -1
  37. package/dist/js/components/Dropdown/DropdownToggle.d.ts +1 -1
  38. package/dist/js/components/Dropdown/DropdownToggle.d.ts.map +1 -1
  39. package/dist/js/components/Dropdown/KebabToggle.d.ts +1 -1
  40. package/dist/js/components/Dropdown/KebabToggle.d.ts.map +1 -1
  41. package/dist/js/components/DualListSelector/DualListSelector.d.ts +1 -0
  42. package/dist/js/components/DualListSelector/DualListSelector.d.ts.map +1 -1
  43. package/dist/js/components/DualListSelector/DualListSelector.js +23 -10
  44. package/dist/js/components/DualListSelector/DualListSelector.js.map +1 -1
  45. package/dist/js/components/Select/SelectOption.d.ts +1 -1
  46. package/dist/js/components/Select/SelectOption.d.ts.map +1 -1
  47. package/dist/js/components/TextInputGroup/TextInputGroup.d.ts +9 -0
  48. package/dist/js/components/TextInputGroup/TextInputGroup.d.ts.map +1 -0
  49. package/dist/js/components/TextInputGroup/TextInputGroup.js +14 -0
  50. package/dist/js/components/TextInputGroup/TextInputGroup.js.map +1 -0
  51. package/dist/js/components/TextInputGroup/TextInputGroupMain.d.ts +15 -0
  52. package/dist/js/components/TextInputGroup/TextInputGroupMain.d.ts.map +1 -0
  53. package/dist/js/components/TextInputGroup/TextInputGroupMain.js +19 -0
  54. package/dist/js/components/TextInputGroup/TextInputGroupMain.js.map +1 -0
  55. package/dist/js/components/TextInputGroup/TextInputGroupUtilities.d.ts +9 -0
  56. package/dist/js/components/TextInputGroup/TextInputGroupUtilities.d.ts.map +1 -0
  57. package/dist/js/components/TextInputGroup/TextInputGroupUtilities.js +14 -0
  58. package/dist/js/components/TextInputGroup/TextInputGroupUtilities.js.map +1 -0
  59. package/dist/js/components/TextInputGroup/index.d.ts +4 -0
  60. package/dist/js/components/TextInputGroup/index.d.ts.map +1 -0
  61. package/dist/js/components/TextInputGroup/index.js +7 -0
  62. package/dist/js/components/TextInputGroup/index.js.map +1 -0
  63. package/dist/js/components/Toolbar/Toolbar.d.ts +2 -0
  64. package/dist/js/components/Toolbar/Toolbar.d.ts.map +1 -1
  65. package/dist/js/components/Toolbar/Toolbar.js +2 -2
  66. package/dist/js/components/Toolbar/Toolbar.js.map +1 -1
  67. package/dist/js/components/index.d.ts +1 -0
  68. package/dist/js/components/index.d.ts.map +1 -1
  69. package/dist/js/components/index.js +1 -0
  70. package/dist/js/components/index.js.map +1 -1
  71. package/dist/styles/assets/pficon/pficon.woff +0 -0
  72. package/dist/styles/assets/pficon/pficon.woff2 +0 -0
  73. package/dist/umd/react-core.css +360 -17
  74. package/dist/umd/react-core.js +953 -885
  75. package/dist/umd/react-core.min.css +360 -17
  76. package/dist/umd/react-core.min.js +3 -3
  77. package/package.json +6 -6
  78. package/src/components/Dropdown/DropdownToggle.tsx +1 -1
  79. package/src/components/Dropdown/KebabToggle.tsx +1 -1
  80. package/src/components/DualListSelector/DualListSelector.tsx +25 -23
  81. package/src/components/Modal/__tests__/ModalBox.test.tsx +11 -21
  82. package/src/components/Modal/__tests__/ModalBoxDescription.test.tsx +12 -0
  83. package/src/components/Modal/__tests__/ModalBoxTitle.test.tsx +59 -0
  84. package/src/components/Modal/__tests__/ModalContent.test.tsx +15 -10
  85. package/src/components/Modal/__tests__/__snapshots__/ModalBox.test.tsx.snap +12 -30
  86. package/src/components/Modal/__tests__/__snapshots__/ModalBoxDescription.test.tsx.snap +10 -0
  87. package/src/components/Modal/__tests__/__snapshots__/ModalBoxTitle.test.tsx.snap +158 -0
  88. package/src/components/Modal/__tests__/__snapshots__/ModalContent.test.tsx.snap +53 -22
  89. package/src/components/Select/SelectOption.tsx +1 -1
  90. package/src/components/TextInputGroup/TextInputGroup.tsx +22 -0
  91. package/src/components/TextInputGroup/TextInputGroupMain.tsx +43 -0
  92. package/src/components/TextInputGroup/TextInputGroupUtilities.tsx +22 -0
  93. package/src/components/TextInputGroup/__tests__/TextInputGroup.test.tsx +77 -0
  94. package/src/components/TextInputGroup/__tests__/__snapshots__/TextInputGroup.test.tsx.snap +211 -0
  95. package/src/components/TextInputGroup/examples/TextInputGroup.md +138 -0
  96. package/src/components/TextInputGroup/index.ts +3 -0
  97. package/src/components/Toolbar/Toolbar.tsx +4 -0
  98. package/src/components/Wizard/examples/Wizard.md +17 -1
  99. package/src/components/index.ts +1 -0
  100. package/src/demos/ProgressDemo.md +82 -0
@@ -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
+ ```