adwaveui
Version:
Interactive Web Components inspired by the Gtk Adwaita theme.
99 lines (98 loc) • 3.25 kB
TypeScript
import { BaseElement } from "../../base-elements";
import "../../index.css";
import { CustomKeyboardEvent } from "../../utils/events";
import { AttributeBool, InputType } from "../../utils/types";
import "./input.css";
declare global {
namespace JSX {
interface AdwInputProps {
class?: string;
id?: string;
slot?: string;
style?: string;
value?: string;
disabled?: AttributeBool;
name?: string;
form?: string;
type?: InputType;
placeholder?: string;
minlength?: number;
maxlength?: number;
errorlabel?: string;
alertlabel?: string;
suggestions?: string;
suggestionsshowall?: AttributeBool;
suggestionsorientation?: "up" | "down";
fuzzy?: AttributeBool;
onChange?: (e: InputChangeEvent) => void;
onchange?: string;
onKeyDown?: (e: CustomKeyboardEvent<{}>) => void;
onkeydown?: string;
onInput?: (e: InputEvent) => void;
oninput?: string;
onBlur?: (e: FocusEvent) => void;
onblur?: string;
onFocus?: (e: FocusEvent) => void;
onfocus?: string;
}
interface IntrinsicElements {
"adw-input": AdwInputProps;
}
}
}
declare class InputChangeEvent extends CustomEvent<{
value: string;
type: "select" | "submit";
}> {
constructor(type: "select" | "submit", value: string);
}
export type { InputChangeEvent };
export declare class ADWaveInputElement extends BaseElement {
accessor value: string;
accessor disabled: boolean;
accessor name: string | null;
accessor form: string | null;
accessor type: InputType;
accessor placeholder: string | null;
accessor minLength: number | null;
accessor maxLength: number | null;
accessor errorLabel: string | null;
accessor alertLabel: string | null;
accessor suggestions: string | null;
accessor suggestionsShowAll: boolean;
accessor suggestionsOrientation: "up" | "down";
accessor fuzzy: boolean;
accessor availableOptions: string[];
accessor selectedOption: number;
accessor isSuggestionsOpen: boolean;
private uid;
private isInFocus;
private hasChanged;
constructor();
/**
* Performs a simple search through options with the provided query,
* if the option starts with the exact same string as the query, it
* is considered a match.
*/
private search;
/**
* Performs a fuzzy search through options with the provided query,
* if the option is similar enough to the query, it is considered a
* match.
*/
private fuzzySearch;
private getMatchingOptions;
private lastScrollIntoView;
/** Scrolls into view the currently highlighted suggestion. */
private scrollActiveToView;
private handleOptionClick;
private handleInputChange;
private highlightNextOption;
private highlightPreviousOption;
private withCustomKeyEvent;
private handleKeyDown;
private handleFocus;
private handleBlur;
private Suggestions;
render(): JSX.Element;
}