Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 7 additions & 0 deletions projects/components/src/combo-box/combo-box.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@
}
}

&.disabled {
background-color: $gray-2;
.trigger-input {
color: black;
}
}

.trigger-control {
height: 100%;
width: 24px;
Expand Down
15 changes: 13 additions & 2 deletions projects/components/src/combo-box/combo-box.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,21 @@ import { ComboBoxMode, ComboBoxOption, ComboBoxResult } from './combo-box-api';
}
],
template: `
<ht-popover (popoverOpen)="this.onPopoverOpen($event)" (popoverClose)="this.onPopoverClose()" class="combo-box">
<ht-popover
class="combo-box"
[disabled]="this.disabled"
(popoverOpen)="this.onPopoverOpen($event)"
(popoverClose)="this.onPopoverClose()"
>
<ht-popover-trigger>
<div
#trigger
class="popover-trigger"
[ngClass]="{
input: this.mode === '${ComboBoxMode.Input}',
chip: this.mode === '${ComboBoxMode.Chip}',
'show-border': this.showBorder
'show-border': this.showBorder,
disabled: this.disabled
}"
[class.has-text]="this.text"
[class.input-focused]="input.matches(':focus')"
Expand Down Expand Up @@ -79,6 +85,7 @@ import { ComboBoxMode, ComboBoxOption, ComboBoxResult } from './combo-box-api';

<!-- Clear Button -->
<div
*ngIf="!this.disabled"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this required? Mostly popover would block all interactions anyway right>?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it's required. The popover is not blocking the x but it should.

[class.has-text]="this.text"
[class.input-focused]="input.matches(':focus')"
[ngClass]="this.mode"
Expand Down Expand Up @@ -427,6 +434,10 @@ export class ComboBoxComponent<TValue = string> implements AfterViewInit, OnChan
});
}

public setDisabledState(isDisabled?: boolean): void {
this.disabled = isDisabled ?? false;
}

private propagateValueChangeToFormControl(value?: string): void {
this.propagateControlValueChange?.(value);
this.propagateControlValueChangeOnTouch?.(value);
Expand Down