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): pressed state removed and updated focus state for readonly #1172

Open
wants to merge 4 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
53 changes: 16 additions & 37 deletions packages/ui-library/src/components/input-field-number/index.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,19 +124,6 @@ export const staticSemanticStyles = css`
outline-color: ${inputfield.container.border.default.rest.color};
border-radius: ${inputfield.container.borderradius};

&.readonly {
color: ${inputfield.userinput.textcolor.default.readonly};
background-color: ${inputfield.container.bgcolor.default.readonly};

& > input {
color: ${inputfield.userinput.textcolor.default.readonly};

&::placeholder {
color: ${inputfield.placeholder.textcolor.default.readonly};
}
}
}

&:focus-within.${theme} {
outline-offset: calc(${inputfield.container.border.default.focus.width} * -1);
outline-width: ${inputfield.container.border.default.focus.width};
Expand Down Expand Up @@ -193,6 +180,22 @@ export const staticSemanticStyles = css`
&::placeholder {
color: ${inputfield.placeholder.textcolor.default.readonly};
}

&:focus-within.${theme} {
outline-offset: calc(${inputfield.container.border.default.focus.width} * -1);
outline-width: ${inputfield.container.border.default.focus.width};
outline-style: ${inputfield.container.border.default.focus.style};
outline-color: ${inputfield.container.border.default.focus.color};
background-color: ${inputfield.container.bgcolor.default.focus};

& > input {
color: ${inputfield.userinput.textcolor.default.focus};

&::placeholder {
color: ${inputfield.placeholder.textcolor.default.focus};
}
}
}
}

&:disabled {
Expand Down Expand Up @@ -253,16 +256,6 @@ export const staticSemanticStyles = css`
color: ${inputfield.placeholder.textcolor.error.rest};
}

&:active {
outline: none;
color: ${inputfield.userinput.textcolor.error.pressed};
background-color: ${inputfield.container.bgcolor.error.pressed};

&::placeholder {
color: ${inputfield.placeholder.textcolor.error.pressed};
}
}

&:focus-within {
outline: none;
color: ${inputfield.userinput.textcolor.error.focus};
Expand All @@ -273,15 +266,6 @@ export const staticSemanticStyles = css`
}
}
}

&.readonly.${theme} {
color: ${inputfield.userinput.textcolor.default.readonly};
background-color: ${inputfield.container.bgcolor.default.readonly};

&::placeholder {
color: ${inputfield.placeholder.textcolor.default.readonly};
}
}
`;
})}
`;
Expand Down Expand Up @@ -401,11 +385,6 @@ export const staticComponentStyles = css`
color: ${stepperbutton.icon.iconcolor.hover};
}

&:active:not(:disabled) {
background-color: ${stepperbutton.container.bgcolor.pressed};
color: ${stepperbutton.icon.iconcolor.pressed};
}

&:disabled {
background-color: ${stepperbutton.container.bgcolor.disabled};
color: ${stepperbutton.icon.iconcolor.disabled};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,6 @@ export class BlrInputFieldNumber extends LitElementCustom {
[this.sizeVariant]: this.sizeVariant,
[this.stepperVariant || 'split']: this.stepperVariant || 'split',
'error-input': this.hasError || false,
'readonly': this.readonly || false,
[this.theme]: this.theme,
});

Expand Down
56 changes: 13 additions & 43 deletions packages/ui-library/src/components/input-field-text/index.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,6 @@ export const styleCustom = css`
}
}

&:active {
&::placeholder {
color: ${inputfield.placeholder.textcolor.default.pressed};
}
}

&[readonly] {
&::placeholder {
color: ${inputfield.placeholder.textcolor.default.readonly};
Expand Down Expand Up @@ -128,15 +122,6 @@ export const styleCustom = css`
}
}

&:active {
border: none;
outline: none;

&::placeholder {
color: ${inputfield.placeholder.textcolor.error.pressed};
}
}

&.focus {
border: none;
outline: none;
Expand Down Expand Up @@ -230,39 +215,32 @@ export const styleCustom = css`
outline: ${inputfield.container.border.default.hover.width} ${inputfield.container.border.default.readonly.style}
${inputfield.container.border.default.readonly.color};
background-color: ${inputfield.container.bgcolor.default.readonly};
}

&:active {
outline: ${inputfield.container.border.default.pressed.width} ${inputfield.container.border.default.pressed.style}
${inputfield.container.border.default.pressed.color};
color: ${inputfield.userinput.textcolor.default.pressed};
background-color: ${inputfield.container.bgcolor.default.pressed};
&.focus {
outline-offset: calc(${inputfield.container.border.default.focus.width} * -1);
outline: ${inputfield.container.border.default.focus.width} ${inputfield.container.border.default.focus.style}
${inputfield.container.border.default.focus.color};
background-color: ${inputfield.container.bgcolor.default.focus};
}
}

&.error-input {
outline: ${inputfield.container.border.error.rest.width} ${inputfield.container.border.error.rest.style}
${inputfield.container.border.error.rest.color};
background-color: ${inputfield.container.bgcolor.error.rest};

&.focus {
outline: ${inputfield.container.border.error.focus.width} ${inputfield.container.border.error.focus.style}
${inputfield.container.border.error.focus.color};
color: ${inputfield.userinput.textcolor.error.focus};
background-color: ${inputfield.container.bgcolor.error.focus};
}

&:hover {
outline: ${inputfield.container.border.error.hover.width} ${inputfield.container.border.error.hover.style};
border-color: ${inputfield.container.border.error.hover.color};
outline: ${inputfield.container.border.error.rest.width} ${inputfield.container.border.error.rest.style}
${inputfield.container.border.error.rest.color};
color: ${inputfield.userinput.textcolor.error.hover};
background-color: ${inputfield.container.bgcolor.error.hover};
}

&:active {
outline: ${inputfield.container.border.error.pressed.width} ${inputfield.container.border.error.pressed.style}
${inputfield.container.border.error.pressed.color};
color: ${inputfield.userinput.textcolor.error.pressed};
background-color: ${inputfield.container.bgcolor.error.pressed};
&.focus {
outline: ${inputfield.container.border.error.focus.width} ${inputfield.container.border.error.focus.style}
${inputfield.container.border.error.focus.color};
color: ${inputfield.userinput.textcolor.error.focus};
background-color: ${inputfield.container.bgcolor.error.focus};
}

.blr-form-input {
Expand Down Expand Up @@ -316,10 +294,6 @@ function getInputIconStyles({ theme, semanticTokens }: { theme: ThemeType; seman
color: ${inputfield.icon.iconcolor.default.focus};
}

&:active .${iconClassName} {
color: ${inputfield.icon.iconcolor.default.pressed};
}

&:has(input[readonly]):not(.error-input) .${iconClassName} {
color: ${inputfield.icon.iconcolor.default.readonly};
}
Expand All @@ -340,10 +314,6 @@ function getInputIconStyles({ theme, semanticTokens }: { theme: ThemeType; seman
&:focus-within .${iconClassName} {
color: ${inputfield.icon.iconcolor.error.focus};
}

&:active .${iconClassName} {
color: ${inputfield.icon.iconcolor.error.pressed};
}
}
}
}
Expand Down
20 changes: 0 additions & 20 deletions packages/ui-library/src/components/select/index.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,6 @@ export const staticStyles = css`
${inputfield.container.border.default.focus.color};
}

&:active {
color: ${inputfield.userinput.textcolor.default.pressed};
background-color: ${inputfield.container.bgcolor.default.pressed};
border-color: ${inputfield.container.border.default.pressed.color};
}

&.disabled {
color: ${inputfield.userinput.textcolor.default.disabled};
background-color: ${inputfield.container.bgcolor.default.disabled};
Expand All @@ -139,12 +133,6 @@ export const staticStyles = css`
border-color: ${inputfield.container.border.error.hover.color};
}

&:active {
color: ${inputfield.userinput.textcolor.error.pressed};
background-color: ${inputfield.container.bgcolor.error.pressed};
border-color: ${inputfield.container.border.error.pressed.color};
}

&.focus {
color: ${inputfield.userinput.textcolor.error.focus};
background-color: ${inputfield.container.bgcolor.error.focus};
Expand Down Expand Up @@ -190,10 +178,6 @@ function getDirectionIndicatorIconStyles({ theme, semanticTokens }: { theme: The
color: ${inputfield.icon.iconcolor.default.focus};
}

&:active .${directionIndicatorIconClassName} {
color: ${inputfield.icon.iconcolor.default.pressed};
}

&.disabled {
.${directionIndicatorIconClassName} {
color: ${inputfield.icon.iconcolor.default.disabled};
Expand All @@ -213,10 +197,6 @@ function getDirectionIndicatorIconStyles({ theme, semanticTokens }: { theme: The
&:focus-within .${directionIndicatorIconClassName} {
color: ${inputfield.icon.iconcolor.error.focus};
}

&:active .${directionIndicatorIconClassName} {
color: ${inputfield.icon.iconcolor.error.pressed};
}
}
}
`;
Expand Down
22 changes: 0 additions & 22 deletions packages/ui-library/src/components/textarea/index.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,17 +193,6 @@ export const staticStyles = css`
}
}

&:active {
outline: ${inputfield.container.border.default.pressed.width} ${inputfield.container.border.default.pressed.style}
${inputfield.container.border.default.pressed.color};
color: ${inputfield.userinput.textcolor.default.pressed};
background-color: ${inputfield.container.bgcolor.default.pressed};

&::placeholder {
color: ${inputfield.placeholder.textcolor.default.pressed};
}
}

&.disabled {
outline: ${inputfield.container.border.default.disabled.width} ${inputfield.container.border.default.disabled.style}
${inputfield.container.border.default.disabled.color};
Expand Down Expand Up @@ -270,17 +259,6 @@ export const staticStyles = css`
color: ${inputfield.placeholder.textcolor.error.focus};
}
}

&:active {
outline: ${inputfield.container.border.error.pressed.width} ${inputfield.container.border.error.pressed.style}
${inputfield.container.border.error.pressed.color};
color: ${inputfield.userinput.textcolor.error.pressed};
background-color: ${inputfield.container.bgcolor.error.pressed};

&::placeholder {
color: ${inputfield.placeholder.textcolor.error.pressed};
}
}
}

&.sm {
Expand Down
3 changes: 3 additions & 0 deletions packages/ui-library/src/components/textarea/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ export class BlrTextarea extends LitElementCustom {
@property() accessor theme: ThemeType = 'Light_value';

@state() protected accessor count = 0;
@state() protected accessor isFocused = false;
@query('textarea') protected accessor textareaElement: HTMLTextAreaElement | null = null;

connectedCallback() {
Expand Down Expand Up @@ -136,12 +137,14 @@ export class BlrTextarea extends LitElementCustom {

protected handleFocus = (event: FocusEvent) => {
if (!this.disabled) {
this.isFocused = true;
this.dispatchEvent(createBlrFocusEvent({ originalEvent: event }));
}
};

protected handleBlur = (event: FocusEvent) => {
if (!this.disabled) {
this.isFocused = false;
this.dispatchEvent(createBlrBlurEvent({ originalEvent: event }));
}
};
Expand Down
Loading