UNPKG

@angular-mdc/web

Version:
105 lines (104 loc) 4.65 kB
import { AfterViewInit, ChangeDetectorRef, ElementRef, EventEmitter, InjectionToken, NgZone, OnDestroy, QueryList } from '@angular/core'; import { Platform } from '@angular/cdk/platform'; import { MDCComponent } from '@angular-mdc/web/base'; import { MdcRipple, MDCRippleCapableSurface } from '@angular-mdc/web/ripple'; import { MdcIcon, MdcIconLocation, MdcIconRegistry } from '@angular-mdc/web/icon'; import { MdcChipSetParentComponent, MdcChipInteractionEvent, MdcChipNavigationEvent, MdcChipRemovalEvent, MdcChipSelectionEvent } from './types'; import { MdcChipPrimaryAction, MdcChipText } from './chip-directives'; import { MDCChipFoundation } from '@material/chips'; /** * Injection token used to provide the parent MdcChipSet component to MdcChip. */ export declare const MDC_CHIPSET_PARENT_COMPONENT: InjectionToken<MdcChipSetParentComponent>; export declare class MdcChipCheckmark { elementRef: ElementRef<HTMLElement>; constructor(elementRef: ElementRef<HTMLElement>); } export declare class MdcChip extends MDCComponent<MDCChipFoundation> implements AfterViewInit, OnDestroy, MDCRippleCapableSurface { private _platform; private _ngZone; private _changeDetectorRef; private _ripple; elementRef: ElementRef<HTMLElement>; private _parent; /** Emits whenever the component is destroyed. */ private _destroyed; _root: Element; private _id; selected?: boolean; /** The unique ID of the chip. */ get id(): string; get leadingIcon(): MdcChipIcon | undefined; get trailingIcon(): MdcChipIcon | undefined; label?: string; get filter(): boolean; set filter(value: boolean); private _filter; get choice(): boolean; set choice(value: boolean); private _choice; get input(): boolean; set input(value: boolean); private _input; /** Determines whether or not the chip displays the remove styling and emits (removed) events. */ get removable(): boolean; set removable(value: boolean); private _removable; get touch(): boolean; set touch(value: boolean); private _touch; /** Whether the chip ripple is disabled. */ get disableRipple(): boolean; set disableRipple(value: boolean); private _disableRipple; /** The value of the chip. Defaults to the content inside `<mdc-chip>` tags. */ get value(): string | undefined; set value(value: string | undefined); protected _value?: string; /** Emitted when the chip is interacted with. */ readonly interactionEvent: EventEmitter<MdcChipInteractionEvent>; /** Emitted when the chip is selected or deselected. */ readonly selectionChange: EventEmitter<MdcChipSelectionEvent>; /** Emitted as chip navigation event. */ readonly navigationEvent: EventEmitter<MdcChipNavigationEvent>; /** Emitted when trailing icon is interacted with. */ readonly trailingIconInteraction: EventEmitter<MdcChipInteractionEvent>; /** Emitted when a chip is to be removed. */ readonly removalEvent: EventEmitter<MdcChipRemovalEvent>; _checkmark?: MdcChipCheckmark; _icons: QueryList<MdcChipIcon>; _primaryAction: MdcChipPrimaryAction; _chipText: MdcChipText; getDefaultFoundation(): MDCChipFoundation; constructor(_platform: Platform, _ngZone: NgZone, _changeDetectorRef: ChangeDetectorRef, _ripple: MdcRipple, elementRef: ElementRef<HTMLElement>, _parent: MdcChipSetParentComponent); ngAfterViewInit(): void; ngOnDestroy(): void; setSelectedFromChipSet(selected: boolean, shouldNotifyClients: boolean): void; /** Allows for programmatic focusing of the chip. */ focus(): void; focusPrimaryAction(): void; focusTrailingAction(): void; removeFocus(): void; /** * Allows for programmatic removal of the chip. * Informs any listeners of the removal request. Does not remove the chip from the DOM. */ remove(): void; _handleInteraction(evt: KeyboardEvent | MouseEvent): void; _onKeydown(evt: KeyboardEvent): void; _handleTrailingIconInteraction(evt: KeyboardEvent | MouseEvent): void; private _createRipple; private _setVariantFromChipSet; private _loadListeners; } export declare class MdcChipIcon extends MdcIcon { private _parentChip; get leading(): boolean; set leading(value: boolean); private _leading; get trailing(): boolean; set trailing(value: boolean); private _trailing; constructor(_parentChip: MdcChip, elementRef: ElementRef<HTMLElement>, iconRegistry: MdcIconRegistry, ariaHidden: string, location?: MdcIconLocation); _onIconInteraction(evt: KeyboardEvent | MouseEvent): void; }