@hummingbirdui/hummingbird
Version:
An open-source system designed for rapid development, without sacrificing the granular control of utility-first CSS.
37 lines (36 loc) • 1.28 kB
TypeScript
import { TooltipOptions } from './tooltip';
import * as Popper from '@popperjs/core';
type Offset = [number, number];
type OffsetFunction = () => Offset;
export interface DropdownOptions extends Pick<TooltipOptions, 'popperConfig'> {
offset: Offset | string | OffsetFunction;
boundary: Popper.Boundary | Element;
reference: 'toggle' | 'parent' | Element | Popper.Rect;
display: 'dynamic' | 'static';
autoClose: boolean | 'inside' | 'outside';
}
export interface DropdownInstance {
toggle(): void;
show(): void;
hide(): void;
update(): void;
dispose(): void;
}
declare enum DropdownEvents {
SHOW = "show.bs.dropdown",
SHOWN = "shown.bs.dropdown",
HIDE = "hide.bs.dropdown",
HIDDEN = "hidden.bs.dropdown"
}
export interface DropdownClass {
readonly VERSION: string;
readonly DATA_KEY: string;
readonly EVENT_KEY: string;
new (element: Element | string, options?: Partial<DropdownOptions>): DropdownInstance;
getInstance(element: Element | string): DropdownInstance | null;
getOrCreateInstance(element: Element | string, config?: Partial<DropdownOptions>): DropdownInstance;
Default: DropdownOptions;
Events: typeof DropdownEvents;
}
declare const Dropdown: DropdownClass;
export default Dropdown;