Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | 1x 14x 14x 14x 1x 1x | import cx from 'classnames'
import PropTypes from 'prop-types'
import Injector from '@s-ui/react-primitive-injector'
import {CLASS_ARROW, CLASS_ARROW_DOWN, CLASS_ARROW_UP, CLASS_CONTAINER} from './config.js'
const MoleculeInputSelect = props => {
const {onClick, iconArrowDown: iconArrow, isOpen, disabled, children, ...rest} = props
const classNames = cx(CLASS_ARROW, {
[CLASS_ARROW_DOWN]: !isOpen,
[CLASS_ARROW_UP]: isOpen
})
return (
<div className={CLASS_CONTAINER} onClick={!disabled ? onClick : null}>
<Injector onClick={onClick} disabled={disabled} {...rest}>
{children}
</Injector>
<span className={classNames}>{iconArrow}</span>
</div>
)
}
MoleculeInputSelect.displayName = 'MoleculeInputSelect'
MoleculeInputSelect.propTypes = {
/** value */
onClick: PropTypes.func,
/** children of the component */
children: PropTypes.element,
/** Icon for arrow */
iconArrowDown: PropTypes.node,
/** if list of options is displayed or not */
isOpen: PropTypes.bool,
/** This Boolean attribute prevents the user from interacting with the input */
disabled: PropTypes.bool
}
export default MoleculeInputSelect
|