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 { AfterViewInit, ChangeDetectorRef, ElementRef, EventEmitter, NgZone, OnDestroy, Renderer2 } from '@angular/core';
|
7 | import { Observable } from 'rxjs';
|
8 | import { NbStatusService } from '../../services/status.service';
|
9 | import { NbHighlightableOption } from '../cdk/a11y/descendant-key-manager';
|
10 | import { NbBooleanInput } from '../helpers';
|
11 | import { NbComponentOrCustomStatus } from '../component-status';
|
12 | import { NbComponentSize } from '../component-size';
|
13 | import * as i0 from "@angular/core";
|
14 | export type NbTagAppearance = 'filled' | 'outline';
|
15 | export interface NbTagSelectionChange {
|
16 | tag: NbTagComponent;
|
17 | selected: boolean;
|
18 | }
|
19 | /**
|
20 | *
|
21 | * To show a cross on a tag and enable `remove` event add the `removable` attribute.
|
22 | * @stacked-example(Removable tags, tag/tag-removable.component)
|
23 | *
|
24 | * You can change appearance via `appearance` input:
|
25 | * @stacked-example(Tag Appearance, tag/tag-appearance.component)
|
26 | *
|
27 | * You can change status via `status` input:
|
28 | * @stacked-example(Tag Status, tag/tag-status.component)
|
29 | *
|
30 | * @styles
|
31 | *
|
32 | * tag-text-font-family:
|
33 | * tag-text-transform:
|
34 | * tag-border-width:
|
35 | * tag-border-style:
|
36 | * tag-border-radius:
|
37 | * tag-tiny-text-font-size:
|
38 | * tag-tiny-text-font-weight:
|
39 | * tag-tiny-text-line-height:
|
40 | * tag-tiny-padding:
|
41 | * tag-tiny-close-offset:
|
42 | * tag-small-text-font-size:
|
43 | * tag-small-text-font-weight:
|
44 | * tag-small-text-line-height:
|
45 | * tag-small-padding:
|
46 | * tag-small-close-offset:
|
47 | * tag-medium-text-font-size:
|
48 | * tag-medium-text-font-weight:
|
49 | * tag-medium-text-line-height:
|
50 | * tag-medium-padding:
|
51 | * tag-medium-close-offset:
|
52 | * tag-large-text-font-size:
|
53 | * tag-large-text-font-weight:
|
54 | * tag-large-text-line-height:
|
55 | * tag-large-padding:
|
56 | * tag-large-close-offset:
|
57 | * tag-giant-text-font-size:
|
58 | * tag-giant-text-font-weight:
|
59 | * tag-giant-text-line-height:
|
60 | * tag-giant-padding:
|
61 | * tag-giant-close-offset:
|
62 | * tag-filled-basic-background-color:
|
63 | * tag-filled-basic-border-color:
|
64 | * tag-filled-basic-text-color:
|
65 | * tag-filled-basic-active-background-color:
|
66 | * tag-filled-basic-active-border-color:
|
67 | * tag-filled-basic-hover-background-color:
|
68 | * tag-filled-basic-hover-border-color:
|
69 | * tag-filled-basic-selected-background-color:
|
70 | * tag-filled-basic-selected-border-color:
|
71 | * tag-filled-primary-background-color:
|
72 | * tag-filled-primary-border-color:
|
73 | * tag-filled-primary-text-color:
|
74 | * tag-filled-primary-active-background-color:
|
75 | * tag-filled-primary-active-border-color:
|
76 | * tag-filled-primary-hover-background-color:
|
77 | * tag-filled-primary-hover-border-color:
|
78 | * tag-filled-primary-selected-background-color:
|
79 | * tag-filled-primary-selected-border-color:
|
80 | * tag-filled-success-background-color:
|
81 | * tag-filled-success-border-color:
|
82 | * tag-filled-success-text-color:
|
83 | * tag-filled-success-active-background-color:
|
84 | * tag-filled-success-active-border-color:
|
85 | * tag-filled-success-hover-background-color:
|
86 | * tag-filled-success-hover-border-color:
|
87 | * tag-filled-success-selected-background-color:
|
88 | * tag-filled-success-selected-border-color:
|
89 | * tag-filled-info-background-color:
|
90 | * tag-filled-info-border-color:
|
91 | * tag-filled-info-text-color:
|
92 | * tag-filled-info-active-background-color:
|
93 | * tag-filled-info-active-border-color:
|
94 | * tag-filled-info-hover-background-color:
|
95 | * tag-filled-info-hover-border-color:
|
96 | * tag-filled-info-selected-background-color:
|
97 | * tag-filled-info-selected-border-color:
|
98 | * tag-filled-warning-background-color:
|
99 | * tag-filled-warning-border-color:
|
100 | * tag-filled-warning-text-color:
|
101 | * tag-filled-warning-active-background-color:
|
102 | * tag-filled-warning-active-border-color:
|
103 | * tag-filled-warning-hover-background-color:
|
104 | * tag-filled-warning-hover-border-color:
|
105 | * tag-filled-warning-selected-background-color:
|
106 | * tag-filled-warning-selected-border-color:
|
107 | * tag-filled-danger-background-color:
|
108 | * tag-filled-danger-border-color:
|
109 | * tag-filled-danger-text-color:
|
110 | * tag-filled-danger-active-background-color:
|
111 | * tag-filled-danger-active-border-color:
|
112 | * tag-filled-danger-hover-background-color:
|
113 | * tag-filled-danger-hover-border-color:
|
114 | * tag-filled-danger-selected-background-color:
|
115 | * tag-filled-danger-selected-border-color:
|
116 | * tag-filled-control-background-color:
|
117 | * tag-filled-control-border-color:
|
118 | * tag-filled-control-text-color:
|
119 | * tag-filled-control-active-background-color:
|
120 | * tag-filled-control-active-border-color:
|
121 | * tag-filled-control-hover-background-color:
|
122 | * tag-filled-control-hover-border-color:
|
123 | * tag-filled-control-selected-background-color:
|
124 | * tag-filled-control-selected-border-color:
|
125 | * tag-outline-basic-background-color:
|
126 | * tag-outline-basic-border-color:
|
127 | * tag-outline-basic-text-color:
|
128 | * tag-outline-basic-active-background-color:
|
129 | * tag-outline-basic-active-border-color:
|
130 | * tag-outline-basic-active-text-color:
|
131 | * tag-outline-basic-hover-background-color:
|
132 | * tag-outline-basic-hover-border-color:
|
133 | * tag-outline-basic-hover-text-color:
|
134 | * tag-outline-basic-selected-background-color:
|
135 | * tag-outline-basic-selected-border-color:
|
136 | * tag-outline-basic-selected-text-color:
|
137 | * tag-outline-primary-background-color:
|
138 | * tag-outline-primary-border-color:
|
139 | * tag-outline-primary-text-color:
|
140 | * tag-outline-primary-active-background-color:
|
141 | * tag-outline-primary-active-border-color:
|
142 | * tag-outline-primary-active-text-color:
|
143 | * tag-outline-primary-hover-background-color:
|
144 | * tag-outline-primary-hover-border-color:
|
145 | * tag-outline-primary-hover-text-color:
|
146 | * tag-outline-primary-selected-background-color:
|
147 | * tag-outline-primary-selected-border-color:
|
148 | * tag-outline-primary-selected-text-color:
|
149 | * tag-outline-success-background-color:
|
150 | * tag-outline-success-border-color:
|
151 | * tag-outline-success-text-color:
|
152 | * tag-outline-success-active-background-color:
|
153 | * tag-outline-success-active-border-color:
|
154 | * tag-outline-success-active-text-color:
|
155 | * tag-outline-success-hover-background-color:
|
156 | * tag-outline-success-hover-border-color:
|
157 | * tag-outline-success-hover-text-color:
|
158 | * tag-outline-success-selected-background-color:
|
159 | * tag-outline-success-selected-border-color:
|
160 | * tag-outline-success-selected-text-color:
|
161 | * tag-outline-info-background-color:
|
162 | * tag-outline-info-border-color:
|
163 | * tag-outline-info-text-color:
|
164 | * tag-outline-info-active-background-color:
|
165 | * tag-outline-info-active-border-color:
|
166 | * tag-outline-info-active-text-color:
|
167 | * tag-outline-info-hover-background-color:
|
168 | * tag-outline-info-hover-border-color:
|
169 | * tag-outline-info-hover-text-color:
|
170 | * tag-outline-info-selected-background-color:
|
171 | * tag-outline-info-selected-border-color:
|
172 | * tag-outline-info-selected-text-color:
|
173 | * tag-outline-warning-background-color:
|
174 | * tag-outline-warning-border-color:
|
175 | * tag-outline-warning-text-color:
|
176 | * tag-outline-warning-active-background-color:
|
177 | * tag-outline-warning-active-border-color:
|
178 | * tag-outline-warning-active-text-color:
|
179 | * tag-outline-warning-hover-background-color:
|
180 | * tag-outline-warning-hover-border-color:
|
181 | * tag-outline-warning-hover-text-color:
|
182 | * tag-outline-warning-selected-background-color:
|
183 | * tag-outline-warning-selected-border-color:
|
184 | * tag-outline-warning-selected-text-color:
|
185 | * tag-outline-danger-background-color:
|
186 | * tag-outline-danger-border-color:
|
187 | * tag-outline-danger-text-color:
|
188 | * tag-outline-danger-active-background-color:
|
189 | * tag-outline-danger-active-border-color:
|
190 | * tag-outline-danger-active-text-color:
|
191 | * tag-outline-danger-hover-background-color:
|
192 | * tag-outline-danger-hover-border-color:
|
193 | * tag-outline-danger-hover-text-color:
|
194 | * tag-outline-danger-selected-background-color:
|
195 | * tag-outline-danger-selected-border-color:
|
196 | * tag-outline-danger-selected-text-color:
|
197 | * tag-outline-control-background-color:
|
198 | * tag-outline-control-border-color:
|
199 | * tag-outline-control-text-color:
|
200 | * tag-outline-control-active-background-color:
|
201 | * tag-outline-control-active-border-color:
|
202 | * tag-outline-control-active-text-color:
|
203 | * tag-outline-control-hover-background-color:
|
204 | * tag-outline-control-hover-border-color:
|
205 | * tag-outline-control-hover-text-color:
|
206 | * tag-outline-control-selected-background-color:
|
207 | * tag-outline-control-selected-border-color:
|
208 | * tag-outline-control-selected-text-color:
|
209 | */
|
210 | export declare class NbTagComponent implements AfterViewInit, OnDestroy, NbHighlightableOption {
|
211 | _hostElement: ElementRef;
|
212 | protected cd: ChangeDetectorRef;
|
213 | protected renderer: Renderer2;
|
214 | protected zone: NgZone;
|
215 | protected statusService: NbStatusService;
|
216 | private _destroy$;
|
217 | get destroy$(): Observable<NbTagComponent>;
|
218 | /**
|
219 | * Tag text.
|
220 | */
|
221 | text: string;
|
222 | get selected(): boolean;
|
223 | set selected(value: boolean);
|
224 | protected _selected: boolean;
|
225 | static ngAcceptInputType_selected: NbBooleanInput;
|
226 | /**
|
227 | * Controls whether the user can remove a tag or not.
|
228 | */
|
229 | get removable(): boolean;
|
230 | set removable(value: boolean);
|
231 | protected _removable: boolean;
|
232 | static ngAcceptInputType_removable: NbBooleanInput;
|
233 | /**
|
234 | * Tag appearance: `filled`, `outline`.
|
235 | */
|
236 | appearance: NbTagAppearance;
|
237 | /**
|
238 | * Tag status: `basic`, `primary`, `info`, `success`, `warning`, `danger`, `control`.
|
239 | */
|
240 | status: NbComponentOrCustomStatus;
|
241 | /**
|
242 | * Tag size: `tiny`, `small`, `medium`, `large`, `giant`.
|
243 | */
|
244 | size: NbComponentSize;
|
245 | role: string;
|
246 | /**
|
247 | * Emits when the user removes the tag
|
248 | * (whether by clicking on the remove button or by pressing `delete` or `backspace` key).
|
249 | */
|
250 | readonly remove: EventEmitter<NbTagComponent>;
|
251 | readonly selectedChange: EventEmitter<NbTagSelectionChange>;
|
252 | _isActive: boolean;
|
253 | _id: string;
|
254 | get filled(): boolean;
|
255 | set filled(value: boolean);
|
256 | get outline(): boolean;
|
257 | set outline(value: boolean);
|
258 | get basic(): boolean;
|
259 | get primary(): boolean;
|
260 | get success(): boolean;
|
261 | get info(): boolean;
|
262 | get warning(): boolean;
|
263 | get danger(): boolean;
|
264 | get control(): boolean;
|
265 | get tiny(): boolean;
|
266 | get small(): boolean;
|
267 | get medium(): boolean;
|
268 | get large(): boolean;
|
269 | get giant(): boolean;
|
270 | get additionalClasses(): string[];
|
271 | _remove(): void;
|
272 | constructor(_hostElement: ElementRef, cd: ChangeDetectorRef, renderer: Renderer2, zone: NgZone, statusService: NbStatusService);
|
273 | ngAfterViewInit(): void;
|
274 | ngOnDestroy(): void;
|
275 | _toggleSelection(): void;
|
276 | setActiveStyles(): void;
|
277 | setInactiveStyles(): void;
|
278 | static ɵfac: i0.ɵɵFactoryDeclaration<NbTagComponent, never>;
|
279 | static ɵcmp: i0.ɵɵComponentDeclaration<NbTagComponent, "nb-tag", ["nbTag"], { "text": { "alias": "text"; "required": false; }; "selected": { "alias": "selected"; "required": false; }; "removable": { "alias": "removable"; "required": false; }; "appearance": { "alias": "appearance"; "required": false; }; "status": { "alias": "status"; "required": false; }; "size": { "alias": "size"; "required": false; }; "role": { "alias": "role"; "required": false; }; }, { "remove": "remove"; "selectedChange": "selectedChange"; }, never, never, false, never>;
|
280 | }
|