UNPKG

@progress/kendo-angular-icons

Version:

Kendo UI Angular component starter template

69 lines (68 loc) 3.13 kB
/**----------------------------------------------------------------------------------------- * Copyright © 2025 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the project root for more information *-------------------------------------------------------------------------------------------*/ import { Component, ElementRef, Input, Renderer2, HostBinding } from '@angular/core'; import { isDocumentAvailable } from '@progress/kendo-angular-common'; import { IconBaseDirective } from '../common/icon-base'; import * as i0 from "@angular/core"; /** * Represents the [Kendo UI Icon component for Angular](slug:overview_icon). * Used to display icons from the [Kendo UI Icons](slug:icon_list) collection. * * @example * ```html * <kendo-icon name="home"></kendo-icon> * ``` */ export class IconComponent extends IconBaseDirective { element; renderer; hostClass = true; hostAriaHidden = true; /** * Sets the `Icon` to render. Supports all [Kendo UI Icons](slug:icon_list). */ set name(name) { if (isDocumentAvailable()) { const newName = name !== this._name; if (newName) { const element = this.element.nativeElement; this.renderer.removeClass(element, `k-i-${this.name}`); this.renderer.addClass(element, `k-i-${name}`); } } this._name = name; } get name() { return this._name; } _name; constructor(element, renderer) { super(element, renderer); this.element = element; this.renderer = renderer; } static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: IconComponent, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component }); static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: IconComponent, isStandalone: true, selector: "kendo-icon", inputs: { name: "name" }, host: { properties: { "class.k-icon": "this.hostClass", "class.k-font-icon": "this.hostClass", "attr.aria-hidden": "this.hostAriaHidden" } }, exportAs: ["kendoIcon"], usesInheritance: true, ngImport: i0, template: '', isInline: true }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: IconComponent, decorators: [{ type: Component, args: [{ exportAs: 'kendoIcon', selector: 'kendo-icon', template: '', standalone: true }] }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }], propDecorators: { hostClass: [{ type: HostBinding, args: ['class.k-icon'] }, { type: HostBinding, args: ['class.k-font-icon'] }], hostAriaHidden: [{ type: HostBinding, args: ['attr.aria-hidden'] }], name: [{ type: Input }] } });