{"version":3,"file":"igniteui-angular-badge.mjs","names":[],"sources":["../../../projects/igniteui-angular/badge/src/badge/badge.component.ts","../../../projects/igniteui-angular/badge/src/badge/badge.component.html","../../../projects/igniteui-angular/badge/src/badge/badge.module.ts"],"sourcesContent":["import { booleanAttribute, Component, HostBinding, Input, ChangeDetectionStrategy, ViewEncapsulation } from '@angular/core';\nimport { IgxIconComponent } from 'igniteui-angular/icon';\n\nlet NEXT_ID = 0;\n\n/**\n * Determines the igxBadge type\n */\nexport const IgxBadgeType = {\n    PRIMARY: 'primary',\n    INFO: 'info',\n    SUCCESS: 'success',\n    WARNING: 'warning',\n    ERROR: 'error'\n} as const;\nexport type IgxBadgeType = (typeof IgxBadgeType)[keyof typeof IgxBadgeType];\n/**\n * Badge provides visual notifications used to decorate avatars, menus, etc.\n *\n * @igxModule IgxBadgeModule\n *\n * @igxTheme igx-badge-theme\n *\n * @igxKeywords badge, icon, notification\n *\n * @igxGroup Data Entry & Display\n *\n * @remarks\n * The Ignite UI Badge is used to decorate avatars, navigation menus, or other components in the\n * application when visual notification is needed. They are usually designed as icons with a predefined\n * style to communicate information, success, warnings, or errors.\n *\n * @example\n * ```html\n * <div class=\"avatar-badge-container\">\n *  <igx-avatar icon=\"person\" shape=\"circle\" size=\"small\"></igx-avatar>\n *  <igx-badge icon=\"check\" type=\"success\" shape=\"square\"></igx-badge>\n * </div>\n * ```\n */\n@Component({\n    selector: 'igx-badge',\n    styleUrl: 'badge.component.css',\n    templateUrl: 'badge.component.html',\n    encapsulation: ViewEncapsulation.None,\n    changeDetection: ChangeDetectionStrategy.Eager,\n    imports: [IgxIconComponent]\n})\nexport class IgxBadgeComponent {\n\n   /**\n    * Sets/gets the `id` of the badge.\n    *\n    * @remarks\n    * If not set, the `id` will have value `\"igx-badge-0\"`.\n    *\n    * @example\n    * ```html\n    * <igx-badge id=\"igx-badge-2\"></igx-badge>\n    * ```\n    */\n    @HostBinding('attr.id')\n    @Input()\n    public id = `igx-badge-${NEXT_ID++}`;\n\n   /**\n    * Sets/gets the type of the badge.\n    *\n    * @remarks\n    * Allowed values are `primary`, `info`, `success`, `warning`, `error`.\n    * Providing an invalid value won't display a badge.\n    *\n    * @example\n    * ```html\n    * <igx-badge type=\"success\"></igx-badge>\n    * ```\n    */\n    @Input()\n    public type: string | IgxBadgeType = IgxBadgeType.PRIMARY;\n\n   /**\n    * Sets/gets the value to be displayed inside the badge.\n    *\n    * @remarks\n    * If neither a `value` nor an `icon` is set the content of the badge will be empty.\n    *\n    * @example\n    * ```html\n    * <igx-badge value=\"11\"></igx-badge>\n    * ```\n    */\n    @Input()\n    public value: string | number = '';\n\n    /**\n     * Sets/gets an icon for the badge from the material icons set.\n     *\n     * @remarks\n     * If neither a `value` nor an `icon` is set the content of the badge will be empty.\n     * Providing an invalid value won't display anything.\n     *\n     * @example\n     * ```html\n     * <igx-badge icon=\"check\"></igx-badge>\n     * ```\n     */\n    @Input()\n    public icon!: string;\n\n    /**\n     * The name of the icon set. Used in case the icon is from a different icon set.\n     */\n    @Input()\n    public iconSet!: string;\n\n    /**\n     * Sets/gets the role attribute value.\n     *\n     * @example\n     * ```typescript\n     * @ViewChild(\"MyBadge\", { read: IgxBadgeComponent })\n     * public badge: IgxBadgeComponent;\n     *\n     * badge.role = 'status';\n     * ```\n     */\n    @HostBinding('attr.role')\n    public role = 'status';\n\n    /**\n     * Sets/gets the css class to use on the badge.\n     *\n     * @example\n     * ```typescript\n     * @ViewChild(\"MyBadge\", { read: IgxBadgeComponent })\n     * public badge: IgxBadgeComponent;\n     *\n     * badge.cssClass = 'my-badge-class';\n     * ```\n     */\n    @HostBinding('class.igx-badge')\n    public cssClass = 'igx-badge';\n\n    /**\n     * Sets a square shape to the badge, if `shape` is set to `square`.\n     * By default the shape of the badge is rounded.\n     *\n     * @example\n     * ```html\n     * <igx-badge shape=\"square\"></igx-badge>\n     * ```\n     */\n    @Input()\n    public shape: 'rounded' | 'square' = 'rounded';\n\n    /** @hidden @internal */\n    @HostBinding('class.igx-badge--square')\n    public get _squareShape(): boolean {\n        if (!this.dot) {\n            return this.shape === 'square';\n        }\n        return undefined!;\n    }\n\n    /**\n     * Sets/gets the aria-label attribute value.\n     *\n     * @example\n     * ```typescript\n     * @ViewChild(\"MyBadge\", { read: IgxBadgeComponent })\n     * public badge: IgxBadgeComponent;\n     *\n     * badge.label = 'badge';\n     * ```\n     */\n    @HostBinding('attr.aria-label')\n    public label = 'badge';\n\n    /**\n     * Sets/gets whether the badge is outlined.\n     * Default value is `false`.\n     *\n     * @example\n     * ```html\n     * <igx-badge outlined></igx-badge>\n     * ```\n     */\n    @Input({transform: booleanAttribute})\n    @HostBinding('class.igx-badge--outlined')\n    public outlined = false;\n\n    /**\n     * Sets/gets whether the badge is displayed as a dot.\n     * When true, the badge will be rendered as a minimal 8px indicator without any content.\n     * Default value is `false`.\n     *\n     * @example\n     * ```html\n     * <igx-badge dot type=\"success\"></igx-badge>\n     * ```\n     */\n    @Input({transform: booleanAttribute})\n    @HostBinding('class.igx-badge--dot')\n    public dot = false;\n\n    /**\n     * Defines a human-readable, accessor, author-localized description for\n     * the `type` and the `icon` or `value` of the element.\n     *\n     * @hidden\n     * @internal\n     */\n    @HostBinding('attr.aria-roledescription')\n    public get roleDescription() {\n        if (this.icon) {\n            return this.type + ' type badge with icon type ' + this.icon;\n        } else if (this.value || this.value === 0) {\n            return this.type + ' badge type with value ' + this.value;\n        }\n        return this.type + ' badge type without value';\n    }\n\n    @HostBinding('class.igx-badge--info')\n    public get infoClass() {\n        return this.type === IgxBadgeType.INFO;\n    }\n\n    @HostBinding('class.igx-badge--success')\n    public get successClass() {\n        return this.type === IgxBadgeType.SUCCESS;\n    }\n\n    @HostBinding('class.igx-badge--warning')\n    public get warningClass() {\n        return this.type === IgxBadgeType.WARNING;\n    }\n\n    @HostBinding('class.igx-badge--error')\n    public get errorClass() {\n        return this.type === IgxBadgeType.ERROR;\n    }\n}\n","@if (value || value === 0 && !icon) {\n    <span class=\"igx-badge__value\">{{value}}</span>\n}\n@if (icon && !iconSet) {\n    <igx-icon>{{icon}}</igx-icon>\n}\n@if (icon && iconSet) {\n    <igx-icon [family]=\"iconSet\" [name]=\"icon\">{{icon}}</igx-icon>\n}\n<ng-content></ng-content>\n","import { NgModule } from '@angular/core';\nimport { IgxBadgeComponent } from './badge.component';\n\n/**\n * @hidden\n * IMPORTANT: The following is NgModule exported for backwards-compatibility before standalone components\n */\n@NgModule({\n    exports: [IgxBadgeComponent],\n    imports: [IgxBadgeComponent]\n})\nexport class IgxBadgeModule { }\n"],"mappings":";;;AAGA,IAAI,UAAU;AAKd,MAAa,eAAe;CACxB,SAAS;CACT,MAAM;CACN,SAAS;CACT,SAAS;CACT,OAAO;AACD;AAkCV,IAAa,oBAAb,MAAa,kBAAiB;CAR9B,cAAA;EAuBW,KAAA,KAAK,aAAa;EAelB,KAAA,OAA8B,aAAa;EAc3C,KAAA,QAAyB;EAmCzB,KAAA,OAAO;EAcP,KAAA,WAAW;EAYX,KAAA,QAA8B;EAuB9B,KAAA,QAAQ;EAaR,KAAA,WAAW;EAcX,KAAA,MAAM;CAsChB;CArFG,IACW,eAAY;EACnB,IAAI,CAAC,KAAK,KACN,OAAO,KAAK,UAAU;CAG9B;CAkDA,IACW,kBAAe;EACtB,IAAI,KAAK,MACL,OAAO,KAAK,OAAO,gCAAgC,KAAK;OACrD,IAAI,KAAK,SAAS,KAAK,UAAU,GACpC,OAAO,KAAK,OAAO,4BAA4B,KAAK;EAExD,OAAO,KAAK,OAAO;CACvB;CAEA,IACW,YAAS;EAChB,OAAO,KAAK,SAAS,aAAa;CACtC;CAEA,IACW,eAAY;EACnB,OAAO,KAAK,SAAS,aAAa;CACtC;CAEA,IACW,eAAY;EACnB,OAAO,KAAK,SAAS,aAAa;CACtC;CAEA,IACW,aAAU;EACjB,OAAO,KAAK,SAAS,aAAa;CACtC;CAhMS;EAAA,KAAA,OAAA,GAAA,mBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;GAAi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