diff --git a/src/app/playground-components.ts b/src/app/playground-components.ts
index 27ea83e6ab..a3593dd3dc 100644
--- a/src/app/playground-components.ts
+++ b/src/app/playground-components.ts
@@ -895,10 +895,10 @@ export const PLAYGROUND_COMPONENTS: ComponentLink[] = [
name: 'Select Multiple',
},
{
- path: 'select-outline.component',
- link: '/select/select-outline.component',
- component: 'SelectOutlineComponent',
- name: 'Select Outline',
+ path: 'select-filled.component',
+ link: '/select/select-filled.component',
+ component: 'SelectFilledComponent',
+ name: 'Select Filled',
},
{
path: 'select-placeholder.component',
@@ -930,6 +930,12 @@ export const PLAYGROUND_COMPONENTS: ComponentLink[] = [
component: 'SelectStatusComponent',
name: 'Select Status',
},
+ {
+ path: 'select-interactive.component',
+ link: '/select/select-interactive.component',
+ component: 'SelectInteractiveComponent',
+ name: 'Select Interactive',
+ },
],
},
{
diff --git a/src/framework/theme/components/select/_select-filled.scss b/src/framework/theme/components/select/_select-filled.scss
new file mode 100644
index 0000000000..bc98da8b4b
--- /dev/null
+++ b/src/framework/theme/components/select/_select-filled.scss
@@ -0,0 +1,66 @@
+@mixin select-filled {
+ nb-select.appearance-filled .select-button {
+ background-color: nb-theme(select-filled-background-color);
+ border-color: nb-theme(select-filled-border-color);
+ border-style: nb-theme(select-filled-border-style);
+ border-width: nb-theme(select-filled-border-width);
+ color: nb-theme(select-filled-text-color);
+
+ &.placeholder {
+ color: nb-theme(select-filled-placeholder-text-color);
+ }
+
+ &:focus {
+ border-color: nb-theme(select-filled-focus-border-color);
+ }
+ &:hover {
+ background-color: nb-theme(select-filled-hover-background-color);
+ border-color: nb-theme(select-filled-hover-border-color);
+ }
+ &[disabled] {
+ color: nb-theme(select-filled-disabled-text-color);
+ background-color: nb-theme(select-filled-disabled-background-color);
+ border-color: nb-theme(select-filled-disabled-border-color);
+ }
+ }
+
+ @each $size in nb-get-sizes() {
+ nb-select.appearance-filled.size-#{$size} .select-button {
+ padding: nb-theme(select-filled-#{$size}-padding);
+ }
+ .appearance-filled.size-#{$size} {
+ nb-option-group .option-group-title,
+ nb-option {
+ padding: nb-theme(select-option-filled-#{$size}-padding);
+ }
+ nb-option-group nb-option {
+ padding-left: nb-theme(select-group-option-outline-#{$size}-start-padding);
+ }
+ }
+ }
+
+ @each $status in nb-get-statuses() {
+ nb-select.appearance-filled.status-#{$status} .select-button {
+ background-color: nb-theme(select-filled-#{$status}-background-color);
+ border-color: nb-theme(select-filled-#{$status}-border-color);
+ color: nb-theme(select-filled-#{$status}-text-color);
+
+ &.placeholder {
+ color: nb-theme(select-filled-#{$status}-placeholder-text-color);
+ }
+
+ &:focus {
+ background-color: nb-theme(select-filled-#{$status}-focus-background-color);
+ border-color: nb-theme(select-filled-#{$status}-focus-border-color);
+ }
+ &:hover {
+ background-color: nb-theme(select-filled-#{$status}-hover-background-color);
+ border-color: nb-theme(select-filled-#{$status}-hover-border-color);
+ }
+ &[disabled] {
+ background-color: nb-theme(select-filled-#{$status}-disabled-background-color);
+ border-color: nb-theme(select-filled-#{$status}-disabled-border-color);
+ }
+ }
+ }
+}
diff --git a/src/framework/theme/components/select/_select-hero.scss b/src/framework/theme/components/select/_select-hero.scss
new file mode 100644
index 0000000000..290ac19a0e
--- /dev/null
+++ b/src/framework/theme/components/select/_select-hero.scss
@@ -0,0 +1,77 @@
+@mixin select-hero {
+ nb-select.appearance-hero .select-button {
+ $left-color: nb-theme(select-hero-left-background-color);
+ $right-color: nb-theme(select-hero-right-background-color);
+ background-image: linear-gradient(to right, $left-color, $right-color);
+ border-color: nb-theme(select-hero-border-color);
+ border-style: nb-theme(select-hero-border-style);
+ border-width: nb-theme(select-hero-border-width);
+ color: nb-theme(select-hero-text-color);
+
+ &.placeholder {
+ color: nb-theme(select-hero-placeholder-text-color);
+ }
+
+ &:focus {
+ $left-color: nb-theme(select-hero-focus-left-background-color);
+ $right-color: nb-theme(select-hero-focus-right-background-color);
+ background-image: linear-gradient(to right, $left-color, $right-color);
+ }
+ &:hover {
+ $left-color: nb-theme(select-hero-hover-left-background-color);
+ $right-color: nb-theme(select-hero-hover-right-background-color);
+ background-image: linear-gradient(to right, $left-color, $right-color);
+ }
+ &[disabled] {
+ color: nb-theme(select-hero-disabled-text-color);
+ $left-color: nb-theme(select-hero-disabled-left-background-color);
+ $right-color: nb-theme(select-hero-disabled-right-background-color);
+ background-image: linear-gradient(to right, $left-color, $right-color);
+ }
+ }
+
+ @each $size in nb-get-sizes() {
+ nb-select.appearance-hero.size-#{$size} .select-button {
+ padding: nb-theme(select-hero-#{$size}-padding);
+ }
+ .appearance-hero.size-#{$size} {
+ nb-option-group .option-group-title,
+ nb-option {
+ padding: nb-theme(select-option-hero-#{$size}-padding);
+ }
+ nb-option-group nb-option {
+ padding-left: nb-theme(select-group-option-outline-#{$size}-start-padding);
+ }
+ }
+ }
+
+ @each $status in nb-get-statuses() {
+ nb-select.appearance-hero.status-#{$status} .select-button {
+ $left-color: nb-theme(select-hero-#{$status}-left-background-color);
+ $right-color: nb-theme(select-hero-#{$status}-right-background-color);
+ background-image: linear-gradient(to right, $left-color, $right-color);
+ color: nb-theme(select-hero-#{$status}-text-color);
+
+ &.placeholder {
+ color: nb-theme(select-hero-#{$status}-placeholder-text-color);
+ }
+
+ &:focus {
+ $left-color: nb-theme(select-hero-#{$status}-focus-left-background-color);
+ $right-color: nb-theme(select-hero-#{$status}-focus-right-background-color);
+ background-image: linear-gradient(to right, $left-color, $right-color);
+ }
+ &:hover {
+ $left-color: nb-theme(select-hero-#{$status}-hover-left-background-color);
+ $right-color: nb-theme(select-hero-#{$status}-hover-right-background-color);
+ background-image: linear-gradient(to right, $left-color, $right-color);
+ }
+ &[disabled] {
+ color: nb-theme(select-hero-#{$status}-disabled-text-color);
+ $left-color: nb-theme(select-hero-#{$status}-disabled-left-background-color);
+ $right-color: nb-theme(select-hero-#{$status}-disabled-right-background-color);
+ background-image: linear-gradient(to right, $left-color, $right-color);
+ }
+ }
+ }
+}
diff --git a/src/framework/theme/components/select/_select-outline.scss b/src/framework/theme/components/select/_select-outline.scss
new file mode 100644
index 0000000000..38bed4065c
--- /dev/null
+++ b/src/framework/theme/components/select/_select-outline.scss
@@ -0,0 +1,55 @@
+@mixin select-outline {
+ nb-select.appearance-outline .select-button {
+ background-color: nb-theme(select-outline-background-color);
+ border-color: nb-theme(select-outline-border-color);
+ border-style: nb-theme(select-outline-border-style);
+ border-width: nb-theme(select-outline-border-width);
+ color: nb-theme(select-outline-text-color);
+
+ &.placeholder {
+ color: nb-theme(select-outline-placeholder-text-color);
+ }
+
+ &:focus {
+ border-color: nb-theme(select-outline-focus-border-color);
+ }
+ &:hover {
+ border-color: nb-theme(select-outline-hover-border-color);
+ }
+ &[disabled] {
+ color: nb-theme(select-outline-disabled-text-color);
+ background-color: nb-theme(select-outline-disabled-background-color);
+ border-color: nb-theme(select-outline-disabled-border-color);
+ }
+ }
+
+ @each $status in nb-get-statuses() {
+ nb-select.appearance-outline.status-#{$status} .select-button {
+ border-color: nb-theme(select-outline-#{$status}-border-color);
+ &.selected {
+ background-color: nb-theme(select-option-outline-#{$status}-selected-background-color);
+ }
+ &:focus {
+ border-color: nb-theme(select-outline-#{$status}-focus-border-color);
+ }
+ &:hover {
+ border-color: nb-theme(select-outline-#{$status}-hover-border-color);
+ }
+ }
+ }
+
+ @each $size in nb-get-sizes() {
+ nb-select.appearance-outline.size-#{$size} .select-button {
+ padding: nb-theme(select-outline-#{$size}-padding);
+ }
+ .appearance-outline.size-#{$size} {
+ nb-option-group .option-group-title,
+ nb-option {
+ padding: nb-theme(select-option-outline-#{$size}-padding);
+ }
+ nb-option-group nb-option {
+ padding-left: nb-theme(select-group-option-outline-#{$size}-start-padding);
+ }
+ }
+ }
+}
diff --git a/src/framework/theme/components/select/_select.component.theme.scss b/src/framework/theme/components/select/_select.component.theme.scss
index 45c842f027..c0e84adf25 100644
--- a/src/framework/theme/components/select/_select.component.theme.scss
+++ b/src/framework/theme/components/select/_select.component.theme.scss
@@ -4,103 +4,111 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*/
-@mixin nb-select-status($status) {
- border: nb-theme(select-border-width) solid nb-theme(color-#{$status});
-
- nb-option {
- &:hover, &.selected {
- background-color: nb-theme(color-#{$status});
- color: nb-theme(color-white);
- }
- }
-}
+@import './select-outline';
+@import './select-filled';
+@import './select-hero';
@mixin nb-select-theme() {
- nb-select > button[nbButton] {
- transition: all 0.1s;
+ nb-select {
+ .select-button {
+ min-width: nb-theme(select-min-width);
+ cursor: nb-theme(select-cursor);
- &::after {
- @include nb-rtl(left, 0.75rem);
- @include nb-rtl(right, auto);
- }
-
- &.opened {
- &.top {
- border-top-left-radius: 0;
- border-top-right-radius: 0;
+ &.placeholder {
+ font-weight: nb-theme(select-placeholder-text-font-weight);
}
-
- &.bottom {
- border-bottom-left-radius: 0;
- border-bottom-right-radius: 0;
+ &:focus {
+ box-shadow: 0 0 0 nb-theme(select-outline-width) nb-theme(select-outline-color);
+ outline: none;
+ }
+ &[disabled] {
+ cursor: nb-theme(select-disabled-cursor);
}
}
}
- nb-card.select {
- background-color: nb-theme(select-bg);
- max-height: nb-theme(select-max-height);
- margin-bottom: 0;
- box-shadow: none;
+ .options-list-container {
+ overflow: hidden;
- nb-card-body {
+ & > .options-list {
+ margin: 0;
padding: 0;
}
+ }
- nb-option {
- padding: nb-theme(select-option-padding);
- user-select: none;
- }
-
- &.primary {
- @include nb-select-status(primary);
- }
-
- &.danger {
- @include nb-select-status(danger);
- }
+ .options-list {
+ max-height: nb-theme(select-options-list-max-height);
+ height: 100%;
+ overflow: auto;
+ }
- &.warning {
- @include nb-select-status(warning);
- }
+ nb-option {
+ user-select: none;
- &.info {
- @include nb-select-status(info);
+ &:focus {
+ outline: none;
}
+ }
- &.success {
- @include nb-select-status(success);
- }
+ nb-select .select-button,
+ nb-option,
+ nb-option-group {
+ font-family: nb-theme(select-text-font-family);
+ font-weight: nb-theme(select-text-font-weight);
+ }
- &.bottom {
- border-top-left-radius: 0;
- border-top-right-radius: 0;
+ @each $size in nb-get-sizes() {
+ nb-select.size-#{$size} .select-button,
+ .size-#{$size} nb-option {
+ font-size: nb-theme(select-#{$size}-text-font-size);
+ line-height: nb-theme(select-#{$size}-text-line-height);
}
+ }
- &.top {
- border-bottom-left-radius: 0;
- border-bottom-right-radius: 0;
+ @each $shape in nb-get-shapes() {
+ nb-select.shape-#{$shape} .select-button {
+ border-radius: nb-theme(select-#{$shape}-border-radius);
}
- nb-checkbox {
- .text {
- color: inherit;
+ .options-list-container.shape-#{$shape} {
+ &.bottom {
+ border-bottom-left-radius: nb-theme(select-#{$shape}-border-radius);
+ border-bottom-right-radius: nb-theme(select-#{$shape}-border-radius);
+ }
+ &.top {
+ border-top-left-radius: nb-theme(select-#{$shape}-border-radius);
+ border-top-right-radius: nb-theme(select-#{$shape}-border-radius);
}
+ }
+ }
- .native-input:checked + .custom-checkbox {
- border-color: nb-theme(select-checkbox-color);
+ nb-option-group,
+ nb-option {
+ background-color: nb-theme(select-option-background-color);
+ color: nb-theme(select-option-text-color);
- nb-icon {
- color: nb-theme(select-checkmark-color);
- }
- }
+ &[disabled] {
+ background-color: nb-theme(select-option-disabled-background-color);
+ color: nb-theme(select-option-disabled-text-color);
}
+ }
- nb-option, nb-option-group {
- &.disabled {
- background-color: nb-theme(select-option-disabled-bg);
- opacity: nb-theme(select-option-disabled-opacity);
- }
+ nb-option {
+ &.selected {
+ background-color: nb-theme(select-option-selected-background-color);
+ color: nb-theme(select-option-selected-text-color);
+ }
+ &:focus {
+ background-color: nb-theme(select-option-focus-background-color);
+ color: nb-theme(select-option-focus-text-color);
+ }
+ &:hover {
+ background-color: nb-theme(select-option-hover-background-color);
+ color: nb-theme(select-option-hover-text-color);
}
}
+
+ @include select-outline();
+ @include select-filled();
+ @include select-hero();
}
diff --git a/src/framework/theme/components/select/option-group.component.scss b/src/framework/theme/components/select/option-group.component.scss
index 44e4e363a8..6eaa545a3f 100644
--- a/src/framework/theme/components/select/option-group.component.scss
+++ b/src/framework/theme/components/select/option-group.component.scss
@@ -6,17 +6,8 @@
:host {
display: block;
+}
- span {
- padding: 1.125rem 0.5rem;
- display: block;
- }
-
- &.disabled {
- pointer-events: none;
- }
-
- /deep/ nb-option {
- padding: 0.75rem 0.75rem 0.75rem 2.5rem;
- }
+.option-group-title {
+ display: block;
}
diff --git a/src/framework/theme/components/select/option-group.component.ts b/src/framework/theme/components/select/option-group.component.ts
index 10d9fe9ec6..6dea67e246 100644
--- a/src/framework/theme/components/select/option-group.component.ts
+++ b/src/framework/theme/components/select/option-group.component.ts
@@ -13,23 +13,25 @@ import { convertToBoolProperty } from '../helpers';
styleUrls: ['./option-group.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
- {{ title }}
+ {{ title }}
`,
})
export class NbOptionGroupComponent {
@Input() title: string;
- @Input('disabled')
- set setDisabled(disabled: boolean) {
- this.disabled = convertToBoolProperty(disabled);
+ @Input()
+ get disabled(): boolean {
+ return this._disabled;
}
+ set disabled(value: boolean) {
+ this._disabled = convertToBoolProperty(value);
+ }
+ protected _disabled: boolean = false;
- disabled: boolean = false;
-
- @HostBinding('class.disabled')
- get disabledClass(): boolean {
- return this.disabled;
+ @HostBinding('attr.disabled')
+ get disabledAttribute(): '' | null {
+ return this.disabled ? '' : null;
}
}
diff --git a/src/framework/theme/components/select/option.component.scss b/src/framework/theme/components/select/option.component.scss
index 3b45dc5d62..ceb15b9fe8 100644
--- a/src/framework/theme/components/select/option.component.scss
+++ b/src/framework/theme/components/select/option.component.scss
@@ -4,12 +4,11 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*/
+@import '../../styles/core/mixins';
+
:host {
display: block;
-
- &.disabled {
- pointer-events: none;
- }
+ @include nb-component-animation(background-color, color);
&:hover {
cursor: pointer;
@@ -20,3 +19,7 @@
}
}
+:host([disabled]) {
+ pointer-events: none;
+}
+
diff --git a/src/framework/theme/components/select/option.component.ts b/src/framework/theme/components/select/option.component.ts
index 72871748f4..39d96d8026 100644
--- a/src/framework/theme/components/select/option.component.ts
+++ b/src/framework/theme/components/select/option.component.ts
@@ -47,10 +47,14 @@ export class NbOptionComponent implements OnDestroy {
* */
@Input() value: T;
- @Input('disabled')
- set setDisabled(disabled: boolean) {
- this.disabled = convertToBoolProperty(disabled);
+ @Input()
+ get disabled(): boolean {
+ return this._disabled;
}
+ set disabled(value: boolean) {
+ this._disabled = convertToBoolProperty(value);
+ }
+ protected _disabled: boolean = false;
/**
* Fires value when option selection change.
@@ -66,8 +70,7 @@ export class NbOptionComponent implements OnDestroy {
}
selected: boolean = false;
- disabled: boolean = false;
- private alive: boolean = true;
+ protected alive: boolean = true;
constructor(@Inject(forwardRef(() => NbSelectComponent)) protected parent,
protected elementRef: ElementRef,
@@ -98,9 +101,9 @@ export class NbOptionComponent implements OnDestroy {
return this.selected;
}
- @HostBinding('class.disabled')
- get disabledClass(): boolean {
- return this.disabled;
+ @HostBinding('attr.disabled')
+ get disabledAttribute(): '' | null {
+ return this.disabled ? '' : null;
}
@HostListener('click')
@@ -116,7 +119,7 @@ export class NbOptionComponent implements OnDestroy {
this.setSelection(false);
}
- private setSelection(selected: boolean): void {
+ protected setSelection(selected: boolean): void {
/**
* In case of changing options in runtime the reference to the selected option will be kept in select component.
* This may lead to exceptions with detecting changes in destroyed component.
diff --git a/src/framework/theme/components/select/select.component.html b/src/framework/theme/components/select/select.component.html
index f26fa4be67..3c2472d60b 100644
--- a/src/framework/theme/components/select/select.component.html
+++ b/src/framework/theme/components/select/select.component.html
@@ -1,33 +1,25 @@
-