@wikimedia/wvui
Version:
Wikimedia Vue UI (WVUI) – Wikimedia Foundation's Vue.js shared user-interface components for Wikipedia, MediaWiki, and beyond.
92 lines (91 loc) • 3.37 kB
TypeScript
/// <reference types="node" />
import Vue from 'vue';
import { InputType } from '../input/InputType';
import { AbortableSearchFetch, SearchClient, SearchResult } from '../typeahead-search/http/SearchClient';
import { UrlGenerator } from '../typeahead-suggestion/UrlGenerator';
declare const _default: import("vue/types/vue").ExtendedVue<Vue, {
startIcon: string;
articleIcon: string;
isHovered: boolean;
suggestionActiveIndex: number;
suggestionsList: SearchResult[];
isFocused: boolean;
searchQuery: string;
inputValue: string;
InputType: typeof InputType;
isExpanded: boolean;
request: AbortableSearchFetch | null;
debounceId: NodeJS.Timeout | null;
}, {
/**
* Return value of "aria-selected" for a given suggestion
*
* Suggestion is considered "selected" if input value matches suggestion
* "selected" is distinct from "active", 'suggestionActiveIndex' updates on hover and
* doesn't affect the input value, This definition means a user can enter a value that
* matches a suggestion exactly and that suggestion is considered "selected" even
* though the user doesn't interact with the list via keyboard or mouse.
*
* This behavior is approximately equivalent to
* W3's "List Autocomplete with Automatic Selection" example
* https://www.w3.org/TR/wai-aria-practices-1.1/examples/combobox/aria1.1pattern/listbox-combo.html#ex2_label
*
* @param {number} index
* @return {string} either 'true' or 'false'
*/
isSuggestionSelected(index: number): string;
/**
* A convenience method to update those properties that should be updated when new
* suggestions are available.
*
* @param {string} query
* @param {SearchResult[]} suggestions
*/
updateSuggestions(query: string, suggestions: SearchResult[]): void;
/**
* A convenience method to update those properties that should be update when clearing the
* suggestions.
*/
clearSuggestions(): void;
onInput(value: string): void;
onSuggestionMouseOver(index: number): void;
onInputFocus(): void;
onInputBlur(): void;
onFooterHover(): void;
onRootMouseOver(): void;
onRootMouseOut(): void;
onSuggestionMouseDown(event: MouseEvent): void;
onSuggestionClick(suggestion?: SearchResult | undefined): void;
onKeyDownUp(event: KeyboardEvent): void;
onKeyDownDown(event: KeyboardEvent): void;
handleKeyUpDown(event: KeyboardEvent, offset: number): void;
nudgeActiveSuggestion(offset: number): void;
onKeyDownEscape(event: KeyboardEvent): void;
getSuggestionId(suggestion: SearchResult): string;
onSubmit(event: Event): void;
}, {
rootClasses: Record<string, boolean>;
footerClasses: Record<string, boolean>;
footerUrl: string;
isFooterActive: boolean;
suggestionsId: string;
activeSuggestionId: string;
footerId: string;
isExpandedString: string;
}, {
initialInputValue: string;
buttonLabel: string;
formAction: string;
client: SearchClient;
urlGenerator: UrlGenerator;
domain: string;
searchPageTitle: string;
suggestionsLabel: string;
focused: boolean;
id: string;
showThumbnail: boolean;
showDescription: boolean;
highlightQuery: boolean;
autoExpandWidth: boolean;
}>;
export default _default;