import * as React from 'react'; import { Colors } from '../../../../../models/colors'; import { Query } from '../../../../../models/query'; import { dropdownWrapper } from './dropdownList.style'; import OptionsWithCategory from './inner-comps/options-with-category/OptionsWithCategory'; import OptionsWithoutCategory from './inner-comps/options-without-category/OptionsWithoutCategory'; import Input from './inner-comps/input/Input'; import NoResults from './inner-comps/no-results/NoResults'; interface dropdownListProps { options?: Array<{ label: string; id: string }>; optionsWithCategories?: Array<{ category: string; options: Array<{ label: string; id: string }>; }>; onOptionClick?: (option: { label: string; id: string }) => void; handleKeyDown?: ( value: string, e: React.KeyboardEvent, option: { label: string; id: string } ) => void; palette?: Colors; query?: Query; close?: () => void; readOnly?: boolean; name?: string; type?: string; value?: string; maxlength?: number; placeholder?: string; noResults?: string; onChange?: (name: string, value: string, e?: React.ChangeEvent) => void; onKeyDown?: (value: string, e: React.KeyboardEvent) => void; isDropdown?: boolean; translator?: Function; } const DropdownList = React.forwardRef( (props: dropdownListProps, ref: React.Ref) => { return (
{props.query === Query.small && ( )} {props.optionsWithCategories && props.optionsWithCategories.length ? ( ) : props.options && props.options.length ? ( ) : props.query === Query.small ? ( ) : null}
); } ); export default DropdownList;