diff --git a/src/components/ha-selector/ha-selector-image.ts b/src/components/ha-selector/ha-selector-image.ts deleted file mode 100644 index 9619125aba..0000000000 --- a/src/components/ha-selector/ha-selector-image.ts +++ /dev/null @@ -1,152 +0,0 @@ -import { css, html, LitElement } from "lit"; -import { customElement, property, state } from "lit/decorators"; -import { fireEvent } from "../../common/dom/fire_event"; -import type { ImageSelector } from "../../data/selector"; -import type { HomeAssistant } from "../../types"; -import "../ha-icon-button"; -import "../ha-textarea"; -import "../ha-textfield"; -import "../ha-picture-upload"; -import "../ha-radio"; -import "../ha-formfield"; -import type { HaPictureUpload } from "../ha-picture-upload"; -import { URL_PREFIX } from "../../data/image_upload"; - -@customElement("ha-selector-image") -export class HaImageSelector extends LitElement { - @property({ attribute: false }) public hass!: HomeAssistant; - - @property() public value?: any; - - @property() public name?: string; - - @property() public label?: string; - - @property() public placeholder?: string; - - @property() public helper?: string; - - @property({ attribute: false }) public selector!: ImageSelector; - - @property({ type: Boolean }) public disabled = false; - - @property({ type: Boolean }) public required = true; - - @state() private showUpload = false; - - protected firstUpdated(changedProps): void { - super.firstUpdated(changedProps); - - if (!this.value || this.value.startsWith(URL_PREFIX)) { - this.showUpload = true; - } - } - - protected render() { - return html` -
- - ${!this.showUpload - ? html` - - ` - : html` - - `} -
- `; - } - - private _radioGroupPicked(ev): void { - this.showUpload = ev.target.value === "upload"; - } - - private _pictureChanged(ev) { - const value = (ev.target as HaPictureUpload).value; - - fireEvent(this, "value-changed", { value: value ?? undefined }); - } - - private _handleChange(ev) { - let value = ev.target.value; - if (this.value === value) { - return; - } - if (value === "" && !this.required) { - value = undefined; - } - - fireEvent(this, "value-changed", { value }); - } - - static styles = css` - :host { - display: block; - position: relative; - } - div { - display: flex; - flex-direction: column; - } - label { - display: flex; - flex-direction: column; - } - ha-textarea, - ha-textfield { - width: 100%; - } - `; -} - -declare global { - interface HTMLElementTagNameMap { - "ha-selector-image": HaImageSelector; - } -} diff --git a/src/components/ha-selector/ha-selector.ts b/src/components/ha-selector/ha-selector.ts index cb686caef0..006f17ee1d 100644 --- a/src/components/ha-selector/ha-selector.ts +++ b/src/components/ha-selector/ha-selector.ts @@ -34,7 +34,6 @@ const LOAD_ELEMENTS = { file: () => import("./ha-selector-file"), floor: () => import("./ha-selector-floor"), label: () => import("./ha-selector-label"), - image: () => import("./ha-selector-image"), background: () => import("./ha-selector-background"), language: () => import("./ha-selector-language"), navigation: () => import("./ha-selector-navigation"),