Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ui-library): removed readonly state for checkbox radio radiogroup and toggle switch #1167

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 16 additions & 82 deletions packages/ui-library/src/components/checkbox/index.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,6 @@ export const staticStyles = css`
color: ${formlabel.inlinelabel.textcolor.pressed};
}
}

&.readonly {
color: ${formlabel.inlinelabel.textcolor.readonly};

.blr-form-label-inline {
cursor: not-allowed !important;
pointer-events: none;
}
}
}
}

Expand Down Expand Up @@ -182,10 +173,6 @@ export const staticStyles = css`
cursor: not-allowed;
}

&.readonly {
pointer-events: none;
}

&:not(.error) {
&.checked,
&.indeterminate {
Expand All @@ -197,7 +184,7 @@ export const staticStyles = css`
}

&.hover {
&:not(.disabled, .readonly) {
&:not(.disabled) {
background-color: ${checkbox.control.container.bgcolor.active.hover};
outline-color: ${checkbox.control.container.bordercolor.active.hover};

Expand All @@ -217,7 +204,7 @@ export const staticStyles = css`
}

&.active {
&:not(:disabled, [readonly]) {
&:not(:disabled) {
background-color: ${checkbox.control.container.bgcolor.active.pressed};
outline-color: ${checkbox.control.container.bordercolor.active.pressed};

Expand All @@ -235,15 +222,6 @@ export const staticStyles = css`
color: ${checkbox.control.icon.iconcolor.active.disabled};
}
}

&.readonly {
background-color: ${checkbox.control.container.bgcolor.active.readonly};
outline-color: ${checkbox.control.container.bordercolor.active.readonly};

& .checker-icon {
color: ${checkbox.control.icon.iconcolor.active.readonly};
}
}
}

&:not(.checked, .indeterminate) {
Expand All @@ -255,7 +233,7 @@ export const staticStyles = css`
}

&.hover {
&:not(.disabled, .readonly) {
&:not(.disabled) {
background-color: ${checkbox.control.container.bgcolor.inactive.hover};
outline-color: ${checkbox.control.container.bordercolor.inactive.hover};

Expand All @@ -275,7 +253,7 @@ export const staticStyles = css`
}

&.active {
&:not(.disabled, .readonly) {
&:not(.disabled) {
background-color: ${checkbox.control.container.bgcolor.inactive.pressed};
outline-color: ${checkbox.control.container.bordercolor.inactive.pressed};

Expand All @@ -293,15 +271,6 @@ export const staticStyles = css`
color: ${checkbox.control.icon.iconcolor.inactive.disabled};
}
}

&.readonly {
background-color: ${checkbox.control.container.bgcolor.inactive.readonly};
outline-color: ${checkbox.control.container.bordercolor.inactive.readonly};

& .checker-icon {
color: ${checkbox.control.icon.iconcolor.inactive.readonly};
}
}
}
}

Expand Down Expand Up @@ -338,7 +307,7 @@ export const staticStyles = css`
outline-offset: calc(${checkbox.control.container.borderwidth.sm.inactive.rest} * -1);

&.hover {
&:not(.disabled, .readonly) {
&:not(.disabled) {
& .checker-icon {
width: ${checkbox.control.icon.iconsize.sm.hover};
height: ${checkbox.control.icon.iconsize.sm.hover};
Expand All @@ -360,7 +329,7 @@ export const staticStyles = css`
}

&.active {
&:not(.disabled, .readonly) {
&:not(.disabled) {
& .checker-icon {
width: ${checkbox.control.icon.iconsize.sm.pressed};
height: ${checkbox.control.icon.iconsize.sm.pressed};
Expand All @@ -381,22 +350,12 @@ export const staticStyles = css`
outline-offset: calc(${checkbox.control.container.borderwidth.sm.inactive.disabled} * -1);
}

&.readonly {
& .checker-icon {
width: ${checkbox.control.icon.iconsize.sm.readonly};
height: ${checkbox.control.icon.iconsize.sm.readonly};
}

outline-width: ${checkbox.control.container.borderwidth.sm.inactive.readonly};
outline-offset: calc(${checkbox.control.container.borderwidth.sm.inactive.readonly} * -1);
}

&.checked {
outline-width: ${checkbox.control.container.borderwidth.sm.active.rest};
outline-offset: calc(${checkbox.control.container.borderwidth.sm.active.rest} * -1);

&.hover {
&:not(.disabled, .readonly) {
&:not(.disabled) {
outline-width: ${checkbox.control.container.borderwidth.sm.active.hover};
outline-offset: calc(${checkbox.control.container.borderwidth.sm.active.hover} * -1);
}
Expand All @@ -408,7 +367,7 @@ export const staticStyles = css`
}

&.active {
&:not(.disabled, .readonly) {
&:not(.disabled) {
outline-width: ${checkbox.control.container.borderwidth.sm.active.pressed};
outline-offset: calc(${checkbox.control.container.borderwidth.sm.active.pressed} * -1);
}
Expand All @@ -418,11 +377,6 @@ export const staticStyles = css`
outline-width: ${checkbox.control.container.borderwidth.sm.active.disabled};
outline-offset: calc(${checkbox.control.container.borderwidth.sm.active.disabled} * -1);
}

&.readonly {
outline-width: ${checkbox.control.container.borderwidth.sm.active.readonly};
outline-offset: calc(${checkbox.control.container.borderwidth.sm.active.readonly} * -1);
}
}
}
}
Expand Down Expand Up @@ -455,7 +409,7 @@ export const staticStyles = css`
outline-offset: calc(${checkbox.control.container.borderwidth.md.inactive.rest} * -1);

&.hover {
&.not(.disabled):not(.readonly) {
&:not(.disabled) {
outline-width: ${checkbox.control.container.borderwidth.md.inactive.hover};
outline-offset: calc(${checkbox.control.container.borderwidth.md.inactive.hover} * -1);
}
Expand All @@ -467,7 +421,7 @@ export const staticStyles = css`
}

&.active {
&:not(.disabled, .readonly) {
&:not(.disabled) {
outline-width: ${checkbox.control.container.borderwidth.md.inactive.pressed};
outline-offset: calc(${checkbox.control.container.borderwidth.md.inactive.pressed} * -1);
}
Expand All @@ -477,19 +431,14 @@ export const staticStyles = css`
outline-width: ${checkbox.control.container.borderwidth.md.inactive.disabled};
outline-offset: calc(${checkbox.control.container.borderwidth.md.inactive.disabled} * -1);
}

&.readonly {
outline-width: ${checkbox.control.container.borderwidth.md.inactive.readonly};
outline-offset: calc(${checkbox.control.container.borderwidth.md.inactive.readonly} * -1);
}
}

&.checked {
outline-width: ${checkbox.control.container.borderwidth.md.active.rest};
outline-offset: calc(${checkbox.control.container.borderwidth.md.active.rest} * -1);

&.hover {
&:not(.disabled, .readonly) {
&:not(.disabled) {
outline-width: ${checkbox.control.container.borderwidth.md.active.hover};
outline-offset: calc(${checkbox.control.container.borderwidth.md.active.hover} * -1);
}
Expand All @@ -501,7 +450,7 @@ export const staticStyles = css`
}

&.active {
&:not(.disabled, .readonly) {
&:not(.disabled) {
outline-width: ${checkbox.control.container.borderwidth.md.active.pressed};
outline-offset: calc(${checkbox.control.container.borderwidth.md.active.pressed} * -1);
}
Expand All @@ -511,11 +460,6 @@ export const staticStyles = css`
outline-width: ${checkbox.control.container.borderwidth.md.active.disabled};
outline-offset: calc(${checkbox.control.container.borderwidth.md.active.disabled} * -1);
}

&.readonly {
outline-width: ${checkbox.control.container.borderwidth.md.active.readonly};
outline-offset: calc(${checkbox.control.container.borderwidth.md.active.readonly} * -1);
}
}
}
}
Expand Down Expand Up @@ -543,7 +487,7 @@ export const staticStyles = css`
outline-offset: calc(${checkbox.control.container.borderwidth.lg.inactive.rest} * -1);

&.hover {
&:not(.disabled, .readonly) {
&:not(.disabled) {
outline-width: ${checkbox.control.container.borderwidth.lg.inactive.hover};
outline-offset: calc(${checkbox.control.container.borderwidth.lg.inactive.hover} * -1);
}
Expand All @@ -555,7 +499,7 @@ export const staticStyles = css`
}

&.active {
&:not(:disabled, .readonly) {
&:not(:disabled) {
outline-width: ${checkbox.control.container.borderwidth.lg.inactive.pressed};
outline-offset: calc(${checkbox.control.container.borderwidth.lg.inactive.pressed} * -1);
}
Expand All @@ -565,19 +509,14 @@ export const staticStyles = css`
outline-width: ${checkbox.control.container.borderwidth.lg.inactive.disabled};
outline-offset: calc(${checkbox.control.container.borderwidth.lg.inactive.disabled} * -1);
}

&.readonly {
outline-width: ${checkbox.control.container.borderwidth.lg.inactive.readonly};
outline-offset: calc(${checkbox.control.container.borderwidth.lg.inactive.readonly} * -1);
}
}

&.checked {
outline-width: ${checkbox.control.container.borderwidth.lg.active.rest};
outline-offset: calc(${checkbox.control.container.borderwidth.lg.active.rest} * -1);

&.hover {
&:not(.disabled, .readonly) {
&:not(.disabled) {
outline-width: ${checkbox.control.container.borderwidth.lg.active.hover};
outline-offset: calc(${checkbox.control.container.borderwidth.lg.active.hover} * -1);
}
Expand All @@ -589,7 +528,7 @@ export const staticStyles = css`
}

&.active {
&:not(.disabled, .readonly) {
&:not(.disabled) {
outline-width: ${checkbox.control.container.borderwidth.lg.active.pressed};
outline-offset: calc(${checkbox.control.container.borderwidth.lg.active.pressed} * -1);
}
Expand All @@ -599,11 +538,6 @@ export const staticStyles = css`
outline-width: ${checkbox.control.container.borderwidth.lg.active.disabled};
outline-offset: calc(${checkbox.control.container.borderwidth.lg.active.disabled} * -1);
}

&.readonly {
outline-width: ${checkbox.control.container.borderwidth.lg.active.readonly};
outline-offset: calc(${checkbox.control.container.borderwidth.lg.active.readonly} * -1);
}
}
}
}
Expand Down
35 changes: 2 additions & 33 deletions packages/ui-library/src/components/checkbox/index.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,6 @@ export default {
category: 'States',
},
},
readonly: {
description: 'Choose if component is readonly. The user can select but not change the value of this component.',
defaultValue: false,
table: {
category: 'States',
},
},

//Validation
required: {
Expand Down Expand Up @@ -238,8 +231,7 @@ export default {
- [**Checked / Unchecked **](#checked--unchecked)
- [**Indeterminate**](#indeterminate)
- [**States**](#states)
- [**Disabled**](#disabled)
- [**Readonly**](#readonly)
- [**Disabled**](#disabled)
- [**Validation**](#validation)
- [**Required**](#required)
- [**Has Error**](#has-error)
Expand All @@ -266,7 +258,6 @@ const defaultParams: BlrCheckboxType = {
hintMessage: 'This is a small hint message',
hintMessageIcon: 'blrInfo',
disabled: false,
readonly: false,
required: false,
hasError: false,
errorMessage: ' ',
Expand Down Expand Up @@ -294,7 +285,6 @@ const argTypesToDisable = [
'hintMessage',
'hintMessageIcon',
'disabled',
'readonly',
'required',
'hasError',
'errorMessage',
Expand Down Expand Up @@ -405,7 +395,7 @@ Indeterminate.story = {

/**
* ## States
* Apart from states like rest, hover, pressed and focus, the Checkbox component can also be disabled or readonly. The error state is documented under [validation](#validation).
* Apart from states like rest, hover, pressed and focus, the Checkbox component can also be disabled. The error state is documented under [validation](#validation).
*
* ### Disabled
* The Checkbox component in the disabled state can not be interacted with. This means it can not receive focus or be selected.
Expand All @@ -429,27 +419,6 @@ Disabled.story = {
name: ' ',
};

/**
* ### Readonly
* The Checkbox component in the readonly state can not be interacted with, but it can still be selected and receive focus.
*/
export const Readonly = () => {
return html`
${sharedStyles}
<div class="wrapper">
<div class="stories-checkbox">
${BlrCheckboxRenderFunction({
...defaultParams,
label: 'Readonly',
readonly: true,
})}
</div>
</div>
`;
};
Readonly.story = {
name: ' ',
};
/**
* ## Validation
* ### Required
Expand Down
1 change: 0 additions & 1 deletion packages/ui-library/src/components/checkbox/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ const sampleParams: BlrCheckboxType = {
disabled: false,
checked: false,
indeterminate: false,
readonly: false,
hasError: false,
sizeVariant: 'md',
errorMessage: 'This is a sample error message',
Expand Down
Loading
Loading