import { HTMLTemplateResult, nothing, PropertyValues } from "lit";
import { FRoot } from "../../mixins/components/f-root/f-root";
import { FDiv } from "../f-div/f-div";
import { FPopover } from "../f-popover/f-popover";
import { FInput } from "../f-input/f-input";
import { displayCustomTemplate, displayOptions, displayCategories } from "./display-options";
export type FSuggestState = "primary" | "default" | "success" | "warning" | "danger";
export type FSuggestCustomEvent = {
value?: string | FSuggestTemplate;
};
export type FSuggestSuffixWhen = (value: string) => boolean;
export type FSuggestSuggestionsCategory = Record;
export type FSuggestTemplate = {
value: Type;
template: (value?: string) => HTMLTemplateResult;
toString: () => string;
};
export type FSuggestWhen = (suggestion: string | FSuggestTemplate, value?: string) => boolean;
export type FSuggestSuggestions = string[] | FSuggestSuggestionsCategory | FSuggestTemplate[];
export declare class FSuggest extends FRoot {
/**
* css loaded from scss file
*/
static styles: import("lit").CSSResult[];
/**
* @attribute Variants are various visual representations of an input field.
*/
variant?: "curved" | "round" | "block";
/**
* @attribute Categories are various visual representations of an input field.
*/
category?: "fill" | "outline" | "transparent";
/**
* @attribute suggestions to show on value
*/
suggestions?: FSuggestSuggestions;
/**
* @attribute disable showing suggestions
*/
disableSuggestions: boolean;
/**
* @attribute States are used to communicate purpose and connotations.
*/
state?: FSuggestState;
/**
* @attribute f-input can have 2 sizes. By default size is inherited by the parent f-field.
*/
size?: "medium" | "small";
/**
* @attribute Defines the value of an f-input. Validation rules are applied on the value depending on the type property of the f-text-input.
*/
value?: string;
/**
* @attribute Defines the placeholder text for f-text-input
*/
placeholder?: string;
/**
* @attribute Icon-left enables an icon on the left of the input value.
*/
iconLeft?: string;
/**
* @attribute Icon-right enables an icon on the right of the input value.
*/
iconRight?: string;
/**
* @attribute Prefix property enables a string before the input value.
*/
prefix: string | null;
/**
* @attribute Suffix property enables a string on the right side of the input box.
*/
suffix?: string;
/**
* @attribute This shows the character count while typing and auto limits after reaching the max length.
*/
maxLength?: number;
/**
* @attribute Loader icon replaces the content of the button .
*/
loading?: boolean;
/**
* @attribute Shows disabled state of input element
*/
disabled?: boolean;
/**
* @attribute Displays a close icon-button on the right side of the input that allows the user to clear the input value
*/
clear?: boolean;
/**
* @attribute When true the user can not select the input element.
*/
readOnly?: boolean;
suffixWhen?: FSuggestSuffixWhen;
suggestWhen: FSuggestWhen;
set ["suggest-when"](val: FSuggestWhen);
/**
* @attribute max height for options
*/
optionsMaxHeight?: string;
/**
* input element reference
*/
fInput: FInput;
/**
* popover element reference
*/
popOverElement: FPopover;
FSelectOptions?: FDiv;
currentIndex: number;
currentCategoryIndex: number;
filteredSuggestions?: FSuggestSuggestions;
/**
* emit input custom event
*/
handleInput(e: CustomEvent<{
value: string;
}>): void;
dispatchInputEvent(value?: string | FSuggestTemplate): void;
handleBlur(wait?: boolean): Promise;
handleFocus(): void;
get filteredSuggestionsLength(): number;
get anySuggestions(): boolean;
get isStringArraySuggestions(): boolean;
get isTemplateArraySuggestions(): boolean;
get isSearchComponent(): boolean;
handleKeyDown(event: KeyboardEvent): void;
navigateOptions(direction: number): void;
scrollFocusedOptionIntoView(): void;
selectOption(): void;
displayOptions: typeof displayOptions;
displayCategories: typeof displayCategories;
displayCustomTemplate: typeof displayCustomTemplate;
willUpdate(changedProperties: PropertyValues): void;
render(): import("lit-html").TemplateResult<1>;
getSuggestionHtml(suggestions: FSuggestSuggestions): import("lit-html").TemplateResult<1> | typeof nothing | import("lit-html").TemplateResult<1>[];
handleSuggest(event: PointerEvent): Promise;
handleSelect(sg: FSuggestTemplate): Promise;
dispatchSelectedEvent(value: string | FSuggestTemplate): void;
}
/**
* Required for typescript
*/
declare global {
interface HTMLElementTagNameMap {
"f-suggest": FSuggest;
}
}