Sha256: 2fa8ccf94ceccd4def131f402000637ee4571bd06cd6fd67a01eb984f1eb1f71
Contents?: true
Size: 1.5 KB
Versions: 14
Compression:
Stored size: 1.5 KB
Contents
import React from 'react'; import { InputGroup, Button, Icon } from 'patternfly-react'; import PropTypes from 'prop-types'; import TypeAheadInput from './TypeAheadInput'; import TypeAheadItems from './TypeAheadItems'; import keyPressHandler from '../helpers/helpers'; import commonSearchPropTypes from '../helpers/commonPropTypes'; const TypeAheadSearch = ({ userInputValue, clearSearch, getInputProps, getItemProps, isOpen, inputValue, highlightedIndex, selectedItem, selectItem, openMenu, onSearch, items, activeItems, actionText, shouldShowItems, }) => ( <div> <InputGroup> <TypeAheadInput onKeyPress={e => keyPressHandler( e, isOpen, activeItems, highlightedIndex, selectItem, userInputValue, onSearch, )} onInputFocus={openMenu} passedProps={getInputProps()} /> {userInputValue && <InputGroup.Button> <Button onClick={clearSearch}> <Icon name="times" /> </Button> </InputGroup.Button> } <InputGroup.Button> <Button aria-label="patternfly 3 search button" onClick={() => onSearch(inputValue)}>{actionText}</Button> </InputGroup.Button> </InputGroup> {shouldShowItems && <TypeAheadItems {...{ items, highlightedIndex, selectedItem, getItemProps, activeItems, }} />} </div> ); TypeAheadSearch.propTypes = { ...commonSearchPropTypes, actionText: PropTypes.string, }; TypeAheadSearch.defaultProps = { actionText: 'Search', }; export default TypeAheadSearch;
Version data entries
14 entries across 14 versions & 1 rubygems