1- import { forwardRef , useEffect , useRef , useState } from 'react' ;
1+ import {
2+ forwardRef ,
3+ useEffect ,
4+ useState ,
5+ useRef ,
6+ FunctionComponent ,
7+ Ref ,
8+ MouseEvent as ReactMouseEvent ,
9+ KeyboardEvent as ReactKeyboardEvent ,
10+ FormEvent as ReactFormEvent ,
11+ CSSProperties
12+ } from 'react' ;
213import { Button } from '@patternfly/react-core/dist/esm/components/Button' ;
314import { Label , LabelGroup , LabelProps } from '@patternfly/react-core/dist/esm/components/Label' ;
415import { MenuToggle , MenuToggleElement , MenuToggleProps } from '@patternfly/react-core/dist/esm/components/MenuToggle' ;
@@ -57,7 +68,7 @@ export interface MultiTypeaheadSelectProps extends Omit<SelectProps, 'toggle' |
5768 initialInputValue ?: string ;
5869}
5970
60- export const MultiTypeaheadSelectBase : React . FunctionComponent < MultiTypeaheadSelectProps > = ( {
71+ export const MultiTypeaheadSelectBase : FunctionComponent < MultiTypeaheadSelectProps > = ( {
6172 innerRef,
6273 initialOptions,
6374 onSelectionChange,
@@ -145,7 +156,7 @@ export const MultiTypeaheadSelectBase: React.FunctionComponent<MultiTypeaheadSel
145156 } ;
146157
147158 const selectOption = (
148- _event : React . MouseEvent < Element , MouseEvent > | React . KeyboardEvent < HTMLInputElement > | undefined ,
159+ _event : ReactMouseEvent < Element , MouseEvent > | ReactKeyboardEvent < HTMLInputElement > | undefined ,
149160 option : string | number
150161 ) => {
151162 const selections = selected . includes ( option ) ? selected . filter ( ( o ) => option !== o ) : [ ...selected , option ] ;
@@ -155,21 +166,21 @@ export const MultiTypeaheadSelectBase: React.FunctionComponent<MultiTypeaheadSel
155166 } ;
156167
157168 const clearOption = (
158- _event : React . MouseEvent < Element , MouseEvent > | React . KeyboardEvent < HTMLInputElement > | undefined ,
169+ _event : ReactMouseEvent < Element , MouseEvent > | ReactKeyboardEvent < HTMLInputElement > | undefined ,
159170 option : string | number
160171 ) => {
161172 const selections = selected . filter ( ( o ) => option !== o ) ;
162173 onSelectionChange && onSelectionChange ( _event , selections ) ;
163174 setSelected ( selections ) ;
164175 } ;
165176
166- const _onSelect = ( _event : React . MouseEvent < Element , MouseEvent > | undefined , value : string | number | undefined ) => {
177+ const _onSelect = ( _event : ReactMouseEvent < Element , MouseEvent > | undefined , value : string | number | undefined ) => {
167178 if ( value && value !== NO_RESULTS ) {
168179 selectOption ( _event , value ) ;
169180 }
170181 } ;
171182
172- const onTextInputChange = ( _event : React . FormEvent < HTMLInputElement > , value : string ) => {
183+ const onTextInputChange = ( _event : ReactFormEvent < HTMLInputElement > , value : string ) => {
173184 setInputValue ( value ) ;
174185 onInputChange && onInputChange ( value ) ;
175186
@@ -228,7 +239,7 @@ export const MultiTypeaheadSelectBase: React.FunctionComponent<MultiTypeaheadSel
228239 setActiveAndFocusedItem ( indexToFocus ) ;
229240 } ;
230241
231- const defaultOnInputKeyDown = ( event : React . KeyboardEvent < HTMLInputElement > ) => {
242+ const defaultOnInputKeyDown = ( event : ReactKeyboardEvent < HTMLInputElement > ) => {
232243 const focusedItem = focusedItemIndex !== null ? selectOptions [ focusedItemIndex ] : null ;
233244
234245 switch ( event . key ) {
@@ -252,7 +263,7 @@ export const MultiTypeaheadSelectBase: React.FunctionComponent<MultiTypeaheadSel
252263 }
253264 } ;
254265
255- const onInputKeyDown = ( event : React . KeyboardEvent < HTMLInputElement > ) => {
266+ const onInputKeyDown = ( event : ReactKeyboardEvent < HTMLInputElement > ) => {
256267 if ( onInputKeyDownProp ) {
257268 onInputKeyDownProp ( event ) ;
258269 } else {
@@ -266,15 +277,15 @@ export const MultiTypeaheadSelectBase: React.FunctionComponent<MultiTypeaheadSel
266277 textInputRef ?. current ?. focus ( ) ;
267278 } ;
268279
269- const onClearButtonClick = ( ev : React . MouseEvent ) => {
280+ const onClearButtonClick = ( ev : ReactMouseEvent ) => {
270281 setSelected ( [ ] ) ;
271282 onInputChange && onInputChange ( '' ) ;
272283 resetActiveAndFocusedItem ( ) ;
273284 textInputRef ?. current ?. focus ( ) ;
274285 onSelectionChange && onSelectionChange ( ev , [ ] ) ;
275286 } ;
276287
277- const toggle = ( toggleRef : React . Ref < MenuToggleElement > ) => (
288+ const toggle = ( toggleRef : Ref < MenuToggleElement > ) => (
278289 < MenuToggle
279290 ref = { toggleRef }
280291 variant = "typeahead"
@@ -286,7 +297,7 @@ export const MultiTypeaheadSelectBase: React.FunctionComponent<MultiTypeaheadSel
286297 style = {
287298 {
288299 width : toggleWidth
289- } as React . CSSProperties
300+ } as CSSProperties
290301 }
291302 { ...toggleProps }
292303 >
@@ -359,7 +370,7 @@ export const MultiTypeaheadSelectBase: React.FunctionComponent<MultiTypeaheadSel
359370
360371MultiTypeaheadSelectBase . displayName = 'MultiTypeaheadSelectBase' ;
361372
362- export const MultiTypeaheadSelect = forwardRef ( ( props : MultiTypeaheadSelectProps , ref : React . Ref < any > ) => (
373+ export const MultiTypeaheadSelect = forwardRef ( ( props : MultiTypeaheadSelectProps , ref : Ref < any > ) => (
363374 < MultiTypeaheadSelectBase { ...props } innerRef = { ref } />
364375) ) ;
365376
0 commit comments