import React, { Component, type JSX } from 'react'; import { AutoCompleteAssistiveHint } from '@digigov/react-core/AutoCompleteAssistiveHint'; import { AutoCompleteContainer } from '@digigov/react-core/AutoCompleteContainer'; import { AutoCompleteInputBase } from '@digigov/react-core/AutoCompleteInputBase'; import { AutoCompleteMultipleInput } from '@digigov/react-core/AutoCompleteMultipleInput'; import { AutoCompleteMultipleInputContainer } from '@digigov/react-core/AutoCompleteMultipleInputContainer'; import { AutoCompleteResultList } from '@digigov/react-core/AutoCompleteResultList'; import { AutoCompleteResultListItem } from '@digigov/react-core/AutoCompleteResultListItem'; export interface AutoCompleteProps { source: (query: string, syncResults: (options: string[]) => void) => void; id: string; multiple?: boolean; tStatusResults?: (x: number, y: string) => string; tStatusNoResults?: () => string; tStatusQueryTooShort?: (x: number) => string; tStatusSelectedOption?: (x: string, y: number, z: number) => string; tNoResults?: () => string; tAssistiveHint?: () => string; templates?: { suggestion?: (value: any, query: string | string[]) => any; inputValue?: (value: any) => string; }; width?: '25%' | '33.3%' | '50%' | '66.6%' | '75%' | '100%' | 'full'; autoselect?: boolean; hint?: boolean; defaultValue?: string | string[]; minLength?: number; name?: string; placeholder?: string; onConfirm?: (x: any) => void; confirmOnBlur?: boolean; required?: boolean; numberOfSelected?: 1 | 2 | 3 | 'all'; } export interface State { focused: any; hovered: any; menuOpen: boolean; options: any[]; query: string; selectedValues: any[]; validChoiceMade: boolean; selected: any; ariaHint: boolean; } export interface NewQueryProps { menuOpen?: boolean; query?: string; } export default class AutoComplete extends Component { static defaultProps: { width: string; autoselect: boolean; minLength: number; name: string; placeholder: string; hint: boolean; onConfirm: () => void; confirmOnBlur: boolean; required: boolean; tNoResults: () => string; tAssistiveHint: () => string; }; elementReferences: {}; constructor(props: AutoCompleteProps); isQueryAnOption(query: string, options: string[]): boolean; componentDidMount(): void; getDirectInputChanges(): void; componentDidUpdate(_: any, prevState: Readonly): void; hasAutoselect(): boolean; templateInputValue(value: string): string; templateSuggestion(value: string): string; handleComponentBlur(newState?: NewQueryProps): void; handleListMouseLeave(): void; handleAutoCompleteBlur(event: any, index?: number): void; handleInputChange(event: { target: any; }): void; handleInputClick(event: React.MouseEvent): void; handleInputFocus(): void; handleOptionFocus(index: number): void; handleOptionMouseEnter(index: number): void; handleOptionClickMultiple(index: number): void; handleOptionClick(index: number): void; handleOptionMouseDown(event: { preventDefault: () => void; }): void; handleUpArrow(event: { preventDefault: () => void; }): void; handleDownArrow(event: { preventDefault: () => void; }): void; handleSpace(event: { preventDefault: () => void; }): void; handleEnter(event: { preventDefault: () => void; }): void; handlePrintableKey(event: { target: any; }): void; handleKeyDown(event: { preventDefault: () => void; keyCode: number; target: any; }): void; render(): JSX.Element; } export { AutoComplete, AutoCompleteInputBase, AutoCompleteResultList, AutoCompleteResultListItem, AutoCompleteContainer, AutoCompleteAssistiveHint, AutoCompleteMultipleInputContainer, AutoCompleteMultipleInput, };