import { Container, FillStyleInputs } from 'pixi.js'; import { Signal } from 'typed-signals'; import { FancyButton } from './FancyButton'; import { ScrollBox, ScrollBoxOptions } from './ScrollBox'; import { PixiTextClass, PixiTextStyle } from './utils/helpers/text'; import { type GetViewSettings } from './utils/helpers/view'; type Offset = { y: number; x: number; }; export type SelectItemsOptions = { items: string[]; backgroundColor: FillStyleInputs; width: number; height: number; hoverColor?: FillStyleInputs; textStyle?: PixiTextStyle; TextClass?: PixiTextClass; radius?: number; }; export type SelectOptions = { closedBG: GetViewSettings; openBG: GetViewSettings; textStyle?: PixiTextStyle; TextClass?: PixiTextClass; selected?: number; selectedTextOffset?: { x?: number; y?: number; }; items: SelectItemsOptions; scrollBoxOffset?: { x?: number; y?: number; }; scrollBoxWidth?: number; scrollBoxHeight?: number; scrollBoxRadius?: number; visibleItems?: number; scrollBox?: ScrollBoxOptions & { offset?: Offset; }; }; /** * Container-based component that gives us a selection dropdown. * * It is a composition of a {@link Button} and a {@link ScrollBox}. * @example * new Select({ * closedBG: `select_closed.png`, * openBG: `select_open.png`, * textStyle: { fill: 0xffffff, fontSize: 20 }, * items: { * items, * backgroundColor: 0x000000, * hoverColor: 0x000000, * width: 200, * height: 50, * }, * scrollBox: { * width: 200, * height: 350, * radius: 30, * }, * }); */ export declare class Select extends Container { protected view: Container; protected openButton: FancyButton; protected closeButton: FancyButton; protected openView: Container; protected scrollBox: ScrollBox | undefined; /** Selected value ID. */ value: number; /** Fires when selected value is changed. */ onSelect: Signal<(value: number, text: string) => void>; constructor(options?: SelectOptions); /** * Initiates Select. * @param root0 * @param root0.closedBG * @param root0.textStyle * @param root0.items * @param root0.openBG * @param root0.selected * @param root0.selectedTextOffset * @param root0.scrollBox * @param root0.visibleItems * @param root0.TextClass */ init({ closedBG, textStyle, TextClass, items, openBG, selected, selectedTextOffset, scrollBox, visibleItems, }: SelectOptions): void; /** * Adds items to the dropdown. * @param items * @param selected */ addItems(items: SelectItemsOptions, selected?: number): void; /** * Remove items from the dropdown. * @param itemID - Item to remove (starting from 0). */ removeItem(itemID: number): void; /** Toggle the select state (open if closed, closes - id open). */ toggle(): void; /** Show dropdown. */ open(): void; /** Hide dropdown. */ close(): void; protected convertItemsToButtons({ items, backgroundColor, hoverColor, width, height, textStyle, TextClass, radius, }: SelectItemsOptions): FancyButton[]; } export {}; //# sourceMappingURL=Select.d.ts.map