import React from 'react';
import PropTypes from 'prop-types';
import Select, { components } from 'react-select';
import { MenuSelectStyle } from './seahub-select-style';
const DropdownIndicator = props => {
return (
components.DropdownIndicator && (
)
);
};
const ClearIndicator = ({ innerProps, ...props }) => {
const onMouseDown = e => {
e.nativeEvent.stopImmediatePropagation();
innerProps.onMouseDown(e);
};
props.innerProps = { ...innerProps, onMouseDown };
return (
);
};
ClearIndicator.propTypes = {
innerProps: PropTypes.object,
};
const MenuList = (props) => (
e.nativeEvent.stopImmediatePropagation()} onMouseDown={e => e.nativeEvent.stopImmediatePropagation()} >
{props.children}
);
MenuList.propTypes = {
children: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),
};
const Option = props => {
return (
);
};
Option.propTypes = {
data: PropTypes.shape({
style: PropTypes.object,
}),
};
class SeahubSelect extends React.Component {
getMenuPortalTarget = () => {
const { menuPortalTarget = '.modal' } = this.props;
return document.querySelector(menuPortalTarget);
};
render() {
const { options = [], onChange, value = {}, isSearchable = true, placeholder = '',
isMulti = false, menuPosition, isClearable = true, noOptionsMessage = (() => { return null; }),
classNamePrefix, innerRef, isDisabled = false, form, className } = this.props;
return (
);
}
}
SeahubSelect.propTypes = {
isMulti: PropTypes.bool,
options: PropTypes.array.isRequired,
value: PropTypes.oneOfType([PropTypes.object, PropTypes.array, PropTypes.string]),
isSearchable: PropTypes.bool,
isClearable: PropTypes.bool,
placeholder: PropTypes.string,
classNamePrefix: PropTypes.string,
className: PropTypes.string,
form: PropTypes.string,
onChange: PropTypes.func.isRequired,
menuPortalTarget: PropTypes.string,
menuPosition: PropTypes.string,
noOptionsMessage: PropTypes.func,
innerRef: PropTypes.object,
isDisabled: PropTypes.bool,
};
export default SeahubSelect;