@@ -23,7 +23,7 @@ import type {
2323} from "home-assistant-js-websocket" ;
2424import { dump } from "js-yaml" ;
2525import type { CSSResultGroup , PropertyValues , TemplateResult } from "lit" ;
26- import { LitElement , css , html , nothing } from "lit" ;
26+ import { LitElement , html , nothing } from "lit" ;
2727import { customElement , property , query , state } from "lit/decorators" ;
2828import { classMap } from "lit/directives/class-map" ;
2929import memoizeOne from "memoize-one" ;
@@ -39,14 +39,14 @@ import { debounce } from "../../../../common/util/debounce";
3939import "../../../../components/automation/ha-automation-row" ;
4040import type { HaAutomationRow } from "../../../../components/automation/ha-automation-row" ;
4141import "../../../../components/automation/ha-automation-row-event-chip" ;
42+ import "../../../../components/automation/ha-automation-row-live-test" ;
4243import "../../../../components/ha-card" ;
4344import "../../../../components/ha-condition-icon" ;
4445import "../../../../components/ha-dropdown" ;
4546import type { HaDropdownSelectEvent } from "../../../../components/ha-dropdown" ;
4647import "../../../../components/ha-dropdown-item" ;
4748import "../../../../components/ha-expansion-panel" ;
4849import "../../../../components/ha-icon-button" ;
49- import "../../../../components/ha-tooltip" ;
5050import type {
5151 AutomationClipboard ,
5252 Condition ,
@@ -498,23 +498,15 @@ export default class HaAutomationConditionRow extends LitElement {
498498 @click=${ this . _toggleSidebar }
499499 @toggle-collapsed=${ this . _toggleCollapse }
500500 > ${ this . _renderRow ( ) }
501- <div
501+ < ha-automation-row-live-test
502502 slot ="icons "
503- id = "live-test"
504- class= ${ this . _liveTestResult . state }
505- role= "status"
506- tabindex= "0"
507- aria- label= ${ this . hass . localize (
503+ .state =${ this . _liveTestResult . state }
504+ .label =${ this . hass . localize (
508505 `ui.panel.config.automation.editor.conditions.live_test_state.${ this . _liveTestResult . state } `
509506 ) }
510- >
511- ${ this . _liveTestResult . message
512- ? html `<ha- to oltip for = "live-test" >
513- ${ this . _liveTestResult . message }
514- </ ha- to oltip> `
515- : nothing }
516- </ div> </ ha- auto mation- row
517- > `
507+ .message=${ this . _liveTestResult . message }
508+ > </ ha-automation-row-live-test
509+ > </ ha-automation-row > `
518510 : html `
519511 < ha-expansion-panel
520512 left-chevron
@@ -1064,52 +1056,7 @@ export default class HaAutomationConditionRow extends LitElement {
10641056 }
10651057
10661058 static get styles ( ) : CSSResultGroup {
1067- return [
1068- rowStyles ,
1069- overflowStyles ,
1070- css `
1071- # live-test {
1072- position : absolute;
1073- inset-inline-end : -6px ;
1074- width : 12px ;
1075- height : 12px ;
1076- border-radius : var (--ha-border-radius-circle );
1077- border : 3px solid;
1078- box-sizing : border-box;
1079- background-color : var (--card-background-color );
1080- transition : all var (--ha-animation-duration-normal ) ease-in-out;
1081- }
1082- # live-test .pass {
1083- background-color : var (--ha-color-fill-success-loud-resting );
1084- border-color : var (--ha-color-fill-success-loud-resting );
1085- }
1086- # live-test .pass : hover {
1087- background-color : var (--ha-color-fill-success-loud-hover );
1088- border-color : var (--ha-color-fill-success-loud-hover );
1089- }
1090- # live-test .fail {
1091- border-color : var (--ha-color-fill-warning-loud-resting );
1092- }
1093- # live-test .fail : hover {
1094- background-color : var (--ha-color-fill-warning-loud-hover );
1095- border-color : var (--ha-color-fill-warning-loud-hover );
1096- }
1097- # live-test .invalid {
1098- border-color : var (--ha-color-fill-danger-loud-resting );
1099- }
1100- # live-test .invalid : hover {
1101- background-color : var (--ha-color-fill-danger-loud-hover );
1102- border-color : var (--ha-color-fill-danger-loud-hover );
1103- }
1104- # live-test .unknown {
1105- border-color : var (--ha-color-fill-neutral-loud-resting );
1106- }
1107- # live-test .unknown : hover {
1108- background-color : var (--ha-color-fill-neutral-loud-hover );
1109- border-color : var (--ha-color-fill-neutral-loud-hover );
1110- }
1111- ` ,
1112- ] ;
1059+ return [ rowStyles , overflowStyles ] ;
11131060 }
11141061}
11151062
0 commit comments