Skip to content

Commit

Permalink
perf: move help text functionality into dropdown slot
Browse files Browse the repository at this point in the history
  • Loading branch information
jordanjones243 authored and jason-capsule42 committed Oct 4, 2024
1 parent 99420fd commit 0d6aff5
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 22 deletions.
1 change: 0 additions & 1 deletion demo/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,6 @@ The component may be restyled using the following code sample and changing the v
@import './../node_modules/@aurodesignsystem/design-tokens/dist/tokens/SCSSVariables';

:host {
--ds-auro-select-help-text-color: var(--ds-color-text-secondary-default, $ds-color-text-secondary-default);
--ds-auro-select-placeholder-text-color: var(--ds-color-text-secondary-default, $ds-color-text-secondary-default);
}
```
Expand Down
22 changes: 12 additions & 10 deletions src/auro-select.js
Original file line number Diff line number Diff line change
Expand Up @@ -550,18 +550,20 @@ export class AuroSelect extends LitElement {
<slot></slot>
</div>
<slot name="label" slot="label"></slot>
<span slot="helpText">
${!this.validity || this.validity === undefined || this.validity === 'valid'
? html`
<p class="selectElement-helpText" id="${this.uniqueId}" part="helpText">
<slot name="helpText"></slot>
</p>`
: html`
<p class="selectElement-helpText" id="${this.uniqueId}" role="alert" aria-live="assertive" part="helpText">
${this.setCustomValidity}
</p>`
}
</span>
</${this.dropdownTag}>
<!-- Help text and error message template -->
${!this.validity || this.validity === undefined || this.validity === 'valid'
? html`
<p class="selectElement-helpText" id="${this.uniqueId}" part="helpText">
<slot name="helpText"></slot>
</p>`
: html`
<p class="selectElement-helpText" id="${this.uniqueId}" role="alert" aria-live="assertive" part="helpText">
${this.setCustomValidity}
</p>`
}
</div>
`;
}
Expand Down
10 changes: 0 additions & 10 deletions src/color.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@
}
}
}

.selectElement-helpText {
color: var(--ds-auro-select-help-text-color);
}
}

:host([disabled]) {
Expand All @@ -35,12 +31,6 @@
}
}

:host([validity]:not([validity='valid'])) {
.selectElement-helpText {
--ds-auro-select-help-text-color: var(--ds-color-text-error-default, #{$ds-color-text-error-default});
}
}

.placeholder {
color: var(--ds-auro-select-placeholder-text-color);
}
1 change: 0 additions & 1 deletion src/tokens.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
@import './../node_modules/@aurodesignsystem/design-tokens/dist/tokens/SCSSVariables';

:host {
--ds-auro-select-help-text-color: var(--ds-color-text-secondary-default, $ds-color-text-secondary-default);
--ds-auro-select-placeholder-text-color: var(--ds-color-text-secondary-default, $ds-color-text-secondary-default);
}

0 comments on commit 0d6aff5

Please sign in to comment.