UNPKG

@theia/core

Version:

Theia is a cloud & desktop IDE framework implemented in TypeScript.

72 lines 3.38 kB
import * as React from 'react'; import '../../../src/browser/style/select-component.css'; export interface SelectOption { value?: string; label?: string; separator?: boolean; disabled?: boolean; detail?: string; description?: string; markdown?: boolean; userData?: string; } export interface SelectComponentProps { id?: string; className?: string; options: readonly SelectOption[]; defaultValue?: string | number; onChange?: (option: SelectOption, index: number) => void; onBlur?: () => void; onFocus?: () => void; alignment?: 'left' | 'right'; } export interface SelectComponentState { dimensions?: DOMRect; selected: number; original: number; hover: number; } export declare const SELECT_COMPONENT_CONTAINER = "select-component-container"; export declare class SelectComponent extends React.Component<SelectComponentProps, SelectComponentState> { protected dropdownElement: HTMLElement; protected fieldRef: React.RefObject<HTMLDivElement>; protected dropdownRef: React.RefObject<HTMLDivElement>; protected mountedListeners: Map<string, EventListenerOrEventListenerObject>; protected optimalWidth: number; protected optimalHeight: number; protected resizeObserver: ResizeObserver | undefined; /** Window the scroll/wheel/resize listeners are attached to; may differ from the main window in secondary windows. */ protected listenersWindow: Window | undefined; /** Perfect-scrollbar ancestors the `ps-scroll-y` listener was attached to. The field may have moved to another window since, so the elements are remembered. */ protected psScrollListenerTargets: HTMLElement[]; constructor(props: SelectComponentProps); /** * The document that currently hosts this component. Falls back to the main document before * the first render. Widgets can be moved to secondary windows, so this must be re-queried * instead of captured once. */ protected getHostDocument(): Document; /** Finds or creates the dropdown portal container in the given document. */ protected resolveDropdownContainer(hostDocument: Document): HTMLElement; protected getInitialSelectedIndex(props: SelectComponentProps): number; componentDidUpdate(prevProps: SelectComponentProps, prevState: SelectComponentState): void; get options(): readonly SelectOption[]; get value(): string | number | undefined; set value(value: string | number | undefined); protected get alignLeft(): boolean; protected getOptimalWidth(): number; protected getOptimalHeight(maxWidth?: number): number; protected attachListeners(): void; componentWillUnmount(): void; protected detachListeners(): void; render(): React.ReactNode; protected nextNotSeparator(direction: 'forwards' | 'backwards', startFrom?: number): number; protected handleKeypress(ev: React.KeyboardEvent<HTMLDivElement>): void; protected handleClickEvent(event: React.MouseEvent<HTMLElement>): void; protected toggleVisibility(): void; protected hide(index?: number, releaseFocus?: boolean): void; protected renderDropdown(): React.ReactNode; protected renderOption(index: number, option: SelectOption): React.ReactNode; protected selectOption(index: number, option: SelectOption): void; } //# sourceMappingURL=select-component.d.ts.map