36 lines
576 B
JavaScript
36 lines
576 B
JavaScript
const DropdownSelectorInput = ( {
|
|
checked,
|
|
getInputProps,
|
|
inputRef,
|
|
isDisabled,
|
|
onFocus,
|
|
onRemoveItem,
|
|
placeholder,
|
|
tabIndex,
|
|
value,
|
|
} ) => {
|
|
return (
|
|
<input
|
|
{ ...getInputProps( {
|
|
ref: inputRef,
|
|
className: 'wc-block-dropdown-selector__input',
|
|
disabled: isDisabled,
|
|
onFocus,
|
|
onKeyDown( e ) {
|
|
if (
|
|
e.key === 'Backspace' &&
|
|
! value &&
|
|
checked.length > 0
|
|
) {
|
|
onRemoveItem( checked[ checked.length - 1 ] );
|
|
}
|
|
},
|
|
placeholder,
|
|
tabIndex,
|
|
} ) }
|
|
/>
|
|
);
|
|
};
|
|
|
|
export default DropdownSelectorInput;
|