@kitten-science/kitten-scientists
Version:
Add-on for the wonderful incremental browser game: https://kittensgame.com/web/
44 lines • 1.93 kB
TypeScript
import { ExpandoButton } from "./buttons/ExpandoButton.js";
import type { LabelListItem } from "./LabelListItem.js";
import { UiComponent, type UiComponentInterface, type UiComponentOptions } from "./UiComponent.js";
export type CollapsiblePanelOptions = ThisType<CollapsiblePanel> & UiComponentOptions & {
/**
* Should the main child be expanded right away?
*/
readonly initiallyExpanded?: boolean;
};
/**
* A `Panel` is a section of the UI that can be expanded and collapsed
* through an expando button.
* The panel also has a head element, which is extended to create the panel
* behavior.
*/
export declare class CollapsiblePanel<THead extends LabelListItem = LabelListItem> extends UiComponent {
readonly options: CollapsiblePanelOptions;
protected readonly container: UiComponent;
readonly expando: ExpandoButton;
readonly head: THead;
protected _mainChildVisible: boolean;
get isExpanded(): boolean;
/**
* Constructs a settings panel that is used to contain a single child element.
*
* @param host A reference to the host.
* @param head Another component to host in the head of the panel.
* @param options Options for this panel.
*/
constructor(parent: UiComponent, head: THead, options?: CollapsiblePanelOptions);
toString(): string;
addChildHead(child: UiComponentInterface): this;
addChildrenHead(children?: Iterable<UiComponentInterface>): this;
addChildContent(child: UiComponent): this;
addChildrenContent(children?: Iterable<UiComponentInterface>): this;
/**
* Control the visibility of the panel's contents.
*
* @param expand Should the panel be expanded? If not set, the panel is toggled.
* @param toggleNested Also toggle all panels inside this panel?
*/
toggle(expand?: boolean | undefined, toggleNested?: boolean): void;
}
//# sourceMappingURL=CollapsiblePanel.d.ts.map