import { customElement, property } from "lit/decorators"; import { css, html, LitElement, nothing } from "lit"; import "./ha-radio"; import { classMap } from "lit/directives/class-map"; import { styleMap } from "lit/directives/style-map"; import type { HaRadio } from "./ha-radio"; import { fireEvent } from "../common/dom/fire_event"; import type { HomeAssistant } from "../types"; import { computeRTL } from "../common/util/compute_rtl"; import { stopPropagation } from "../common/dom/stop_propagation"; interface SelectBoxOptionImage { src: string; src_dark?: string; flip_rtl?: boolean; } export interface SelectBoxOption { label?: string; description?: string; image?: string | SelectBoxOptionImage; value: string; disabled?: boolean; } @customElement("ha-select-box") export class HaSelectBox extends LitElement { @property({ attribute: false }) public hass?: HomeAssistant; @property({ attribute: false }) public options: SelectBoxOption[] = []; @property({ attribute: false }) public value?: string; @property({ type: Boolean }) public disabled?: boolean; @property({ type: Number, attribute: "max_columns" }) public maxColumns?: number; render() { const maxColumns = this.maxColumns ?? 3; const columns = Math.min(maxColumns, this.options.length); return html`