Skip to content

Commit

Permalink
[V6] Oppdatert bruk av action-farger (#2717)
Browse files Browse the repository at this point in the history
* 💄 Button secondary hover

* 💄 Radio/Checkbox action-farger

* :WIP: combobox action-farger

* 🐛 Tilpasset hover-farge på checkbox i confirmationpanel

* 💄 copybutton hover-text action

* 💄 dropdown, helptext hover-text

* 💄 link og linkpanel actionsfarger

* 💄 Search action-farger

* 💄 select action-farger

* 💄 Stepper action

* 💄 Textarea action

* 💄 Textarea og textfield colors

* 🐛 Riktig hover-bakgrunn på combobox selected option

* 📝 Changeset

* 📝 changeset tokens

* 📝 Dokumentert nye tokens
  • Loading branch information
KenAJoh authored Feb 14, 2024
1 parent 4999e28 commit 939e6ad
Show file tree
Hide file tree
Showing 22 changed files with 95 additions and 56 deletions.
5 changes: 5 additions & 0 deletions .changeset/three-chefs-notice.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@navikt/ds-css": major
---

CSS: Oppdatert bruk av action-farger i systemet. Dette påvirker komponentene: Button, CopyButton, Dropdown, Combobox, ConfirmationPanel, Radio, Checkbox, Search, Select, TextField, Textarea, Helptext, LinkPanel, Link, ReadMore, Stepper og Tabs. Endringen skal ikke brekke noe for konsumenter så lenge man ikke har overskrevet farger manuelt.
5 changes: 5 additions & 0 deletions .changeset/three-chefs-notice2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@navikt/ds-css": major
---

Tokens: Nye tokens `--a-text-action-hover` og `--a-border-action-hover`
2 changes: 2 additions & 0 deletions @navikt/core/css/button.css
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@
background-color: var(--ac-button-primary-bg, var(--__ac-button-primary-bg, var(--a-surface-action)));
color: var(--ac-button-primary-text, var(--__ac-button-primary-text, var(--a-text-on-action)));
}

@media (forced-colors: active) {
.navds-button.navds-button--primary {
background-color: highlight;
Expand Down Expand Up @@ -227,6 +228,7 @@
--ac-button-secondary-hover-bg,
var(--__ac-button-secondary-hover-bg, var(--a-surface-action-subtle-hover))
);
box-shadow: inset 0 0 0 2px var(--ac-button-secondary-hover-border, var(--a-border-action-hover));
}

.navds-button--secondary:focus-visible {
Expand Down
2 changes: 1 addition & 1 deletion @navikt/core/css/copybutton.css
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
}

.navds-copybutton--action:hover {
color: var(--ac-copybutton-action-hover-text, var(--__ac-copybutton-action-text, var(--a-text-action)));
color: var(--ac-copybutton-action-hover-text, var(--__ac-copybutton-action-text, var(--a-text-action-hover)));
background-color: var(--ac-copybutton-action-hover-bg, var(--__ac-copybutton-bg-hover, var(--a-surface-hover)));
}

Expand Down
1 change: 1 addition & 0 deletions @navikt/core/css/dropdown.css
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@

.navds-dropdown__item:hover {
background-color: var(--ac-dropdown-item-hover-bg, var(--a-surface-action-subtle-hover));
color: var(--ac-dropdown-item-hover-text, var(--a-text-action-hover));
}

.navds-dropdown__item:active {
Expand Down
11 changes: 1 addition & 10 deletions @navikt/core/css/form/combobox.css
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,6 @@
}

.navds-combobox__wrapper-inner:has(.navds-combobox__input:focus-visible) {
box-shadow:
0 0 0 1px var(--a-surface-default) inset,
var(--a-shadow-focus);
box-shadow: var(--a-shadow-focus);
outline: 3px solid transparent;
outline-offset: 2px;
Expand All @@ -113,9 +110,6 @@
}

.navds-combobox__wrapper-inner:has(.navds-combobox__input:focus) {
box-shadow:
0 0 0 1px var(--a-surface-default) inset,
var(--a-shadow-focus);
box-shadow: var(--a-shadow-focus);
outline: 3px solid transparent;
outline-offset: 2px;
Expand All @@ -129,9 +123,6 @@

@supports not selector(:has) {
.navds-combobox--focused .navds-combobox__wrapper-inner {
box-shadow:
0 0 0 1px var(--a-surface-default) inset,
var(--a-shadow-focus);
box-shadow: var(--a-shadow-focus);
outline: 3px solid transparent;
outline-offset: 2px;
Expand Down Expand Up @@ -310,7 +301,7 @@

.navds-combobox__list-item--focus,
.navds-combobox__list--with-hover
.navds-combobox__list-item:not([data-no-focus="true"], .navds-combobox__list-item--new-option):hover {
.navds-combobox__list-item:where(:not([data-no-focus="true"], .navds-combobox__list-item--new-option)):hover {
background-color: var(--ac-combobox-list-item-hover-bg, var(--a-surface-hover));
cursor: pointer;
border-left: 4px solid var(--ac-combobox-list-item-hover-border-left, var(--a-border-strong));
Expand Down
4 changes: 4 additions & 0 deletions @navikt/core/css/form/confirmation-panel.css
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
background-color: var(--ac-confirmation-panel-error-bg, var(--a-surface-danger-subtle));
}

.navds-confirmation-panel--error .navds-checkbox__input:hover:not(:disabled) + .navds-checkbox__label {
color: var(--a-text-default);
}

@media (forced-colors: active) {
.navds-confirmation-panel__inner::before {
content: "";
Expand Down
38 changes: 19 additions & 19 deletions @navikt/core/css/form/radio-checkbox.css
Original file line number Diff line number Diff line change
Expand Up @@ -94,24 +94,19 @@
.navds-checkbox__input:hover:focus-visible + .navds-checkbox__label::before,
.navds-radio__input:hover:focus-visible + .navds-radio__label::before {
box-shadow:
0 0 0 2px var(--ac-radio-checkbox-action, var(--a-surface-action)),
0 0 0 2px var(--ac-radio-checkbox-action, var(--a-surface-action-hover)),
0 0 0 4px var(--a-border-focus);
}

@supports not selector(:focus-visible) {
.navds-checkbox__input:hover:focus + .navds-checkbox__label::before,
.navds-radio__input:hover:focus + .navds-radio__label::before {
box-shadow:
0 0 0 2px var(--ac-radio-checkbox-action, var(--a-surface-action)),
0 0 0 2px var(--ac-radio-checkbox-action, var(--a-surface-action-hover)),
0 0 0 4px var(--a-border-focus);
}
}

.navds-checkbox__input:indeterminate + .navds-checkbox__label::before {
box-shadow: 0 0 0 2px var(--ac-radio-checkbox-action, var(--a-surface-action));
background-color: var(--ac-radio-checkbox-action, var(--a-surface-action));
}

.navds-checkbox__input:indeterminate + .navds-checkbox__label::after {
content: "";
position: absolute;
Expand All @@ -128,9 +123,14 @@
transform: translate(0.25rem, -50%);
}

.navds-checkbox__input:checked + .navds-checkbox__label::before {
box-shadow: 0 0 0 2px var(--ac-radio-checkbox-action, var(--a-surface-action));
background-color: var(--ac-radio-checkbox-action, var(--a-surface-action));
.navds-checkbox__input:where(:checked, :indeterminate) + .navds-checkbox__label::before {
box-shadow: 0 0 0 2px var(--ac-radio-checkbox-action, var(--a-surface-action-selected));
background-color: var(--ac-radio-checkbox-action, var(--a-surface-action-selected));
}

.navds-checkbox__input:where(:checked, :indeterminate):hover + .navds-checkbox__label::before {
box-shadow: 0 0 0 2px var(--ac-radio-checkbox-action, var(--a-surface-action-selected-hover));
background-color: var(--ac-radio-checkbox-action, var(--a-surface-action-selected-hover));
}

.navds-checkbox__input:where(:not(:checked)) + .navds-checkbox__label > .navds-checkbox__icon {
Expand All @@ -144,7 +144,7 @@
transform: translate(var(--a-spacing-1-alt));
pointer-events: none;

/* Fixed edcase where when using in shadow-dom, svg will not center */
/* Fixed edcase where when using in shadow-dom, svg will not center */
display: flex;
align-items: center;
}
Expand All @@ -166,7 +166,7 @@
.navds-checkbox__input:indeterminate:focus-visible + .navds-checkbox__label::before,
.navds-checkbox__input:checked:focus-visible + .navds-checkbox__label::before {
box-shadow:
0 0 0 1px var(--ac-radio-checkbox-action, var(--a-surface-action)),
0 0 0 1px var(--ac-radio-checkbox-action, var(--a-surface-action-selected)),
0 0 0 2px var(--ac-radio-checkbox-bg, var(--a-surface-default)),
0 0 0 4px var(--a-border-focus);
}
Expand All @@ -175,22 +175,22 @@
.navds-checkbox__input:indeterminate:focus + .navds-checkbox__label::before,
.navds-checkbox__input:checked:focus + .navds-checkbox__label::before {
box-shadow:
0 0 0 1px var(--ac-radio-checkbox-action, var(--a-surface-action)),
0 0 0 1px var(--ac-radio-checkbox-action, var(--a-surface-action-selected)),
0 0 0 2px var(--ac-radio-checkbox-bg, var(--a-surface-default)),
0 0 0 4px var(--a-border-focus);
}
}

.navds-radio__input:checked + .navds-radio__label::before {
box-shadow:
0 0 0 2px var(--ac-radio-checkbox-action, var(--a-surface-action)),
0 0 0 2px var(--ac-radio-checkbox-action, var(--a-surface-action-selected)),
inset 0 0 0 2px var(--ac-radio-checkbox-bg, var(--a-surface-default));
background-color: var(--ac-radio-checkbox-action, var(--a-surface-action));
background-color: var(--ac-radio-checkbox-action, var(--a-surface-action-selected));
}

.navds-radio__input:checked:focus-visible + .navds-radio__label::before {
box-shadow:
0 0 0 2px var(--ac-radio-checkbox-action, var(--a-surface-action)),
0 0 0 2px var(--ac-radio-checkbox-action, var(--a-surface-action-selected)),
inset 0 0 0 2px var(--ac-radio-checkbox-bg, var(--a-surface-default)),
0 0 0 4px var(--a-border-focus);
}
Expand All @@ -206,19 +206,19 @@

.navds-checkbox__input:hover:not(:disabled) + .navds-checkbox__label,
.navds-radio__input:hover:not(:disabled) + .navds-radio__label {
color: var(--ac-radio-checkbox-action, var(--a-surface-action));
color: var(--ac-radio-checkbox-action, var(--a-surface-action-hover));
}

.navds-checkbox__input:hover:not(:disabled):not(:checked):not(:indeterminate):not(:focus-visible)
+ .navds-checkbox__label::before,
.navds-radio__input:hover:not(:disabled):not(:checked):not(:focus-visible) + .navds-radio__label::before {
box-shadow: 0 0 0 2px var(--ac-radio-checkbox-action, var(--a-surface-action));
box-shadow: 0 0 0 2px var(--ac-radio-checkbox-action, var(--a-surface-action-hover));
}

@supports not selector(:focus-visible) {
.navds-checkbox__input:hover:not(:disabled):not(:checked):not(:indeterminate):not(:focus) + .navds-checkbox__label::before,
.navds-radio__input:hover:not(:disabled):not(:checked):not(:focus) + .navds-radio__label::before {
box-shadow: 0 0 0 2px var(--ac-radio-checkbox-action, var(--a-surface-action));
box-shadow: 0 0 0 2px var(--ac-radio-checkbox-action, var(--a-surface-action-hover));
}
}

Expand Down
14 changes: 7 additions & 7 deletions @navikt/core/css/form/search.css
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
}

.navds-search__button-clear:hover {
color: var(--ac-search-clear-icon-hover, var(--__ac-search-clear-icon-hover, var(--a-text-action)));
color: var(--ac-search-clear-icon-hover, var(--__ac-search-clear-icon-hover, var(--a-text-action-hover)));
}

.navds-search__button-clear:focus-visible {
Expand Down Expand Up @@ -134,12 +134,12 @@
0 -1px 0 0 var(--ac-search-button-border, var(--__ac-search-button-border, var(--a-border-default))) inset;
}

.navds-search__button-search.navds-button--secondary:hover {
.navds-search__button-search.navds-button--secondary:where(:hover, :active) {
box-shadow:
-1px 0 0 0 var(--ac-search-button-border-hover, var(--__ac-search-button-border-hover, var(--a-border-action))) inset,
0 1px 0 0 var(--ac-search-button-border-hover, var(--__ac-search-button-border-hover, var(--a-border-action))) inset,
0 -1px 0 0 var(--ac-search-button-border-hover, var(--__ac-search-button-border-hover, var(--a-border-action))) inset,
-1px 0 0 0 var(--ac-search-button-border-hover, var(--__ac-search-button-border-hover, var(--a-border-action)));
-1px 0 0 0 var(--ac-search-button-border-hover, var(--__ac-search-button-border-hover, var(--a-border-action-hover))) inset,
0 1px 0 0 var(--ac-search-button-border-hover, var(--__ac-search-button-border-hover, var(--a-border-action-hover))) inset,
0 -1px 0 0 var(--ac-search-button-border-hover, var(--__ac-search-button-border-hover, var(--a-border-action-hover))) inset,
-1px 0 0 0 var(--ac-search-button-border-hover, var(--__ac-search-button-border-hover, var(--a-border-action-hover)));
z-index: 1;
}

Expand All @@ -155,7 +155,7 @@

.navds-search__button-search.navds-button--secondary:focus-visible:hover {
box-shadow:
0 0 0 1px var(--ac-search-button-border-hover, var(--__ac-search-button-border-hover, var(--a-border-action))) inset,
0 0 0 1px var(--ac-search-button-border-hover, var(--__ac-search-button-border-hover, var(--a-border-action-hover))) inset,
var(--a-shadow-focus);
}

Expand Down
3 changes: 2 additions & 1 deletion @navikt/core/css/form/select.css
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,13 @@
}

.navds-select__input:hover {
border-color: var(--ac-select-hover-bg, var(--a-border-action));
border-color: var(--ac-select-hover-border, var(--a-border-action-hover));
cursor: pointer;
}

.navds-select__input:focus-visible {
outline: none;
border-color: var(--ac-select-active-border, var(--a-border-action-selected));
box-shadow: var(--a-shadow-focus);
}

Expand Down
3 changes: 2 additions & 1 deletion @navikt/core/css/form/text-field.css
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,14 @@
}

.navds-text-field__input:hover {
border-color: var(--ac-textfield-hover-border, var(--__ac-textfield-hover-border, var(--a-border-action)));
border-color: var(--ac-textfield-hover-border, var(--__ac-textfield-hover-border, var(--a-border-action-hover)));
}

.navds-text-field__input:focus-visible {
outline: 2px solid transparent;
outline-offset: 2px;
box-shadow: var(--a-shadow-focus);
border-color: var(--ac-textfield-active-border, var(--a-border-action-selected));
}

@supports not selector(:focus-visible) {
Expand Down
3 changes: 2 additions & 1 deletion @navikt/core/css/form/textarea.css
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,14 @@
}

.navds-textarea__input:hover {
border-color: var(--ac-textarea-hover-border, var(--__ac-textarea-hover-border, var(--a-border-action)));
border-color: var(--ac-textarea-hover-border, var(--__ac-textarea-hover-border, var(--a-border-action-hover)));
}

.navds-textarea__input:focus-visible {
outline: 2px solid transparent;
outline-offset: 2px;
box-shadow: var(--a-shadow-focus);
border-color: var(--ac-textarea-active-border, var(--a-border-action-selected));
}

@supports not selector(:focus-visible) {
Expand Down
5 changes: 5 additions & 0 deletions @navikt/core/css/help-text.css
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@

.navds-help-text__button:where(:hover, :focus-visible, [aria-expanded="true"]) > .navds-help-text__icon--filled {
display: inherit;
color: var(--ac-help-text-button-hover-color, var(--a-surface-action-hover));
}

.navds-help-text__button[aria-expanded="true"] > .navds-help-text__icon--filled {
color: var(--ac-help-text-button-active-color, var(--a-surface-action-active));
}

@supports not selector(:focus-visible) {
Expand Down
4 changes: 2 additions & 2 deletions @navikt/core/css/link-panel.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@

.navds-link-panel:hover .navds-link-panel__title {
text-decoration: underline;
color: var(--ac-link-panel-hover-text, var(--a-text-action));
color: var(--ac-link-panel-hover-text, var(--a-text-action-hover));
}

.navds-link-panel:hover {
box-shadow: var(--a-shadow-small);
border-color: var(--ac-link-panel-hover-border, var(--a-border-action));
border-color: var(--ac-link-panel-hover-border, var(--a-border-action-hover));
}

.navds-link-panel:focus-visible {
Expand Down
1 change: 1 addition & 0 deletions @navikt/core/css/link.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

.navds-link:hover {
text-decoration: none;
color: var(--ac-link-hover-text, var(--a-text-action-hover));
}

.navds-link.navds-link--remove-underline {
Expand Down
1 change: 1 addition & 0 deletions @navikt/core/css/read-more.css
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

.navds-read-more__button:hover {
background-color: var(--ac-read-more-hover-bg, var(--a-surface-hover));
color: var(--ac-read-more-hover-text, var(--a-text-action-hover));
}

.navds-read-more__button:active {
Expand Down
7 changes: 5 additions & 2 deletions @navikt/core/css/stepper.css
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,10 @@ button.navds-stepper__step {
color: var(--ac-stepper-active, var(--a-text-action-selected));
}

.navds-stepper__step:hover:where(:not(.navds-stepper__step--non-interactive)) {
color: var(--ac-stepper-hover-active, var(--a-text-action-hover));
}

:where(.navds-stepper__step:hover) .navds-stepper__content {
text-decoration: underline;
}
Expand All @@ -239,8 +243,7 @@ button.navds-stepper__step {
}

:where(.navds-stepper__step:not(.navds-stepper__step--active):hover) .navds-stepper__circle--success {
color: var(--ac-stepper-hover-bg, var(--a-surface-action-subtle-hover));
background-color: var(--ac-stepper-text, var(--a-surface-action));
background-color: var(--ac-stepper-text, var(--a-surface-action-hover));
}

/* Non-interactive */
Expand Down
2 changes: 1 addition & 1 deletion @navikt/core/css/tabs.css
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
}

.navds-tabs__tab[aria-selected="true"] {
box-shadow: inset 0 -3px 0 0 var(--ac-tabs-selected-border, var(--a-border-action));
box-shadow: inset 0 -3px 0 0 var(--ac-tabs-selected-border, var(--a-border-action-selected));
color: var(--ac-tabs-selected-text, var(--a-text-default));
}

Expand Down
Loading

0 comments on commit 939e6ad

Please sign in to comment.