import { IContextMenuProvider } from "../../contextmenu.js"; import { IHoverDelegate } from "../hover/hoverDelegate.js"; import { IAction, IActionRunner } from "../../../common/actions.js"; import { Event as BaseEvent } from "../../../common/event.js"; import { IMarkdownString } from "../../../common/htmlContent.js"; import { Disposable, IDisposable } from "../../../common/lifecycle.js"; import { ThemeIcon } from "../../../common/themables.js"; import { IActionProvider } from "../dropdown/dropdown.js"; export interface IButtonOptions extends Partial { readonly title?: boolean | string; /** * Will fallback to `title` if not set. */ readonly ariaLabel?: string; readonly supportIcons?: boolean; readonly supportShortLabel?: boolean; readonly secondary?: boolean; readonly small?: boolean; readonly hoverDelegate?: IHoverDelegate; readonly disabled?: boolean; } export interface IButtonStyles { readonly buttonBackground: string | undefined; readonly buttonHoverBackground: string | undefined; readonly buttonForeground: string | undefined; readonly buttonSeparator: string | undefined; readonly buttonSecondaryBackground: string | undefined; readonly buttonSecondaryHoverBackground: string | undefined; readonly buttonSecondaryForeground: string | undefined; readonly buttonSecondaryBorder: string | undefined; readonly buttonBorder: string | undefined; } export declare const unthemedButtonStyles: IButtonStyles; export interface IButton extends IDisposable { readonly element: HTMLElement; readonly onDidClick: BaseEvent; set label(value: string | IMarkdownString); set icon(value: ThemeIcon); set enabled(value: boolean); set checked(value: boolean); focus(): void; hasFocus(): boolean; } export interface IButtonWithDescription extends IButton { description: string; } export declare class Button extends Disposable implements IButton { protected options: IButtonOptions; protected _element: HTMLElement; protected _label: string | IMarkdownString; protected _labelElement: HTMLElement | undefined; protected _labelShortElement: HTMLElement | undefined; private _hover; private _onDidClick; get onDidClick(): BaseEvent; private _onDidEscape; get onDidEscape(): BaseEvent; private focusTracker; constructor(container: HTMLElement, options: IButtonOptions); dispose(): void; protected getContentElements(content: string): HTMLElement[]; private updateStyles; get element(): HTMLElement; set label(value: string | IMarkdownString); get label(): string | IMarkdownString; set labelShort(value: string); protected _setAriaLabel(): void; set icon(icon: ThemeIcon); set enabled(value: boolean); get enabled(): boolean; set secondary(value: boolean); set checked(value: boolean); get checked(): boolean; setTitle(title: string): void; focus(): void; hasFocus(): boolean; } export interface IButtonWithDropdownOptions extends IButtonOptions { readonly contextMenuProvider: IContextMenuProvider; readonly actions: readonly IAction[] | IActionProvider; readonly actionRunner?: IActionRunner; readonly addPrimaryActionToDropdown?: boolean; /** * dropdown menus with higher layers are rendered higher in z-index order */ readonly dropdownLayer?: number; } export declare class ButtonWithDropdown extends Disposable implements IButton { readonly primaryButton: Button; private readonly action; readonly dropdownButton: Button; private readonly separatorContainer; private readonly separator; readonly element: HTMLElement; private readonly _onDidClick; readonly onDidClick: BaseEvent; constructor(container: HTMLElement, options: IButtonWithDropdownOptions); dispose(): void; set label(value: string); set icon(icon: ThemeIcon); set enabled(enabled: boolean); get enabled(): boolean; set checked(value: boolean); get checked(): boolean; focus(): void; hasFocus(): boolean; } export declare class ButtonWithDescription implements IButtonWithDescription { private readonly options; private _button; private _element; private _descriptionElement; constructor(container: HTMLElement, options: IButtonOptions); get onDidClick(): BaseEvent; get element(): HTMLElement; set label(value: string); set icon(icon: ThemeIcon); get enabled(): boolean; set enabled(enabled: boolean); set checked(value: boolean); get checked(): boolean; focus(): void; hasFocus(): boolean; dispose(): void; set description(value: string); } export declare enum ButtonBarAlignment { Horizontal = 0, Vertical = 1 } export declare class ButtonBar { private readonly container; private readonly options?; private readonly _buttons; private readonly _buttonStore; constructor(container: HTMLElement, options?: { alignment?: ButtonBarAlignment; } | undefined); dispose(): void; get buttons(): IButton[]; clear(): void; addButton(options: IButtonOptions): IButton; addButtonWithDescription(options: IButtonOptions): IButtonWithDescription; addButtonWithDropdown(options: IButtonWithDropdownOptions): IButton; private pushButton; } /** * This is a Button that supports an icon to the left, and markdown to the right, with proper separation and wrapping the markdown label, which Button doesn't do. */ export declare class ButtonWithIcon extends Button { private readonly _iconElement; private readonly _mdlabelElement; get labelElement(): HTMLElement; get iconElement(): HTMLElement; constructor(container: HTMLElement, options: IButtonOptions); get label(): IMarkdownString | string; set label(value: IMarkdownString | string); get icon(): ThemeIcon; set icon(icon: ThemeIcon); }