UNPKG

@teaui/core

Version:

A high-level terminal UI library for Node

37 lines (36 loc) 1.24 kB
import { Viewport } from '../Viewport.js'; import { type Props as ViewProps, View } from '../View.js'; import { Size } from '../geometry.js'; import { type Orientation } from '../types.js'; type PercentLocation = 'left' | 'center' | 'right'; interface Props extends ViewProps { direction?: Orientation; min?: number; max?: number; value?: number; showPercent?: boolean; /** * Where to display the percent text. * - 'left': left-aligned inside the bar * - 'center' (default): centered inside the bar * - 'right': to the right of the bar, outside it */ location?: PercentLocation; } export declare class Progress extends View { #private; constructor(props: Props); update(props: Props): void; get value(): number; set value(value: number); naturalSize(available: Size): Size; /** * The label reserve is the total chars consumed by the percent label and its * space separator when placed outside the bar (left or right). The label is * always padded to the width of "100%" (4 chars) plus 1 space = 5 chars. */ static readonly LABEL_WIDTH = 4; static readonly LABEL_RESERVE = 5; render(viewport: Viewport): void; } export {};