UNPKG

@esri/calcite-components

Version:

Web Components for Esri's Calcite Design System.

65 lines (64 loc) 2.05 kB
/** * Defines interface for components with open/close public emitter. * All implementations of this interface must handle the following events: `beforeOpen`, `open`, `beforeClose`, `close`. */ export interface OpenCloseComponent { /** * The host element. */ readonly el: HTMLElement; /** * When true, the component opens. */ open?: boolean; /** * Specifies the name of transitionProp. */ transitionProp?: string; /** * Specifies property on which active transition is watched for. */ openTransitionProp: string; /** * Specifies element that the transition is allowed to emit on. */ transitionEl: HTMLDivElement; /** * Defines method for `beforeOpen` event handler. */ onBeforeOpen: () => void; /** * Defines method for `open` event handler: */ onOpen: () => void; /** * Defines method for `beforeClose` event handler: */ onBeforeClose: () => void; /** * Defines method for `close` event handler: */ onClose: () => void; } /** * Helper to determine globally set transition duration on the given openTransitionProp, which is imported and set in the @Watch("open"). * Used to emit (before)open/close events both for when the opacity transition is present and when there is none (transition-duration is set to 0). * * @param component * @param nonOpenCloseComponent */ export declare function onToggleOpenCloseComponent(component: OpenCloseComponent, nonOpenCloseComponent?: boolean): void; /** * Helper to keep track of transition listeners on setTransitionEl and connectedCallback on OpenCloseComponent components. * * For component which do not have open prop, use `onToggleOpenCloseComponent` implementation. * * @param component */ export declare function connectOpenCloseComponent(component: OpenCloseComponent): void; /** * Helper to tear down transition listeners on disconnectedCallback on OpenCloseComponent components. * * @param component */ export declare function disconnectOpenCloseComponent(component: OpenCloseComponent): void;