Consolidate all icon button logic into <ha-icon-button> + ensure tooltip (#9230)

This commit is contained in:
Philip Allgaier
2021-10-14 15:44:20 +02:00
committed by GitHub
parent bddb505b7f
commit 0c940be5fb
152 changed files with 1222 additions and 1120 deletions

View File

@@ -11,7 +11,7 @@ import {
} from "lit";
import { customElement, property, state, query } from "lit/decorators";
import { fireEvent } from "../../common/dom/fire_event";
import "../ha-svg-icon";
import "../ha-icon-button";
import type {
HaFormElement,
HaFormStringData,
@@ -64,17 +64,13 @@ export class HaFormString extends LitElement implements HaFormElement {
@input=${this._valueChanged}
></mwc-textfield>
${isPassword
? html`
<mwc-icon-button
toggles
title="Click to toggle between masked and clear password"
@click=${this._toggleUnmaskedPassword}
tabindex="-1"
><ha-svg-icon
.path=${this._unmaskedPassword ? mdiEyeOff : mdiEye}
></ha-svg-icon>
</mwc-icon-button>
`
? html`<ha-icon-button
toggles
.label="Click to toggle between masked and clear password"
@click=${this._toggleUnmaskedPassword}
tabindex="-1"
.path=${this._unmaskedPassword ? mdiEyeOff : mdiEye}
></ha-icon-button>`
: ""}
`;
}
@@ -126,7 +122,7 @@ export class HaFormString extends LitElement implements HaFormElement {
mwc-textfield {
display: block;
}
mwc-icon-button {
ha-icon-button {
position: absolute;
top: 1em;
right: 12px;