Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add basic and control statuses #2047

Merged
merged 74 commits into from
Oct 31, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
91643a4
refactor: change basic control base color to white
yggg Oct 17, 2019
bb8e791
feat: add transparent semantic variables
yggg Oct 28, 2019
8fa6820
refactor: change default text color
yggg Oct 28, 2019
d8586e3
feat: add basic and control statuses
yggg Oct 28, 2019
2a9ddb0
feat(toastr): add basic and control statuses
yggg Oct 28, 2019
3d9a6d4
fix(playground): skip control background class generation
yggg Oct 28, 2019
b507d84
docs(toastr): update default status
yggg Oct 28, 2019
cdb5ec8
feat(button): add basic and control statuses
yggg Oct 28, 2019
bd0cb28
feat(input): add basic and control statuses
yggg Oct 28, 2019
8754ad2
feat(checkbox): add basic and control statuses
yggg Oct 28, 2019
20bfd67
feat(badge): add basic and control statuses
yggg Oct 28, 2019
73ddf53
feat(progress bar): add basic and control statuses
yggg Oct 28, 2019
988a948
feat(alert): add basic and control statuses
yggg Oct 28, 2019
753bdf3
fix(playground): prevent components overlay overflow by spinners
yggg Oct 28, 2019
5046255
feat(spinner): add basic and control statuses
yggg Oct 28, 2019
ba51efa
feat(tooltip): add basic and control statuses
yggg Oct 28, 2019
73c8f59
feat(radio): add basic and control statuses
yggg Oct 28, 2019
6ab012a
feat(icon): add basic and control statuses
yggg Oct 28, 2019
1b248f7
feat(toggle): add basic and control statuses
yggg Oct 28, 2019
4d562e2
fix(input): set proper text color for control status
yggg Oct 28, 2019
59f4b8d
feat(select): add basic and control statuses
yggg Oct 28, 2019
5e7039e
refactor(playground): use primary color as control examples background
yggg Oct 29, 2019
03256cc
refactor(input): move disabled mappings to each status
yggg Oct 29, 2019
f99ed65
refactor(select): move disabled mappings to each status
yggg Oct 29, 2019
58de8fa
feat(card): add basic and control statuses
yggg Oct 29, 2019
4337b62
feat(chat): add basic and control statuses
yggg Oct 29, 2019
b394a10
refactor: use nb-outline mixin
yggg Oct 29, 2019
702827a
fix(toggle): update basic and control statuses according design
yggg Oct 29, 2019
be43268
feat(toggle): allow checked input to be set as an attribute
yggg Oct 29, 2019
49f654e
refactor: revert default status breaking changes
yggg Oct 29, 2019
6989ef3
refactor(input): update padding according to design
yggg Oct 29, 2019
54e4d6b
refactor(select): make text and placeholder same as input
yggg Oct 29, 2019
98d16e0
refactor(select): update padding according to design
yggg Oct 29, 2019
a96614e
docs(select): update theme properties list
yggg Oct 29, 2019
3d5783c
feat(toggle): add disabled state theme properties for each status
yggg Oct 29, 2019
6cc16ba
fix(playground): add missing file
yggg Oct 29, 2019
013b6a5
test(layout): update expected color
yggg Oct 30, 2019
47b7b8e
test(toastr): update expected status
yggg Oct 30, 2019
bc1956a
fix(tooltip): set correct colors for basic status
yggg Oct 30, 2019
4b5f767
refactor(toggle): update control colors
yggg Oct 30, 2019
f1ec21d
refactor(checkbox): add disabled state for each status
yggg Oct 30, 2019
c971238
refactor(radio): add disabled state for each status
yggg Oct 30, 2019
6a550a4
refactor(checkbox): allow to set checked via attribute
yggg Oct 30, 2019
53a5bdf
refactor(input): set disabled text color to white
yggg Oct 30, 2019
2f61ec6
refactor(select): set disabled text color to white
yggg Oct 30, 2019
55e4626
docs(checkbox): set basic status for basic example
yggg Oct 30, 2019
27c3489
docs(input): set basic status for basic example
yggg Oct 30, 2019
00b530f
docs(select): add basic and control examples
yggg Oct 30, 2019
e25b26c
refactor(input, select): remove outline on focus
yggg Oct 30, 2019
c223eb6
fix(icon): use current color for basic icon
yggg Oct 30, 2019
515bc40
fix(icon): set default status if it's not provided in config
yggg Oct 30, 2019
ed7c338
refactor(tooltip): update icon size according to design
yggg Oct 30, 2019
2aadba1
refactor(spinner): update sizes according to design
yggg Oct 30, 2019
8d7a03d
refactor(input, spinner): make input and select same height as buttons
yggg Oct 30, 2019
96696c8
fix(button): change icon depending on size
yggg Oct 30, 2019
dea19d2
refactor(icon): make status optional
yggg Oct 30, 2019
51f17f1
refactor(tooltip): make status optional
yggg Oct 30, 2019
a613aff
Merge branch 'master' into feat/add-basic-and-control-statuses
yggg Oct 30, 2019
b054807
fix(select): use correct variable for adjacent border
yggg Oct 30, 2019
eee5db0
refactor(spinner): convert empty status value to basic
yggg Oct 30, 2019
5f7b67b
docs(tooltip): update theme properties list
yggg Oct 30, 2019
5ee17e0
docs(chat): update theme properties list
yggg Oct 30, 2019
cad2de4
docs(icon): update theme properties list
yggg Oct 30, 2019
d1fa646
style: remove tab symbol
yggg Oct 30, 2019
1ba549b
refactor(toastr): move status before state in theme variable name
yggg Oct 30, 2019
663f442
Merge branch 'master' into feat/add-basic-and-control-statuses
yggg Oct 31, 2019
c6cfe4e
Merge branch 'master' into feat/add-basic-and-control-statuses
yggg Oct 31, 2019
8c3676f
fix(chat): set status on input hover and focus
yggg Oct 31, 2019
9cf8eba
fix(chat): make basic default status
yggg Oct 31, 2019
5502e2a
docs(checkbox): add space between checkboxes
yggg Oct 31, 2019
d8fd0a5
refactor(overlay): use color from Eva
yggg Oct 31, 2019
4b74beb
docs(infinite list): make placeholders full width
yggg Oct 31, 2019
14c2163
fix(popover): set text color for any popover
yggg Oct 31, 2019
afde53e
refactor(chat): add empty status deprecation warning
yggg Oct 31, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .stylelintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

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

"value-list-comma-space-after": "always-single-line",
"value-list-comma-space-before": "never",
Expand Down
2 changes: 1 addition & 1 deletion e2e/layout-theme.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ describe('nb-layout theme', () => {
expect(value).toEqual(themeDefault);
});
cardHeader.getCssValue('color').then(value => {
expect(value).toEqual('rgba(25, 32, 56, 1)');
expect(value).toEqual('rgba(34, 43, 69, 1)');
});
cardHeader.getCssValue('text-decoration').then(value => {
expect(value).toMatch('none');
Expand Down
2 changes: 1 addition & 1 deletion src/app/components-list/components-overlay.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
left: 0;
width: 100vw;
height: 100vh;
z-index: 9999;
z-index: 99999;
overflow-y: auto;
padding: 2rem;
}
2 changes: 1 addition & 1 deletion src/framework/bootstrap/styles/_button-group.scss
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@
color: nb-theme(button-filled-#{$status}-text-color);
}
.btn-outline-#{$status} {
background-color: nb-theme(button-outline-background-color);
background-color: nb-theme(button-outline-#{$status}-background-color);
border-color: nb-theme(button-outline-#{$status}-border-color);
color: nb-theme(button-outline-#{$status}-text-color);
}
Expand Down
2 changes: 1 addition & 1 deletion src/framework/bootstrap/styles/_buttons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
font-weight: nb-theme(button-text-font-weight);

&:focus {
box-shadow: 0 0 0 nb-theme(button-outline-width) nb-theme(button-outline-color);
@include nb-outline(nb-theme(button-outline-width), nb-theme(button-outline-color));
outline: none;
}

Expand Down
2 changes: 1 addition & 1 deletion src/framework/bootstrap/styles/_dropdowns.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
background-color: nb-theme(select-option-background-color);
color: nb-theme(select-option-text-color);
font-family: nb-theme(select-text-font-family);
font-weight: nb-theme(select-text-font-weight);
font-weight: nb-theme(select-medium-text-font-weight);
font-size: nb-theme(select-medium-text-font-size);
line-height: nb-theme(select-medium-text-line-height);

Expand Down
20 changes: 10 additions & 10 deletions src/framework/bootstrap/styles/_forms.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,36 +10,36 @@
@mixin nb-b-forms-theme() {

.form-control {
background-color: nb-theme(input-background-color);
border-color: nb-theme(input-border-color);
background-color: nb-theme(input-basic-background-color);
border-color: nb-theme(input-basic-border-color);
border-style: nb-theme(input-border-style);
border-width: nb-theme(input-border-width);
color: nb-theme(input-text-color);
color: nb-theme(input-basic-text-color);
font-family: nb-theme(input-text-font-family);
@include nb-component-animation(border, background-color, color);

&::placeholder {
color: nb-theme(input-placeholder-text-color);
color: nb-theme(input-basic-placeholder-text-color);
font-family: nb-theme(input-placeholder-text-font-family);
text-overflow: ellipsis;
}

&:focus {
outline: none;
border-color: nb-theme(input-focus-border-color);
border-color: nb-theme(input-basic-focus-border-color);
}

&:hover {
border-color: nb-theme(input-hover-border-color);
border-color: nb-theme(input-basic-hover-border-color);
}

&:disabled {
background-color: nb-theme(input-disabled-background-color);
border-color: nb-theme(input-disabled-border-color);
color: nb-theme(input-disabled-text-color);
background-color: nb-theme(input-basic-disabled-background-color);
border-color: nb-theme(input-basic-disabled-border-color);
color: nb-theme(input-basic-disabled-text-color);

&::placeholder {
color: nb-theme(input-disabled-placeholder-text-color);
color: nb-theme(input-basic-disabled-placeholder-text-color);
}
}

Expand Down
10 changes: 5 additions & 5 deletions src/framework/bootstrap/styles/_outline-buttons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,33 @@
@import 'status-buttons';

@mixin b-btn-outline($status) {
background-color: nb-theme(button-outline-background-color);
background-color: nb-theme(button-outline-#{$status}-background-color);
border-style: nb-theme(button-outline-border-style);
border-width: nb-theme(button-outline-border-width);
text-transform: nb-theme(button-outline-text-transform);
border-color: nb-theme(button-outline-#{$status}-border-color);
color: nb-theme(button-outline-#{$status}-text-color);

&:focus {
background-color: nb-theme(button-outline-background-color);
background-color: nb-theme(button-outline-#{$status}-background-color);
border-color: nb-theme(button-outline-#{$status}-focus-border-color);
color: nb-theme(button-outline-#{$status}-focus-text-color);
}

&:hover {
background-color: nb-theme(button-outline-background-color);
background-color: nb-theme(button-outline-#{$status}-background-color);
border-color: nb-theme(button-outline-#{$status}-hover-border-color);
color: nb-theme(button-outline-#{$status}-hover-text-color);
}

&:active {
background-color: nb-theme(button-outline-background-color);
background-color: nb-theme(button-outline-#{$status}-background-color);
border-color: nb-theme(button-outline-#{$status}-active-border-color);
color: nb-theme(button-outline-#{$status}-active-text-color);
}

&[disabled] {
background-color: nb-theme(button-outline-background-color);
background-color: nb-theme(button-outline-#{$status}-disabled-background-color);
border-color: nb-theme(button-outline-#{$status}-disabled-border-color);
color: nb-theme(button-outline-#{$status}-disabled-text-color);
}
Expand Down
12 changes: 0 additions & 12 deletions src/framework/theme/components/alert/_alert.component.theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,10 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*/

@mixin nb-alert-header() {
padding: nb-theme(alert-padding);
border-bottom: 1px solid nb-theme(alert-separator);
border-top-left-radius: nb-theme(alert-border-radius);
border-top-right-radius: nb-theme(alert-border-radius);
color: nb-theme(alert-fg-heading);

@include nb-headings();
}

@mixin nb-alert-theme() {
nb-alert {
background-color: nb-theme(alert-background-color);
border-radius: nb-theme(alert-border-radius);
box-shadow: nb-theme(alert-shadow);
color: nb-theme(alert-text-color);
font-family: nb-theme(alert-text-font-family);
font-size: nb-theme(alert-text-font-size);
font-weight: nb-theme(alert-text-font-weight);
Expand Down
66 changes: 56 additions & 10 deletions src/framework/theme/components/alert/alert.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Component, Input, HostBinding, Output, EventEmitter } from '@angular/co

import { NbComponentSize } from '../component-size';
import { NbComponentStatus } from '../component-status';
import { convertToBoolProperty } from '../helpers';
import { convertToBoolProperty, emptyStatusWarning } from '../helpers';


/**
Expand Down Expand Up @@ -46,11 +46,11 @@ import { convertToBoolProperty } from '../helpers';
* ```
*
* Colored alerts could be simply configured by providing a `status` property:
* @stacked-example(Colored Alert, alert/alert-colors.component)
* @stacked-example(Alert status, alert/alert-colors.component)
*
* It is also possible to assign an `accent` property for a slight alert highlight
* as well as combine it with `status`:
* @stacked-example(Accent Alert, alert/alert-accents.component)
* @stacked-example(Alert accent, alert/alert-accents.component)
*
* And `outline` property:
* @stacked-example(Outline Alert, alert/alert-outline.component)
Expand All @@ -59,15 +59,13 @@ import { convertToBoolProperty } from '../helpers';
*
* @styles
*
* alert-background-color:
* alert-border-radius:
* alert-bottom-margin:
* alert-padding:
* alert-scrollbar-color:
* alert-scrollbar-background-color:
* alert-scrollbar-width:
* alert-shadow:
* alert-text-color:
* alert-text-font-family:
* alert-text-font-size:
* alert-text-font-weight:
Expand All @@ -79,6 +77,8 @@ import { convertToBoolProperty } from '../helpers';
* alert-medium-padding:
* alert-large-height:
* alert-giant-height:
* alert-basic-background-color:
* alert-basic-text-color:
* alert-primary-background-color:
* alert-primary-text-color:
* alert-success-background-color:
Expand All @@ -89,17 +89,23 @@ import { convertToBoolProperty } from '../helpers';
* alert-warning-text-color:
* alert-danger-background-color:
* alert-danger-text-color:
* alert-control-background-color:
* alert-control-text-color:
* alert-accent-basic-color:
* alert-accent-primary-color:
* alert-accent-info-color:
* alert-accent-success-color:
* alert-accent-warning-color:
* alert-accent-danger-color:
* alert-accent-control-color:
* alert-outline-width:
* alert-outline-basic-color:
* alert-outline-primary-color:
* alert-outline-info-color:
* alert-outline-success-color:
* alert-outline-warning-color:
* alert-outline-danger-color:
* alert-outline-control-color:
*/
@Component({
selector: 'nb-alert',
Expand All @@ -122,21 +128,31 @@ export class NbAlertComponent {

/**
* Alert status (adds specific styles):
* `primary`, `success`, `info`, `warning`, `danger`.
* Unset by default.
* `basic` (default), `primary`, `success`, `info`, `warning`, `danger`, `control`.
*/
@Input() status: '' | NbComponentStatus = '';
@Input()
get status(): NbComponentStatus {
return this._status;
}
set status(value: NbComponentStatus) {
if ((value as string) === '') {
emptyStatusWarning('NbAlert');
value = 'basic';
}
this._status = value;
}
protected _status: NbComponentStatus = 'basic';

/**
* Alert accent (color of the top border):
* `primary`, `success`, `info`, `warning`, `danger`.
* `basic`, `primary`, `success`, `info`, `warning`, `danger`, `control`.
* Unset by default.
*/
@Input() accent: '' | NbComponentStatus = '';

/**
* Alert outline (color of the border):
* `primary`, `success`, `info`, `warning`, `danger`.
* `basic`, `primary`, `success`, `info`, `warning`, `danger`, `control`.
* Unset by default.
*/
@Input() outline: '' | NbComponentStatus = '';
Expand Down Expand Up @@ -217,6 +233,16 @@ export class NbAlertComponent {
return this.status === 'danger';
}

@HostBinding('class.status-basic')
get basic() {
return this.status === 'basic';
}

@HostBinding('class.status-control')
get control() {
return this.status === 'control';
}

@HostBinding('class.accent-primary')
get primaryAccent() {
return this.accent === 'primary';
Expand All @@ -242,6 +268,16 @@ export class NbAlertComponent {
return this.accent === 'danger';
}

@HostBinding('class.accent-basic')
get basicAccent() {
return this.accent === 'basic';
}

@HostBinding('class.accent-control')
get controlAccent() {
return this.accent === 'control';
}

@HostBinding('class.outline-primary')
get primaryOutline() {
return this.outline === 'primary';
Expand All @@ -266,4 +302,14 @@ export class NbAlertComponent {
get dangerOutline() {
return this.outline === 'danger';
}

@HostBinding('class.outline-basic')
get basicOutline() {
return this.outline === 'basic';
}

@HostBinding('class.outline-control')
get controlOutline() {
return this.outline === 'control';
}
}
16 changes: 15 additions & 1 deletion src/framework/theme/components/badge/badge.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ export type NbBadgePosition = NbBadgePhysicalPosition | NbBadgeLogicalPosition;
* badge-text-font-weight:
* badge-text-line-height:
* badge-padding:
* badge-basic-background-color:
* badge-basic-text-color:
* badge-primary-background-color:
* badge-primary-text-color:
* badge-success-background-color:
Expand All @@ -70,6 +72,8 @@ export type NbBadgePosition = NbBadgePhysicalPosition | NbBadgeLogicalPosition;
* badge-warning-text-color:
* badge-danger-background-color:
* badge-danger-text-color:
* badge-control-background-color:
* badge-control-text-color:
*/
@Component({
selector: 'nb-badge',
Expand Down Expand Up @@ -104,7 +108,7 @@ export class NbBadgeComponent {

/**
* Badge status (adds specific styles):
* 'primary', 'info', 'success', 'warning', 'danger'
* 'basic', 'primary', 'info', 'success', 'warning', 'danger', 'control'
*/
@Input() status: NbComponentStatus = 'primary';

Expand Down Expand Up @@ -133,6 +137,16 @@ export class NbBadgeComponent {
return this.status === 'danger';
}

@HostBinding('class.status-basic')
get basic(): boolean {
return this.status === 'basic';
}

@HostBinding('class.status-control')
get control(): boolean {
return this.status === 'control';
}

@HostBinding('class.position-top')
get top(): boolean {
return this.position.includes('top');
Expand Down
4 changes: 4 additions & 0 deletions src/framework/theme/components/button/_button-ghost.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
border-width: nb-theme(button-ghost-border-width);
text-transform: nb-theme(button-ghost-text-transform);

&:focus {
@include nb-outline(nb-theme(button-outline-width), nb-theme(button-outline-color), (inset-shadow: true));
}

@each $size in nb-get-sizes() {
&.size-#{$size} {
padding: nb-theme(button-ghost-#{$size}-padding);
Expand Down
6 changes: 5 additions & 1 deletion src/framework/theme/components/button/_button-outline.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@

@mixin button-outline() {
[nbButton].appearance-outline {
background-color: nb-theme(button-outline-background-color);
border-style: nb-theme(button-outline-border-style);
border-width: nb-theme(button-outline-border-width);
text-transform: nb-theme(button-outline-text-transform);

&:focus {
@include nb-outline(nb-theme(button-outline-width), nb-theme(button-outline-color), (inset-shadow: true));
}

@each $size in nb-get-sizes() {
&.size-#{$size} {
padding: nb-theme(button-outline-#{$size}-padding);
Expand All @@ -19,6 +22,7 @@

@each $status in nb-get-statuses() {
&.status-#{$status} {
background-color: nb-theme(button-outline-#{$status}-background-color);
border-color: nb-theme(button-outline-#{$status}-border-color);
color: nb-theme(button-outline-#{$status}-text-color);

Expand Down
Loading