import React from 'react'; // react select import Select, {StylesConfig, ClearIndicatorProps, components} from 'react-select'; // icons import Cancel from '../../../assets/images/input/select-cancel'; // components import Typography from '../Typography'; // styles import './styles.scss'; interface Option { id?: number | string; value: string; label: string; } interface GeneralSelectProps { options: Option[]; placeholder?: string; error?: string; label?: string; selectedValue: Option | null; isError: boolean; setSelectedValue: (option: Option | null) => void; builderSelect: boolean; gallerySelect: boolean; clearField: boolean; qrField?: boolean; search?: boolean; currentTheme?: string | null | undefined; } const colourStyles: StylesConfig = { dropdownIndicator: (styles, {isFocused, selectProps}) => ({ ...styles, color: isFocused && selectProps.menuIsOpen ? 'var(--primary-color)' : 'grey', transform: !isFocused && !selectProps.menuIsOpen ? 'rotate(0deg)' : 'rotate(180deg)', }), option: (styles, {isDisabled, isFocused, isSelected}) => { return { ...styles, backgroundColor: isDisabled ? undefined : isSelected && isFocused ? 'var(--secondary-color)' : isFocused && !isSelected ? 'var(--secondary-color)' : undefined, }; }, }; const errorStyles = { color: 'var(--error-color)', fontWeight: '400', }; const ClearIndicator: React.FC> = (props) => { return ( ); }; const GeneralSelect: React.FC = ({ options, placeholder, error, label, isError, selectedValue, setSelectedValue, builderSelect, gallerySelect=false, clearField, qrField = false, search = false, currentTheme = "default" }) => { return (
{label && }