@patternfly/react-core 4.183.8 → 4.183.9

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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,14 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## 4.183.9 (2022-01-10)
7
+
8
+ **Note:** Version bump only for package @patternfly/react-core
9
+
10
+
11
+
12
+
13
+
6
14
  ## 4.183.8 (2022-01-07)
7
15
 
8
16
  **Note:** Version bump only for package @patternfly/react-core
@@ -16626,20 +16626,6 @@ label.pf-c-radio, .pf-c-radio__label,
16626
16626
  transform: translateX(100%);
16627
16627
  }
16628
16628
  }
16629
- .pf-c-skip-to-content {
16630
- --pf-c-skip-to-content--Top: var(--pf-global--spacer--md);
16631
- --pf-c-skip-to-content--ZIndex: var(--pf-global--ZIndex--2xl);
16632
- --pf-c-skip-to-content--focus--Left: var(--pf-global--spacer--md);
16633
- position: absolute;
16634
- top: var(--pf-c-skip-to-content--Top);
16635
- left: -300%;
16636
- z-index: var(--pf-c-skip-to-content--ZIndex);
16637
- }
16638
-
16639
- .pf-c-skip-to-content:focus {
16640
- left: var(--pf-c-skip-to-content--focus--Left);
16641
- }
16642
-
16643
16629
  .pf-c-slider {
16644
16630
  --pf-c-slider--value: 0;
16645
16631
  --pf-c-slider__rail--PaddingTop: var(--pf-global--spacer--md);
@@ -16859,6 +16845,20 @@ label.pf-c-radio, .pf-c-radio__label,
16859
16845
  margin-left: var(--pf-c-slider__main--actions--MarginLeft);
16860
16846
  }
16861
16847
 
16848
+ .pf-c-skip-to-content {
16849
+ --pf-c-skip-to-content--Top: var(--pf-global--spacer--md);
16850
+ --pf-c-skip-to-content--ZIndex: var(--pf-global--ZIndex--2xl);
16851
+ --pf-c-skip-to-content--focus--Left: var(--pf-global--spacer--md);
16852
+ position: absolute;
16853
+ top: var(--pf-c-skip-to-content--Top);
16854
+ left: -300%;
16855
+ z-index: var(--pf-c-skip-to-content--ZIndex);
16856
+ }
16857
+
16858
+ .pf-c-skip-to-content:focus {
16859
+ left: var(--pf-c-skip-to-content--focus--Left);
16860
+ }
16861
+
16862
16862
  .pf-c-spinner {
16863
16863
  --pf-c-spinner--diameter: var(--pf-global--icon--FontSize--xl);
16864
16864
  --pf-c-spinner--Width: var(--pf-c-spinner--diameter);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patternfly/react-core",
3
- "version": "4.183.8",
3
+ "version": "4.183.9",
4
4
  "description": "This library provides a set of common React components for use with the PatternFly reference implementation.",
5
5
  "main": "dist/js/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -34,9 +34,9 @@
34
34
  "generate": "node scripts/copyStyles.js"
35
35
  },
36
36
  "dependencies": {
37
- "@patternfly/react-icons": "^4.34.8",
38
- "@patternfly/react-styles": "^4.33.8",
39
- "@patternfly/react-tokens": "^4.35.8",
37
+ "@patternfly/react-icons": "^4.34.9",
38
+ "@patternfly/react-styles": "^4.33.9",
39
+ "@patternfly/react-tokens": "^4.35.9",
40
40
  "focus-trap": "6.2.2",
41
41
  "react-dropzone": "9.0.0",
42
42
  "tippy.js": "5.1.2",
@@ -60,5 +60,5 @@
60
60
  "react": "^16.8.0 || ^17.0.0",
61
61
  "react-dom": "^16.8.0 || ^17.0.0"
62
62
  },
63
- "gitHead": "3989892d2af335ff579d10ab029dba6716ffaa50"
63
+ "gitHead": "245bd40994d575c2a111d746f35d7f96e82809da"
64
64
  }
@@ -13,139 +13,20 @@ import TimesIcon from '@patternfly/react-icons/dist/esm/icons/times-icon';
13
13
 
14
14
  ### Basic
15
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
- );
16
+ ```ts file="./TextInputGroupBasic.tsx"
25
17
  ```
26
18
 
27
19
  ### Disabled
28
20
 
29
- ```js
30
- import React from 'react';
31
- import { TextInputGroup, TextInputGroupMain } from '@patternfly/react-core';
32
-
33
- const DisabledTextInputGroup = () => (
34
- <TextInputGroup isDisabled>
35
- <TextInputGroupMain value="Disabled" type="text" aria-label="Disabled text input group example input" />
36
- </TextInputGroup>
37
- );
21
+ ```ts file="./TextInputGroupDisabled.tsx"
38
22
  ```
39
23
 
40
24
  ### Utilities and icon
41
25
 
42
- ```js
43
- import React from 'react';
44
- import { TextInputGroup, TextInputGroupMain, TextInputGroupUtilities, Button } from '@patternfly/react-core';
45
- import SearchIcon from '@patternfly/react-icons/dist/esm/icons/search-icon';
46
- import TimesIcon from '@patternfly/react-icons/dist/esm/icons/times-icon';
47
-
48
- const TextInputGroupWithIcons = () => {
49
- const [inputValue, setInputValue] = React.useState('');
50
-
51
- /** callback for updating the inputValue state in this component so that the input can be controlled */
52
- const handleInputChange = (value, _event) => {
53
- setInputValue(value);
54
- };
55
-
56
- /** show the input clearing button only when the input is not empty */
57
- const showClearButton = inputValue;
58
-
59
- /** callback for clearing the text input */
60
- const clearInput = () => {
61
- setInputValue('');
62
- };
63
-
64
- return (
65
- <TextInputGroup>
66
- <TextInputGroupMain icon={<SearchIcon />} value={inputValue} onChange={handleInputChange} />
67
- <TextInputGroupUtilities>
68
- {showClearButton && (
69
- <Button variant="plain" onClick={clearInput} aria-label="Clear button and input">
70
- <TimesIcon />
71
- </Button>
72
- )}
73
- </TextInputGroupUtilities>
74
- </TextInputGroup>
75
- );
76
- };
26
+ ```ts file="./TextInputGroupUtilitiesAndIcon.tsx"
77
27
  ```
78
28
 
79
29
  ### Filters
80
30
 
81
- ```js
82
- import React from 'react';
83
- import { TextInputGroup, TextInputGroupMain, TextInputGroupUtilities, Button } from '@patternfly/react-core';
84
- import { Chip, ChipGroup } from '@patternfly/react-core';
85
- import SearchIcon from '@patternfly/react-icons/dist/esm/icons/search-icon';
86
- import TimesIcon from '@patternfly/react-icons/dist/esm/icons/times-icon';
87
-
88
- const TextInputGroupWithChips = () => {
89
- const [inputValue, setInputValue] = React.useState('');
90
- const [currentChips, setCurrentChips] = React.useState([
91
- 'chip one',
92
- 'chip two',
93
- 'chip three',
94
- 'chip four',
95
- 'chip five',
96
- 'chip six',
97
- 'chip seven',
98
- 'chip eight',
99
- 'chip nine',
100
- 'chip ten',
101
- 'chip eleven',
102
- 'chip twelve',
103
- 'chip thirteen',
104
- 'chip fourteen'
105
- ]);
106
-
107
- /** show the search icon only when there are no chips to prevent the chips from being displayed behind the icon */
108
- const showSearchIcon = !currentChips.length;
109
-
110
- /** callback for updating the inputValue state in this component so that the input can be controlled */
111
- const handleInputChange = (value, _event) => {
112
- setInputValue(value);
113
- };
114
-
115
- /** callback for removing a chip from the chip selections */
116
- const deleteChip = chipToDelete => {
117
- const newChips = currentChips.filter(chip => !Object.is(chip, chipToDelete));
118
- setCurrentChips(newChips);
119
- };
120
-
121
- /** show the input/chip clearing button only when either the text input or chip group are not empty */
122
- const showClearButton = inputValue || !!currentChips.length;
123
-
124
- /** callback for clearing all selected chips and the text input */
125
- const clearChipsAndInput = () => {
126
- setCurrentChips([]);
127
- setInputValue('');
128
- };
129
-
130
- return (
131
- <TextInputGroup>
132
- <TextInputGroupMain icon={showSearchIcon && <SearchIcon />} value={inputValue} onChange={handleInputChange}>
133
- <ChipGroup>
134
- {currentChips.map(currentChip => (
135
- <Chip key={currentChip} onClick={() => deleteChip(currentChip)}>
136
- {currentChip}
137
- </Chip>
138
- ))}
139
- </ChipGroup>
140
- </TextInputGroupMain>
141
- <TextInputGroupUtilities>
142
- {showClearButton && (
143
- <Button variant="plain" onClick={clearChipsAndInput} aria-label="Clear button and input">
144
- <TimesIcon />
145
- </Button>
146
- )}
147
- </TextInputGroupUtilities>
148
- </TextInputGroup>
149
- );
150
- };
31
+ ```ts file="./TextInputGroupFilters.tsx"
151
32
  ```
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import { TextInputGroup, TextInputGroupMain } from '@patternfly/react-core';
3
+
4
+ export const TextInputGroupBasic: React.FunctionComponent = () => (
5
+ <TextInputGroup>
6
+ <TextInputGroupMain />
7
+ </TextInputGroup>
8
+ );
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import { TextInputGroup, TextInputGroupMain } from '@patternfly/react-core';
3
+
4
+ export const TextInputGroupDisabled: React.FunctionComponent = () => (
5
+ <TextInputGroup isDisabled>
6
+ <TextInputGroupMain value="Disabled" type="text" aria-label="Disabled text input group example input" />
7
+ </TextInputGroup>
8
+ );
@@ -0,0 +1,69 @@
1
+ import React from 'react';
2
+ import { TextInputGroup, TextInputGroupMain, TextInputGroupUtilities, Button } from '@patternfly/react-core';
3
+ import { Chip, ChipGroup } from '@patternfly/react-core';
4
+ import SearchIcon from '@patternfly/react-icons/dist/esm/icons/search-icon';
5
+ import TimesIcon from '@patternfly/react-icons/dist/esm/icons/times-icon';
6
+
7
+ export const TextInputGroupFilters: React.FunctionComponent = () => {
8
+ const [inputValue, setInputValue] = React.useState('');
9
+ const [currentChips, setCurrentChips] = React.useState([
10
+ 'chip one',
11
+ 'chip two',
12
+ 'chip three',
13
+ 'chip four',
14
+ 'chip five',
15
+ 'chip six',
16
+ 'chip seven',
17
+ 'chip eight',
18
+ 'chip nine',
19
+ 'chip ten',
20
+ 'chip eleven',
21
+ 'chip twelve',
22
+ 'chip thirteen',
23
+ 'chip fourteen'
24
+ ]);
25
+
26
+ /** show the search icon only when there are no chips to prevent the chips from being displayed behind the icon */
27
+ const showSearchIcon = !currentChips.length;
28
+
29
+ /** callback for updating the inputValue state in this component so that the input can be controlled */
30
+ const handleInputChange = (value: string, _event: React.FormEvent<HTMLInputElement>) => {
31
+ setInputValue(value);
32
+ };
33
+
34
+ /** callback for removing a chip from the chip selections */
35
+ const deleteChip = (chipToDelete: string) => {
36
+ const newChips = currentChips.filter(chip => !Object.is(chip, chipToDelete));
37
+ setCurrentChips(newChips);
38
+ };
39
+
40
+ /** show the input/chip clearing button only when either the text input or chip group are not empty */
41
+ const showClearButton = !!inputValue || !!currentChips.length;
42
+
43
+ /** callback for clearing all selected chips and the text input */
44
+ const clearChipsAndInput = () => {
45
+ setCurrentChips([]);
46
+ setInputValue('');
47
+ };
48
+
49
+ return (
50
+ <TextInputGroup>
51
+ <TextInputGroupMain icon={showSearchIcon && <SearchIcon />} value={inputValue} onChange={handleInputChange}>
52
+ <ChipGroup>
53
+ {currentChips.map(currentChip => (
54
+ <Chip key={currentChip} onClick={() => deleteChip(currentChip)}>
55
+ {currentChip}
56
+ </Chip>
57
+ ))}
58
+ </ChipGroup>
59
+ </TextInputGroupMain>
60
+ <TextInputGroupUtilities>
61
+ {showClearButton && (
62
+ <Button variant="plain" onClick={clearChipsAndInput} aria-label="Clear button and input">
63
+ <TimesIcon />
64
+ </Button>
65
+ )}
66
+ </TextInputGroupUtilities>
67
+ </TextInputGroup>
68
+ );
69
+ };
@@ -0,0 +1,34 @@
1
+ import React from 'react';
2
+ import { TextInputGroup, TextInputGroupMain, TextInputGroupUtilities, Button } from '@patternfly/react-core';
3
+ import SearchIcon from '@patternfly/react-icons/dist/esm/icons/search-icon';
4
+ import TimesIcon from '@patternfly/react-icons/dist/esm/icons/times-icon';
5
+
6
+ export const TextInputGroupUtilitiesAndIcon: React.FunctionComponent = () => {
7
+ const [inputValue, setInputValue] = React.useState('');
8
+
9
+ /** callback for updating the inputValue state in this component so that the input can be controlled */
10
+ const handleInputChange = (value: string, _event: React.FormEvent<HTMLInputElement>) => {
11
+ setInputValue(value);
12
+ };
13
+
14
+ /** show the input clearing button only when the input is not empty */
15
+ const showClearButton = !!inputValue;
16
+
17
+ /** callback for clearing the text input */
18
+ const clearInput = () => {
19
+ setInputValue('');
20
+ };
21
+
22
+ return (
23
+ <TextInputGroup>
24
+ <TextInputGroupMain icon={<SearchIcon />} value={inputValue} onChange={handleInputChange} />
25
+ <TextInputGroupUtilities>
26
+ {showClearButton && (
27
+ <Button variant="plain" onClick={clearInput} aria-label="Clear button and input">
28
+ <TimesIcon />
29
+ </Button>
30
+ )}
31
+ </TextInputGroupUtilities>
32
+ </TextInputGroup>
33
+ );
34
+ };
@@ -24,7 +24,7 @@ Additionally, attributes can be selected by typing the full (case sensitive) nam
24
24
 
25
25
  Attributes can be deselected (returning you to attribute selection mode) by hitting `escape`, or by hitting `backspace` when the only text in the text input is the attribute.
26
26
 
27
- ```js file="./examples/TextInputGroup/AttributeValueFiltering.js"
27
+ ```ts file="./examples/TextInputGroup/AttributeValueFiltering.tsx"
28
28
  ```
29
29
  ### Auto-complete search
30
30
 
@@ -36,5 +36,5 @@ Hitting `escape` while focused on the input or menu will close the menu, and the
36
36
 
37
37
  When only one item remains in the suggestion list, tab can be used to auto-complete the typing of that item.
38
38
 
39
- ```js file="./examples/TextInputGroup/AutoCompleteSearch.js"
39
+ ```ts file="./examples/TextInputGroup/AutoCompleteSearch.tsx"
40
40
  ```
@@ -16,14 +16,18 @@ import {
16
16
  import SearchIcon from '@patternfly/react-icons/dist/esm/icons/search-icon';
17
17
  import TimesIcon from '@patternfly/react-icons/dist/esm/icons/times-icon';
18
18
 
19
- export const AttributeValueFiltering = () => {
19
+ export const AttributeValueFiltering: React.FunctionComponent = () => {
20
20
  const [inputValue, setInputValue] = React.useState('');
21
21
  const [selectedKey, setSelectedKey] = React.useState('');
22
22
  const [menuIsOpen, setMenuIsOpen] = React.useState(false);
23
- const [currentChips, setCurrentChips] = React.useState([]);
23
+ const [currentChips, setCurrentChips] = React.useState<string[]>([]);
24
+
25
+ interface attributeValueData {
26
+ [attribute: string]: string[];
27
+ }
24
28
 
25
29
  /** key and value data to be shown in the menu */
26
- const data = {
30
+ const data: attributeValueData = {
27
31
  Cluster: ['acmeqe-managed-1', 'local-cluster'],
28
32
  Kind: ['Template', 'ReplicationController', 'ReplicaSet', 'Deployment'],
29
33
  Label: ['release', 'environment', 'partition'],
@@ -33,19 +37,19 @@ export const AttributeValueFiltering = () => {
33
37
  };
34
38
  const keyNames = ['Cluster', 'Kind', 'Label', 'Name', 'Namespace', 'Status'];
35
39
  const [menuItemsText, setMenuItemsText] = React.useState(keyNames);
36
- const [menuItems, setMenuItems] = React.useState([]);
40
+ const [menuItems, setMenuItems] = React.useState<React.ReactElement[]>([]);
37
41
 
38
42
  /** refs used to detect when clicks occur inside vs outside of the textInputGroup and menu popper */
39
- const menuRef = React.useRef();
40
- const textInputGroupRef = React.useRef();
43
+ const menuRef = React.useRef<HTMLDivElement>();
44
+ const textInputGroupRef = React.useRef<HTMLDivElement>();
41
45
 
42
46
  /** callback for updating the inputValue state in this component so that the input can be controlled */
43
- const handleInputChange = (value, _event) => {
47
+ const handleInputChange = (value: string, _event: React.FormEvent<HTMLInputElement>) => {
44
48
  setInputValue(value);
45
49
  };
46
50
 
47
51
  /** callback for removing a chip from the chip selections */
48
- const deleteChip = chipToDelete => {
52
+ const deleteChip = (chipToDelete: string) => {
49
53
  const newChips = currentChips.filter(chip => !Object.is(chip, chipToDelete));
50
54
  setCurrentChips(newChips);
51
55
  };
@@ -106,13 +110,13 @@ export const AttributeValueFiltering = () => {
106
110
  }, [inputValue]);
107
111
 
108
112
  /** add selected key/value pair as a chip in the chip group */
109
- const selectValue = selectedValue => {
113
+ const selectValue = (selectedValue: string) => {
110
114
  setCurrentChips([...currentChips, `${selectedKey}: ${selectedValue}`]);
111
115
  clearSelectedKey();
112
116
  };
113
117
 
114
118
  /** update the input to show the selected key and the menu to show the values associated with that specific key */
115
- const selectKey = selectedText => {
119
+ const selectKey = (selectedText: string) => {
116
120
  setInputValue(`${selectedText}: `);
117
121
  setSelectedKey(selectedText);
118
122
  setMenuItemsText(data[selectedText]);
@@ -150,13 +154,13 @@ export const AttributeValueFiltering = () => {
150
154
  /** allow the user to focus on the menu and navigate using the arrow keys */
151
155
  const handleArrowKey = () => {
152
156
  if (menuRef.current) {
153
- const firstElement = menuRef.current.querySelector('li > button:not(:disabled)');
157
+ const firstElement = menuRef.current.querySelector<HTMLButtonElement>('li > button:not(:disabled)');
154
158
  firstElement && firstElement.focus();
155
159
  }
156
160
  };
157
161
 
158
162
  /** enable keyboard only usage */
159
- const handleTextInputKeyDown = event => {
163
+ const handleTextInputKeyDown = (event: React.KeyboardEvent) => {
160
164
  switch (event.key) {
161
165
  case 'Enter':
162
166
  handleEnter();
@@ -178,8 +182,8 @@ export const AttributeValueFiltering = () => {
178
182
  };
179
183
 
180
184
  /** perform the proper key or value selection when a menu item is selected */
181
- const onSelect = (event, _itemId) => {
182
- const selectedText = event.target.innerText;
185
+ const onSelect = (event: React.MouseEvent<Element, MouseEvent>, _itemId: string | number) => {
186
+ const selectedText = (event.target as HTMLElement).innerText;
183
187
 
184
188
  if (selectedKey.length) {
185
189
  selectValue(selectedText);
@@ -191,11 +195,11 @@ export const AttributeValueFiltering = () => {
191
195
  };
192
196
 
193
197
  /** close the menu when a click occurs outside of the menu or text input group */
194
- const handleClick = event => {
198
+ const handleClick = (event: MouseEvent) => {
195
199
  if (
196
200
  menuRef.current &&
197
- !menuRef.current.contains(event.target) &&
198
- !textInputGroupRef.current.contains(event.target)
201
+ !menuRef.current.contains(event.target as HTMLElement) &&
202
+ !textInputGroupRef.current.contains(event.target as HTMLElement)
199
203
  ) {
200
204
  setMenuIsOpen(false);
201
205
  }
@@ -205,7 +209,7 @@ export const AttributeValueFiltering = () => {
205
209
  const showSearchIcon = !currentChips.length;
206
210
 
207
211
  /** only show the clear button when there is something that can be cleared */
208
- const showClearButton = inputValue || !!currentChips.length;
212
+ const showClearButton = !!inputValue || !!currentChips.length;
209
213
 
210
214
  const inputGroup = (
211
215
  <div ref={textInputGroupRef}>
@@ -16,26 +16,26 @@ import {
16
16
  import SearchIcon from '@patternfly/react-icons/dist/esm/icons/search-icon';
17
17
  import TimesIcon from '@patternfly/react-icons/dist/esm/icons/times-icon';
18
18
 
19
- export const AutoCompleteSearch = () => {
19
+ export const AutoCompleteSearch: React.FunctionComponent = () => {
20
20
  const [inputValue, setInputValue] = React.useState('');
21
21
  const [menuIsOpen, setMenuIsOpen] = React.useState(false);
22
- const [currentChips, setCurrentChips] = React.useState([]);
22
+ const [currentChips, setCurrentChips] = React.useState<string[]>([]);
23
23
 
24
24
  /** auto-completing suggestion text items to be shown in the menu */
25
25
  const suggestionItems = ['Cluster', 'Kind', 'Label', 'Name', 'Namespace', 'Status'];
26
- const [menuItems, setMenuItems] = React.useState([]);
26
+ const [menuItems, setMenuItems] = React.useState<React.ReactElement[]>([]);
27
27
 
28
28
  /** refs used to detect when clicks occur inside vs outside of the textInputGroup and menu popper */
29
- const menuRef = React.useRef();
30
- const textInputGroupRef = React.useRef();
29
+ const menuRef = React.useRef<HTMLDivElement>();
30
+ const textInputGroupRef = React.useRef<HTMLDivElement>();
31
31
 
32
32
  /** callback for updating the inputValue state in this component so that the input can be controlled */
33
- const handleInputChange = (value, _event) => {
33
+ const handleInputChange = (value: string, _event: React.FormEvent<HTMLInputElement>) => {
34
34
  setInputValue(value);
35
35
  };
36
36
 
37
37
  /** callback for removing a chip from the chip selections */
38
- const deleteChip = chipToDelete => {
38
+ const deleteChip = (chipToDelete: string) => {
39
39
  const newChips = currentChips.filter(chip => !Object.is(chip, chipToDelete));
40
40
  setCurrentChips(newChips);
41
41
  };
@@ -80,7 +80,7 @@ export const AutoCompleteSearch = () => {
80
80
  }, [inputValue]);
81
81
 
82
82
  /** add the given string as a chip in the chip group and clear the input */
83
- const addChip = newChipText => {
83
+ const addChip = (newChipText: string) => {
84
84
  setCurrentChips([...currentChips, `${newChipText}`]);
85
85
  setInputValue('');
86
86
  };
@@ -92,7 +92,7 @@ export const AutoCompleteSearch = () => {
92
92
  }
93
93
  };
94
94
 
95
- const handleTab = event => {
95
+ const handleTab = (event: React.KeyboardEvent) => {
96
96
  if (menuItems.length === 3) {
97
97
  setInputValue(menuItems[2].props.children);
98
98
  event.preventDefault();
@@ -107,7 +107,7 @@ export const AutoCompleteSearch = () => {
107
107
  /** allow the user to focus on the menu and navigate using the arrow keys */
108
108
  const handleArrowKey = () => {
109
109
  if (menuRef.current) {
110
- const firstElement = menuRef.current.querySelector('li > button:not(:disabled)');
110
+ const firstElement = menuRef.current.querySelector<HTMLButtonElement>('li > button:not(:disabled)');
111
111
  firstElement && firstElement.focus();
112
112
  }
113
113
  };
@@ -120,7 +120,7 @@ export const AutoCompleteSearch = () => {
120
120
  };
121
121
 
122
122
  /** enable keyboard only usage while focused on the text input */
123
- const handleTextInputKeyDown = event => {
123
+ const handleTextInputKeyDown = (event: React.KeyboardEvent) => {
124
124
  switch (event.key) {
125
125
  case 'Enter':
126
126
  handleEnter();
@@ -146,26 +146,26 @@ export const AutoCompleteSearch = () => {
146
146
  };
147
147
 
148
148
  /** add the text of the selected item as a new chip */
149
- const onSelect = (event, _itemId) => {
150
- const selectedText = event.target.innerText;
149
+ const onSelect = (event: React.MouseEvent<Element, MouseEvent>, _itemId: string | number) => {
150
+ const selectedText = (event.target as HTMLElement).innerText;
151
151
  addChip(selectedText);
152
152
  event.stopPropagation();
153
153
  focusTextInput();
154
154
  };
155
155
 
156
156
  /** close the menu when a click occurs outside of the menu or text input group */
157
- const handleClick = event => {
157
+ const handleClick = (event: MouseEvent) => {
158
158
  if (
159
159
  menuRef.current &&
160
- !menuRef.current.contains(event.target) &&
161
- !textInputGroupRef.current.contains(event.target)
160
+ !menuRef.current.contains(event.target as HTMLElement) &&
161
+ !textInputGroupRef.current.contains(event.target as HTMLElement)
162
162
  ) {
163
163
  setMenuIsOpen(false);
164
164
  }
165
165
  };
166
166
 
167
167
  /** enable keyboard only usage while focused on the menu */
168
- const handleMenuKeyDown = event => {
168
+ const handleMenuKeyDown = (event: React.KeyboardEvent) => {
169
169
  if (event.key === 'Escape') {
170
170
  setInputValue('');
171
171
  focusTextInput();
@@ -177,7 +177,7 @@ export const AutoCompleteSearch = () => {
177
177
  const showSearchIcon = !currentChips.length;
178
178
 
179
179
  /** only show the clear button when there is something that can be cleared */
180
- const showClearButton = inputValue || !!currentChips.length;
180
+ const showClearButton = !!inputValue || !!currentChips.length;
181
181
 
182
182
  const inputGroup = (
183
183
  <div ref={textInputGroupRef}>