UNPKG

@blox/material

Version:

Material Components for Angular

165 lines (164 loc) 6.41 kB
import { AfterContentInit, ElementRef, EventEmitter, OnDestroy, Renderer2, ChangeDetectorRef } from '@angular/core'; import { AbstractMdcRipple } from '../ripple/abstract.mdc.ripple'; import { MdcEventRegistry } from '../../utils/mdc.event.registry'; export declare enum ChipEventSource { primary = 0, trailing = 1, none = 2 } /** * Directive for the (optional) leading or trailing icon of an `mdcChip`. * Depending on the position within the `mdcChip` the icon will determine * whether it is a leading or trailing icon. * Trailing icons must implement the functionality to remove the chip from the set, and * must only be added to input chips (`mdcChipSet="input"`). Chips with a trailing * icon must implement the `remove` event. Trailing icons should be wrapped * inside an `mdcChipCell`. */ export declare class MdcChipIconDirective { _elm: ElementRef; private _rndr; _cdRef: ChangeDetectorRef; /** * Event emitted for trailing icon user interactions. Please note that chip removal should be * handled by the `remove` output of the chip, *not* by a handler for this output. */ readonly interact: EventEmitter<void>; private _originalTabindex; private __tabindex; private __role; constructor(_elm: ElementRef, _rndr: Renderer2, _cdRef: ChangeDetectorRef); ngOnDestroy(): void; } /** * Directive for the text of an `mdcChip`. Must be contained in an `mdcChipPrimaryAction` * directive. */ export declare class MdcChipTextDirective { _elm: ElementRef; readonly _cls = true; constructor(_elm: ElementRef); } /** * Directive for the primary action element of a chip. The `mdcChipPrimaryAction` must * contain the `mdcChipText` directive, and be contained by an `mdcChipCell` directive. */ export declare class MdcChipPrimaryActionDirective { _elm: ElementRef; private __tabindex; constructor(_elm: ElementRef); } /** * Directive for the main content of a chip, or for an optional trailing * action on `input` chips. This directive must contain an * `mdcChipPrimaryActione` or an `mdcChipIcon` (when used for the trailing action). * An `mdcChipCell` must always be the direct child of an `mdcChip`. */ export declare class MdcChipCellDirective { _elm: ElementRef; constructor(_elm: ElementRef); } /** * Directive for a chip. Chips must be child elements of an `mdcChipSet`, * and must contain an `mdcChipCell`, and may additionally contain an `mdcChipIcon` for * the leading icon. An optional trailing icon must be wrapped in a second `mdcChipCell`. */ export declare class MdcChipDirective extends AbstractMdcRipple implements AfterContentInit, OnDestroy { private _elm; private initialized; private selectedMem; private removableMem; private _uniqueValue; private _value; /** * Event emitted for user interaction with the chip. */ readonly interact: EventEmitter<void>; /** * Event emitted when the user has removed (by clicking the trailing icon) the chip. * This event must be implemented when the `removable` property is set, and the chip * has a trailing icon. The implementation must remove the chip from the set. * Without such implementation the directive will animate the chip out of vision, * but will not remove the chip from the DOM. */ readonly remove: EventEmitter<void>; /** * Event emitted when a navigation event has occured. */ readonly navigation: EventEmitter<{ key: string; source: ChipEventSource; }>; /** * Event emitted when the chip changes from not-selected to selected state or vice versa * (for filter and choice chips). */ readonly selectedChange: EventEmitter<boolean>; private _checkmark; private _leadingIcon; private _trailingIcon; private _adapter; constructor(_elm: ElementRef, rndr: Renderer2, registry: MdcEventRegistry, doc: any); ngAfterContentInit(): void; ngOnDestroy(): void; private initActions; private initIcons; private get _text(); private get _primaryAction(); private get _chipCell(); private computeLeadingIcon; private computeTrailingIcon; private previousElement; private initCheckMark; private addCheckMark; private removeCheckMark; /** * The value the chip represents. The value must be unique for the `mdcChipSet`. If you do not provide a value * a unique value will be computed automatically. */ get value(): string; set value(val: string); /** * The 'selected' state of the chip. Filter and choice chips are either selected or * not selected. Making a choice chip selected, will make all other chips in that set * not selected. */ get selected(): boolean; set selected(val: boolean); static ngAcceptInputType_selected: boolean | ''; /** * If set to a value other than `false`, clicking the trailing icon will animate the * chip out of view, and then emit the `remove` output. */ get removable(): boolean; set removable(val: boolean); static ngAcceptInputType_removable: boolean | ''; /** @docs-private */ protected computeRippleBoundingRect(): ClientRect; } /** * Directive for a chip-set (a collection of <code>mdcChip</code>). */ export declare class MdcChipSetDirective implements AfterContentInit, OnDestroy { private _elm; private cdRef; private _subscriptions; private _initialized; constructor(_elm: ElementRef, cdRef: ChangeDetectorRef); ngAfterContentInit(): void; ngOnDestroy(): void; /** * Chip sets by default contain 'action' chips. Set this value to <code>choice</code>, * <code>filter</code>, <code>input</code>, or <code>action</code> to determine the kind * of chips that are contained in the chip set. */ get mdcChipSet(): 'choice' | 'filter' | 'input' | 'action'; set mdcChipSet(value: 'choice' | 'filter' | 'input' | 'action'); static ngAcceptInputType_mdcChipSet: 'choice' | 'filter' | 'input' | 'action' | ''; private initChips; private destroySubscriptions; private initSubscriptions; private chip; private findChipIndex; } export declare const CHIP_DIRECTIVES: (typeof MdcChipIconDirective | typeof MdcChipTextDirective | typeof MdcChipCellDirective | typeof MdcChipDirective | typeof MdcChipSetDirective)[];