import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import Select from 'react-select';
import { emphasize, makeStyles, useTheme } from '@material-ui/core/styles';
import Typography from '@material-ui/core/Typography';
import NoSsr from '@material-ui/core/NoSsr';
import TextField from '@material-ui/core/TextField';
import Paper from '@material-ui/core/Paper';
import Chip from '@material-ui/core/Chip';
import MenuItem from '@material-ui/core/MenuItem';
import CancelIcon from '@material-ui/icons/Cancel';
const suggestions = [
{ label: 'Afghanistan' },
{ label: 'Aland Islands' },
{ label: 'Albania' },
{ label: 'Algeria' },
{ label: 'American Samoa' },
{ label: 'Andorra' },
{ label: 'Angola' },
{ label: 'Anguilla' },
{ label: 'Antarctica' },
{ label: 'Antigua and Barbuda' },
{ label: 'Argentina' },
{ label: 'Armenia' },
{ label: 'Aruba' },
{ label: 'Australia' },
{ label: 'Austria' },
{ label: 'Azerbaijan' },
{ label: 'Bahamas' },
{ label: 'Bahrain' },
{ label: 'Bangladesh' },
{ label: 'Barbados' },
{ label: 'Belarus' },
{ label: 'Belgium' },
{ label: 'Belize' },
{ label: 'Benin' },
{ label: 'Bermuda' },
{ label: 'Bhutan' },
{ label: 'Bolivia, Plurinational State of' },
{ label: 'Bonaire, Sint Eustatius and Saba' },
{ label: 'Bosnia and Herzegovina' },
{ label: 'Botswana' },
{ label: 'Bouvet Island' },
{ label: 'Brazil' },
{ label: 'British Indian Ocean Territory' },
{ label: 'Brunei Darussalam' },
].map(suggestion => ({
value: suggestion.label,
label: suggestion.label,
}));
const useStyles = makeStyles(theme => ({
root: {
flexGrow: 1,
height: 250,
},
input: {
display: 'flex',
padding: 0,
height: 'auto',
},
valueContainer: {
display: 'flex',
flexWrap: 'wrap',
flex: 1,
alignItems: 'center',
overflow: 'hidden',
},
chip: {
margin: theme.spacing(0.5, 0.25),
},
chipFocused: {
backgroundColor: emphasize(
theme.palette.type === 'light' ? theme.palette.grey[300] : theme.palette.grey[700],
0.08,
),
},
noOptionsMessage: {
padding: theme.spacing(1, 2),
},
singleValue: {
fontSize: 16,
},
placeholder: {
position: 'absolute',
left: 8,
bottom: 6,
fontSize: 16,
},
paper: {
position: 'absolute',
zIndex: 1,
marginTop: theme.spacing(1),
left: 0,
right: 0,
},
}));
function NoOptionsMessage(props) {
const { selectProps, innerProps, children } = props;
return (
{children}
);
}
NoOptionsMessage.propTypes = {
children: PropTypes.node,
innerProps: PropTypes.object,
selectProps: PropTypes.object.isRequired,
};
NoOptionsMessage.defaultProps = {
children: null,
innerProps: null
};
function inputComponent({ inputRef, ...props }) {
return
;
}
inputComponent.propTypes = {
inputRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
};
inputComponent.defaultProps = {
inputRef: undefined
};
function Control(props) {
const {
children,
innerProps,
innerRef,
selectProps: { classes, TextFieldProps },
} = props;
return (
);
}
Control.propTypes = {
children: PropTypes.node,
innerProps: PropTypes.object,
innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
selectProps: PropTypes.object.isRequired,
};
Control.defaultProps = {
children: null,
innerProps: null,
innerRef: undefined
};
function Option(props) {
const {
innerRef,
isFocused,
isSelected,
innerProps,
children
} = props;
return (
);
}
Option.propTypes = {
children: PropTypes.node,
innerProps: PropTypes.object,
innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
isFocused: PropTypes.bool,
isSelected: PropTypes.bool,
};
Option.defaultProps = {
children: null,
innerProps: null,
innerRef: undefined,
isFocused: false,
isSelected: false
};
function Placeholder(props) {
const { selectProps, innerProps, children } = props;
return (
{children}
);
}
Placeholder.propTypes = {
children: PropTypes.node,
innerProps: PropTypes.object,
selectProps: PropTypes.object.isRequired,
};
Placeholder.defaultProps = {
children: null,
innerProps: null,
};
function SingleValue(props) {
const { selectProps, children, innerProps } = props;
return (
{children}
);
}
SingleValue.propTypes = {
children: PropTypes.node,
innerProps: PropTypes.object,
selectProps: PropTypes.object.isRequired,
};
SingleValue.defaultProps = {
children: null,
innerProps: null,
};
function ValueContainer(props) {
const { selectProps, children } = props;
return {children}
;
}
ValueContainer.propTypes = {
children: PropTypes.node,
selectProps: PropTypes.object.isRequired,
};
ValueContainer.defaultProps = {
children: null,
};
function MultiValue(props) {
const {
children,
selectProps,
removeProps,
isFocused
} = props;
return (
}
/>
);
}
MultiValue.propTypes = {
children: PropTypes.node,
isFocused: PropTypes.bool,
removeProps: PropTypes.object.isRequired,
selectProps: PropTypes.object.isRequired,
};
MultiValue.defaultProps = {
children: null,
isFocused: false,
};
function Menu(props) {
const { selectProps, innerProps, children } = props;
return (
{children}
);
}
Menu.propTypes = {
children: PropTypes.node,
innerProps: PropTypes.object,
selectProps: PropTypes.object,
};
Menu.defaultProps = {
children: null,
innerProps: null,
selectProps: null,
};
const components = {
Control,
Menu,
MultiValue,
NoOptionsMessage,
Option,
Placeholder,
SingleValue,
ValueContainer,
};
export default function SelectSuggestions() {
const classes = useStyles();
const theme = useTheme();
const [single, setSingle] = React.useState(null);
function handleChangeSingle(value) {
setSingle(value);
}
const selectStyles = {
input: base => ({
...base,
color: theme.palette.text.primary,
'& input': {
font: 'inherit',
},
}),
};
return (
);
}