diff --git a/src/components/ha-qr-scanner.ts b/src/components/ha-qr-scanner.ts index b8b4ef1ba5..8b60cbd170 100644 --- a/src/components/ha-qr-scanner.ts +++ b/src/components/ha-qr-scanner.ts @@ -17,8 +17,8 @@ import "./ha-dropdown"; import type { HaDropdownSelectEvent } from "./ha-dropdown"; import "./ha-dropdown-item"; import "./ha-spinner"; -import "./ha-textfield"; -import type { HaTextField } from "./ha-textfield"; +import "./input/ha-input"; +import type { HaInput } from "./input/ha-input"; prepareZXingModule({ overrides: { @@ -64,7 +64,7 @@ class HaQrScanner extends LitElement { @query("#canvas-container", true) private _canvasContainer?: HTMLDivElement; - @query("ha-textfield") private _manualInput?: HaTextField; + @query("ha-input") private _manualInput?: HaInput; public disconnectedCallback(): void { super.disconnectedCallback(); @@ -153,13 +153,13 @@ class HaQrScanner extends LitElement {

${this.hass.localize("ui.components.qr-scanner.manual_input")}

- + > ${this.hass.localize("ui.common.submit")} @@ -242,7 +242,7 @@ class HaQrScanner extends LitElement { private _manualKeyup(ev: KeyboardEvent) { if (ev.key === "Enter") { - this._qrCodeScanned((ev.target as HaTextField).value); + this._qrCodeScanned((ev.target as HaInput).value ?? ""); } } @@ -254,7 +254,7 @@ class HaQrScanner extends LitElement { } private _manualSubmit() { - this._qrCodeScanned(this._manualInput!.value); + this._qrCodeScanned(this._manualInput!.value ?? ""); } private _handleDropdownSelect(ev: HaDropdownSelectEvent) { @@ -382,7 +382,7 @@ class HaQrScanner extends LitElement { display: flex; align-items: center; } - ha-textfield { + ha-input { flex: 1; margin-right: 8px; margin-inline-end: 8px; diff --git a/src/dialogs/config-flow/previews/entity-preview-row.ts b/src/dialogs/config-flow/previews/entity-preview-row.ts index cfabdd8440..8441e39061 100644 --- a/src/dialogs/config-flow/previews/entity-preview-row.ts +++ b/src/dialogs/config-flow/previews/entity-preview-row.ts @@ -16,6 +16,7 @@ import "../../../components/ha-humidifier-state"; import "../../../components/ha-select"; import "../../../components/ha-slider"; import "../../../components/ha-time-input"; +import "../../../components/input/ha-input"; import { isTiltOnly } from "../../../data/cover"; import { isUnavailableState } from "../../../data/entity/entity"; import type { ImageEntity } from "../../../data/image"; @@ -72,7 +73,7 @@ class EntityPreviewRow extends LitElement { min-width: 45px; text-align: end; } - ha-textfield { + ha-input { text-align: end; direction: ltr !important; } @@ -273,18 +274,23 @@ class EntityPreviewRow extends LitElement {
` - : html`
- + + > + ${stateObj.attributes.unit_of_measurement + ? html`${stateObj.attributes.unit_of_measurement}` + : nothing} +
`} `; } @@ -323,7 +329,7 @@ class EntityPreviewRow extends LitElement { if (domain === "text") { return html` - + > `; } diff --git a/src/dialogs/config-flow/step-flow-create-entry.ts b/src/dialogs/config-flow/step-flow-create-entry.ts index c4ea0982b8..8ff61d07a0 100644 --- a/src/dialogs/config-flow/step-flow-create-entry.ts +++ b/src/dialogs/config-flow/step-flow-create-entry.ts @@ -11,6 +11,8 @@ import { computeDomain } from "../../common/entity/compute_domain"; import { navigate } from "../../common/navigate"; import "../../components/ha-area-picker"; import "../../components/ha-button"; +import "../../components/input/ha-input"; +import type { HaInput } from "../../components/input/ha-input"; import { assistSatelliteSupportsSetupFlow } from "../../data/assist_satellite"; import { getConfigEntries } from "../../data/config_entries"; import type { DataEntryFlowStepCreateEntry } from "../../data/data_entry_flow"; @@ -22,7 +24,7 @@ import { type EntityRegistryDisplayEntry, } from "../../data/entity/entity_registry"; import { domainToName } from "../../data/integration"; -import type { HomeAssistant } from "../../types"; +import type { HomeAssistant, ValueChangedEvent } from "../../types"; import { brandsUrl } from "../../util/brands-url"; import { showAlertDialog } from "../generic/show-dialog-box"; import { showVoiceAssistantSetupDialog } from "../voice-assistant-setup/show-voice-assistant-setup-dialog"; @@ -162,7 +164,7 @@ class StepFlowCreateEntry extends LitElement { : nothing} - + > ) { const picker = ev.currentTarget as any; const device = picker.device; const area = ev.detail.value; @@ -290,9 +292,9 @@ class StepFlowCreateEntry extends LitElement { this.requestUpdate("_deviceUpdate"); } - private _deviceNameChanged(ev): void { - const picker = ev.currentTarget as any; - const device = picker.device; + private _deviceNameChanged(ev: InputEvent): void { + const picker = ev.currentTarget as HaInput; + const device = (picker as any).device; const name = picker.value; if (!(device in this._deviceUpdate)) { @@ -343,12 +345,11 @@ class StepFlowCreateEntry extends LitElement { .secondary { color: var(--secondary-text-color); } - ha-textfield, ha-area-picker { display: block; } - ha-textfield { - margin: 8px 0; + ha-input { + margin: var(--ha-space-2) 0; } .buttons > *:last-child { margin-left: auto; diff --git a/src/dialogs/enter-code/dialog-enter-code.ts b/src/dialogs/enter-code/dialog-enter-code.ts index d84a78711d..d462970d1a 100644 --- a/src/dialogs/enter-code/dialog-enter-code.ts +++ b/src/dialogs/enter-code/dialog-enter-code.ts @@ -5,10 +5,10 @@ import { ifDefined } from "lit/directives/if-defined"; import { fireEvent } from "../../common/dom/fire_event"; import "../../components/ha-button"; import "../../components/ha-control-button"; -import "../../components/ha-dialog-footer"; -import "../../components/ha-textfield"; import "../../components/ha-dialog"; -import type { HaTextField } from "../../components/ha-textfield"; +import "../../components/ha-dialog-footer"; +import "../../components/input/ha-input"; +import type { HaInput } from "../../components/input/ha-input"; import type { HomeAssistant } from "../../types"; import type { HassDialog } from "../make-dialog-manager"; import type { EnterCodeDialogParams } from "./show-enter-code-dialog"; @@ -39,7 +39,7 @@ export class DialogEnterCode @state() private _open = false; - @query("#code") private _input?: HaTextField; + @query("#code") private _input?: HaInput; @state() private _showClearButton = false; @@ -97,7 +97,7 @@ export class DialogEnterCode } private _inputValueChange(e) { - const field = e.currentTarget as HaTextField; + const field = e.currentTarget as HaInput; const val = field.value; this._showClearButton = !!val; } @@ -119,7 +119,7 @@ export class DialogEnterCode width="small" @closed=${this._dialogClosed} > - + >
- + password-toggle + >
${BUTTONS.map((value) => value === "" @@ -212,7 +213,7 @@ export class DialogEnterCode /* Place above other dialogs */ --dialog-z-index: 104; } - ha-textfield { + ha-input { width: 100%; margin: auto; } diff --git a/src/dialogs/generic/dialog-box.ts b/src/dialogs/generic/dialog-box.ts index 5251819b6f..b3c3d60548 100644 --- a/src/dialogs/generic/dialog-box.ts +++ b/src/dialogs/generic/dialog-box.ts @@ -5,12 +5,12 @@ import { classMap } from "lit/directives/class-map"; import { ifDefined } from "lit/directives/if-defined"; import { fireEvent } from "../../common/dom/fire_event"; import "../../components/ha-button"; +import "../../components/ha-dialog"; import "../../components/ha-dialog-footer"; import "../../components/ha-dialog-header"; import "../../components/ha-svg-icon"; -import "../../components/ha-textfield"; -import type { HaTextField } from "../../components/ha-textfield"; -import "../../components/ha-dialog"; +import "../../components/input/ha-input"; +import type { HaInput } from "../../components/input/ha-input"; import type { HomeAssistant } from "../../types"; import type { DialogBoxParams } from "./show-dialog-box"; @@ -28,7 +28,7 @@ class DialogBox extends LitElement { @state() private _validInput = true; - @query("ha-textfield") private _textField?: HaTextField; + @query("ha-input") private _textField?: HaInput; private _closePromise?: Promise; @@ -109,14 +109,13 @@ class DialogBox extends LitElement { ${this._params.text ? html`

${this._params.text}

` : ""} ${this._params.prompt ? html` - + > + ${this._params.inputSuffix + ? html`${this._params.inputSuffix}` + : nothing} + ` - : ""} + : nothing}
${confirmPrompt @@ -240,7 +243,7 @@ class DialogBox extends LitElement { .secondary { color: var(--secondary-text-color); } - ha-textfield { + ha-input { width: 100%; } .title.alert { diff --git a/src/dialogs/more-info/components/siren/ha-more-info-siren-advanced-controls.ts b/src/dialogs/more-info/components/siren/ha-more-info-siren-advanced-controls.ts index 809bcfbbcd..3d39ac9b9e 100644 --- a/src/dialogs/more-info/components/siren/ha-more-info-siren-advanced-controls.ts +++ b/src/dialogs/more-info/components/siren/ha-more-info-siren-advanced-controls.ts @@ -7,13 +7,13 @@ import { fireEvent } from "../../../../common/dom/fire_event"; import { supportsFeature } from "../../../../common/entity/supports-feature"; import "../../../../components/ha-button"; import "../../../../components/ha-control-button"; -import type { HaSelectSelectEvent } from "../../../../components/ha-select"; +import "../../../../components/ha-dialog"; import "../../../../components/ha-dialog-footer"; import "../../../../components/ha-icon-button"; import "../../../../components/ha-list-item"; import "../../../../components/ha-select"; -import "../../../../components/ha-textfield"; -import "../../../../components/ha-dialog"; +import type { HaSelectSelectEvent } from "../../../../components/ha-select"; +import "../../../../components/input/ha-input"; import { SirenEntityFeature } from "../../../../data/siren"; import { haStyle } from "../../../../resources/styles"; import type { HomeAssistant } from "../../../../types"; @@ -95,27 +95,31 @@ class MoreInfoSirenAdvancedControls extends LitElement { : nothing} ${supportsVolume ? html` - + > + % + ` : nothing} ${supportsDuration ? html` - + > + s + ` : nothing}
diff --git a/src/dialogs/more-info/controls/more-info-configurator.ts b/src/dialogs/more-info/controls/more-info-configurator.ts index b063ed77bd..782a24c0c5 100644 --- a/src/dialogs/more-info/controls/more-info-configurator.ts +++ b/src/dialogs/more-info/controls/more-info-configurator.ts @@ -4,7 +4,7 @@ import { customElement, property, state } from "lit/decorators"; import "../../../components/ha-alert"; import "../../../components/ha-button"; import "../../../components/ha-markdown"; -import "../../../components/ha-textfield"; +import "../../../components/input/ha-input"; import type { HomeAssistant } from "../../../types"; @customElement("more-info-configurator") @@ -33,15 +33,15 @@ export class MoreInfoConfigurator extends LitElement { ? html` ${this.stateObj.attributes.errors} ` - : ""} + : nothing} ${this.stateObj.attributes.fields.map( (field) => - html`` + >` )} ${this.stateObj.attributes.submit_caption ? html`

@@ -53,7 +53,7 @@ export class MoreInfoConfigurator extends LitElement { ${this.stateObj.attributes.submit_caption}

` - : ""} + : nothing} `; } diff --git a/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-success.ts b/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-success.ts index 1f8313012c..f09d901054 100644 --- a/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-success.ts +++ b/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-success.ts @@ -4,13 +4,14 @@ import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../common/dom/fire_event"; import { stopPropagation } from "../../common/dom/stop_propagation"; -import type { HaSelectSelectEvent } from "../../components/ha-select"; import { computeDeviceName, computeDeviceNameDisplay, } from "../../common/entity/compute_device_name"; import "../../components/ha-select"; +import type { HaSelectSelectEvent } from "../../components/ha-select"; import "../../components/ha-tts-voice-picker"; +import "../../components/input/ha-input"; import type { AssistPipeline } from "../../data/assist_pipeline"; import { listAssistPipelines, @@ -99,14 +100,14 @@ export class HaVoiceAssistantSetupStepSuccess extends LitElement { : nothing}
- + >
${this.assistConfiguration && this.assistConfiguration.available_wake_words.length > 1 diff --git a/src/onboarding/onboarding-location.ts b/src/onboarding/onboarding-location.ts index 32ee949491..ce9e7b146b 100644 --- a/src/onboarding/onboarding-location.ts +++ b/src/onboarding/onboarding-location.ts @@ -16,8 +16,8 @@ import "../components/ha-list"; import "../components/ha-list-item"; import "../components/ha-radio"; import "../components/ha-spinner"; -import "../components/ha-textfield"; -import type { HaTextField } from "../components/ha-textfield"; +import "../components/input/ha-input"; +import type { HaInput } from "../components/input/ha-input"; import "../components/map/ha-locations-editor"; import type { HaLocationsEditor, @@ -103,22 +103,20 @@ class OnboardingLocation extends LitElement {

` : nothing} @@ -176,9 +175,9 @@ class DialogAutomationMode extends LitElement implements HassDialog { } } - private _valueChanged(ev: CustomEvent) { + private _valueChanged(ev: InputEvent) { ev.stopPropagation(); - const target = ev.target as any; + const target = ev.target as HaInput; if (target.name === "max") { this._newMax = Number(target.value); } @@ -201,9 +200,6 @@ class DialogAutomationMode extends LitElement implements HassDialog { haStyle, haStyleDialog, css` - ha-textfield { - display: block; - } ha-dialog { --dialog-content-padding: 0; } diff --git a/src/panels/config/automation/automation-save-dialog/dialog-automation-save.ts b/src/panels/config/automation/automation-save-dialog/dialog-automation-save.ts index 28374d127f..ffa9c57bcc 100644 --- a/src/panels/config/automation/automation-save-dialog/dialog-automation-save.ts +++ b/src/panels/config/automation/automation-save-dialog/dialog-automation-save.ts @@ -7,6 +7,7 @@ import "../../../../components/chips/ha-assist-chip"; import "../../../../components/chips/ha-chip-set"; import "../../../../components/ha-alert"; import "../../../../components/ha-area-picker"; +import "../../../../components/ha-dialog"; import "../../../../components/ha-dialog-footer"; import "../../../../components/ha-domain-icon"; import "../../../../components/ha-expansion-panel"; @@ -16,8 +17,7 @@ import "../../../../components/ha-suggest-with-ai-button"; import type { SuggestWithAIGenerateTask } from "../../../../components/ha-suggest-with-ai-button"; import "../../../../components/ha-svg-icon"; import "../../../../components/ha-textarea"; -import "../../../../components/ha-textfield"; -import "../../../../components/ha-dialog"; +import "../../../../components/input/ha-input"; import "../../category/ha-category-picker"; import { supportsMarkdownHelper } from "../../../../common/translations/markdown_support"; @@ -27,16 +27,16 @@ import type { ScriptConfig } from "../../../../data/script"; import type { HassDialog } from "../../../../dialogs/make-dialog-manager"; import { haStyle, haStyleDialog } from "../../../../resources/styles"; import type { HomeAssistant } from "../../../../types"; -import type { - EntityRegistryUpdate, - SaveDialogParams, -} from "./show-dialog-automation-save"; import { type MetadataSuggestionResult, generateMetadataSuggestionTask, processMetadataSuggestion, } from "../../common/suggest-metadata-ai"; import { buildEntityMetadataInspirations } from "../../common/suggest-metadata-inspirations"; +import type { + EntityRegistryUpdate, + SaveDialogParams, +} from "./show-dialog-automation-save"; @customElement("ha-dialog-automation-save") class DialogAutomationSave extends LitElement implements HassDialog { @@ -129,7 +129,7 @@ class DialogAutomationSave extends LitElement implements HassDialog { } return html` - + > ${this._params.domain === "script" && this._visibleOptionals.includes("icon") ? html` ${this._params.hideInputs ? nothing - : html` + > ` : nothing}
@@ -160,9 +160,8 @@ export default class HaAutomationTriggerEditor extends LitElement { border-top: 1px solid var(--divider-color); border-bottom: 1px solid var(--divider-color); } - ha-textfield { - display: block; - margin-bottom: 24px; + ha-input { + margin-bottom: var(--ha-space-3); } `, ]; diff --git a/src/panels/config/automation/trigger/types/ha-automation-trigger-conversation.ts b/src/panels/config/automation/trigger/types/ha-automation-trigger-conversation.ts index e5cd4f9d84..5fda6fd3e7 100644 --- a/src/panels/config/automation/trigger/types/ha-automation-trigger-conversation.ts +++ b/src/panels/config/automation/trigger/types/ha-automation-trigger-conversation.ts @@ -1,11 +1,12 @@ -import { mdiClose } from "@mdi/js"; +import "@home-assistant/webawesome/dist/components/divider/divider"; +import { mdiClose, mdiPlus } from "@mdi/js"; import { css, html, LitElement, nothing } from "lit"; import { customElement, property, query } from "lit/decorators"; import { ensureArray } from "../../../../../common/array/ensure-array"; import { fireEvent } from "../../../../../common/dom/fire_event"; import "../../../../../components/ha-icon-button"; -import "../../../../../components/ha-textfield"; -import type { HaTextField } from "../../../../../components/ha-textfield"; +import "../../../../../components/input/ha-input"; +import type { HaInput } from "../../../../../components/input/ha-input"; import type { ConversationTrigger } from "../../../../../data/automation"; import { showConfirmationDialog } from "../../../../../dialogs/generic/show-dialog-box"; import type { HomeAssistant } from "../../../../../types"; @@ -24,7 +25,7 @@ export class HaConversationTrigger @property({ type: Boolean }) public disabled = false; - @query("#option_input", true) private _optionInput?: HaTextField; + @query("#option_input", true) private _optionInput?: HaInput; public static get defaultConfig(): ConversationTrigger { return { trigger: "conversation", command: "" }; @@ -35,31 +36,31 @@ export class HaConversationTrigger const commands = command ? ensureArray(command) : []; return html`${commands.length - ? commands.map( - (option, index) => html` - - - - ` - ) + ? html`${commands.map( + (option, index) => html` + + + + ` + )} ` : nothing} - `; + > + + `; } private _handleKeyAdd(ev: KeyboardEvent) { @@ -104,14 +111,14 @@ export class HaConversationTrigger input.value = ""; } - private async _updateOption(ev: Event) { + private async _updateOption(ev: InputEvent) { const index = (ev.target as any).index; const command = [ ...(Array.isArray(this.trigger.command) ? this.trigger.command : [this.trigger.command]), ]; - command.splice(index, 1, (ev.target as HaTextField).value); + command.splice(index, 1, (ev.target as HaInput).value ?? ""); fireEvent(this, "value-changed", { value: { ...this.trigger, command }, }); @@ -155,20 +162,8 @@ export class HaConversationTrigger .option { margin-top: 4px; } - ha-textfield { - display: block; - margin-bottom: 8px; - --textfield-icon-trailing-padding: 0; - } - ha-textfield > ha-icon-button { - position: relative; - right: -8px; - --ha-icon-button-size: 36px; - --mdc-icon-size: 20px; - color: var(--secondary-text-color); - inset-inline-start: initial; - inset-inline-end: -8px; - direction: var(--direction); + ha-input { + margin-bottom: var(--ha-space-1); } #option_input { margin-top: 8px; @@ -177,6 +172,10 @@ export class HaConversationTrigger margin-top: 8px; margin-bottom: 8px; } + wa-divider { + margin-top: var(--ha-space-2); + margin-bottom: var(--ha-space-3); + } `; } diff --git a/src/panels/config/automation/trigger/types/ha-automation-trigger-event.ts b/src/panels/config/automation/trigger/types/ha-automation-trigger-event.ts index 0e4dfd1090..ad780f530e 100644 --- a/src/panels/config/automation/trigger/types/ha-automation-trigger-event.ts +++ b/src/panels/config/automation/trigger/types/ha-automation-trigger-event.ts @@ -1,8 +1,8 @@ -import { css, html, LitElement } from "lit"; +import { html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import { fireEvent } from "../../../../../common/dom/fire_event"; -import "../../../../../components/ha-textfield"; import "../../../../../components/ha-yaml-editor"; +import "../../../../../components/input/ha-input"; import "../../../../../components/user/ha-users-picker"; import type { EventTrigger } from "../../../../../data/automation"; import type { HomeAssistant } from "../../../../../types"; @@ -24,7 +24,7 @@ export class HaEventTrigger extends LitElement implements TriggerElement { protected render() { const { event_type, event_data, context } = this.trigger; return html` - + > - - + { - const inputElement = ev.target.parentElement as HaTextField; + const inputElement = ev.target.parentElement as HaInput; const url = this.hass.hassUrl(`/api/webhook/${inputElement.value}`); await copyToClipboard(url); @@ -229,11 +228,11 @@ export class HaWebhookTrigger extends LitElement { display: flex; } - ha-textfield { + ha-input { flex: 1; } - ha-textfield > ha-icon-button { + ha-input > ha-icon-button { --ha-icon-button-size: 24px; --mdc-icon-size: 18px; color: var(--secondary-text-color); diff --git a/src/panels/config/backup/dialogs/dialog-generate-backup.ts b/src/panels/config/backup/dialogs/dialog-generate-backup.ts index 98c8397b15..a340cb276a 100644 --- a/src/panels/config/backup/dialogs/dialog-generate-backup.ts +++ b/src/panels/config/backup/dialogs/dialog-generate-backup.ts @@ -6,6 +6,7 @@ import { isComponentLoaded } from "../../../../common/config/is_component_loaded import { fireEvent } from "../../../../common/dom/fire_event"; import "../../../../components/ha-alert"; import "../../../../components/ha-button"; +import "../../../../components/ha-dialog"; import "../../../../components/ha-dialog-footer"; import "../../../../components/ha-dialog-header"; import "../../../../components/ha-expansion-panel"; @@ -14,8 +15,8 @@ import "../../../../components/ha-icon-button-prev"; import "../../../../components/ha-md-list"; import "../../../../components/ha-md-list-item"; import "../../../../components/ha-select"; -import "../../../../components/ha-textfield"; -import "../../../../components/ha-dialog"; +import "../../../../components/input/ha-input"; +import type { HaInput } from "../../../../components/input/ha-input"; import type { BackupAgent, BackupConfig, @@ -290,7 +291,7 @@ class DialogGenerateBackup extends LitElement implements HassDialog { const disabledAgentIds = this._disabledAgentIds(); return html` - - + @@ -385,10 +386,10 @@ class DialogGenerateBackup extends LitElement implements HassDialog { }; } - private _nameChanged(ev) { + private _nameChanged(ev: InputEvent) { this._formData = { ...this._formData!, - name: ev.target.value, + name: (ev.target as HaInput).value ?? "", }; } @@ -468,7 +469,7 @@ class DialogGenerateBackup extends LitElement implements HassDialog { overflow: hidden; white-space: nowrap; } - ha-textfield { + ha-input { width: 100%; } .content { diff --git a/src/panels/config/integrations/integration-panels/zwave_js/add-node/zwave-js-add-node-code-input.ts b/src/panels/config/integrations/integration-panels/zwave_js/add-node/zwave-js-add-node-code-input.ts index 3b26d00f55..2df7ce2b3a 100644 --- a/src/panels/config/integrations/integration-panels/zwave_js/add-node/zwave-js-add-node-code-input.ts +++ b/src/panels/config/integrations/integration-panels/zwave_js/add-node/zwave-js-add-node-code-input.ts @@ -1,11 +1,11 @@ -import { customElement, property } from "lit/decorators"; import { css, html, LitElement, nothing } from "lit"; +import { customElement, property } from "lit/decorators"; import { fireEvent } from "../../../../../../common/dom/fire_event"; -import type { HaTextField } from "../../../../../../components/ha-textfield"; +import type { HaInput } from "../../../../../../components/input/ha-input"; -import "../../../../../../components/ha-textfield"; import "../../../../../../components/ha-alert"; +import "../../../../../../components/input/ha-input"; @customElement("zwave-js-add-node-code-input") export class ZWaveJsAddNodeCodeInput extends LitElement { @@ -27,14 +27,14 @@ export class ZWaveJsAddNodeCodeInput extends LitElement { ${this.error ? html`${this.error}` : nothing} - + > ${this.referenceKey ? html`
${this.value.padEnd(5, "ยท")}${this.referenceKey} @@ -50,24 +50,24 @@ export class ZWaveJsAddNodeCodeInput extends LitElement { } private _handleChange(ev: InputEvent): void { - const inputElement = ev.target as HaTextField; + const inputElement = ev.target as HaInput; if ( this.numeric && - (isNaN(Number(inputElement.value)) || inputElement.value.length > 5) + (isNaN(Number(inputElement.value)) || inputElement.value!.length > 5) ) { inputElement.value = this.value; return; } - this.value = (ev.target as HaTextField).value; + this.value = (ev.target as HaInput).value ?? ""; fireEvent(this, "value-changed", { - value: (ev.target as HaTextField).value, + value: (ev.target as HaInput).value, }); } static styles = css` - ha-textfield { + ha-input { width: 100%; } ha-alert {