mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-27 19:26:36 +00:00
Cleanup some styling on disabled entity picker (#25632)
This commit is contained in:
parent
46e05f10d1
commit
9f69347e1d
@ -72,7 +72,9 @@ export class HaGenericPicker extends LitElement {
|
|||||||
|
|
||||||
protected render() {
|
protected render() {
|
||||||
return html`
|
return html`
|
||||||
${this.label ? html`<label>${this.label}</label>` : nothing}
|
${this.label
|
||||||
|
? html`<label ?disabled=${this.disabled}>${this.label}</label>`
|
||||||
|
: nothing}
|
||||||
<div class="container">
|
<div class="container">
|
||||||
${!this._opened
|
${!this._opened
|
||||||
? html`
|
? html`
|
||||||
@ -116,7 +118,9 @@ export class HaGenericPicker extends LitElement {
|
|||||||
|
|
||||||
private _renderHelper() {
|
private _renderHelper() {
|
||||||
return this.helper
|
return this.helper
|
||||||
? html`<ha-input-helper-text>${this.helper}</ha-input-helper-text>`
|
? html`<ha-input-helper-text .disabled=${this.disabled}
|
||||||
|
>${this.helper}</ha-input-helper-text
|
||||||
|
>`
|
||||||
: nothing;
|
: nothing;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -165,6 +169,9 @@ export class HaGenericPicker extends LitElement {
|
|||||||
position: relative;
|
position: relative;
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
label[disabled] {
|
||||||
|
color: var(--mdc-text-field-disabled-ink-color, rgba(0, 0, 0, 0.6));
|
||||||
|
}
|
||||||
label {
|
label {
|
||||||
display: block;
|
display: block;
|
||||||
margin: 0 0 8px;
|
margin: 0 0 8px;
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
import type { TemplateResult } from "lit";
|
import type { TemplateResult } from "lit";
|
||||||
import { css, html, LitElement } from "lit";
|
import { css, html, LitElement } from "lit";
|
||||||
import { customElement } from "lit/decorators";
|
import { customElement, property } from "lit/decorators";
|
||||||
|
|
||||||
@customElement("ha-input-helper-text")
|
@customElement("ha-input-helper-text")
|
||||||
class InputHelperText extends LitElement {
|
class InputHelperText extends LitElement {
|
||||||
|
@property({ type: Boolean, reflect: true }) disabled = false;
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render(): TemplateResult {
|
||||||
return html`<slot></slot>`;
|
return html`<slot></slot>`;
|
||||||
}
|
}
|
||||||
@ -18,6 +20,9 @@ class InputHelperText extends LitElement {
|
|||||||
padding-inline-start: 16px;
|
padding-inline-start: 16px;
|
||||||
padding-inline-end: 16px;
|
padding-inline-end: 16px;
|
||||||
}
|
}
|
||||||
|
:host([disabled]) {
|
||||||
|
color: var(--mdc-text-field-disabled-ink-color, rgba(0, 0, 0, 0.6));
|
||||||
|
}
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,7 +85,9 @@ class HaMultiTextField extends LitElement {
|
|||||||
</ha-button>
|
</ha-button>
|
||||||
</div>
|
</div>
|
||||||
${this.helper
|
${this.helper
|
||||||
? html`<ha-input-helper-text>${this.helper}</ha-input-helper-text>`
|
? html`<ha-input-helper-text .disabled=${this.disabled}
|
||||||
|
>${this.helper}</ha-input-helper-text
|
||||||
|
>`
|
||||||
: nothing}
|
: nothing}
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
@ -88,6 +88,12 @@ export class HaPickerField extends LitElement {
|
|||||||
static get styles(): CSSResultGroup {
|
static get styles(): CSSResultGroup {
|
||||||
return [
|
return [
|
||||||
css`
|
css`
|
||||||
|
ha-combo-box-item[disabled] {
|
||||||
|
background-color: var(
|
||||||
|
--mdc-text-field-disabled-fill-color,
|
||||||
|
whitesmoke
|
||||||
|
);
|
||||||
|
}
|
||||||
ha-combo-box-item {
|
ha-combo-box-item {
|
||||||
background-color: var(--mdc-text-field-fill-color, whitesmoke);
|
background-color: var(--mdc-text-field-fill-color, whitesmoke);
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
@ -106,6 +112,12 @@ export class HaPickerField extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Add Similar focus style as the text field */
|
/* Add Similar focus style as the text field */
|
||||||
|
ha-combo-box-item[disabled]:after {
|
||||||
|
background-color: var(
|
||||||
|
--mdc-text-field-disabled-line-color,
|
||||||
|
rgba(0, 0, 0, 0.42)
|
||||||
|
);
|
||||||
|
}
|
||||||
ha-combo-box-item:after {
|
ha-combo-box-item:after {
|
||||||
display: block;
|
display: block;
|
||||||
content: "";
|
content: "";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user