@ebay/ebayui-core
Version:
Collection of core eBay components; considered to be the building blocks for all composite structures, pages & apps.
96 lines (95 loc) • 3.24 kB
TypeScript
import { DropdownUtil } from "../../common/dropdown";
import type { WithNormalizedProps } from "../../global";
export interface ComboboxOption {
text: string;
value?: string;
class?: Marko.HTMLAttributes["class"];
sticky?: boolean;
}
export interface ComboboxEvent {
currentInputValue: State["currentValue"];
selectedOption?: ComboboxOption;
option: Input["option"];
}
interface ComboboxInput extends Omit<Marko.HTML.Input, `on${string}`> {
expanded?: boolean;
borderless?: boolean;
fluid?: boolean;
autocomplete?: "list" | "none";
"list-selection"?: "manual" | "automatic";
"floating-label"?: string;
strategy?: "fixed" | "absolute";
flip?: boolean;
button?: Marko.Input<"button"> & Marko.AttrTag<{
htmlAttributes?: Record<string, unknown>;
renderBody?: Marko.Body;
}>;
option?: Marko.AttrTag<ComboboxOption>;
/**
* For internal use only. Used when combobox container changes.
* @returns The dropdown element to be used for the combobox
*/
"dropdown-element"?: () => HTMLElement;
"chevron-size"?: "large";
"on-focus"?: (event: ComboboxEvent) => void;
"on-button-click"?: (event: {
originalEvent: MouseEvent;
}) => void;
"on-expand"?: () => void;
"on-collapse"?: () => void;
"on-input-change"?: (event: ComboboxEvent) => void;
"on-change"?: (event: ComboboxEvent) => void;
"on-floating-label-init"?: (event: ComboboxEvent) => void;
"on-select"?: (event: ComboboxEvent) => void;
"on-keydown"?: (event: KeyboardEvent) => void;
"on-option-click"?: (text: string) => void;
}
export interface Input extends WithNormalizedProps<ComboboxInput> {
}
interface State {
currentValue: Input["value"];
}
export default class Combobox extends Marko.Component<Input, State> {
expander: any;
buttonClicked: boolean;
optionClicked: boolean;
activeDescendant: any;
lastValue: Input["value"];
autocomplete: NonNullable<Input["autocomplete"]>;
listSelection: NonNullable<Input["listSelection"]>;
expanded?: boolean;
expandedChange: boolean;
_floatingLabel: any;
dropdownUtil: DropdownUtil;
focus(): void;
handleFocus(): void;
isExpanded(): any;
isCollapsed(): any;
expand(): void;
collapse(): void;
handleButtonClick(originalEvent: MouseEvent): void;
handleActiveDescendantChange(ev: CustomEvent): void;
setSelectedView(): void;
handleExpand(): void;
handleCollapse(): void;
handleComboboxClick(e: MouseEvent): void;
handleComboboxKeyDown(originalEvent: KeyboardEvent): void;
handleComboboxKeyUp(originalEvent: KeyboardEvent): void;
handleComboboxBlur(): void;
handleSelectOption(text: string): void;
handleFloatingLabelInit(): void;
onInput(input: Input): void;
onMount(): void;
onUpdate(): void;
onRender(): void;
onDestroy(): void;
_setupFloatingLabel(): void;
_setupMakeup(): void;
_cleanupMakeup(): void;
_setSelectedText(text: string): void;
_getSelectedOption(): ComboboxOption | undefined;
_getVisibleOptions(): ComboboxOption[];
_hasVisibleOptions(): boolean;
_emitComboboxEvent(eventName: string): void;
}
export {};