Skip to content

Commit 884dd66

Browse files
authored
feat: add basic and control statuses (#2047)
1 parent cb06bb6 commit 884dd66

File tree

114 files changed

+3120
-1424
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+3120
-1424
lines changed

.stylelintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
"unit-case": "lower",
2121
"unit-no-unknown": true,
22-
"unit-whitelist": ["px", "%", "deg", "ms", "em", "vh", "vw", "s", "rem"],
22+
"unit-whitelist": ["px", "%", "deg", "ms", "em", "vh", "vw", "vmax", "s", "rem"],
2323

2424
"value-list-comma-space-after": "always-single-line",
2525
"value-list-comma-space-before": "never",

e2e/layout-theme.e2e-spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ describe('nb-layout theme', () => {
5757
expect(value).toEqual(themeDefault);
5858
});
5959
cardHeader.getCssValue('color').then(value => {
60-
expect(value).toEqual('rgba(25, 32, 56, 1)');
60+
expect(value).toEqual('rgba(34, 43, 69, 1)');
6161
});
6262
cardHeader.getCssValue('text-decoration').then(value => {
6363
expect(value).toMatch('none');

src/app/components-list/components-overlay.component.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
left: 0;
77
width: 100vw;
88
height: 100vh;
9-
z-index: 9999;
9+
z-index: 99999;
1010
overflow-y: auto;
1111
padding: 2rem;
1212
}

src/framework/bootstrap/styles/_button-group.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@
251251
color: nb-theme(button-filled-#{$status}-text-color);
252252
}
253253
.btn-outline-#{$status} {
254-
background-color: nb-theme(button-outline-background-color);
254+
background-color: nb-theme(button-outline-#{$status}-background-color);
255255
border-color: nb-theme(button-outline-#{$status}-border-color);
256256
color: nb-theme(button-outline-#{$status}-text-color);
257257
}

src/framework/bootstrap/styles/_buttons.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
font-weight: nb-theme(button-text-font-weight);
1919

2020
&:focus {
21-
box-shadow: 0 0 0 nb-theme(button-outline-width) nb-theme(button-outline-color);
21+
@include nb-outline(nb-theme(button-outline-width), nb-theme(button-outline-color));
2222
outline: none;
2323
}
2424

src/framework/bootstrap/styles/_dropdowns.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
background-color: nb-theme(select-option-background-color);
2020
color: nb-theme(select-option-text-color);
2121
font-family: nb-theme(select-text-font-family);
22-
font-weight: nb-theme(select-text-font-weight);
22+
font-weight: nb-theme(select-medium-text-font-weight);
2323
font-size: nb-theme(select-medium-text-font-size);
2424
line-height: nb-theme(select-medium-text-line-height);
2525

src/framework/bootstrap/styles/_forms.scss

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,36 +10,36 @@
1010
@mixin nb-b-forms-theme() {
1111

1212
.form-control {
13-
background-color: nb-theme(input-background-color);
14-
border-color: nb-theme(input-border-color);
13+
background-color: nb-theme(input-basic-background-color);
14+
border-color: nb-theme(input-basic-border-color);
1515
border-style: nb-theme(input-border-style);
1616
border-width: nb-theme(input-border-width);
17-
color: nb-theme(input-text-color);
17+
color: nb-theme(input-basic-text-color);
1818
font-family: nb-theme(input-text-font-family);
1919
@include nb-component-animation(border, background-color, color);
2020

2121
&::placeholder {
22-
color: nb-theme(input-placeholder-text-color);
22+
color: nb-theme(input-basic-placeholder-text-color);
2323
font-family: nb-theme(input-placeholder-text-font-family);
2424
text-overflow: ellipsis;
2525
}
2626

2727
&:focus {
2828
outline: none;
29-
border-color: nb-theme(input-focus-border-color);
29+
border-color: nb-theme(input-basic-focus-border-color);
3030
}
3131

3232
&:hover {
33-
border-color: nb-theme(input-hover-border-color);
33+
border-color: nb-theme(input-basic-hover-border-color);
3434
}
3535

3636
&:disabled {
37-
background-color: nb-theme(input-disabled-background-color);
38-
border-color: nb-theme(input-disabled-border-color);
39-
color: nb-theme(input-disabled-text-color);
37+
background-color: nb-theme(input-basic-disabled-background-color);
38+
border-color: nb-theme(input-basic-disabled-border-color);
39+
color: nb-theme(input-basic-disabled-text-color);
4040

4141
&::placeholder {
42-
color: nb-theme(input-disabled-placeholder-text-color);
42+
color: nb-theme(input-basic-disabled-placeholder-text-color);
4343
}
4444
}
4545

src/framework/bootstrap/styles/_outline-buttons.scss

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,33 +7,33 @@
77
@import 'status-buttons';
88

99
@mixin b-btn-outline($status) {
10-
background-color: nb-theme(button-outline-background-color);
10+
background-color: nb-theme(button-outline-#{$status}-background-color);
1111
border-style: nb-theme(button-outline-border-style);
1212
border-width: nb-theme(button-outline-border-width);
1313
text-transform: nb-theme(button-outline-text-transform);
1414
border-color: nb-theme(button-outline-#{$status}-border-color);
1515
color: nb-theme(button-outline-#{$status}-text-color);
1616

1717
&:focus {
18-
background-color: nb-theme(button-outline-background-color);
18+
background-color: nb-theme(button-outline-#{$status}-background-color);
1919
border-color: nb-theme(button-outline-#{$status}-focus-border-color);
2020
color: nb-theme(button-outline-#{$status}-focus-text-color);
2121
}
2222

2323
&:hover {
24-
background-color: nb-theme(button-outline-background-color);
24+
background-color: nb-theme(button-outline-#{$status}-background-color);
2525
border-color: nb-theme(button-outline-#{$status}-hover-border-color);
2626
color: nb-theme(button-outline-#{$status}-hover-text-color);
2727
}
2828

2929
&:active {
30-
background-color: nb-theme(button-outline-background-color);
30+
background-color: nb-theme(button-outline-#{$status}-background-color);
3131
border-color: nb-theme(button-outline-#{$status}-active-border-color);
3232
color: nb-theme(button-outline-#{$status}-active-text-color);
3333
}
3434

3535
&[disabled] {
36-
background-color: nb-theme(button-outline-background-color);
36+
background-color: nb-theme(button-outline-#{$status}-disabled-background-color);
3737
border-color: nb-theme(button-outline-#{$status}-disabled-border-color);
3838
color: nb-theme(button-outline-#{$status}-disabled-text-color);
3939
}

src/framework/theme/components/alert/_alert.component.theme.scss

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,10 @@
44
* Licensed under the MIT License. See License.txt in the project root for license information.
55
*/
66

7-
@mixin nb-alert-header() {
8-
padding: nb-theme(alert-padding);
9-
border-bottom: 1px solid nb-theme(alert-separator);
10-
border-top-left-radius: nb-theme(alert-border-radius);
11-
border-top-right-radius: nb-theme(alert-border-radius);
12-
color: nb-theme(alert-fg-heading);
13-
14-
@include nb-headings();
15-
}
16-
177
@mixin nb-alert-theme() {
188
nb-alert {
19-
background-color: nb-theme(alert-background-color);
209
border-radius: nb-theme(alert-border-radius);
2110
box-shadow: nb-theme(alert-shadow);
22-
color: nb-theme(alert-text-color);
2311
font-family: nb-theme(alert-text-font-family);
2412
font-size: nb-theme(alert-text-font-size);
2513
font-weight: nb-theme(alert-text-font-weight);

src/framework/theme/components/alert/alert.component.ts

Lines changed: 56 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { Component, Input, HostBinding, Output, EventEmitter } from '@angular/co
88

99
import { NbComponentSize } from '../component-size';
1010
import { 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
}

src/framework/theme/components/badge/badge.component.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ export type NbBadgePosition = NbBadgePhysicalPosition | NbBadgeLogicalPosition;
6060
* badge-text-font-weight:
6161
* badge-text-line-height:
6262
* badge-padding:
63+
* badge-basic-background-color:
64+
* badge-basic-text-color:
6365
* badge-primary-background-color:
6466
* badge-primary-text-color:
6567
* badge-success-background-color:
@@ -70,6 +72,8 @@ export type NbBadgePosition = NbBadgePhysicalPosition | NbBadgeLogicalPosition;
7072
* badge-warning-text-color:
7173
* badge-danger-background-color:
7274
* badge-danger-text-color:
75+
* badge-control-background-color:
76+
* badge-control-text-color:
7377
*/
7478
@Component({
7579
selector: 'nb-badge',
@@ -104,7 +108,7 @@ export class NbBadgeComponent {
104108

105109
/**
106110
* Badge status (adds specific styles):
107-
* 'primary', 'info', 'success', 'warning', 'danger'
111+
* 'basic', 'primary', 'info', 'success', 'warning', 'danger', 'control'
108112
*/
109113
@Input() status: NbComponentStatus = 'primary';
110114

@@ -133,6 +137,16 @@ export class NbBadgeComponent {
133137
return this.status === 'danger';
134138
}
135139

140+
@HostBinding('class.status-basic')
141+
get basic(): boolean {
142+
return this.status === 'basic';
143+
}
144+
145+
@HostBinding('class.status-control')
146+
get control(): boolean {
147+
return this.status === 'control';
148+
}
149+
136150
@HostBinding('class.position-top')
137151
get top(): boolean {
138152
return this.position.includes('top');

src/framework/theme/components/button/_button-ghost.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
border-width: nb-theme(button-ghost-border-width);
1313
text-transform: nb-theme(button-ghost-text-transform);
1414

15+
&:focus {
16+
@include nb-outline(nb-theme(button-outline-width), nb-theme(button-outline-color), (inset-shadow: true));
17+
}
18+
1519
@each $size in nb-get-sizes() {
1620
&.size-#{$size} {
1721
padding: nb-theme(button-ghost-#{$size}-padding);

src/framework/theme/components/button/_button-outline.scss

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,14 @@
66

77
@mixin button-outline() {
88
[nbButton].appearance-outline {
9-
background-color: nb-theme(button-outline-background-color);
109
border-style: nb-theme(button-outline-border-style);
1110
border-width: nb-theme(button-outline-border-width);
1211
text-transform: nb-theme(button-outline-text-transform);
1312

13+
&:focus {
14+
@include nb-outline(nb-theme(button-outline-width), nb-theme(button-outline-color), (inset-shadow: true));
15+
}
16+
1417
@each $size in nb-get-sizes() {
1518
&.size-#{$size} {
1619
padding: nb-theme(button-outline-#{$size}-padding);
@@ -19,6 +22,7 @@
1922

2023
@each $status in nb-get-statuses() {
2124
&.status-#{$status} {
25+
background-color: nb-theme(button-outline-#{$status}-background-color);
2226
border-color: nb-theme(button-outline-#{$status}-border-color);
2327
color: nb-theme(button-outline-#{$status}-text-color);
2428

0 commit comments

Comments
 (0)