UNPKG

asciitorium

Version:
53 lines (52 loc) 1.44 kB
import { Component, ComponentProps } from '../core/Component.js'; import { State } from '../core/State.js'; import { Option } from './Option.js'; import { OptionGroup } from './OptionGroup.js'; export interface SelectOptions<T = any> extends ComponentProps { items?: string[]; selectedItem?: State<string>; selected?: State<T>; children?: (Option<T> | OptionGroup<T>)[]; showSelectionBox?: boolean; } export declare class Select<T = any> extends Component { private scrollableViewport; private readonly items; private readonly selectedState; private focusedIndex; private selectedIndex; private readonly showSelectionBox; focusable: boolean; hasFocus: boolean; private flattenChildren; constructor(options: SelectOptions<T>); /** * Move focus to the next item (skipping group headers) */ moveNext(): void; /** * Move focus to the previous item (skipping group headers) */ movePrevious(): void; /** * Select the currently focused item (if not a group header) */ select(): void; /** * Jump to the first item */ moveToStart(): void; /** * Jump to the last item */ moveToEnd(): void; /** * Page down (move down by roughly a page of items) */ pageDown(): void; /** * Page up (move up by roughly a page of items) */ pageUp(): void; draw(): string[][]; }