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

Stylelint v16 update #3250

Merged
merged 12 commits into from
Oct 21, 2024
5 changes: 5 additions & 0 deletions .changeset/slimy-yaks-smash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@navikt/ds-css": patch
---

Updated to Selectors Level 4 syntax.
2 changes: 1 addition & 1 deletion @navikt/core/css/baseline/_utilities.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* https://web.dev/prefers-reduced-motion/ */
@media (prefers-reduced-motion: reduce) {
*:not(.navds-loader *):not(.navds-loader):not(.navds-progress-bar *):not(.navds-progress-bar),
*:not(.navds-loader *, .navds-loader, .navds-progress-bar *, .navds-progress-bar),
::before,
::after {
animation-delay: -1ms !important;
Expand Down
1 change: 1 addition & 0 deletions @navikt/core/css/button.css
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@
inset 0 0 0 1px var(--ac-button-primary-focus-border, var(--__ac-button-primary-focus-border, var(--a-surface-default))),
var(--a-shadow-focus);
}

@media (forced-colors: active) {
.navds-button--primary:focus-visible {
box-shadow: none;
Expand Down
2 changes: 1 addition & 1 deletion @navikt/core/css/darkside/baseline/utilities.darkside.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

/* https://web.dev/prefers-reduced-motion/ */
@media (prefers-reduced-motion: reduce) {
*:not(.navds-loader *):not(.navds-loader):not(.navds-progress-bar *):not(.navds-progress-bar),
*:not(.navds-loader *, .navds-loader, .navds-progress-bar *, .navds-progress-bar),
::before,
::after {
animation-delay: -1ms !important;
Expand Down
16 changes: 8 additions & 8 deletions @navikt/core/css/darkside/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
@layer aksel.reset, aksel.typography, aksel.theme, aksel.components, aksel.utilities;

/* CSS foundations */
@import url("./baseline/reset.darkside.css") layer(aksel.reset);
@import url("./baseline/print.darkside.css") layer(aksel.reset);
@import url("./baseline/fonts.darkside.css") layer(aksel.typography);
@import url("./baseline/theme.darkside.css") layer(aksel.theme);
@import url("./typography.darkside.css") layer(aksel.typography);
@import url("./baseline/utilities.darkside.css") layer(aksel.utilities);
@import "./baseline/reset.darkside.css" layer(aksel.reset);
@import "./baseline/print.darkside.css" layer(aksel.reset);
@import "./baseline/fonts.darkside.css" layer(aksel.typography);
@import "./baseline/theme.darkside.css" layer(aksel.theme);
@import "./typography.darkside.css" layer(aksel.typography);
@import "./baseline/utilities.darkside.css" layer(aksel.utilities);

/* Theming */
@import url("@navikt/ds-tokens/dist/darkside/tokens.css") layer(aksel.theme);
@import "@navikt/ds-tokens/dist/darkside/tokens.css" layer(aksel.theme);

/* Components */
@import url("./button.darkside.css") layer(aksel.components);
@import "./button.darkside.css" layer(aksel.components);
18 changes: 9 additions & 9 deletions @navikt/core/css/date.css
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,14 @@
border-radius: var(--a-border-radius-xlarge);
}

.navds-date .rdp-button:not(.rdp-day_selected):not([disabled]):focus-visible,
.navds-date .navds-date__month-button:not(.rdp-day_selected):not([disabled]):focus-visible {
.navds-date .rdp-button:not(.rdp-day_selected, [disabled]):focus-visible,
.navds-date .navds-date__month-button:not(.rdp-day_selected, [disabled]):focus-visible {
box-shadow: var(--a-shadow-focus);
}

@supports not selector(:focus-visible) {
.navds-date .rdp-button:not(.rdp-day_selected):not([disabled]):focus,
.navds-date .navds-date__month-button:not(.rdp-day_selected):not([disabled]):focus {
.navds-date .rdp-button:not(.rdp-day_selected, [disabled]):focus,
.navds-date .navds-date__month-button:not(.rdp-day_selected, [disabled]):focus {
box-shadow: var(--a-shadow-focus);
}
}
Expand Down Expand Up @@ -167,8 +167,8 @@
color: var(--ac-date-disabled-text, var(--a-text-subtle));
}

.navds-date .rdp-button:where(:not(.rdp-day_selected):not([disabled])):hover,
.navds-date__month-button:where(:not(.rdp-day_selected):not([disabled])):hover {
.navds-date .rdp-button:where(:not(.rdp-day_selected, [disabled])):hover,
.navds-date__month-button:where(:not(.rdp-day_selected, [disabled])):hover {
background: var(--ac-date-hover-bg, var(--a-surface-action-subtle-hover));
cursor: pointer;
}
Expand Down Expand Up @@ -201,19 +201,19 @@
}

/* Error-handling */
.navds-date__field--error .navds-date__field-input:not(:hover):not(:disabled) {
.navds-date__field--error .navds-date__field-input:not(:hover, :disabled) {
border-color: var(--ac-date-input-error-border, var(--a-border-danger));
box-shadow: inset 0 0 0 1px var(--ac-date-input-error-border, var(--a-border-danger));
}

.navds-date__field--error .navds-date__field-input:focus-visible:not(:hover):not(:disabled) {
.navds-date__field--error .navds-date__field-input:focus-visible:not(:hover, :disabled) {
box-shadow:
inset 0 0 0 1px var(--ac-date-input-error-border, var(--a-border-danger)),
var(--a-shadow-focus);
}

@supports not selector(:focus-visible) {
.navds-date__field--error .navds-date__field-input:focus:not(:hover):not(:disabled) {
.navds-date__field--error .navds-date__field-input:focus:not(:hover, :disabled) {
box-shadow:
inset 0 0 0 1px var(--ac-date-input-error-border, var(--a-border-danger)),
var(--a-shadow-focus);
Expand Down
2 changes: 1 addition & 1 deletion @navikt/core/css/dropdown.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
border-bottom: 1px solid var(--a-border-divider);
}

.navds-dropdown__menu > :not(.navds-dropdown__divider):not(.navds-dropdown__list) {
.navds-dropdown__menu > :not(.navds-dropdown__divider, .navds-dropdown__list) {
margin: 0 var(--a-spacing-4) var(--a-spacing-3);
}

Expand Down
4 changes: 2 additions & 2 deletions @navikt/core/css/form/combobox.css
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@
cursor: text;
}

.navds-combobox--error .navds-text-field__input:not(:hover):not(:disabled) {
.navds-combobox--error .navds-text-field__input:not(:hover, :disabled) {
border-color: var(--ac-combobox-error-border, var(--a-border-danger));
box-shadow: 0 0 0 1px var(--ac-combobox-error-border, var(--a-border-danger));
}

.navds-combobox--error
.navds-text-field__input:not(:hover):not(:disabled):not(.navds-combobox__wrapper-inner--virtually-unfocused):focus-within {
.navds-text-field__input:not(:hover, :disabled, .navds-combobox__wrapper-inner--virtually-unfocused):focus-within {
outline: 2px solid transparent;
outline-offset: 2px;
box-shadow:
Expand Down
4 changes: 2 additions & 2 deletions @navikt/core/css/form/fieldset.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
min-width: 0;
}

.navds-fieldset > :not(:first-child):not(:empty) {
.navds-fieldset > :not(:first-child, :empty) {
margin-top: var(--a-spacing-2);
}

Expand All @@ -26,7 +26,7 @@
}

/* Applied when hideLegend is applied to fieldset */
.navds-fieldset > .navds-sr-only + :not(:first-child):not(:empty) {
.navds-fieldset > .navds-sr-only + :not(:first-child, :empty) {
margin-top: 0;
}

Expand Down
38 changes: 16 additions & 22 deletions @navikt/core/css/form/radio-checkbox.css
Original file line number Diff line number Diff line change
Expand Up @@ -170,44 +170,42 @@
color: var(--ac-radio-checkbox-action, var(--a-surface-action-hover));
}

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

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

.navds-checkbox--error
> .navds-checkbox__input:not(:hover):not(:disabled):not(:checked):not(:indeterminate)
+ .navds-checkbox__label::before,
.navds-radio--error > .navds-radio__input:not(:hover):not(:disabled):not(:checked) + .navds-radio__label::before {
.navds-checkbox--error > .navds-checkbox__input:not(:hover, :disabled, :checked, :indeterminate) + .navds-checkbox__label::before,
.navds-radio--error > .navds-radio__input:not(:hover, :disabled, :checked) + .navds-radio__label::before {
box-shadow: 0 0 0 2px var(--ac-radio-checkbox-error-border, var(--a-border-danger));
}

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

.navds-checkbox--error
> .navds-checkbox__input:hover:not(:disabled):not(:checked):not(:indeterminate):not(:focus)
> .navds-checkbox__input:hover:not(:disabled, :checked, :indeterminate, :focus)
+ .navds-checkbox__label::before,
.navds-radio--error > .navds-radio__input:hover:not(:disabled):not(:checked):not(:focus) + .navds-radio__label::before {
.navds-radio--error > .navds-radio__input:hover:not(:disabled, :checked, :focus) + .navds-radio__label::before {
background-color: var(--ac-radio-checkbox-error-hover-bg, var(--a-surface-danger-subtle));
box-shadow: 0 0 0 2px var(--ac-radio-checkbox-error-border, var(--a-border-danger));
}

.navds-checkbox--error
> .navds-checkbox__input:focus:hover:not(:disabled):not(:checked):not(:indeterminate)
> .navds-checkbox__input:focus:hover:not(:disabled, :checked, :indeterminate)
+ .navds-checkbox__label::before,
.navds-radio--error > .navds-radio__input:focus:hover:not(:disabled):not(:checked) + .navds-radio__label::before {
.navds-radio--error > .navds-radio__input:focus:hover:not(:disabled, :checked) + .navds-radio__label::before {
background-color: var(--ac-radio-checkbox-error-hover-bg, var(--a-surface-danger-subtle));
box-shadow:
0 0 0 2px var(--ac-radio-checkbox-error-border, var(--a-border-danger)),
Expand Down Expand Up @@ -241,14 +239,10 @@
color: var(--a-text-default);
}

.navds-checkbox--readonly
> .navds-checkbox__input:not(:disabled):not(:checked):not(:indeterminate)
+ .navds-checkbox__label::before,
.navds-checkbox--readonly
> .navds-checkbox__input:hover:not(:checked):not(:indeterminate):not(:focus)
+ .navds-checkbox__label::before,
.navds-radio--readonly > .navds-radio__input:not(:disabled):not(:checked) + .navds-radio__label::before,
.navds-radio--readonly > .navds-radio__input:hover:not(:checked):not(:focus) + .navds-radio__label::before {
.navds-checkbox--readonly > .navds-checkbox__input:not(:disabled, :checked, :indeterminate) + .navds-checkbox__label::before,
.navds-checkbox--readonly > .navds-checkbox__input:hover:not(:checked, :indeterminate, :focus) + .navds-checkbox__label::before,
.navds-radio--readonly > .navds-radio__input:not(:disabled, :checked) + .navds-radio__label::before,
.navds-radio--readonly > .navds-radio__input:hover:not(:checked, :focus) + .navds-radio__label::before {
background-color: var(--__ac-radio-checkbox-readonly-bg);
box-shadow: 0 0 0 2px var(--__ac-radio-checkbox-readonly-border);
}
Expand Down
6 changes: 3 additions & 3 deletions @navikt/core/css/form/search.css
Original file line number Diff line number Diff line change
Expand Up @@ -186,12 +186,12 @@
}

/* Error-handling */
.navds-search--error .navds-search__input:not(:hover):not(:disabled) {
.navds-search--error .navds-search__input:not(:hover, :disabled) {
border-color: var(--ac-search-error-border, var(--__ac-search-error-border, var(--a-border-danger)));
box-shadow: inset 0 0 0 1px var(--ac-search-error-border, var(--__ac-search-error-border, var(--a-border-danger)));
}

.navds-search--error .navds-search__input:focus-visible:not(:hover):not(:disabled) {
.navds-search--error .navds-search__input:focus-visible:not(:hover, :disabled) {
box-shadow:
inset 0 0 0 1px var(--ac-search-error-border, var(--__ac-search-error-border, var(--a-border-danger))),
var(--a-shadow-focus);
Expand All @@ -205,7 +205,7 @@
}

@supports not selector(:focus-visible) {
.navds-search--error .navds-search__input:focus:not(:hover):not(:disabled) {
.navds-search--error .navds-search__input:focus:not(:hover, :disabled) {
box-shadow:
inset 0 0 0 1px var(--ac-search-error-border, var(--__ac-search-error-border, var(--a-border-danger))),
var(--a-shadow-focus);
Expand Down
2 changes: 1 addition & 1 deletion @navikt/core/css/form/select.css
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
/**
Error handling
*/
.navds-select--error > * select:not(:hover):not(:focus):not(:disabled) {
.navds-select--error > * select:not(:hover, :focus, :disabled) {
box-shadow: 0 0 0 1px var(--ac-select-error-border, var(--a-surface-danger));
border-color: var(--ac-select-error-border, var(--a-surface-danger));
}
Expand Down
6 changes: 3 additions & 3 deletions @navikt/core/css/form/text-field.css
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,19 @@
/**
Error handling
*/
.navds-text-field--error > .navds-text-field__input:not(:hover):not(:disabled) {
.navds-text-field--error > .navds-text-field__input:not(:hover, :disabled) {
border-color: var(--ac-textfield-error-border, var(--__ac-textfield-error-border, var(--a-border-danger)));
box-shadow: 0 0 0 1px var(--ac-textfield-error-border, var(--__ac-textfield-error-border, var(--a-border-danger)));
}

.navds-text-field--error > .navds-text-field__input:focus-visible:not(:hover):not(:disabled) {
.navds-text-field--error > .navds-text-field__input:focus-visible:not(:hover, :disabled) {
box-shadow:
0 0 0 1px var(--a-border-danger),
var(--a-shadow-focus);
}

@supports not selector(:focus-visible) {
.navds-text-field--error > .navds-text-field__input:focus:not(:hover):not(:disabled) {
.navds-text-field--error > .navds-text-field__input:focus:not(:hover, :disabled) {
box-shadow:
0 0 0 1px var(--a-border-danger),
var(--a-shadow-focus);
Expand Down
4 changes: 2 additions & 2 deletions @navikt/core/css/form/textarea.css
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,13 @@
/**
Error handling
*/
.navds-textarea--error .navds-textarea__input:not(:hover):not(:focus-visible):not(:disabled) {
.navds-textarea--error .navds-textarea__input:not(:hover, :focus-visible, :disabled) {
box-shadow: 0 0 0 1px var(--ac-textarea-error-border, var(--__ac-textarea-error-border, var(--a-border-danger)));
border-color: var(--ac-textarea-error-border, var(--__ac-textarea-error-border, var(--a-border-danger)));
}

@supports not selector(:focus-visible) {
.navds-textarea--error .navds-textarea__input:not(:hover):not(:focus):not(:disabled) {
.navds-textarea--error .navds-textarea__input:not(:hover, :focus, :disabled) {
box-shadow: 0 0 0 1px var(--ac-textarea-error-border, var(--__ac-textarea-error-border, var(--a-border-danger)));
border-color: var(--ac-textarea-error-border, var(--__ac-textarea-error-border, var(--a-border-danger)));
}
Expand Down
1 change: 1 addition & 0 deletions @navikt/core/css/index.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@charset "UTF-8";

@import "baseline/index.css";
@import "typography.css";
@import "accordion.css";
Expand Down
10 changes: 6 additions & 4 deletions @navikt/core/css/modal.css
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@
/* From polyfill */
position: fixed;
top: 0;
right: 0;
bottom: 0;
right: 0;
/* stylelint-disable-next-line declaration-block-no-redundant-longhand-properties */
left: 0;
}

Expand Down Expand Up @@ -96,8 +97,9 @@
/* From polyfill: */
position: fixed;
top: 0;
right: 0;
bottom: 0;
right: 0;
/* stylelint-disable-next-line declaration-block-no-redundant-longhand-properties */
left: 0;
}

Expand Down Expand Up @@ -176,7 +178,7 @@
}

@keyframes akselModalFadeIn {
from {
0% {
opacity: 0.0001; /* Safari will not set focus inside the modal when it opens if we set this to 0 */
transform: translate3d(0, calc(5% + 4px), 0);
}
Expand All @@ -185,7 +187,7 @@
opacity: 1;
}

to {
100% {
transform: none;
}
}
Expand Down
3 changes: 1 addition & 2 deletions @navikt/core/css/primitives/stack.css
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@

.navds-stack__spacer {
flex: 1;
justify-self: stretch;
KenAJoh marked this conversation as resolved.
Show resolved Hide resolved
align-self: stretch;
place-content: stretch stretch;
}

.navds-stack > .navds-stack__spacer {
Expand Down
3 changes: 1 addition & 2 deletions @navikt/core/css/stepper.css
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,7 @@ button.navds-stepper__step {
grid-template-columns:
[content-start] auto [circle] var(--navds-stepper-circle-size)
[content-end] auto;
justify-items: center;
align-items: center;
place-items: center center;
margin-bottom: 0;
}

Expand Down
2 changes: 1 addition & 1 deletion @navikt/core/css/toggle-group.css
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@
}

.navds-toggle-group__button:active {
background-color: none !important;
background-color: unset !important;
}

.navds-toggle-group__button:focus-visible {
Expand Down
Loading
Loading