UNPKG

ngx-mat-lib

Version:

A bunch of utilities and components to use in your Angular 7+ apps!

50 lines (49 loc) 2 kB
import { AriaDescriber } from "@angular/cdk/a11y"; import { ElementRef, NgZone, OnDestroy, Renderer2 } from "@angular/core"; import { ThemePalette } from "@angular/material/core"; export declare type XmatBadgePosition = "above after" | "above before" | "below before" | "below after"; export declare type XmatBadgeSize = "small" | "medium" | "large"; /** Directive to display a text badge. */ export declare class XmatBadgeDirective implements OnDestroy { private _ngZone; private _ariaDescriber; private _renderer; static nextId: number; size: XmatBadgeSize; position: XmatBadgePosition; /** The color of the badge. Can be `primary`, `accent`, or `warn`. */ color: ThemePalette; /** Whether the badge should overlap its contents or not */ overlap: boolean; /** The content for the badge */ content: string; /** Message used to describe the decorated element via aria-describedby */ description: string; /** Whether the badge is hidden. */ hidden: boolean; /** Whether the badge has any content. */ hasContent: boolean; /** Unique id for the badge */ id: number; private _badgeElement; private _color; private _content; private _description; private _elementRef; private _hidden; private _overlap; constructor(_ngZone: NgZone, _ariaDescriber: AriaDescriber, _renderer: Renderer2, elementRef: ElementRef); /** Whether the badge is above the host or not */ isAbove(): boolean; /** Whether the badge is after the host or not */ isAfter(): boolean; ngOnDestroy(): void; /** Injects a span element into the DOM with the content. */ private _updateTextContent; /** Creates the badge element */ private _createBadgeElement; /** Adds css theme class given the color to the component host */ private _setColor; /** Sets the aria-label property on the element */ private _updateHostAriaDescription; }