mirror of
https://github.com/home-assistant/frontend.git
synced 2025-12-20 02:38:53 +00:00
52 lines
1.5 KiB
TypeScript
52 lines
1.5 KiB
TypeScript
import { mdiPower, mdiPowerOff } from "@mdi/js";
|
|
import { HassEntity } from "home-assistant-js-websocket";
|
|
import { CSSResultGroup, html, LitElement, nothing } from "lit";
|
|
import { customElement, property } from "lit/decorators";
|
|
import "../../../components/ha-attributes";
|
|
import type { HomeAssistant } from "../../../types";
|
|
import { moreInfoControlStyle } from "../components/ha-more-info-control-style";
|
|
import "../components/ha-more-info-state-header";
|
|
import "../components/ha-more-info-toggle";
|
|
|
|
@customElement("more-info-input_boolean")
|
|
class MoreInfoInputBoolean extends LitElement {
|
|
@property({ attribute: false }) public hass!: HomeAssistant;
|
|
|
|
@property({ attribute: false }) public stateObj?: HassEntity;
|
|
|
|
protected render() {
|
|
if (!this.hass || !this.stateObj) {
|
|
return nothing;
|
|
}
|
|
|
|
return html`
|
|
<ha-more-info-state-header
|
|
.hass=${this.hass}
|
|
.stateObj=${this.stateObj}
|
|
></ha-more-info-state-header>
|
|
<div class="controls">
|
|
<ha-more-info-toggle
|
|
.stateObj=${this.stateObj}
|
|
.hass=${this.hass}
|
|
.iconPathOn=${mdiPower}
|
|
.iconPathOff=${mdiPowerOff}
|
|
></ha-more-info-toggle>
|
|
</div>
|
|
<ha-attributes
|
|
.hass=${this.hass}
|
|
.stateObj=${this.stateObj}
|
|
></ha-attributes>
|
|
`;
|
|
}
|
|
|
|
static get styles(): CSSResultGroup {
|
|
return moreInfoControlStyle;
|
|
}
|
|
}
|
|
|
|
declare global {
|
|
interface HTMLElementTagNameMap {
|
|
"more-info-input_boolean": MoreInfoInputBoolean;
|
|
}
|
|
}
|