UNPKG

@teaui/core

Version:

A high-level terminal UI library for Node

49 lines (48 loc) 1.57 kB
import type { KeyEvent, MouseEvent } from '../events/index.js'; import type { Viewport } from '../Viewport.js'; import type { Props as ViewProps } from '../View.js'; import { View } from '../View.js'; import { Size } from '../geometry.js'; import { System } from '../System.js'; import { type FontFamily, type LegendItem } from '../types.js'; interface TextProps { placeholder?: string; onChange?: (text: string) => void; onSubmit?: (text: string) => void; } interface StyleProps { value?: string; wrap?: boolean; multiline?: boolean; font?: FontFamily; format?: (text: string) => string; } export type Props = StyleProps & TextProps & ViewProps; /** * Text input. Supports selection, word movement via alt+←→, single and multiline * input, and wrapped lines. */ export declare class Input extends View { #private; constructor(props?: Props); update(props: Props): void; get value(): string; set value(value: string); get placeholder(): string | undefined; set placeholder(placeholder: string | undefined); get font(): FontFamily; set font(font: FontFamily); get wrap(): boolean; set wrap(wrap: boolean); get multiline(): boolean; set multiline(multiline: boolean); legendItems(): LegendItem[]; naturalSize(available: Size): Size; minSelected(): number; maxSelected(): number; receiveKey(event: KeyEvent): void; receivePaste(text: string): void; receiveMouse(event: MouseEvent, system: System): void; render(viewport: Viewport): void; } export {};