From e79dec2d84c6d2ae4ab2d5a497d50e9768465a2b Mon Sep 17 00:00:00 2001 From: "christian.b.hoffmann" Date: Tue, 21 Nov 2023 15:27:31 +0100 Subject: [PATCH] restructured css --- .../components/forms/checkbox/index.css.ts | 44 ++++++++----------- .../src/components/forms/checkbox/index.ts | 9 ++++ 2 files changed, 28 insertions(+), 25 deletions(-) diff --git a/packages/ui-library/src/components/forms/checkbox/index.css.ts b/packages/ui-library/src/components/forms/checkbox/index.css.ts index aa3a32261..fe48e9992 100644 --- a/packages/ui-library/src/components/forms/checkbox/index.css.ts +++ b/packages/ui-library/src/components/forms/checkbox/index.css.ts @@ -137,13 +137,13 @@ export const { tokenizedLight: styleCustomLight, tokenizedDark: styleCustomDark } - &:not(.disabled) { - &:not(.error) { - .label-wrapper { + .label-wrapper { + &:not(.disabled) { + &:not(.error) { color: ${LabelNextToControl.Rest}; &:hover { - &:not([readonly]) { + &:not(.readonly) { color: ${LabelNextToControl.Hover}; } } @@ -151,7 +151,7 @@ export const { tokenizedLight: styleCustomLight, tokenizedDark: styleCustomDark color: ${LabelNextToControl.Focus}; } &.active { - &:not(:disabled):not([readonly]) { + &:not(.readonly) { color: ${LabelNextToControl.Pressed}; } } @@ -167,27 +167,23 @@ export const { tokenizedLight: styleCustomLight, tokenizedDark: styleCustomDark &.error { color: ${LabelNextToControl.Error}; } - } - &.disabled { - .input-control { - cursor: not-allowed; - } - .label-wrapper { + &.disabled { .blr-form-label-inline { cursor: not-allowed; color: ${LabelNextToControl.Disabled}; } - } + } } - &.readonly { - .input-control { + + .input-control, .visual-checkbox { + &.disabled { + cursor: not-allowed; + } + &.readonly { pointer-events: none; } - } - - &:not(.error) { - & .input-control, & .visual-checkbox { + &:not(.error) { &.checked { background-color: ${Checkbox.Control.Container.BackgroundColor.Active.Rest}; outline-color: ${Checkbox.Control.Container.BorderColor.Active.Rest}; @@ -218,13 +214,12 @@ export const { tokenizedLight: styleCustomLight, tokenizedDark: styleCustomDark } } - &:not(.checked) { background-color: ${Checkbox.Control.Container.BackgroundColor.Inactive.Rest}; outline-color: ${Checkbox.Control.Container.BorderColor.Inactive.Rest}; &.hover { - &:not(:disabled):not([readonly]) { + &:not(.disabled):not(.readonly) { background-color: ${Checkbox.Control.Container.BackgroundColor.Inactive.Hover}; outline-color: ${Checkbox.Control.Container.BorderColor.Inactive.Hover}; } @@ -234,7 +229,7 @@ export const { tokenizedLight: styleCustomLight, tokenizedDark: styleCustomDark outline-color: ${Checkbox.Control.Container.BorderColor.Inactive.Focus}; } &.active { - &:not(:disabled):not([readonly]) { + &:not(.disabled):not(.readonly) { background-color: ${Checkbox.Control.Container.BackgroundColor.Inactive.Pressed}; outline-color: ${Checkbox.Control.Container.BorderColor.Inactive.Pressed}; } @@ -249,10 +244,8 @@ export const { tokenizedLight: styleCustomLight, tokenizedDark: styleCustomDark } } } - } - - &.error { - & .input-control, & .visual-checkbox { + + &.error { &.checked { background-color: ${Checkbox.Control.Container.BackgroundColor.Active.Error}; outline-color: ${Checkbox.Control.Container.BorderColor.Active.Error}; @@ -264,6 +257,7 @@ export const { tokenizedLight: styleCustomLight, tokenizedDark: styleCustomDark } } + &.sm { &:not(.error) { .input-control, .visual-checkbox { diff --git a/packages/ui-library/src/components/forms/checkbox/index.ts b/packages/ui-library/src/components/forms/checkbox/index.ts index 9494a75f9..17617d0d9 100644 --- a/packages/ui-library/src/components/forms/checkbox/index.ts +++ b/packages/ui-library/src/components/forms/checkbox/index.ts @@ -73,18 +73,26 @@ export class BlrCheckbox extends LitElement { const classes = classMap({ 'blr-semantic-action': true, 'blr-checkbox': true, + + /* 'error': this.hasError || false, 'disabled': this.disabled || false, 'focus': this.focused || false, 'checked': this.checked || false, 'readonly': this.readonly || false, 'indeterminate': this.indeterminate || false, + */ + [`${this.size}`]: this.size, }); const labelWrapperClasses = classMap({ 'label-wrapper': true, + 'disabled': this.disabled || false, + 'focus': this.focused || false, + 'checked': this.checked || false, 'readonly': this.readonly || false, + 'indeterminate': this.indeterminate || false, }); const visualCheckboxClasses = classMap({ @@ -94,6 +102,7 @@ export class BlrCheckbox extends LitElement { 'focus': this.focused || false, 'checked': this.checked || false, 'readonly': this.readonly || false, + 'indeterminate': this.indeterminate || false, }); const checkerIconClasses = classMap({