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(checkbox): Eva style 💅 #1311

Merged
merged 47 commits into from
Apr 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
0e6e507
feat(theme): css variables support (#1257)
nnixaa Mar 21, 2019
a70898a
feat(icons): new `nb-icon` component, icons library, and @nebular/eva…
nnixaa Mar 29, 2019
a0e00e7
feat(theme): add eva palette
yggg Mar 21, 2019
ac905d3
feat(theme): add file for helper classes
yggg Mar 21, 2019
48fb0da
refactor(checkbox): add new mapping properties
yggg Mar 21, 2019
e8a623b
feat(checkbox): add primary, info and white statuses
yggg Mar 21, 2019
c872be9
feat(checkbox): add indeterminate input
yggg Mar 21, 2019
70a8f72
feat(checkbox): add change output
yggg Mar 21, 2019
7b22a49
test(checkbox): add checks for indeterminate and change events
yggg Mar 21, 2019
f2d183a
refactor(checkbox): use updated component properties for styles
yggg Mar 21, 2019
b27e091
refactor(theme): separate new theme tokens from old ones
yggg Mar 21, 2019
9160cf6
refactor(theme): simplify font variables naming
yggg Mar 22, 2019
ce6e4d9
docs(checkbox): add new properties
yggg Mar 22, 2019
1ab9147
docs(checkbox): add indeterminate example
yggg Mar 22, 2019
8fd00af
docs(checkbox): add indeterminate and checked disable examples
yggg Mar 22, 2019
30c98a7
docs(checkbox): add examples with new statuses
yggg Mar 22, 2019
b467746
docs(checkbox): make reset button visible
yggg Mar 22, 2019
dce09e0
fix(theme): use proper values for typography settings
yggg Mar 23, 2019
6a1a31f
refactor(theme): move global styles to proper directory
yggg Mar 23, 2019
e4ada7a
fix(checkbox): use updated class names in tests and select
yggg Mar 25, 2019
6bf6f69
refactor(theme): add statuses function
yggg Mar 25, 2019
bc09545
fix(checkbox): ignore basic status
yggg Mar 25, 2019
fabfb05
refactor(checkbox): extract statuses into enum
yggg Mar 25, 2019
98a54e4
feat(theme): add new Eva theme variables
yggg Mar 28, 2019
55e696e
refactor(checkbox): remove named inputs
yggg Mar 28, 2019
d1e19f0
refactor(checkbox): extract component statuses in shared type
yggg Mar 28, 2019
8f78594
refactor(theme): remove 'white' and 'basic' statuses
yggg Mar 30, 2019
583489d
refactor(checkbox): use nb-icon
yggg Mar 30, 2019
c3738ee
test(checkbox): add icon module import
yggg Mar 30, 2019
9666be7
test(checkbox): add mark touched test
yggg Mar 30, 2019
97af6e2
feat(checkbox): add state transition properties
yggg Mar 30, 2019
700a8e0
feat(checkbox): add minus and check mark checkbox icons
yggg Apr 1, 2019
5ed643d
feat: add default component status
yggg Apr 1, 2019
844e4ae
refactor(checkbox): add default checkbox appearance
yggg Apr 1, 2019
5a46c5d
docs(checkbox): add new theme properties
yggg Apr 1, 2019
d8c299c
fix(select): update icon selector
yggg Apr 1, 2019
56a034c
feat(checkbox): add border style theme property
yggg Apr 1, 2019
dde47fb
refactor: remove mixin duplicate
yggg Apr 1, 2019
61cc8d3
refactor(theme): make transition not configurable
yggg Apr 2, 2019
0299171
refactor(checkbox): set default status in ts file
yggg Apr 2, 2019
e053b2c
feat(theme): update typography
yggg Apr 2, 2019
437df3e
feat(theme): add sizes ts type and scss function
yggg Apr 2, 2019
610d70a
docs(checkbox): update theme properties list
yggg Apr 2, 2019
48e5e83
feat(checkbox): update view after focus change
yggg Apr 2, 2019
e6b5eac
test(checkbox): ensure default if set when no status passed
yggg Apr 2, 2019
497027f
feat(checkbox): typo in event name
yggg Apr 2, 2019
a7eab6c
refactor(checkbox): remove unused class and auxiliary methods
yggg Apr 2, 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 e2e/checkbox.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe('nb-checkbox', () => {

it('should apply check on click', () => {
const input = element(by.css('#first input'));
const indicator = element(by.css('#first .customised-control-indicator'));
const indicator = element(by.css('#first .custom-checkbox'));

expect(input.getAttribute('checked')).toBeFalsy();
indicator.click();
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -176,4 +176,4 @@
"uglifyjs-webpack-plugin": "1.1.5"
},
"schematics": "./schematics/dist/collection.json"
}
}
nnixaa marked this conversation as resolved.
Show resolved Hide resolved
6 changes: 6 additions & 0 deletions src/app/playground-components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,12 @@ export const PLAYGROUND_COMPONENTS: ComponentLink[] = [
component: 'CheckboxTestComponent',
name: 'Checkbox Test',
},
{
path: 'checkbox-indeterminate.component',
link: '/checkbox/checkbox-indeterminate.component',
component: 'CheckboxIndeterminateComponent',
name: 'Checkbox Indeterminate',
},
],
},
{
Expand Down
2 changes: 1 addition & 1 deletion src/framework/eva-icons/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@
"@nebular/theme": "4.0.0-beta.0",
"eva-icons": "^1.1.1"
}
}
}
137 changes: 72 additions & 65 deletions src/framework/theme/components/checkbox/_checkbox.component.theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,91 +4,98 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*/

@mixin checkbox-border($color) {
.customised-control-input:checked + .customised-control-indicator {
border-color: $color;
}
@mixin nb-checkbox-theme() {
nb-checkbox {
.custom-checkbox {
width: nb-theme(checkbox-width);
height: nb-theme(checkbox-height);
border-style: nb-theme(checkbox-border-style);
border-width: nb-theme(checkbox-border-width);
border-radius: nb-theme(checkbox-border-radius);
}

&:hover .customised-control-input:enabled + .customised-control-indicator,
.customised-control-input:focus:enabled + .customised-control-indicator {
border-color: $color;
opacity: 0.6;
.native-input:focus + .custom-checkbox {
box-shadow: 0 0 0 nb-theme(checkbox-outline-width) nb-theme(checkbox-outline-color);
}

.text {
color: nb-theme(checkbox-text-color);
font-family: nb-theme(checkbox-text-font-family);
font-size: nb-theme(checkbox-text-font-size);
font-weight: nb-theme(checkbox-text-font-weight);
line-height: nb-theme(checkbox-text-line-height);
}
}
}

@mixin check-mark-style($size, $color, $border-size) {
&::before {
height: calc(#{$size} * 0.6);
width: calc(#{$size} * 0.4);
border-color: $color;
border-width: 0 $border-size $border-size 0;
@each $status in nb-get-statuses() {
@include nb-checkbox-status($status);
}
}

@mixin nb-checkbox-theme() {
nb-checkbox {
.customised-control-indicator {
background-color: nb-theme(checkbox-bg);
width: nb-theme(checkbox-size);
height: nb-theme(checkbox-size);
border: nb-theme(checkbox-border-size) solid nb-theme(checkbox-border-color);

@include check-mark-style(
nb-theme(checkbox-size),
nb-theme(checkbox-checkmark),
nb-theme(checkbox-border-size)
);
@mixin nb-checkbox-status($status: '') {
nb-checkbox.status-#{$status} {
.custom-checkbox {
background-color: nb-theme(checkbox-#{$status}-background-color);
border-color: nb-theme(checkbox-#{$status}-border-color);
}

.customised-control-input:checked + .customised-control-indicator {
background-color: nb-theme(checkbox-checked-bg);
width: nb-theme(checkbox-checked-size);
height: nb-theme(checkbox-checked-size);
border: nb-theme(checkbox-checked-border-size) solid nb-theme(checkbox-checked-border-color);
.custom-checkbox.checked {
background-color: nb-theme(checkbox-#{$status}-checked-background-color);
border-color: nb-theme(checkbox-#{$status}-checked-border-color);
position: relative;

@include check-mark-style(
nb-theme(checkbox-checked-size),
nb-theme(checkbox-checked-checkmark),
nb-theme(checkbox-checked-border-size)
);
nb-icon {
color: nb-theme(checkbox-#{$status}-checked-checkmark-color);
}
}

.customised-control-input:disabled + .customised-control-indicator {
background-color: nb-theme(checkbox-disabled-bg);
width: nb-theme(checkbox-disabled-size);
height: nb-theme(checkbox-disabled-size);
border: nb-theme(checkbox-disabled-border-size) solid nb-theme(checkbox-border-color);
.custom-checkbox.indeterminate {
background-color: nb-theme(checkbox-#{$status}-indeterminate-background-color);
border-color: nb-theme(checkbox-#{$status}-indeterminate-border-color);
position: relative;

@include check-mark-style(
nb-theme(checkbox-disabled-size),
nb-theme(checkbox-checkmark),
nb-theme(checkbox-disabled-border-size)
);
nb-icon {
color: nb-theme(checkbox-#{$status}-indeterminate-checkmark-color);
}
}

.customised-control-input:disabled:checked + .customised-control-indicator {
border-color: nb-theme(checkbox-checked-border-color);

@include check-mark-style(
nb-theme(checkbox-disabled-size),
nb-theme(checkbox-disabled-checkmark),
nb-theme(checkbox-disabled-border-size)
);
.custom-checkbox.checked,
.custom-checkbox.indeterminate {
nb-icon {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 50%;
}
}

@include checkbox-border(nb-theme(checkbox-checked-border-color));
&.success {
@include checkbox-border(nb-theme(color-success));
.native-input:focus + .custom-checkbox {
border-color: nb-theme(checkbox-#{$status}-focus-background-color);
}
&.warning {
@include checkbox-border(nb-theme(color-warning));

.custom-checkbox:hover {
background-color: nb-theme(checkbox-#{$status}-hover-background-color);
border-color: nb-theme(checkbox-#{$status}-hover-border-color);
}
&.danger {
@include checkbox-border(nb-theme(color-danger));

.native-input:active + .custom-checkbox {
background-color: nb-theme(checkbox-#{$status}-hover-background-color);
border-color: nb-theme(checkbox-#{$status}-hover-border-color);
}

.customised-control-description {
color: nb-theme(color-fg-heading);
.native-input:disabled {
& + .custom-checkbox {
background-color: nb-theme(checkbox-disabled-background-color);
border-color: nb-theme(checkbox-disabled-border-color);

nb-icon {
color: nb-theme(checkbox-disabled-checkmark-color);
}
}
& ~ .text {
color: nb-theme(checkbox-disabled-text-color);
}
}
}
}
34 changes: 8 additions & 26 deletions src/framework/theme/components/checkbox/checkbox.component.scss
Original file line number Diff line number Diff line change
@@ -1,41 +1,23 @@
@import '../../styles/core/mixins';

:host {
.customised-control {
.label {
position: relative;
display: inline-flex;
align-items: center;
margin: 0;
min-height: inherit;
padding: 0.375rem 1.5rem 0.375rem 0;
}

.customised-control-input {
position: absolute;
opacity: 0;
}

.customised-control-input:disabled {
& ~ .customised-control-indicator,
& ~ .customised-control-description {
opacity: 0.5;
}
}

.customised-control-indicator {
border-radius: 0.25rem;
.custom-checkbox {
flex-shrink: 0;

&::before {
content: '';
border-style: solid;
display: block;
margin: 0 auto;
transform: rotate(45deg);
}
@include nb-component-animation(background-color, border, box-shadow);
}

.customised-control-description {
@include nb-ltr(padding-left, 0.5rem);
@include nb-rtl(padding-right, 0.5rem);
.text {
transition: color 0.15s ease-in;
@include nb-ltr(padding-left, 0.6875rem);
@include nb-rtl(padding-right, 0.6875rem);
}
}
Loading