Skip to content

Commit

Permalink
refactor: remove focus colour from label, hint and legend (#678)
Browse files Browse the repository at this point in the history
* refactor: remove focus colour from label, hint and legend

* refactor: remove focus text colour from form fields

* chore: update tokens package
  • Loading branch information
melaniebmn authored Nov 19, 2024
1 parent 6b41ba0 commit 544f1cb
Show file tree
Hide file tree
Showing 12 changed files with 76 additions and 53 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"@babel/core": "^7.20.12",
"@babel/preset-env": "^7.20.2",
"@babel/preset-typescript": "^7.21.0",
"@cdssnc/gcds-tokens": "^1.20.1",
"@cdssnc/gcds-tokens": "^1.20.2",
"@fortawesome/fontawesome-free": "^6.3.0",
"@stencil/angular-output-target": "file:../../utils/angular-output-target",
"@stencil/postcss": "^2.1.0",
Expand Down
8 changes: 6 additions & 2 deletions packages/web/src/components/gcds-checkbox/gcds-checkbox.css
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
color: var(--gcds-checkbox-disabled-text);

gcds-label {
color: var(--gcds-checkbox-disabled-text);
--gcds-label-text: currentColor;

&:before,
&:after {
Expand All @@ -107,6 +107,10 @@
background-color: var(--gcds-checkbox-disabled-background);
}
}

gcds-hint {
--gcds-hint-text: currentColor;
}
}
}

Expand All @@ -124,7 +128,7 @@

@layer focus {
:host .gcds-checkbox:focus-within {
color: var(--gcds-checkbox-focus-text);
color: var(--gcds-checkbox-focus-color);

input:focus + gcds-label:before {
outline: var(--gcds-checkbox-focus-outline-width) solid currentcolor;
Expand Down
10 changes: 4 additions & 6 deletions packages/web/src/components/gcds-fieldset/gcds-fieldset.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@layer reset, default, disabled, focus;
@layer reset, default, disabled;

@layer reset {
:host {
Expand Down Expand Up @@ -49,11 +49,9 @@
@layer disabled {
:host .gcds-fieldset:disabled {
color: var(--gcds-fieldset-disabled-text);
}
}

@layer focus {
:host .gcds-fieldset:focus-within {
color: var(--gcds-fieldset-focus-text);
gcds-hint {
--gcds-hint-text: currentColor;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,14 @@
:host .gcds-file-uploader-wrapper.gcds-disabled {
color: var(--gcds-file-uploader-disabled-text);

gcds-label {
--gcds-label-text: currentColor;
}

gcds-hint {
--gcds-hint-text: currentColor;
}

:is(.file-uploader__input, .file-uploader__uploaded-file) {
pointer-events: none;
}
Expand Down Expand Up @@ -170,8 +178,6 @@

@layer focus {
:host .gcds-file-uploader-wrapper:focus-within {
color: var(--gcds-file-uploader-focus-text);

.file-uploader__uploaded-file:focus-within {
border-color: var(--gcds-file-uploader-file-focus-border-color);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/web/src/components/gcds-hint/gcds-hint.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
:host {
.gcds-hint,
gcds-text::part(text) {
color: inherit;
color: var(--gcds-hint-text);
}

.gcds-hint {
Expand Down
24 changes: 14 additions & 10 deletions packages/web/src/components/gcds-input/gcds-input.css
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,14 @@
:host .gcds-input-wrapper.gcds-disabled {
color: var(--gcds-input-disabled-text);

gcds-label {
--gcds-label-text: currentColor;
}

gcds-hint {
--gcds-hint-text: currentColor;
}

input:disabled {
cursor: not-allowed;
background-color: var(--gcds-input-disabled-background);
Expand All @@ -76,15 +84,11 @@
}

@layer focus {
:host .gcds-input-wrapper:focus-within {
color: var(--gcds-input-focus-text);

input:focus {
border-color: var(--gcds-input-focus-text);
outline: var(--gcds-input-outline-width) solid
var(--gcds-input-focus-text);
outline-offset: var(--gcds-input-border-width);
box-shadow: var(--gcds-input-focus-box-shadow);
}
:host .gcds-input-wrapper:focus-within input:focus {
border-color: var(--gcds-input-focus-border);
outline: var(--gcds-input-outline-width) solid
var(--gcds-input-focus-border);
outline-offset: var(--gcds-input-border-width);
box-shadow: var(--gcds-input-focus-box-shadow);
}
}
5 changes: 1 addition & 4 deletions packages/web/src/components/gcds-label/gcds-label.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
:host {
display: block;
}

:host .gcds-label {
color: inherit;
}
}

@layer default {
Expand All @@ -16,6 +12,7 @@
max-width: 100%;
font: var(--gcds-label-font-desktop);
margin: var(--gcds-label-margin) !important;
color: var(--gcds-label-text);
cursor: pointer;

@media only screen and (width < 48em) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@
color: var(--gcds-radio-disabled-text);

gcds-label {
--gcds-label-text: currentColor;

&:before,
&:after {
cursor: not-allowed;
Expand All @@ -107,6 +109,10 @@
background-color: var(--gcds-radio-disabled-background);
}
}

gcds-hint {
--gcds-hint-text: currentColor;
}
}
}

Expand All @@ -124,7 +130,7 @@

@layer focus {
:host .gcds-radio:focus-within {
color: var(--gcds-radio-focus-text);
color: var(--gcds-radio-focus-color);

input:focus + gcds-label {
&:before {
Expand Down
4 changes: 2 additions & 2 deletions packages/web/src/components/gcds-search/gcds-search.css
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@
@layer focus {
:host .gcds-search {
input:focus {
border-color: var(--gcds-search-focus-text);
border-color: var(--gcds-search-focus-border-color);
outline: var(--gcds-search-outline-width) solid
var(--gcds-search-focus-text);
var(--gcds-search-focus-border-color);
outline-offset: var(--gcds-search-border-width);
border-radius: var(--gcds-search-focus-border-radius);
box-shadow: var(--gcds-search-focus-box-shadow);
Expand Down
24 changes: 14 additions & 10 deletions packages/web/src/components/gcds-select/gcds-select.css
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,14 @@
:host .gcds-select-wrapper.gcds-disabled {
color: var(--gcds-select-disabled-text);

gcds-label {
--gcds-label-text: currentColor;
}

gcds-hint {
--gcds-hint-text: currentColor;
}

select:disabled {
cursor: not-allowed;
background-color: var(--gcds-select-disabled-background);
Expand All @@ -73,15 +81,11 @@
}

@layer focus {
:host .gcds-select-wrapper:focus-within {
color: var(--gcds-select-focus-text);

select:focus {
border-color: var(--gcds-select-focus-text);
outline: var(--gcds-select-outline-width) solid
var(--gcds-select-focus-text);
outline-offset: var(--gcds-select-border-width);
box-shadow: var(--gcds-select-focus-box-shadow);
}
:host .gcds-select-wrapper:focus-within select:focus {
border-color: var(--gcds-select-focus-border);
outline: var(--gcds-select-outline-width) solid
var(--gcds-select-focus-border);
outline-offset: var(--gcds-select-border-width);
box-shadow: var(--gcds-select-focus-box-shadow);
}
}
24 changes: 14 additions & 10 deletions packages/web/src/components/gcds-textarea/gcds-textarea.css
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@
:host .gcds-textarea-wrapper.gcds-disabled {
color: var(--gcds-textarea-disabled-text);

gcds-label {
--gcds-label-text: currentColor;
}

gcds-hint {
--gcds-hint-text: currentColor;
}

textarea:disabled {
cursor: not-allowed;
background-color: var(--gcds-textarea-disabled-background);
Expand All @@ -72,15 +80,11 @@
}

@layer focus {
:host .gcds-textarea-wrapper:focus-within {
color: var(--gcds-textarea-focus-text);

textarea:focus {
border-color: var(--gcds-textarea-focus-text);
outline: var(--gcds-textarea-outline-width) solid
var(--gcds-textarea-focus-text);
outline-offset: var(--gcds-textarea-border-width);
box-shadow: var(--gcds-textarea-focus-box-shadow);
}
:host .gcds-textarea-wrapper:focus-within textarea:focus {
border-color: var(--gcds-textarea-focus-border);
outline: var(--gcds-textarea-outline-width) solid
var(--gcds-textarea-focus-border);
outline-offset: var(--gcds-textarea-border-width);
box-shadow: var(--gcds-textarea-focus-box-shadow);
}
}

0 comments on commit 544f1cb

Please sign in to comment.