adwaveui
Version:
Interactive Web Components inspired by the Gtk Adwaita theme.
173 lines (172 loc) • 6.57 kB
TypeScript
import "../../base-elements";
import { AttributesOf, EventNamesOf } from "wc_toolkit";
import { CustomKeyboardEvent, CustomMouseEvent } from "../../utils/events";
declare class AdwInputChangeEvent extends Event {
readonly type: "change";
value: string;
t: "select" | "submit";
constructor(eventType: string, type: "select" | "submit", value: string);
}
declare const CustomElement: import("wc_toolkit").CustomElement<{
value: "string";
defaultValue: "string";
disabled: "boolean";
name: "string";
form: "string";
type: "string";
placeholder: "string";
minLength: "number";
maxLength: "number";
errorLabel: "string";
alertLabel: "string";
/**
* List of suggestions to show below the input field. Only "matching"
* suggestions are shown, if any, unless `suggestionsShowAll` is
* set to `true`.
*/
suggestions: "string[]";
/**
* When enabled, always show all suggestions, regardless of the input value.
*/
suggestionsShowAll: "boolean";
/**
* In which direction the suggestion box should open.
* - `up` - The box will open above the input.
* - `down` - The box will open below the input.
* - `detect` - The box will try to detect if it has
* enough space to open `down`, if not it will open `up`.
*
* Default: `down`
*/
suggestionsOrientation: import("wc_toolkit").AttributeParser<"up" | "down" | "detect">;
/**
* When enabled, perform a fuzzy search on the suggestions to determine which
* ones to show. By default only a exact substring match is considered as "matching".
*/
fuzzy: "boolean";
}, {
readonly change: typeof AdwInputChangeEvent;
readonly optionclick: new (name: string, detail: any, base: MouseEvent) => CustomMouseEvent<string, any>;
readonly keydown: new (name: string, detail: any, base: KeyboardEvent) => CustomKeyboardEvent<string, any>;
readonly input: {
new (type: string, eventInitDict?: InputEventInit | undefined): InputEvent;
prototype: InputEvent;
};
readonly cut: {
new (type: string, eventInitDict?: ClipboardEventInit | undefined): ClipboardEvent;
prototype: ClipboardEvent;
};
readonly copy: {
new (type: string, eventInitDict?: ClipboardEventInit | undefined): ClipboardEvent;
prototype: ClipboardEvent;
};
readonly paste: {
new (type: string, eventInitDict?: ClipboardEventInit | undefined): ClipboardEvent;
prototype: ClipboardEvent;
};
readonly focus: {
new (type: string, eventInitDict?: FocusEventInit | undefined): FocusEvent;
prototype: FocusEvent;
};
readonly blur: {
new (type: string, eventInitDict?: FocusEventInit | undefined): FocusEvent;
prototype: FocusEvent;
};
}, {
focus(): void;
showSuggestions(): void;
hideSuggestions(): void;
isSuggestionListOpen(): boolean;
scrollActiveToView(forceInstant?: boolean): void;
_highlightNextOption(offset?: number): void;
_highlightPreviousOption(offset?: number): void;
_handleOptionClick(event: MouseEvent): void;
_handleInputChange(event: Event): void;
_handleKeyDown(event: KeyboardEvent): void;
_handleFocus(ev: FocusEvent): void;
_handleBlur(ev: FocusEvent): void;
}>;
declare const AdwInput: import("wc_toolkit").CustomElement<{
value: "string";
defaultValue: "string";
disabled: "boolean";
name: "string";
form: "string";
type: "string";
placeholder: "string";
minLength: "number";
maxLength: "number";
errorLabel: "string";
alertLabel: "string";
/**
* List of suggestions to show below the input field. Only "matching"
* suggestions are shown, if any, unless `suggestionsShowAll` is
* set to `true`.
*/
suggestions: "string[]";
/**
* When enabled, always show all suggestions, regardless of the input value.
*/
suggestionsShowAll: "boolean";
/**
* In which direction the suggestion box should open.
* - `up` - The box will open above the input.
* - `down` - The box will open below the input.
* - `detect` - The box will try to detect if it has
* enough space to open `down`, if not it will open `up`.
*
* Default: `down`
*/
suggestionsOrientation: import("wc_toolkit").AttributeParser<"up" | "down" | "detect">;
/**
* When enabled, perform a fuzzy search on the suggestions to determine which
* ones to show. By default only a exact substring match is considered as "matching".
*/
fuzzy: "boolean";
}, {
readonly change: typeof AdwInputChangeEvent;
readonly optionclick: new (name: string, detail: any, base: MouseEvent) => CustomMouseEvent<string, any>;
readonly keydown: new (name: string, detail: any, base: KeyboardEvent) => CustomKeyboardEvent<string, any>;
readonly input: {
new (type: string, eventInitDict?: InputEventInit | undefined): InputEvent;
prototype: InputEvent;
};
readonly cut: {
new (type: string, eventInitDict?: ClipboardEventInit | undefined): ClipboardEvent;
prototype: ClipboardEvent;
};
readonly copy: {
new (type: string, eventInitDict?: ClipboardEventInit | undefined): ClipboardEvent;
prototype: ClipboardEvent;
};
readonly paste: {
new (type: string, eventInitDict?: ClipboardEventInit | undefined): ClipboardEvent;
prototype: ClipboardEvent;
};
readonly focus: {
new (type: string, eventInitDict?: FocusEventInit | undefined): FocusEvent;
prototype: FocusEvent;
};
readonly blur: {
new (type: string, eventInitDict?: FocusEventInit | undefined): FocusEvent;
prototype: FocusEvent;
};
}, {
focus(): void;
showSuggestions(): void;
hideSuggestions(): void;
isSuggestionListOpen(): boolean;
scrollActiveToView(forceInstant?: boolean): void;
_highlightNextOption(offset?: number): void;
_highlightPreviousOption(offset?: number): void;
_handleOptionClick(event: MouseEvent): void;
_handleInputChange(event: Event): void;
_handleKeyDown(event: KeyboardEvent): void;
_handleFocus(ev: FocusEvent): void;
_handleBlur(ev: FocusEvent): void;
}>;
type AdwInput = InstanceType<typeof CustomElement>;
type AdwInputAttributes = AttributesOf<typeof AdwInput>;
type AdwInputEvents = EventNamesOf<typeof AdwInput>;
export { AdwInput };
export type { AdwInputAttributes, AdwInputChangeEvent, AdwInputEvents };