primeng
Version:
PrimeNG is an open source UI library for Angular featuring a rich set of 80+ components, a theme designer, various theme alternatives such as Material, Bootstrap, Tailwind, premium templates and professional support. In addition, it integrates with PrimeB
111 lines (103 loc) • 3.98 kB
JavaScript
import * as i0 from '@angular/core';
import { Injectable, booleanAttribute, Input, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
import { isEmpty } from '@primeuix/utils';
import { BaseComponent } from 'primeng/basecomponent';
import { BaseStyle } from 'primeng/base';
const css = `
.p-icon {
display: inline-block;
vertical-align: baseline;
}
.p-icon-spin {
-webkit-animation: p-icon-spin 2s infinite linear;
animation: p-icon-spin 2s infinite linear;
}
@-webkit-keyframes p-icon-spin {
0% {
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(359deg);
transform: rotate(359deg);
}
}
@keyframes p-icon-spin {
0% {
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(359deg);
transform: rotate(359deg);
}
}
`;
class BaseIconStyle extends BaseStyle {
name = 'baseicon';
inlineStyles = css;
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: BaseIconStyle, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: BaseIconStyle });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: BaseIconStyle, decorators: [{
type: Injectable
}] });
/**
*
* [Live Demo](https://www.primeng.org/)
*
* @module baseiconstyle
*
*/
var BaseIconClasses;
(function (BaseIconClasses) {
BaseIconClasses["root"] = "p-icon";
})(BaseIconClasses || (BaseIconClasses = {}));
class BaseIcon extends BaseComponent {
label;
spin = false;
styleClass;
role;
ariaLabel;
ariaHidden;
ngOnInit() {
super.ngOnInit();
this.getAttributes();
}
getAttributes() {
const isLabelEmpty = isEmpty(this.label);
this.role = !isLabelEmpty ? 'img' : undefined;
this.ariaLabel = !isLabelEmpty ? this.label : undefined;
this.ariaHidden = isLabelEmpty;
}
getClassNames() {
return `p-icon ${this.styleClass ? this.styleClass + ' ' : ''}${this.spin ? 'p-icon-spin' : ''}`;
}
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: BaseIcon, deps: null, target: i0.ɵɵFactoryTarget.Component });
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "19.2.2", type: BaseIcon, isStandalone: true, selector: "ng-component", inputs: { label: "label", spin: ["spin", "spin", booleanAttribute], styleClass: "styleClass" }, host: { classAttribute: "p-component p-iconwrapper" }, providers: [BaseIconStyle], usesInheritance: true, ngImport: i0, template: ` <ng-content></ng-content> `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: BaseIcon, decorators: [{
type: Component,
args: [{
template: ` <ng-content></ng-content> `,
standalone: true,
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
providers: [BaseIconStyle],
host: {
class: 'p-component p-iconwrapper'
}
}]
}], propDecorators: { label: [{
type: Input
}], spin: [{
type: Input,
args: [{ transform: booleanAttribute }]
}], styleClass: [{
type: Input
}] } });
/**
* Generated bundle index. Do not edit.
*/
export { BaseIcon, BaseIconClasses, BaseIconStyle };
//# sourceMappingURL=primeng-icons-baseicon.mjs.map