Skip to content

Commit

Permalink
chore(text-field): remove wrapper slot spans
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 466112636
  • Loading branch information
asyncLiz authored and copybara-github committed Aug 8, 2022
1 parent f7e1bbb commit fe86936
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 18 deletions.
9 changes: 2 additions & 7 deletions textfield/filled-text-field.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export class MdFilledTextField extends FilledTextField {

/** @soyTemplate */
protected override renderField(): TemplateResult {
// TODO(b/239690585): move start/end slots to renderFieldContent
return html`
<md-filled-field
class="md3-text-field__field"
Expand All @@ -45,13 +44,9 @@ export class MdFilledTextField extends FilledTextField {
?populated=${!!this.value}
?required=${this.required}
>
<span slot="start">
${this.renderLeadingIcon()}
</span>
${this.renderLeadingIcon()}
${this.renderFieldContent()}
<span slot="end">
${this.renderTrailingIcon()}
</span>
${this.renderTrailingIcon()}
</md-filled-field>
`;
}
Expand Down
16 changes: 12 additions & 4 deletions textfield/lib/text-field.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,19 +175,27 @@ export class TextField extends LitElement {
return html`${prefix}${input}${suffix}`;
}

/** @soyTemplate */
/**
* @soyTemplate
* @slotName start
*/
protected renderLeadingIcon(): TemplateResult {
return html`
<span class="md3-text-field__icon md3-text-field__icon--leading">
<span class="md3-text-field__icon md3-text-field__icon--leading"
slot="start">
<slot name="leadingicon" @slotchange=${this.handleIconChange}></slot>
</span>
`;
}

/** @soyTemplate */
/**
* @soyTemplate
* @slotName end
*/
protected renderTrailingIcon(): TemplateResult {
return html`
<span class="md3-text-field__icon md3-text-field__icon--trailing">
<span class="md3-text-field__icon md3-text-field__icon--trailing"
slot="end">
<slot name="trailingicon" @slotchange=${this.handleIconChange}></slot>
</span>
`;
Expand Down
9 changes: 2 additions & 7 deletions textfield/outlined-text-field.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export class MdOutlinedTextField extends OutlinedTextField {

/** @soyTemplate */
protected override renderField(): TemplateResult {
// TODO(b/239690585): move start/end slots to renderFieldContent
return html`
<md-outlined-field
class="md3-text-field__field"
Expand All @@ -45,13 +44,9 @@ export class MdOutlinedTextField extends OutlinedTextField {
?populated=${!!this.value}
?required=${this.required}
>
<span slot="start">
${this.renderLeadingIcon()}
</span>
${this.renderLeadingIcon()}
${this.renderFieldContent()}
<span slot="end">
${this.renderTrailingIcon()}
</span>
${this.renderTrailingIcon()}
</md-outlined-field>
`;
}
Expand Down

0 comments on commit fe86936

Please sign in to comment.