Skip to content

Commit

Permalink
Fix time input with helper text width (#23134)
Browse files Browse the repository at this point in the history
* Fix time input with helper text width

* Make time input help text always newline

* Put helper text out of base-time-input
  • Loading branch information
wendevlin authored Dec 4, 2024
1 parent 64e8b63 commit a78ddb5
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions src/components/ha-base-time-input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export class HaBaseTimeInput extends LitElement {
return html`
${this.label
? html`<label>${this.label}${this.required ? " *" : ""}</label>`
: ""}
: nothing}
<div class="time-input-wrap-wrap">
<div class="time-input-wrap">
${this.enableDay
Expand All @@ -158,7 +158,7 @@ export class HaBaseTimeInput extends LitElement {
>
</ha-textfield>
`
: ""}
: nothing}
<ha-textfield
id="hour"
Expand Down Expand Up @@ -221,7 +221,7 @@ export class HaBaseTimeInput extends LitElement {
class=${this.enableMillisecond ? "has-suffix" : ""}
>
</ha-textfield>`
: ""}
: nothing}
${this.enableMillisecond
? html`<ha-textfield
id="millisec"
Expand All @@ -240,7 +240,7 @@ export class HaBaseTimeInput extends LitElement {
.disabled=${this.disabled}
>
</ha-textfield>`
: ""}
: nothing}
${this.clearable && !this.required && !this.disabled
? html`<ha-icon-button
label="clear"
Expand All @@ -251,7 +251,7 @@ export class HaBaseTimeInput extends LitElement {
</div>
${this.format === 24
? ""
? nothing
: html`<ha-select
.required=${this.required}
.value=${this.amPm}
Expand All @@ -265,10 +265,10 @@ export class HaBaseTimeInput extends LitElement {
<mwc-list-item value="AM">AM</mwc-list-item>
<mwc-list-item value="PM">PM</mwc-list-item>
</ha-select>`}
${this.helper
? html`<ha-input-helper-text>${this.helper}</ha-input-helper-text>`
: ""}
</div>
${this.helper
? html`<ha-input-helper-text>${this.helper}</ha-input-helper-text>`
: nothing}
`;
}

Expand Down Expand Up @@ -363,17 +363,17 @@ export class HaBaseTimeInput extends LitElement {
width: 85px;
}
:host([clearable]) .mdc-select__anchor {
padding-inline-end: var(--select-selected-text-padding-end, 12px);
padding-inline-end: var(--select-selected-text-padding-end, 12px);
}
ha-icon-button {
position: relative
position: relative;
--mdc-icon-button-size: 36px;
--mdc-icon-size: 20px;
color: var(--secondary-text-color);
direction: var(--direction);
display: flex;
align-items: center;
background-color:var(--mdc-text-field-fill-color, whitesmoke);
background-color: var(--mdc-text-field-fill-color, whitesmoke);
border-bottom-style: solid;
border-bottom-width: 1px;
}
Expand All @@ -398,6 +398,10 @@ export class HaBaseTimeInput extends LitElement {
padding-inline-start: 4px;
padding-inline-end: initial;
}
ha-input-helper-text {
padding-top: 8px;
line-height: normal;
}
`;
}

Expand Down

0 comments on commit a78ddb5

Please sign in to comment.