UNPKG

@teaui/core

Version:

A high-level terminal UI library for Node

47 lines (46 loc) 1.71 kB
import { Container, type Props as ContainerProps } from '../Container.js'; import { Size } from '../geometry.js'; import { View } from '../View.js'; import { Viewport } from '../Viewport.js'; import { System } from '../System.js'; import { type MouseEvent } from '../events/index.js'; import { Style } from '../Style.js'; interface Props extends ContainerProps { multiple?: boolean; } interface SectionProps extends ContainerProps { title?: string; isOpen?: boolean; } export declare class Accordion extends Container { #private; static Section: typeof Section; static create(sections: ([string, View] | Section)[], extraProps?: Props): Accordion; constructor(props?: Props); update(props: Props): void; get sections(): Section[]; addSection(title: string, view: View): void; addSection(section: Section): void; add(child: View, at?: number): void; naturalSize(available: Size): Size; render(viewport: Viewport): void; } declare class Section extends Container { #private; onClick: ((section: Section, isOpen: boolean) => void) | undefined; static create(title: string, child: View, extraProps?: Omit<SectionProps, 'title' | 'view'>): Section; constructor({ title, isOpen, ...props }: SectionProps); get title(): string; set title(value: string); get isOpen(): boolean; set isOpen(value: boolean); get titleStyle(): Style; open(): void; close(): void; update({ title, ...props }: Omit<SectionProps, 'view'>): void; naturalSize(available: Size): Size; receiveMouse(event: MouseEvent, system: System): void; receiveTick(dt: number): boolean; render(viewport: Viewport): void; } export {};