wj-elements
Version:
WebJET Elements is a modern set of user interface tools harnessing the power of web components designed to simplify web application development.
85 lines (84 loc) • 2.62 kB
TypeScript
import { default as WJElement } from '../wje-element/element.js';
/**
* `Popup` is a custom web component that represents a popup.
* @summary This element represents a popup.
* @documentation https://elements.webjet.sk/components/popup
* @status stable
* @augments {WJElement}
* @csspart native - The native part of the popup.
* @slot anchor - The slot for the anchor of the popup.
* @slot arrow - The slot for the arrow of the popup.
* @slot - The default slot for the popup.
* // @fires wje-popup:reposition - Event fired when the popup is repositioned.
* // @fires wje-popup:show - Event fired when the popup is shown.
* // @fires wje-popup:hide - Event fired when the popup is hidden.
* @tag wje-popup
*/
export default class Popup extends WJElement {
/**
* Returns the CSS styles for the component.
* @static
* @returns {CSSStyleSheet} The CSS styles for the component.
*/
static get cssStyleSheet(): CSSStyleSheet;
_manual: boolean;
/**
* Sets the manual property of the popup.
* @param {boolean} value The value to set.
*/
set manual(value: boolean);
/**
* Gets the manual property of the popup.
* @returns {boolean} The value of the manual property.
*/
get manual(): boolean;
beforeDraw(context: any, store: any, params: any): void;
/**
* Draws the component for the popup.
* @returns {DocumentFragment}
*/
draw(): DocumentFragment;
slotAnchor: HTMLSlotElement;
slotArrow: HTMLSlotElement;
native: HTMLDivElement;
/**
* After Draws the component.
*/
afterDraw(): void;
/**
* Sets the anchor for the popup.
* Adds a click event listener to the anchor element.
*/
setAnchor(): void;
anchorEl: any;
manualCallback: (e: any) => void;
clickHandler: (e: any) => void;
/**
* Toggles the active attribute of the popup.
*/
showHide(): void;
/**
* Repositions the popup.
* Uses the floating-ui library to compute the position.
*/
reposition(): void;
offsetCalc: number;
arrow: Element;
/**
* Shows the popup.
* Adds the popup-active class to the native element.
* Sets up auto update for repositioning.
*/
show(dispatchEvent?: boolean): void;
cleanup: any;
/**
* Hides the popup.
* Removes the popup-active class from the native element.
* Cleans up the auto update for repositioning.
*/
hide(dispatchEvent?: boolean): void;
/**
* Removes the active attribute when the popup is hidden.
*/
handleHide: () => void;
}