UNPKG

@teaui/core

Version:

A high-level terminal UI library for Node

65 lines (64 loc) 1.85 kB
import { Viewport } from '../Viewport.js'; import { type Props as ViewProps, View } from '../View.js'; import { Size } from '../geometry.js'; import { type KeyEvent, type MouseEvent } from '../events/index.js'; import { type Orientation, type LegendItem } from '../types.js'; type ButtonProps = { /** * Whether to show ◃, ▹ buttons on either side of the slider. * Default: false */ buttons?: false; /** * If provided, values will be in fit the equation `min(range) + N * step`. Also * applies to the buttons, if they are visible. */ step?: number; } | { /** * Whether to show ◃, ▹ buttons on either side of the slider. * Default: false */ buttons: true; /** * If provided, values will be in fit the equation `min(range) + N * step`. Also * applies to the buttons, if they are visible. */ step: number; }; type Props = ViewProps & ButtonProps & { /** * What direction to draw the slider. * Default: 'horizontal' */ direction?: Orientation; /** * Whether to show a border around the slider. * Default: false */ border?: boolean; /** * Minimum and maximum values - inclusive. */ range?: [number, number]; /** * Current position of the slider, should be within the range */ value?: number; onChange?: (value: number) => void; }; export declare class Slider extends View { #private; constructor(props: Props); update(props: Props): void; get border(): boolean; set border(value: boolean); get value(): number; set value(value: number); naturalSize(_available: Size): Size; legendItems(): LegendItem[]; receiveKey(event: KeyEvent): void; receiveMouse(event: MouseEvent): void; render(viewport: Viewport): void; } export {};