@@ -8,7 +8,7 @@ import { Component, Input, HostBinding, Output, EventEmitter } from '@angular/co
88
99import { NbComponentSize } from '../component-size' ;
1010import { NbComponentStatus } from '../component-status' ;
11- import { convertToBoolProperty } from '../helpers' ;
11+ import { convertToBoolProperty , emptyStatusWarning } from '../helpers' ;
1212
1313
1414/**
@@ -46,11 +46,11 @@ import { convertToBoolProperty } from '../helpers';
4646 * ```
4747 *
4848 * Colored alerts could be simply configured by providing a `status` property:
49- * @stacked -example(Colored Alert, alert/alert-colors.component)
49+ * @stacked -example(Alert status , alert/alert-colors.component)
5050 *
5151 * It is also possible to assign an `accent` property for a slight alert highlight
5252 * as well as combine it with `status`:
53- * @stacked -example(Accent Alert, alert/alert-accents.component)
53+ * @stacked -example(Alert accent , alert/alert-accents.component)
5454 *
5555 * And `outline` property:
5656 * @stacked -example(Outline Alert, alert/alert-outline.component)
@@ -59,15 +59,13 @@ import { convertToBoolProperty } from '../helpers';
5959 *
6060 * @styles
6161 *
62- * alert-background-color:
6362 * alert-border-radius:
6463 * alert-bottom-margin:
6564 * alert-padding:
6665 * alert-scrollbar-color:
6766 * alert-scrollbar-background-color:
6867 * alert-scrollbar-width:
6968 * alert-shadow:
70- * alert-text-color:
7169 * alert-text-font-family:
7270 * alert-text-font-size:
7371 * alert-text-font-weight:
@@ -79,6 +77,8 @@ import { convertToBoolProperty } from '../helpers';
7977 * alert-medium-padding:
8078 * alert-large-height:
8179 * alert-giant-height:
80+ * alert-basic-background-color:
81+ * alert-basic-text-color:
8282 * alert-primary-background-color:
8383 * alert-primary-text-color:
8484 * alert-success-background-color:
@@ -89,17 +89,23 @@ import { convertToBoolProperty } from '../helpers';
8989 * alert-warning-text-color:
9090 * alert-danger-background-color:
9191 * alert-danger-text-color:
92+ * alert-control-background-color:
93+ * alert-control-text-color:
94+ * alert-accent-basic-color:
9295 * alert-accent-primary-color:
9396 * alert-accent-info-color:
9497 * alert-accent-success-color:
9598 * alert-accent-warning-color:
9699 * alert-accent-danger-color:
100+ * alert-accent-control-color:
97101 * alert-outline-width:
102+ * alert-outline-basic-color:
98103 * alert-outline-primary-color:
99104 * alert-outline-info-color:
100105 * alert-outline-success-color:
101106 * alert-outline-warning-color:
102107 * alert-outline-danger-color:
108+ * alert-outline-control-color:
103109 */
104110@Component ( {
105111 selector : 'nb-alert' ,
@@ -122,21 +128,31 @@ export class NbAlertComponent {
122128
123129 /**
124130 * Alert status (adds specific styles):
125- * `primary`, `success`, `info`, `warning`, `danger`.
126- * Unset by default.
131+ * `basic` (default), `primary`, `success`, `info`, `warning`, `danger`, `control`.
127132 */
128- @Input ( ) status : '' | NbComponentStatus = '' ;
133+ @Input ( )
134+ get status ( ) : NbComponentStatus {
135+ return this . _status ;
136+ }
137+ set status ( value : NbComponentStatus ) {
138+ if ( ( value as string ) === '' ) {
139+ emptyStatusWarning ( 'NbAlert' ) ;
140+ value = 'basic' ;
141+ }
142+ this . _status = value ;
143+ }
144+ protected _status : NbComponentStatus = 'basic' ;
129145
130146 /**
131147 * Alert accent (color of the top border):
132- * `primary`, `success`, `info`, `warning`, `danger`.
148+ * `basic`, ` primary`, `success`, `info`, `warning`, `danger`, `control `.
133149 * Unset by default.
134150 */
135151 @Input ( ) accent : '' | NbComponentStatus = '' ;
136152
137153 /**
138154 * Alert outline (color of the border):
139- * `primary`, `success`, `info`, `warning`, `danger`.
155+ * `basic`, ` primary`, `success`, `info`, `warning`, `danger`, `control `.
140156 * Unset by default.
141157 */
142158 @Input ( ) outline : '' | NbComponentStatus = '' ;
@@ -217,6 +233,16 @@ export class NbAlertComponent {
217233 return this . status === 'danger' ;
218234 }
219235
236+ @HostBinding ( 'class.status-basic' )
237+ get basic ( ) {
238+ return this . status === 'basic' ;
239+ }
240+
241+ @HostBinding ( 'class.status-control' )
242+ get control ( ) {
243+ return this . status === 'control' ;
244+ }
245+
220246 @HostBinding ( 'class.accent-primary' )
221247 get primaryAccent ( ) {
222248 return this . accent === 'primary' ;
@@ -242,6 +268,16 @@ export class NbAlertComponent {
242268 return this . accent === 'danger' ;
243269 }
244270
271+ @HostBinding ( 'class.accent-basic' )
272+ get basicAccent ( ) {
273+ return this . accent === 'basic' ;
274+ }
275+
276+ @HostBinding ( 'class.accent-control' )
277+ get controlAccent ( ) {
278+ return this . accent === 'control' ;
279+ }
280+
245281 @HostBinding ( 'class.outline-primary' )
246282 get primaryOutline ( ) {
247283 return this . outline === 'primary' ;
@@ -266,4 +302,14 @@ export class NbAlertComponent {
266302 get dangerOutline ( ) {
267303 return this . outline === 'danger' ;
268304 }
305+
306+ @HostBinding ( 'class.outline-basic' )
307+ get basicOutline ( ) {
308+ return this . outline === 'basic' ;
309+ }
310+
311+ @HostBinding ( 'class.outline-control' )
312+ get controlOutline ( ) {
313+ return this . outline === 'control' ;
314+ }
269315}
0 commit comments