import * as i0 from '@angular/core';
import { OnInit, OnChanges, OnDestroy, ElementRef } from '@angular/core';
import { SafeHtml } from '@angular/platform-browser';
import { Observable } from 'rxjs';
import { IgxTheme } from 'igniteui-angular/core';
import { IMXIcon } from '@igniteui/material-icons-extended';
type IconType = "svg" | "font" | "liga";
type IconReference = IconMeta & FamilyMeta;
interface IconMeta {
name: string;
family: string;
type?: IconType;
/** @hidden @internal */
external?: boolean;
}
interface FamilyMeta {
className: string;
type: IconType;
prefix?: string;
}
interface IconFamily {
name: string;
meta: FamilyMeta;
}
/**
* Icon provides a way to include material icons to markup
*
* @igxModule IgxIconModule
*
* @igxTheme igx-icon-theme
*
* @igxKeywords icon, picture
*
* @igxGroup Display
*
* @remarks
*
* The Ignite UI Icon makes it easy for developers to include material design icons directly in their markup. The icons
* support different icon families and can be marked as active or disabled using the `active` property. This will change the appearance
* of the icon.
*
* @example
* ```html
* home
* ```
*/
declare class IgxIconComponent implements OnInit, OnChanges, OnDestroy {
el: ElementRef;
private iconService;
private ref;
private _iconRef;
private _destroy$;
private _userClasses;
private _iconClasses;
protected get elementClasses(): string;
private addIconClass;
private clearIconClasses;
/**
* An accessor that returns inactive property.
*
* @example
* ```typescript
* @ViewChild("MyIcon")
* public icon: IgxIconComponent;
* ngAfterViewInit() {
* let iconActive = this.icon.getInactive;
* }
* ```
*/
get getInactive(): boolean;
/**
* The `aria-hidden` attribute of the icon.
* By default is set to 'true'.
*/
ariaHidden: boolean;
/**
* An @Input property that sets the value of the `family`. By default it's "material".
*
* @example
* ```html
* settings
* ```
*/
family: string;
/**
* Set the `name` of the icon.
*
* @example
* ```html
*
* ```
*/
name: string;
/**
* An @Input property that allows you to disable the `active` property. By default it's applied.
*
* @example
* ```html
* settings
* ```
*/
active: boolean;
constructor();
/**
* @hidden
* @internal
*/
ngOnInit(): void;
/**
* @hidden
* @internal
*/
ngOnChanges(): void;
/**
* @hidden
* @internal
*/
ngOnDestroy(): void;
protected get iconRef(): IconReference;
protected set iconRef(ref: IconReference);
/**
* An accessor that returns the value of the family property.
*
* @example
* ```typescript
* @ViewChild("MyIcon")
* public icon: IgxIconComponent;
* ngAfterViewInit() {
* let iconFamily = this.icon.getFamily;
* }
* ```
*/
get getFamily(): string;
/**
* An accessor that returns the value of the active property.
*
* @example
* ```typescript
* @ViewChild("MyIcon")
* public icon: IgxIconComponent;
* ngAfterViewInit() {
* let iconActive = this.icon.getActive;
* }
* ```
*/
get getActive(): boolean;
/**
* An accessor that returns the value of the iconName property.
*
* @example
* ```typescript
* @ViewChild("MyIcon")
* public icon: IgxIconComponent;
* ngAfterViewInit() {
* let name = this.icon.getName;
* }
* ```
*/
get getName(): string;
/**
* An accessor that returns the underlying SVG image as SafeHtml.
*
* @example
* ```typescript
* @ViewChild("MyIcon")
* public icon: IgxIconComponent;
* ngAfterViewInit() {
* let svg: SafeHtml = this.icon.getSvg;
* }
* ```
*/
get getSvg(): SafeHtml;
/**
* @hidden
* @internal
*/
private setIcon;
static ɵfac: i0.ɵɵFactoryDeclaration;
static ɵcmp: i0.ɵɵComponentDeclaration;
static ngAcceptInputType_active: unknown;
}
/**
* Event emitted when a SVG icon is loaded through
* a HTTP request.
*/
interface IgxIconLoadedEvent {
/** Name of the icon */
name: string;
/** The actual SVG text, if any */
value?: string;
/** The font-family for the icon. Defaults to material. */
family: string;
}
/**
* **Ignite UI for Angular Icon Service** -
*
* The Ignite UI Icon Service makes it easy for developers to include custom SVG images and use them with IgxIconComponent.
* In addition it could be used to associate a custom class to be applied on IgxIconComponent according to given font-family.
*
* Example:
* ```typescript
* this.iconService.setFamily('material', { className: 'material-icons', type: 'font' });
* this.iconService.addSvgIcon('aruba', '/assets/svg/country_flags/aruba.svg', 'svg-flags');
* ```
*/
declare class IgxIconService {
private _sanitizer;
private _httpClient;
private _platformUtil;
private _themeToken;
private _destroyRef;
protected document: Document;
/**
* Observable that emits when an icon is successfully loaded
* through a HTTP request.
*
* @example
* ```typescript
* this.service.iconLoaded.subscribe((ev: IgxIconLoadedEvent) => ...);
* ```
*/
iconLoaded: Observable;
private _defaultFamily;
private _iconRefs;
private _families;
private _cachedIcons;
private _iconLoaded;
private _domParser;
constructor();
/**
* Returns the default font-family.
* ```typescript
* const defaultFamily = this.iconService.defaultFamily;
* ```
*/
get defaultFamily(): IconFamily;
/**
* Sets the default font-family.
* ```typescript
* this.iconService.defaultFamily = 'svg-flags';
* ```
*/
set defaultFamily(family: IconFamily);
/**
* Registers a custom class to be applied to IgxIconComponent for a given font-family.
* ```typescript
* this.iconService.registerFamilyAlias('material', 'material-icons');
* ```
* @deprecated in version 18.1.0. Use `setFamily` instead.
*/
registerFamilyAlias(alias: string, className?: string, type?: IconType): this;
/**
* Returns the custom class, if any, associated to a given font-family.
* ```typescript
* const familyClass = this.iconService.familyClassName('material');
* ```
*/
familyClassName(alias: string): string;
/** @hidden @internal */
private familyType;
/** @hidden @internal */
setRefsByTheme(theme: IgxTheme): void;
/**
* Creates a family to className relationship that is applied to the IgxIconComponent
* whenever that family name is used.
* ```typescript
* this.iconService.setFamily('material', { className: 'material-icons', type: 'liga' });
* ```
*/
setFamily(name: string, meta: FamilyMeta): void;
/**
* Adds an icon reference meta for an icon in a meta family.
* Executes only if no icon reference is found.
* ```typescript
* this.iconService.addIconRef('aruba', 'default', { name: 'aruba', family: 'svg-flags' });
* ```
*/
addIconRef(name: string, family: string, icon: IconMeta): void;
private _setIconRef;
/**
* Similar to addIconRef, but always sets the icon reference meta for an icon in a meta family.
* ```typescript
* this.iconService.setIconRef('aruba', 'default', { name: 'aruba', family: 'svg-flags' });
* ```
*/
setIconRef(name: string, family: string, icon: IconMeta): void;
/**
* Returns the icon reference meta for an icon in a given family.
* ```typescript
* const iconRef = this.iconService.getIconRef('aruba', 'default');
* ```
*/
getIconRef(name: string, family: string): IconReference;
private getOrCreateSvgFamily;
/**
* Adds an SVG image to the cache. SVG source is an url.
* ```typescript
* this.iconService.addSvgIcon('aruba', '/assets/svg/country_flags/aruba.svg', 'svg-flags');
* ```
*/
addSvgIcon(name: string, url: string, family?: string, stripMeta?: boolean): void;
/**
* Adds an SVG image to the cache. SVG source is its text.
* ```typescript
* this.iconService.addSvgIconFromText('simple', '', 'svg-flags');
* ```
*/
addSvgIconFromText(name: string, iconText: string, family?: string, stripMeta?: boolean): void;
/**
* Returns whether a given SVG image is present in the cache.
* ```typescript
* const isSvgCached = this.iconService.isSvgIconCached('aruba', 'svg-flags');
* ```
*/
isSvgIconCached(name: string, family: string): boolean;
/**
* Returns the cached SVG image as string.
* ```typescript
* const svgIcon = this.iconService.getSvgIcon('aruba', 'svg-flags');
* ```
*/
getSvgIcon(name: string, family: string): SafeHtml;
/**
* @hidden
*/
private fetchSvg;
/**
* @hidden
*/
private cacheSvgIcon;
static ɵfac: i0.ɵɵFactoryDeclaration;
static ɵprov: i0.ɵɵInjectableDeclaration;
}
declare const IndigoIcons: Map;
/**
* @hidden
* @deprecated
* IMPORTANT: The following is NgModule exported for backwards-compatibility before standalone components
*/
declare class IgxIconModule {
static ɵfac: i0.ɵɵFactoryDeclaration;
static ɵmod: i0.ɵɵNgModuleDeclaration;
static ɵinj: i0.ɵɵInjectorDeclaration;
}
export { IgxIconComponent, IgxIconModule, IgxIconService, IndigoIcons };
export type { FamilyMeta, IconFamily, IconMeta, IconReference, IgxIconLoadedEvent };