UNPKG

@sixbell-telco/sdk

Version:

A collection of reusable components designed for use in Sixbell Telco Angular projects

56 lines (55 loc) 2 kB
import { ElementRef } from '@angular/core'; import * as i0 from "@angular/core"; /** * Directive that detects clicks outside of an element and emits an event when they occur. * * This directive is useful for implementing dismissible UI components like dropdowns, * modals, and popups that should close when a user clicks outside of them. * * @example * ```html * <!-- Basic usage --> * <div stClickOutside (outsideClick)="closeDropdown()"> * Dropdown content * </div> * * <!-- With conditional behavior --> * <div stClickOutside (outsideClick)="isOpen ? closeDropdown() : null"> * Dropdown content that only closes when open * </div> * ``` * * @usageNotes * The directive emits the `outsideClick` event when a click occurs outside * the element it's attached to. It does not automatically hide or modify * the element - you need to handle that in your component logic. * * Common use cases include: * - Closing dropdowns when clicking elsewhere on the page * - Dismissing modals when clicking outside the modal content * - Hiding tooltips or popovers when clicking outside * * @publicApi */ export declare class ClickOutsideDirective { private elementRef; /** * Event emitted when a click occurs outside the element. * * @example * ```html * <div stClickOutside (outsideClick)="handleOutsideClick()">...</div> * ``` */ outsideClick: import("@angular/core").OutputEmitterRef<void>; constructor(elementRef: ElementRef); /** * Listens for clicks on the document and determines if they occurred * outside the element this directive is attached to. * * @param event The mouse event from the document click */ clickedOutside(event: MouseEvent): void; static ɵfac: i0.ɵɵFactoryDeclaration<ClickOutsideDirective, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<ClickOutsideDirective, "[stClickOutside]", never, {}, { "outsideClick": "outsideClick"; }, never, never, true, never>; }