Sha256: 33f1fa95291bb3500393aec55aff40546147874cf8e01cc056d7becac47ca950
Contents?: true
Size: 1.14 KB
Versions: 60
Compression:
Stored size: 1.14 KB
Contents
import React from 'react'; import PropTypes from 'prop-types'; import { translate as __ } from 'foremanReact/common/I18n'; import { FormGroup, ControlLabel } from 'react-bootstrap'; import BootstrapSelect from '../../move_to_pf/react-bootstrap-select'; function MultiSelect(props) { const { options, onChange, defaultValues, ...otherProps } = props; const optionComponents = options.map(option => ( <option key={`option-${option.value}`} value={option.value}> {option.label} </option> )); return ( <FormGroup controlId="formControlsSelectMultiple"> <ControlLabel srOnly>{__('Select Value')}</ControlLabel> <BootstrapSelect defaultValues={defaultValues} {...otherProps} multiple onChange={evt => onChange(evt)} > {optionComponents} </BootstrapSelect> </FormGroup> ); } MultiSelect.defaultProps = { onChange: () => {}, defaultValues: null, }; MultiSelect.propTypes = { options: PropTypes.arrayOf(PropTypes.object).isRequired, onChange: PropTypes.func, defaultValues: PropTypes.arrayOf(PropTypes.string), }; export default MultiSelect;
Version data entries
60 entries across 60 versions & 1 rubygems