diff --git a/src/components/checkbox/checkbox.styles.ts b/src/components/checkbox/checkbox.styles.ts index 829eded88..59b026e74 100644 --- a/src/components/checkbox/checkbox.styles.ts +++ b/src/components/checkbox/checkbox.styles.ts @@ -72,6 +72,10 @@ export default css` width: 100%; } + .checkbox__icon--invisible { + visibility: hidden; + } + .checkbox__checked-icon, .checkbox__indeterminate-icon { display: inline-flex; diff --git a/src/components/checkbox/checkbox.ts b/src/components/checkbox/checkbox.ts index 608a723c5..23335f422 100644 --- a/src/components/checkbox/checkbox.ts +++ b/src/components/checkbox/checkbox.ts @@ -212,6 +212,11 @@ export default class WaCheckbox extends WebAwesomeFormAssociatedElement { render() { const hasHelpTextSlot = isServer ? true : this.hasSlotController.test('help-text'); const hasHelpText = this.helpText ? true : !!hasHelpTextSlot; + const isIndeterminate = !this.checked && this.indeterminate + + const iconName = isIndeterminate ? "indeterminate" : "check" + const iconState = isIndeterminate ? "indeterminate" : "check" + const iconVisible = this.checked || this.indeterminate // // NOTE: we use a `
` around the label slot because of this Chrome bug. @@ -265,21 +270,7 @@ export default class WaCheckbox extends WebAwesomeFormAssociatedElement { @focus=${this.handleFocus} /> - ${this.checked - ? html` - - ` - : html``} - ${!this.checked && this.indeterminate - ? html` - - ` - : html``} +