1 | /**
|
2 | * @license
|
3 | * Copyright Akveo. All Rights Reserved.
|
4 | * Licensed under the MIT License. See License.txt in the project root for license information.
|
5 | */
|
6 | import { ElementRef, OnChanges, OnInit, Renderer2 } from '@angular/core';
|
7 | import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
|
8 | import { NbStatusService } from '../../services/status.service';
|
9 | import { NbComponentOrCustomStatus } from '../component-status';
|
10 | import { NbIconLibraries } from './icon-libraries';
|
11 | import * as i0 from "@angular/core";
|
12 | export interface NbIconConfig {
|
13 | icon: string;
|
14 | pack?: string;
|
15 | status?: NbComponentOrCustomStatus;
|
16 | options?: {
|
17 | [name: string]: any;
|
18 | };
|
19 | }
|
20 | /**
|
21 | * Icon component. Allows to render both `svg` and `font` icons.
|
22 | * Starting from Nebular 4.0 uses [Eva Icons](https://akveo.github.io/eva-icons/) pack by default.
|
23 | *
|
24 | * Basic icon example:
|
25 | * @stacked-example(Showcase, icon/icon-showcase.component)
|
26 | *
|
27 | * Icon configuration:
|
28 | *
|
29 | * ```html
|
30 | * <nb-icon icon="star"></nb-icon>
|
31 | * ```
|
32 | * ### Installation
|
33 | *
|
34 | * By default Nebular comes without any pre-installed icon pack.
|
35 | * Starting with Nebular 4.0.0 we ship separate package called `@nebular/eva-icons`
|
36 | * which integrates SVG [Eva Icons](https://akveo.github.io/eva-icons/) pack to Nebular. To add it to your
|
37 | * project run:
|
38 | * ```sh
|
39 | * npm i eva-icons @nebular/eva-icons
|
40 | * ```
|
41 | * This command will install Eva Icons pack. Then register `NbEvaIconsModule` into your app module:
|
42 | * ```ts
|
43 | * import { NbEvaIconsModule } from '@nebular/eva-icons';
|
44 | *
|
45 | * @NgModule({
|
46 | * imports: [
|
47 | * // ...
|
48 | * NbEvaIconsModule,
|
49 | * ],
|
50 | * })
|
51 | * export class AppModule { }
|
52 | * ```
|
53 | * Last thing, import `NbIconModule` to your feature module where you need to show an icon:
|
54 | * ```ts
|
55 | * import { NbIconModule } from '@nebular/theme';
|
56 | *
|
57 | * @NgModule({
|
58 | * imports: [
|
59 | * // ...
|
60 | * NbIconModule,
|
61 | * ],
|
62 | * })
|
63 | * export class PageModule { }
|
64 | * ```
|
65 | * ### Usage
|
66 | *
|
67 | * Icon can be colored using `status` input:
|
68 | * ```html
|
69 | * <nb-icon icon="star" status="warning"></nb-icon>
|
70 | * ```
|
71 | *
|
72 | * Colored icons:
|
73 | * @stacked-example(Colored Icons, icon/icon-colors.component)
|
74 | *
|
75 | * In case you need to specify an icon from a specific icon pack, this could be done using `pack` input property:
|
76 | * ```html
|
77 | * <nb-icon icon="star" pack="font-awesome"></nb-icon>
|
78 | * ```
|
79 | * Additional icon settings (if available by the icon pack) could be passed using `options` input:
|
80 | *
|
81 | * ```html
|
82 | * <nb-icon icon="star" [options]="{ animation: { type: 'zoom' } }"></nb-icon>
|
83 | * ```
|
84 | *
|
85 | * @styles
|
86 | *
|
87 | * icon-font-size:
|
88 | * icon-line-height:
|
89 | * icon-width:
|
90 | * icon-height:
|
91 | * icon-svg-vertical-align:
|
92 | * icon-basic-color:
|
93 | * icon-primary-color:
|
94 | * icon-info-color:
|
95 | * icon-success-color:
|
96 | * icon-warning-color:
|
97 | * icon-danger-color:
|
98 | * icon-control-color:
|
99 | */
|
100 | export declare class NbIconComponent implements NbIconConfig, OnChanges, OnInit {
|
101 | protected sanitizer: DomSanitizer;
|
102 | protected iconLibrary: NbIconLibraries;
|
103 | protected el: ElementRef;
|
104 | protected renderer: Renderer2;
|
105 | protected statusService: NbStatusService;
|
106 | protected iconDef: any;
|
107 | protected prevClasses: any[];
|
108 | html: SafeHtml;
|
109 | get primary(): boolean;
|
110 | get info(): boolean;
|
111 | get success(): boolean;
|
112 | get warning(): boolean;
|
113 | get danger(): boolean;
|
114 | get basic(): boolean;
|
115 | get control(): boolean;
|
116 | get additionalClasses(): string[];
|
117 | /**
|
118 | * Icon name
|
119 | * @param {string} status
|
120 | */
|
121 | icon: string;
|
122 | /**
|
123 | * Icon pack name
|
124 | * @param {string} status
|
125 | */
|
126 | pack: string;
|
127 | /**
|
128 | * Additional icon settings
|
129 | * @param {[name: string]: any}
|
130 | */
|
131 | options: {
|
132 | [name: string]: any;
|
133 | };
|
134 | /**
|
135 | * Icon status (adds specific styles):
|
136 | * `basic`, `primary`, `info`, `success`, `warning`, `danger`, `control`
|
137 | */
|
138 | status?: NbComponentOrCustomStatus;
|
139 | /**
|
140 | * Sets all icon configurable properties via config object.
|
141 | * If passed value is a string set icon name.
|
142 | * @docs-private
|
143 | */
|
144 | get config(): string | NbIconConfig;
|
145 | set config(value: string | NbIconConfig);
|
146 | protected _config: string | NbIconConfig;
|
147 | constructor(sanitizer: DomSanitizer, iconLibrary: NbIconLibraries, el: ElementRef, renderer: Renderer2, statusService: NbStatusService);
|
148 | ngOnInit(): void;
|
149 | ngOnChanges(): void;
|
150 | renderIcon(name: string, pack?: string, options?: {
|
151 | [name: string]: any;
|
152 | }): import("./icon-libraries").NbIconDefinition;
|
153 | protected clearIcon(): void;
|
154 | protected assignClasses(classes: string[]): void;
|
155 | static ɵfac: i0.ɵɵFactoryDeclaration<NbIconComponent, never>;
|
156 | static ɵcmp: i0.ɵɵComponentDeclaration<NbIconComponent, "nb-icon", never, { "icon": { "alias": "icon"; "required": false; }; "pack": { "alias": "pack"; "required": false; }; "options": { "alias": "options"; "required": false; }; "status": { "alias": "status"; "required": false; }; "config": { "alias": "config"; "required": false; }; }, {}, never, never, false, never>;
|
157 | }
|