carbon-components-angular
Version:
Next generation components
114 lines (110 loc) • 4.15 kB
TypeScript
/**
*
* carbon-angular v0.0.0 | popover.directive.d.ts
*
* Copyright 2014, 2025 IBM
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { AfterViewInit, ChangeDetectorRef, ElementRef, EventEmitter, NgZone, OnChanges, OnDestroy, Renderer2, SimpleChanges } from "@angular/core";
import { Placement } from "@floating-ui/dom";
import * as i0 from "@angular/core";
declare type oldPlacement = "top-left" | "top-right" | "bottom-left" | "bottom-right" | "left-bottom" | "left-top" | "right-bottom" | "right-top";
export declare class PopoverContainer implements AfterViewInit, OnChanges, OnDestroy {
protected elementRef: ElementRef;
protected ngZone: NgZone;
protected renderer: Renderer2;
protected changeDetectorRef: ChangeDetectorRef;
/**
* Set alignment of popover
* As of v5, `oldPlacements` are now deprecated in favor of Placements
*
* When `autoAlign` is set to `true`, alignment may change for best placement
*/
set align(alignment: oldPlacement | Placement);
_align: Placement;
readonly alignmentClassPrefix = "cds--popover--";
/**
* Emits an event when the dialog is closed
*/
onClose: EventEmitter<Event>;
/**
* Emits an event when the dialog is opened
*/
onOpen: EventEmitter<Event>;
/**
* Emits an event when the state of `isOpen` changes. Allows `isOpen` to be double bound
*/
isOpenChange: EventEmitter<boolean>;
/**
* Show caret at the alignment position
*/
caret: boolean;
/**
* Enable drop shadow around the popover container
*/
dropShadow: boolean;
/**
* Enable high contrast for popover container
*/
highContrast: boolean;
/**
* **Experimental**: Use floating-ui to position the tooltip
* This is not toggleable - should be assigned once
*/
autoAlign: boolean;
containerClass: boolean;
isOpen: boolean;
protected popoverContentRef: HTMLElement;
protected caretRef: HTMLElement;
protected caretOffset: number;
protected caretHeight: number;
protected unmountFloatingElement: Function;
constructor(elementRef: ElementRef, ngZone: NgZone, renderer: Renderer2, changeDetectorRef: ChangeDetectorRef);
/**
* Handles emitting open/close event
* @param open - Is the popover container open
* @param event - Event
*/
handleChange(open: boolean, event?: Event): void;
roundByDPR(value: any): number;
/**
* Compute position of tooltip when autoAlign is enabled
*/
recomputePosition(): void;
/**
* Close the popover and reopen it with updated values without emitting an event
* @param changes
*/
ngOnChanges(changes: SimpleChanges): void;
/**
* Handle initialization of element
*/
ngAfterViewInit(): void;
initializeReferences(): void;
/**
* Clean up
*/
ngOnDestroy(): void;
/**
* Clean up `autoUpdate` if auto alignment is enabled
*/
cleanUp(): void;
/**
* Replace existing previous alignment class with new
* @param previousAlignment
*/
updateAlignmentClass(newAlignment: string, previousAlignment?: string): void;
static ɵfac: i0.ɵɵFactoryDeclaration<PopoverContainer, never>;
static ɵdir: i0.ɵɵDirectiveDeclaration<PopoverContainer, "[cdsPopover], [ibmPopover]", never, { "align": "align"; "caret": "caret"; "dropShadow": "dropShadow"; "highContrast": "highContrast"; "autoAlign": "autoAlign"; "isOpen": "isOpen"; }, { "onClose": "onClose"; "onOpen": "onOpen"; "isOpenChange": "isOpenChange"; }, never, never, false>;
}
export {};