@patternfly/react-core 4.220.2 → 4.221.2

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 (90) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/dist/esm/components/DataList/DataList.d.ts +9 -0
  3. package/dist/esm/components/DataList/DataList.d.ts.map +1 -1
  4. package/dist/esm/components/DataList/DataList.js +3 -2
  5. package/dist/esm/components/DataList/DataList.js.map +1 -1
  6. package/dist/esm/components/DataList/DataListItem.d.ts +2 -0
  7. package/dist/esm/components/DataList/DataListItem.d.ts.map +1 -1
  8. package/dist/esm/components/DataList/DataListItem.js +13 -6
  9. package/dist/esm/components/DataList/DataListItem.js.map +1 -1
  10. package/dist/esm/components/InputGroup/InputGroup.d.ts +2 -0
  11. package/dist/esm/components/InputGroup/InputGroup.d.ts.map +1 -1
  12. package/dist/esm/components/InputGroup/InputGroup.js +3 -2
  13. package/dist/esm/components/InputGroup/InputGroup.js.map +1 -1
  14. package/dist/esm/components/SearchInput/AdvancedSearchMenu.d.ts +2 -0
  15. package/dist/esm/components/SearchInput/AdvancedSearchMenu.d.ts.map +1 -1
  16. package/dist/esm/components/SearchInput/AdvancedSearchMenu.js +12 -10
  17. package/dist/esm/components/SearchInput/AdvancedSearchMenu.js.map +1 -1
  18. package/dist/esm/components/SearchInput/SearchInput.d.ts +8 -0
  19. package/dist/esm/components/SearchInput/SearchInput.d.ts.map +1 -1
  20. package/dist/esm/components/SearchInput/SearchInput.js +38 -28
  21. package/dist/esm/components/SearchInput/SearchInput.js.map +1 -1
  22. package/dist/esm/components/Select/Select.d.ts +2 -0
  23. package/dist/esm/components/Select/Select.d.ts.map +1 -1
  24. package/dist/esm/components/Select/Select.js +8 -7
  25. package/dist/esm/components/Select/Select.js.map +1 -1
  26. package/dist/esm/components/TextInputGroup/TextInputGroup.d.ts +2 -0
  27. package/dist/esm/components/TextInputGroup/TextInputGroup.d.ts.map +1 -1
  28. package/dist/esm/components/TextInputGroup/TextInputGroup.js +3 -2
  29. package/dist/esm/components/TextInputGroup/TextInputGroup.js.map +1 -1
  30. package/dist/esm/components/TextInputGroup/TextInputGroupMain.d.ts +2 -0
  31. package/dist/esm/components/TextInputGroup/TextInputGroupMain.d.ts.map +1 -1
  32. package/dist/esm/components/TextInputGroup/TextInputGroupMain.js +3 -2
  33. package/dist/esm/components/TextInputGroup/TextInputGroupMain.js.map +1 -1
  34. package/dist/js/components/DataList/DataList.d.ts +9 -0
  35. package/dist/js/components/DataList/DataList.d.ts.map +1 -1
  36. package/dist/js/components/DataList/DataList.js +3 -2
  37. package/dist/js/components/DataList/DataList.js.map +1 -1
  38. package/dist/js/components/DataList/DataListItem.d.ts +2 -0
  39. package/dist/js/components/DataList/DataListItem.d.ts.map +1 -1
  40. package/dist/js/components/DataList/DataListItem.js +13 -6
  41. package/dist/js/components/DataList/DataListItem.js.map +1 -1
  42. package/dist/js/components/InputGroup/InputGroup.d.ts +2 -0
  43. package/dist/js/components/InputGroup/InputGroup.d.ts.map +1 -1
  44. package/dist/js/components/InputGroup/InputGroup.js +3 -2
  45. package/dist/js/components/InputGroup/InputGroup.js.map +1 -1
  46. package/dist/js/components/SearchInput/AdvancedSearchMenu.d.ts +2 -0
  47. package/dist/js/components/SearchInput/AdvancedSearchMenu.d.ts.map +1 -1
  48. package/dist/js/components/SearchInput/AdvancedSearchMenu.js +12 -10
  49. package/dist/js/components/SearchInput/AdvancedSearchMenu.js.map +1 -1
  50. package/dist/js/components/SearchInput/SearchInput.d.ts +8 -0
  51. package/dist/js/components/SearchInput/SearchInput.d.ts.map +1 -1
  52. package/dist/js/components/SearchInput/SearchInput.js +38 -28
  53. package/dist/js/components/SearchInput/SearchInput.js.map +1 -1
  54. package/dist/js/components/Select/Select.d.ts +2 -0
  55. package/dist/js/components/Select/Select.d.ts.map +1 -1
  56. package/dist/js/components/Select/Select.js +8 -7
  57. package/dist/js/components/Select/Select.js.map +1 -1
  58. package/dist/js/components/TextInputGroup/TextInputGroup.d.ts +2 -0
  59. package/dist/js/components/TextInputGroup/TextInputGroup.d.ts.map +1 -1
  60. package/dist/js/components/TextInputGroup/TextInputGroup.js +3 -2
  61. package/dist/js/components/TextInputGroup/TextInputGroup.js.map +1 -1
  62. package/dist/js/components/TextInputGroup/TextInputGroupMain.d.ts +2 -0
  63. package/dist/js/components/TextInputGroup/TextInputGroupMain.d.ts.map +1 -1
  64. package/dist/js/components/TextInputGroup/TextInputGroupMain.js +3 -2
  65. package/dist/js/components/TextInputGroup/TextInputGroupMain.js.map +1 -1
  66. package/dist/styles/assets/images/icon-github.hbs +4 -0
  67. package/dist/styles/assets/images/icon-google.hbs +4 -0
  68. package/dist/styles/assets/images/icon-red-hat.hbs +1 -0
  69. package/dist/styles/base-no-reset.css +93 -4
  70. package/dist/styles/base.css +93 -4
  71. package/dist/umd/react-core.css +790 -8
  72. package/dist/umd/react-core.js +433 -342
  73. package/dist/umd/react-core.min.css +790 -8
  74. package/dist/umd/react-core.min.js +6 -6
  75. package/package.json +6 -6
  76. package/src/components/DataList/DataList.tsx +12 -0
  77. package/src/components/DataList/DataListItem.tsx +32 -3
  78. package/src/components/DataList/__tests__/DataList.test.tsx +130 -0
  79. package/src/components/DataList/examples/DataList.md +1 -0
  80. package/src/components/DataList/examples/DataListSelectableRows.tsx +5 -0
  81. package/src/components/InputGroup/InputGroup.tsx +7 -1
  82. package/src/components/SearchInput/AdvancedSearchMenu.tsx +24 -18
  83. package/src/components/SearchInput/SearchInput.tsx +130 -113
  84. package/src/components/SearchInput/__tests__/SearchInput.test.tsx +1 -1
  85. package/src/components/SearchInput/__tests__/__snapshots__/SearchInput.test.tsx.snap +297 -301
  86. package/src/components/SearchInput/examples/SearchInput.md +5 -2
  87. package/src/components/Select/Select.tsx +8 -2
  88. package/src/components/TextInputGroup/TextInputGroup.tsx +18 -7
  89. package/src/components/TextInputGroup/TextInputGroupMain.tsx +5 -0
  90. package/src/demos/PrimaryDetail.md +1 -1
@@ -99,7 +99,9 @@ class SearchInputWithNavigableOptions extends React.Component {
99
99
  this.state = {
100
100
  value: '',
101
101
  resultsCount: 0,
102
- currentResult: 1
102
+ currentResult: 1,
103
+ isPreviousNavigationButtonDisabled: false,
104
+ isNextNavigationButtonDisabled: false
103
105
  };
104
106
 
105
107
  this.onChange = (value, event) => {
@@ -135,7 +137,6 @@ class SearchInputWithNavigableOptions extends React.Component {
135
137
  });
136
138
  };
137
139
  }
138
-
139
140
  render() {
140
141
  return (
141
142
  <SearchInput
@@ -143,6 +144,8 @@ class SearchInputWithNavigableOptions extends React.Component {
143
144
  value={this.state.value}
144
145
  onChange={this.onChange}
145
146
  onClear={this.onClear}
147
+ isNextNavigationButtonDisabled={this.state.currentResult === 3}
148
+ isPreviousNavigationButtonDisabled={this.state.currentResult === 1}
146
149
  resultsCount={`${this.state.currentResult} / ${this.state.resultsCount}`}
147
150
  onNextClick={this.onNext}
148
151
  onPreviousClick={this.onPrevious}
@@ -103,6 +103,8 @@ export interface SelectProps
103
103
  'aria-invalid'?: boolean;
104
104
  /** Label for input field of type ahead select variants */
105
105
  typeAheadAriaLabel?: string;
106
+ /** Id of div for input field of type ahead select variants */
107
+ typeAheadAriaDescribedby?: string;
106
108
  /** Label for clear selection button of type ahead select variants */
107
109
  clearSelectionsAriaLabel?: string;
108
110
  /** Label for toggle of type ahead select variants */
@@ -222,6 +224,7 @@ export class Select extends React.Component<SelectProps & OUIAProps, SelectState
222
224
  'aria-describedby': '',
223
225
  'aria-invalid': false,
224
226
  typeAheadAriaLabel: '',
227
+ typeAheadAriaDescribedby: '',
225
228
  clearSelectionsAriaLabel: 'Clear all',
226
229
  toggleAriaLabel: 'Options menu',
227
230
  removeSelectionAriaLabel: 'Remove',
@@ -943,6 +946,7 @@ export class Select extends React.Component<SelectProps & OUIAProps, SelectState
943
946
  validated,
944
947
  selections: selectionsProp,
945
948
  typeAheadAriaLabel,
949
+ typeAheadAriaDescribedby,
946
950
  clearSelectionsAriaLabel,
947
951
  toggleAriaLabel,
948
952
  removeSelectionAriaLabel,
@@ -1247,7 +1251,7 @@ export class Select extends React.Component<SelectProps & OUIAProps, SelectState
1247
1251
  className
1248
1252
  )}
1249
1253
  {...(width && { style: { width } })}
1250
- {...(validated !== ValidatedOptions.default && { 'aria-describedby': ariaDescribedby })}
1254
+ {...(ariaDescribedby && { 'aria-describedby': ariaDescribedby })}
1251
1255
  {...(validated !== ValidatedOptions.default && { 'aria-invalid': ariaInvalid })}
1252
1256
  >
1253
1257
  {isOpen && menuContainer}
@@ -1268,7 +1272,7 @@ export class Select extends React.Component<SelectProps & OUIAProps, SelectState
1268
1272
  ref={this.parentRef}
1269
1273
  {...getOUIAProps(Select.displayName, ouiaId !== undefined ? ouiaId : this.state.ouiaStateId, ouiaSafe)}
1270
1274
  {...(width && { style: { width } })}
1271
- {...(validated !== ValidatedOptions.default && { 'aria-describedby': ariaDescribedby })}
1275
+ {...(ariaDescribedby && { 'aria-describedby': ariaDescribedby })}
1272
1276
  {...(validated !== ValidatedOptions.default && { 'aria-invalid': ariaInvalid })}
1273
1277
  >
1274
1278
  <SelectToggle
@@ -1337,6 +1341,7 @@ export class Select extends React.Component<SelectProps & OUIAProps, SelectState
1337
1341
  aria-activedescendant={typeaheadActiveChild && typeaheadActiveChild.id}
1338
1342
  id={`${selectToggleId}-select-typeahead`}
1339
1343
  aria-label={typeAheadAriaLabel}
1344
+ {...(typeAheadAriaDescribedby && { 'aria-describedby': typeAheadAriaDescribedby })}
1340
1345
  placeholder={placeholderText as string}
1341
1346
  value={
1342
1347
  typeaheadInputValue !== null
@@ -1365,6 +1370,7 @@ export class Select extends React.Component<SelectProps & OUIAProps, SelectState
1365
1370
  id={`${selectToggleId}-select-multi-typeahead-typeahead`}
1366
1371
  aria-label={typeAheadAriaLabel}
1367
1372
  aria-invalid={validated === ValidatedOptions.error}
1373
+ {...(typeAheadAriaDescribedby && { 'aria-describedby': typeAheadAriaDescribedby })}
1368
1374
  placeholder={placeholderText as string}
1369
1375
  value={typeaheadInputValue !== null ? typeaheadInputValue : ''}
1370
1376
  type="text"
@@ -9,6 +9,8 @@ export interface TextInputGroupProps extends React.HTMLProps<HTMLDivElement> {
9
9
  className?: string;
10
10
  /** Adds disabled styling and a disabled context value which text input group main hooks into for the input itself */
11
11
  isDisabled?: boolean;
12
+ /** @hide A reference object to attach to the input box */
13
+ innerRef?: React.RefObject<any>;
12
14
  }
13
15
 
14
16
  export const TextInputGroupContext = React.createContext<Partial<TextInputGroupProps>>({
@@ -19,13 +21,22 @@ export const TextInputGroup: React.FunctionComponent<TextInputGroupProps> = ({
19
21
  children,
20
22
  className,
21
23
  isDisabled,
24
+ innerRef,
22
25
  ...props
23
- }: TextInputGroupProps) => (
24
- <TextInputGroupContext.Provider value={{ isDisabled }}>
25
- <div className={css(styles.textInputGroup, isDisabled && styles.modifiers.disabled, className)} {...props}>
26
- {children}
27
- </div>
28
- </TextInputGroupContext.Provider>
29
- );
26
+ }: TextInputGroupProps) => {
27
+ const textInputGroupRef = innerRef || React.useRef(null);
28
+
29
+ return (
30
+ <TextInputGroupContext.Provider value={{ isDisabled }}>
31
+ <div
32
+ ref={textInputGroupRef}
33
+ className={css(styles.textInputGroup, isDisabled && styles.modifiers.disabled, className)}
34
+ {...props}
35
+ >
36
+ {children}
37
+ </div>
38
+ </TextInputGroupContext.Provider>
39
+ );
40
+ };
30
41
 
31
42
  TextInputGroup.displayName = 'TextInputGroup';
@@ -37,6 +37,8 @@ export interface TextInputGroupMainProps extends Omit<React.HTMLProps<HTMLDivEle
37
37
  value?: string | number;
38
38
  /** Placeholder value for the input */
39
39
  placeholder?: string;
40
+ /** @hide A reference object to attach to the input box */
41
+ innerRef?: React.RefObject<any>;
40
42
  }
41
43
 
42
44
  export const TextInputGroupMain: React.FunctionComponent<TextInputGroupMainProps> = ({
@@ -51,9 +53,11 @@ export const TextInputGroupMain: React.FunctionComponent<TextInputGroupMainProps
51
53
  'aria-label': ariaLabel = 'Type to filter',
52
54
  value: inputValue,
53
55
  placeholder: inputPlaceHolder,
56
+ innerRef,
54
57
  ...props
55
58
  }: TextInputGroupMainProps) => {
56
59
  const { isDisabled } = React.useContext(TextInputGroupContext);
60
+ const textInputGroupInputInputRef = innerRef || React.useRef(null);
57
61
 
58
62
  const handleChange = (event: React.FormEvent<HTMLInputElement>) => {
59
63
  onChange(event.currentTarget.value, event);
@@ -74,6 +78,7 @@ export const TextInputGroupMain: React.FunctionComponent<TextInputGroupMainProps
74
78
  )}
75
79
  {icon && <span className={css(styles.textInputGroupIcon)}>{icon}</span>}
76
80
  <input
81
+ ref={textInputGroupInputInputRef}
77
82
  type={type}
78
83
  className={css(styles.textInputGroupTextInput)}
79
84
  aria-label={ariaLabel}
@@ -1274,7 +1274,7 @@ class PrimaryDetailCardView extends React.Component {
1274
1274
  };
1275
1275
 
1276
1276
  const drawerContent = (
1277
- <Gallery hasGutter aria-label="Selectable card container">
1277
+ <Gallery hasGutter role='region' aria-label="Selectable card container">
1278
1278
  {filtered.map((product, key) => (
1279
1279
  <React.Fragment>
1280
1280
  <Card