mirror of
https://github.com/home-assistant/frontend.git
synced 2025-11-17 06:50:23 +00:00
48 lines
1.3 KiB
TypeScript
48 lines
1.3 KiB
TypeScript
import { html, LitElement } from "lit";
|
|
import { customElement, property } from "lit/decorators";
|
|
import { fireEvent } from "../../common/dom/fire_event";
|
|
import type { NavigationSelector } from "../../data/selector";
|
|
import type { HomeAssistant } from "../../types";
|
|
import "../ha-navigation-picker";
|
|
|
|
@customElement("ha-selector-navigation")
|
|
export class HaNavigationSelector extends LitElement {
|
|
@property({ attribute: false }) public hass!: HomeAssistant;
|
|
|
|
@property({ attribute: false }) public selector!: NavigationSelector;
|
|
|
|
@property() public value?: string;
|
|
|
|
@property() public label?: string;
|
|
|
|
@property() public helper?: string;
|
|
|
|
@property({ type: Boolean, reflect: true }) public disabled = false;
|
|
|
|
@property({ type: Boolean }) public required = true;
|
|
|
|
protected render() {
|
|
return html`
|
|
<ha-navigation-picker
|
|
.hass=${this.hass}
|
|
.label=${this.label}
|
|
.value=${this.value}
|
|
.required=${this.required}
|
|
.disabled=${this.disabled}
|
|
.helper=${this.helper}
|
|
@value-changed=${this._valueChanged}
|
|
></ha-navigation-picker>
|
|
`;
|
|
}
|
|
|
|
private _valueChanged(ev: CustomEvent) {
|
|
fireEvent(this, "value-changed", { value: ev.detail.value });
|
|
}
|
|
}
|
|
|
|
declare global {
|
|
interface HTMLElementTagNameMap {
|
|
"ha-selector-navigation": HaNavigationSelector;
|
|
}
|
|
}
|