Skip to content

Commit

Permalink
refactor: use ifDefined directive for theme attribute propagation (#8276
Browse files Browse the repository at this point in the history
)
  • Loading branch information
web-padawan authored Dec 4, 2024
1 parent 4dc1add commit 4f7958c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
3 changes: 2 additions & 1 deletion packages/number-field/src/vaadin-lit-number-field.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/
import '@vaadin/input-container/src/vaadin-lit-input-container.js';
import { html, LitElement } from 'lit';
import { ifDefined } from 'lit/directives/if-defined.js';
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
Expand Down Expand Up @@ -45,7 +46,7 @@ class NumberField extends NumberFieldMixin(ThemableMixin(ElementMixin(PolylitMix
.readonly="${this.readonly}"
.disabled="${this.disabled}"
.invalid="${this.invalid}"
theme="${this._theme}"
theme="${ifDefined(this._theme)}"
>
<div
part="decrease-button"
Expand Down
5 changes: 3 additions & 2 deletions packages/select/src/vaadin-lit-select.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import './vaadin-lit-select-list-box.js';
import './vaadin-lit-select-overlay.js';
import './vaadin-lit-select-value-button.js';
import { css, html, LitElement } from 'lit';
import { ifDefined } from 'lit/directives/if-defined.js';
import { screenReaderOnly } from '@vaadin/a11y-base/src/styles/sr-only-styles.js';
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
Expand Down Expand Up @@ -65,7 +66,7 @@ class Select extends SelectBaseMixin(ElementMixin(ThemableMixin(PolylitMixin(Lit
.readonly="${this.readonly}"
.disabled="${this.disabled}"
.invalid="${this.invalid}"
theme="${this._theme}"
theme="${ifDefined(this._theme)}"
@click="${this._onClick}"
>
<slot name="prefix" slot="prefix"></slot>
Expand All @@ -89,7 +90,7 @@ class Select extends SelectBaseMixin(ElementMixin(ThemableMixin(PolylitMixin(Lit
.withBackdrop="${this._phone}"
.renderer="${this.renderer || this.__defaultRenderer}"
?phone="${this._phone}"
theme="${this._theme}"
theme="${ifDefined(this._theme)}"
?no-vertical-overlap="${this.noVerticalOverlap}"
@opened-changed="${this._onOpenedChanged}"
@vaadin-overlay-open="${this._onOverlayOpen}"
Expand Down
3 changes: 2 additions & 1 deletion packages/text-area/src/vaadin-lit-text-area.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/
import '@vaadin/input-container/src/vaadin-lit-input-container.js';
import { html, LitElement } from 'lit';
import { ifDefined } from 'lit/directives/if-defined.js';
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
Expand Down Expand Up @@ -46,7 +47,7 @@ export class TextArea extends TextAreaMixin(ThemableMixin(ElementMixin(PolylitMi
.readonly="${this.readonly}"
.disabled="${this.disabled}"
.invalid="${this.invalid}"
theme="${this._theme}"
theme="${ifDefined(this._theme)}"
@scroll="${this._onScroll}"
>
<slot name="prefix" slot="prefix"></slot>
Expand Down
3 changes: 2 additions & 1 deletion packages/text-field/src/vaadin-lit-text-field.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/
import '@vaadin/input-container/src/vaadin-lit-input-container.js';
import { html, LitElement } from 'lit';
import { ifDefined } from 'lit/directives/if-defined.js';
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
Expand Down Expand Up @@ -45,7 +46,7 @@ export class TextField extends TextFieldMixin(ThemableMixin(ElementMixin(Polylit
.readonly="${this.readonly}"
.disabled="${this.disabled}"
.invalid="${this.invalid}"
theme="${this._theme}"
theme="${ifDefined(this._theme)}"
>
<slot name="prefix" slot="prefix"></slot>
<slot name="input"></slot>
Expand Down

0 comments on commit 4f7958c

Please sign in to comment.