@exadel/esl
Version:
Exadel Smart Library (ESL) is the lightweight custom elements library that provide a set of super-flexible components
63 lines (62 loc) • 2.63 kB
TypeScript
import { ESLToggleable } from '../../esl-toggleable/core';
import type { ESLToggleableActionParams, ESLToggleableRequestDetails } from '../../esl-toggleable/core';
export interface ESLAlertActionParams extends ESLToggleableRequestDetails {
/** text to be shown; passes empty string or null to hide */
text?: string;
/** html content */
html?: string;
/** classes to add to alert element */
cls?: string;
/** timeout to clear classes */
hideTime?: number;
}
/**
* ESLAlert component
* @author Julia Murashko, Alexey Stsefanovich (ala'n)
*
* ESLAlert is a component to show small notifications on your pages. ESLAlert can have multiple instances on the page.
*/
export declare class ESLAlert extends ESLToggleable {
static is: string;
static observedAttributes: string[];
/** Default show/hide params for all ESLAlert instances */
static DEFAULT_PARAMS: ESLAlertActionParams;
/** Event to show alert component */
SHOW_REQUEST_EVENT: string;
/** Event to hide alert component */
HIDE_REQUEST_EVENT: string;
/**
* Defines the scope (using {@link ESLTraversingQuery} syntax) element to listen for an activation event.
* Parent element by default
*/
target: string;
/** Default show/hide params for current ESLAlert instance */
defaultParams: ESLAlertActionParams;
protected $content: HTMLElement;
protected activeCls?: string;
private _$target;
private _clearTimeout;
/** Creates global alert instance (using body element as a base) */
static init(options?: Partial<ESLAlert>): ESLAlert;
protected mergeDefaultParams(params?: ESLToggleableActionParams): ESLToggleableActionParams;
protected attributeChangedCallback(attrName: string, oldVal: string, newVal: string): void;
protected connectedCallback(): void;
/** Target element to listen to activation events */
get $target(): EventTarget;
set $target($el: EventTarget);
protected onShow(params: ESLAlertActionParams): void;
protected onHide(params: ESLAlertActionParams): void;
protected render({ text, html, cls }: ESLAlertActionParams): void;
protected clear(): void;
protected buildRequestParams(e: CustomEvent<ESLToggleableRequestDetails>): ESLAlertActionParams | null;
protected _onHideRequest(e: CustomEvent<ESLToggleableRequestDetails>): void;
protected _onShowRequest(e: CustomEvent<ESLToggleableRequestDetails>): void;
}
declare global {
export interface ESLLibrary {
Alert: typeof ESLAlert;
}
export interface HTMLElementTagNameMap {
'esl-alert': ESLAlert;
}
}