Skip to content

Commit

Permalink
move clear button into input
Browse files Browse the repository at this point in the history
  • Loading branch information
schelv committed Jul 13, 2024
1 parent a18a7eb commit 4a8b154
Showing 1 changed file with 25 additions and 22 deletions.
47 changes: 25 additions & 22 deletions src/components/ha-base-time-input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,27 +79,27 @@ export class HaBaseTimeInput extends LitElement {
/**
* Label for the day input
*/
@property() dayLabel = "";
@property() dayLabel = "Day";

/**
* Label for the hour input
*/
@property() hourLabel = "";
@property() hourLabel = "Hour";

/**
* Label for the min input
*/
@property() minLabel = "";
@property() minLabel = "Minute";

/**
* Label for the sec input
*/
@property() secLabel = "";
@property() secLabel = "Second";

/**
* Label for the milli sec input
*/
@property() millisecLabel = "";
@property() millisecLabel = "Milisecond";

/**
* show the sec field
Expand Down Expand Up @@ -238,21 +238,6 @@ export class HaBaseTimeInput extends LitElement {
>
</ha-textfield>`
: ""}
${this.format === 24
? ""
: html`<ha-select
.required=${this.required}
.value=${this.amPm}
.disabled=${this.disabled}
name="amPm"
naturalMenuWidth
fixedMenuPosition
@selected=${this._valueChanged}
@closed=${stopPropagation}
>
<mwc-list-item value="AM">AM</mwc-list-item>
<mwc-list-item value="PM">PM</mwc-list-item>
</ha-select>`}
${this.clearable && !this.required && !this.disabled
? html`<ha-icon-button
label="clear"
Expand All @@ -261,6 +246,22 @@ export class HaBaseTimeInput extends LitElement {
></ha-icon-button>`
: nothing}
</div>
${this.format === 24
? ""
: html`<ha-select
.required=${this.required}
.value=${this.amPm}
.disabled=${this.disabled}
name="amPm"
naturalMenuWidth
fixedMenuPosition
@selected=${this._valueChanged}
@closed=${stopPropagation}
>
<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>`
: ""}
Expand Down Expand Up @@ -321,17 +322,18 @@ export class HaBaseTimeInput extends LitElement {
position: relative;
}
:host {
display: block;
display: flex;
}
.time-input-wrap {
display: flex;
border-radius: var(--mdc-shape-small, 4px) var(--mdc-shape-small, 4px) 0 0;
overflow: hidden;
position: relative;
direction: ltr;
padding-right: 3px;
}
ha-textfield {
width: 40px;
width: 55px;
text-align: center;
--mdc-shape-small: 0;
--text-field-appearance: none;
Expand Down Expand Up @@ -364,6 +366,7 @@ export class HaBaseTimeInput extends LitElement {
direction: var(--direction);
display: flex;
align-items: center;
background-color:var(--mdc-text-field-fill-color, whitesmoke)
}
label {
-moz-osx-font-smoothing: grayscale;
Expand Down

0 comments on commit 4a8b154

Please sign in to comment.