Compare commits

...
Author SHA1 Message Date
github-actions[bot]andgithub-actions[bot] 8866572e69 Version Packages (#2686)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-01-31 11:33:47 +01:00
a1accdbd95 ✨ suggest some .vscode workspace settings.json / extensions.json (#2664)
* ✨ suggest some workspace settigs / extensions.json

* 🚚 css-custom-properties -> css-variable-autocomplete

* Update .vscode/settings.json

Co-authored-by: Halvor Haugan <83693529+HalvorHaugan@users.noreply.github.com>

* 🔥 remove some extensions

* ✨ add some settings

* 🔥 remove wrongly added files to branch

* Update .vscode/settings.json

* Update .vscode/settings.json

* Update .vscode/settings.json

* 🎨 Fjernet noen uødvendige extensions

* 🎨 La til lokal TS-bruk

---------

Co-authored-by: Halvor Haugan <83693529+HalvorHaugan@users.noreply.github.com>
Co-authored-by: Ken <26967723+KenAJoh@users.noreply.github.com>
Co-authored-by: Ken <ken.aleksander@gmail.com>
2024-01-31 10:47:11 +01:00
Ken fdfdebfa99 🐛 Sentrering av checkmark i Checkbox (#2682)
* 🐛 Checkmark er nå alltid sentrert i checkbox

* 📝 Changeset

* Update @navikt/core/css/form/radio-checkbox.css
2024-01-31 10:47:02 +01:00
Halvor Haugan 56abe568e2 Textarea: debounce ResizeObserver for å unngå feilmelding (#2685) 2024-01-31 10:46:29 +01:00
Halvor Haugan 34acbb87a5 🐛 Textarea: Sett riktig høyde når brukt i Modal + StrictMode (#2679) 2024-01-31 10:35:43 +01:00
Ken fd479e3160 🐞 Datepicker Day Button (#2678)
* 🐛 Fikset Datepicker Day-button

* 📝 Changeset

* 🔥 Fjernet ubrukt referanse til DayButton i Datepicker
2024-01-31 10:30:37 +01:00
github-actions[bot]andgithub-actions[bot] 03ca21b4f6 Version Packages (#2683)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-01-30 22:09:38 +01:00
Vilde Roksand Fauchald e7804297bf Eksponer variabelen "role" i Search-komponenten (#2667)
* expose role variable so its possible to change it

* changeset
2024-01-30 22:07:49 +01:00
github-actions[bot]andgithub-actions[bot] a246c9d707 Version Packages (#2681)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-01-30 16:49:36 +01:00
d3fb3d4d96 🔴 Støtte for høykontrast i komponenter (#2680)
* 💄 Accordion tilpasset høykontrast

* 💄 Alert tilpasset høykontrast

* Legg til tokens for high contrast border og -border width. Tanken er å kunne gjenbruke på tvers av komponenter.

* 💄 Tooltip tilpasset høykontrast

* 💄 ToggleGroup tilpasset høykontrast

* 💄 bedre fargebruk på Accordion

* 🐛 Fjernet deprecated systemfarger

* 💄 alert-farger

* 💄 chat tilpasset høykontrast

* ♿ button css for high contrast

* ♿ Radio og checkbox høykontrast

* ♿ Chips høykontrast

* ♿ ConfirmationPanel høykontrast

* ♿ Tab høykontrast

* ♿ Tabs høykontrast

* ♿ Textfield høykontrast

* ♿ Textarea høykontrast

* ♿ Skeleton høykontrast

* ♿ Link høykontrast

* ♿ LinkPanel høykontrast

* ♿ ExpansionCard høykontrast

* ♿ high contrast CSS for select & datepicker / monthpicker

* ♿ Loader høykontrast

* ♿ dropdown høykontrast

* ♿ HelpText høykontrast

* ♿ Popover høykontrast

* ♿ Switch høykontrast

* ♿ high contrast CSS for ReadMore

* ♿ high contrast CSS for CopyButton

* ♿ high contrast CSS for InternalHeader

* ♿ Modal highcontrast

* ♿ Search høykontrast

* 💄 Timeline tilpasset høykontrast

* ♿ high contrast CSS for Stepper

* ♿ Combobox høykontrast

* Fix "diamond"-shape that should be an "arrow" in Timeline popover

* ♿ high contrast CSS for Switch (small tweaks)

* ♿ high contrast CSS for Switch (remove unused css)

* 🐛 Riktige fokusmarkeringer på radio/checkbox

* chips

* 🐛 Fikset ToggleGroup høykontrast

* 📝 Changeset2

* 🔥 Fjernet high-contrast token fra ds-tokens

* ♿ high contrast CSS for checkbox (tweaks)

* 🔥 Fjernet disabled-prop på radio-story

* Timeline focus in high contrast mode

* 🐛 Fikset fokusmarkering på radio/checkbox

* 🐛 Highlighting av outline var feil satt på ToggleGroup

* 📝 Highlight -> highlight

---------

Co-authored-by: Vegard Haugstvedt <it.vegard@gmail.com>
Co-authored-by: Julian Nymark <julian.nymark@nav.no>
Co-authored-by: Halvor Haugan <halvor.haugan@nav.no>
2024-01-30 16:47:26 +01:00
Julian Nymark d734d3071b 👷 update workflow for chromatic (stop old running action when new is created) 2024-01-30 16:22:04 +01:00
60 changed files with 986 additions and 87 deletions

No files matched your search

+4
View File
@@ -11,6 +11,10 @@ on:
paths:
- "@navikt/**"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
visual_regression_test:
if: ${{ !contains(github.event.pull_request.labels.*.name, 'ignore-chromatic') }}
+13
View File
@@ -0,0 +1,13 @@
{
"recommendations": [
"dbaeumer.vscode-eslint",
"denoland.vscode-deno",
"esbenp.prettier-vscode",
"github.vscode-github-actions",
"ms-playwright.playwright",
"sanity-io.vscode-sanity",
"stylelint.vscode-stylelint",
"vunguyentuan.vscode-css-variables",
"bradlc.vscode-tailwindcss"
]
}
+15
View File
@@ -0,0 +1,15 @@
{
"cssVariables.lookupFiles": ["@navikt/core/css/dist/index.css"],
"eslint.problems.shortenToSingleLine": true,
"deno.enablePaths": ["scripts/article-views", "scripts/changelog"],
"editor.defaultFormatter": "esbenp.prettier-vscode",
"deno.lint": true,
"files.watcherExclude": {
"**/.yarn/**": true,
"**/dist": true,
"**/esm": true,
"**/cjs": true
},
"playwright.reuseBrowser": true,
"typescript.tsdk": "node_modules/typescript/lib"
}
+6
View File
@@ -1,5 +1,11 @@
# @navikt/aksel-icons
## 5.17.2
## 5.17.1
## 5.17.0
## 5.16.0
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@navikt/aksel-icons",
"version": "5.16.0",
"version": "5.17.2",
"author": "Aksel | NAV",
"homepage": "https://aksel.nav.no/ikoner",
"repository": {
+6
View File
@@ -1,5 +1,11 @@
# @navikt/aksel-stylelint
## 5.17.2
## 5.17.1
## 5.17.0
## 5.16.0
## 5.15.1
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@navikt/aksel-stylelint",
"version": "5.16.0",
"version": "5.17.2",
"author": "Aksel | NAV",
"homepage": "https://aksel.nav.no/grunnleggende/kode/stylelint",
"repository": {
@@ -35,8 +35,8 @@
"dev": "yarn watch:lint"
},
"devDependencies": {
"@navikt/ds-css": "^5.16.0",
"@navikt/ds-tokens": "^5.16.0",
"@navikt/ds-css": "^5.17.2",
"@navikt/ds-tokens": "^5.17.2",
"@types/jest": "^29.0.0",
"concurrently": "7.2.1",
"copyfiles": "2.4.1",
+21
View File
@@ -1,5 +1,26 @@
# @navikt/aksel
## 5.17.2
### Patch Changes
- Updated dependencies [[`fdfdebfa9`](https://github.com/navikt/aksel/commit/fdfdebfa99e594099bcea7b5addde9cdabc727a7)]:
- @navikt/ds-css@5.17.2
## 5.17.1
### Patch Changes
- Updated dependencies []:
- @navikt/ds-css@5.17.1
## 5.17.0
### Patch Changes
- Updated dependencies [[`d3fb3d4d9`](https://github.com/navikt/aksel/commit/d3fb3d4d962fac028e7d803dc7c50315d48b4987)]:
- @navikt/ds-css@5.17.0
## 5.16.0
### Patch Changes
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@navikt/aksel",
"version": "5.16.0",
"version": "5.17.2",
"description": "Aksel command line interface. Handles css-imports, codemods and more",
"author": "Aksel | NAV designsystem team",
"license": "MIT",
@@ -29,7 +29,7 @@
},
"homepage": "https://aksel.nav.no/grunnleggende/kode/kommandolinje",
"dependencies": {
"@navikt/ds-css": "5.16.0",
"@navikt/ds-css": "5.17.2",
"axios": "1.6.0",
"chalk": "4.1.0",
"clipboardy": "^2.3.0",
+14
View File
@@ -1,5 +1,19 @@
# @navikt/ds-css
## 5.17.2
### Patch Changes
- Checkbox: I noen edgecaser ved bruk av shadow-dom ble ikke checkmark sentert i Checkbox ([#2682](https://github.com/navikt/aksel/pull/2682))
## 5.17.1
## 5.17.0
### Minor Changes
- Høykontrast: Komponenter støtter nå standard høykontrast-modus på Windows ([#2680](https://github.com/navikt/aksel/pull/2680))
## 5.16.0
### Minor Changes
+16 -1
View File
@@ -74,7 +74,8 @@
}
.navds-accordion__header:focus-visible {
outline: none;
outline: 2px solid transparent;
outline-offset: 3px;
box-shadow: var(--a-shadow-focus);
border-radius: var(--a-border-radius-large);
}
@@ -185,3 +186,17 @@
transform: translateY(0);
}
}
@media (forced-colors: active) {
.navds-accordion__header {
border: 1px solid buttonborder;
background-color: canvas;
color: canvastext;
}
.navds-accordion__header:hover {
background-color: canvas;
border: 1px solid highlight;
color: highlight;
}
}
+10 -2
View File
@@ -33,7 +33,7 @@
font-size: 1.5rem;
align-self: flex-start;
height: var(--a-font-line-height-xlarge);
background: radial-gradient(circle, var(--a-surface-default) 50%, 0, transparent);
background: radial-gradient(circle, var(--a-surface-default) 47%, 0, transparent);
}
.navds-alert--small > .navds-alert__icon {
@@ -64,7 +64,7 @@
}
.navds-alert--warning > .navds-alert__icon {
background: radial-gradient(circle at 50% 57%, var(--a-surface-default) 32%, 0, transparent);
background: radial-gradient(circle at 50% 57%, var(--a-surface-default) 30%, 0, transparent);
color: var(--ac-alert-icon-warning-color, var(--a-icon-warning));
}
@@ -99,3 +99,11 @@
flex-flow: row nowrap;
justify-content: flex-end;
}
@media (forced-colors: active) {
.navds-alert {
border: 1px solid canvastext;
background-color: canvas;
color: canvastext;
}
}
+53 -1
View File
@@ -81,7 +81,8 @@
}
.navds-button:focus-visible {
outline: none;
outline: 2px solid transparent;
outline-offset: 2px;
box-shadow: var(--a-shadow-focus);
}
@@ -129,6 +130,16 @@
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;
color: highlighttext;
}
.navds-button.navds-button--primary span {
forced-color-adjust: none;
}
}
.navds-button--primary:hover {
background-color: var(--ac-button-primary-hover-bg, var(--__ac-button-primary-hover-bg, var(--a-surface-action-hover)));
@@ -139,10 +150,17 @@
}
.navds-button--primary:focus-visible {
outline: 2px solid transparent;
outline-offset: 2px;
box-shadow:
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;
}
}
@supports not selector(:focus-visible) {
.navds-button--primary:focus {
@@ -478,6 +496,7 @@
opacity: 0.3;
}
/* Loader overrides */
.navds-button .navds-loader .navds-loader__foreground {
stroke: var(--ac-button-loader-stroke, currentColor);
}
@@ -486,3 +505,36 @@
.navds-button--danger .navds-loader .navds-loader__background {
stroke: var(--ac-button-primary-loader-stroke-bg, rgb(255 255 255 / 0.3));
}
@media (forced-colors: active) {
.navds-button:not(.navds-button--loading):where(:disabled, .navds-button--disabled) {
opacity: 1;
color: GrayText;
}
.navds-button {
border: 1px solid transparent;
color: ButtonText;
background-color: ButtonFace;
}
.navds-button:hover {
background-color: highlighttext;
border-color: highlight;
color: highlight;
box-shadow: none;
}
.navds-button:hover span {
forced-color-adjust: none;
}
.navds-button .navds-loader .navds-loader__foreground {
stroke: canvas;
}
.navds-button--primary .navds-loader .navds-loader__background,
.navds-button--danger .navds-loader .navds-loader__background {
stroke: canvastext;
}
}
+13
View File
@@ -105,3 +105,16 @@
.navds-chat--right .navds-chat__top-text--left {
align-self: flex-start;
}
@media (forced-colors: active) {
.navds-chat__bubble,
.navds-chat__avatar {
border: 1px solid canvastext;
background-color: canvas;
color: canvastext;
}
.navds-chat__avatar svg {
forced-color-adjust: none;
}
}
+41
View File
@@ -191,3 +191,44 @@
.navds-chips--small .navds-chips--icon-right {
padding-right: var(--a-spacing-05);
}
@media (forced-colors: active) {
.navds-chips__chip {
border: 1px solid transparent;
}
.navds-chips__chip:hover {
background-color: highlighttext;
color: highlight;
}
.navds-chips__chip:focus-visible {
outline: 2px solid transparent;
outline-offset: 2px;
}
.navds-chips__chip:where([aria-pressed="true"], :active, :hover) > span {
forced-color-adjust: none;
}
.navds-chips__toggle:active {
background-color: highlight;
color: highlighttext;
}
.navds-chips__toggle[aria-pressed="true"] {
background-color: selecteditem;
color: selecteditemtext;
border: 1px solid selecteditem;
}
.navds-chips__toggle[aria-pressed="true"]:hover {
background-color: selecteditemtext;
color: selecteditem;
}
.navds-chips__toggle[aria-pressed="true"]:active {
background-color: highlight;
color: highlighttext;
}
}
+22
View File
@@ -28,6 +28,21 @@
place-content: center;
}
@media (forced-colors: active) {
.navds-copybutton {
background-color: ButtonFace;
border-color: ButtonText;
border: solid 1px ButtonText;
color: ButtonText;
}
.navds-copybutton.navds-copybutton:focus-visible {
box-shadow: none;
outline: 2px solid highlight;
outline-offset: 2px;
}
}
.navds-copybutton--icon-right {
--__ac-copybutton-padding: var(--a-spacing-3) var(--a-spacing-4) var(--a-spacing-3) var(--a-spacing-5);
}
@@ -201,3 +216,10 @@
cursor: not-allowed;
opacity: 0.3;
}
@media (forced-colors: active) {
.navds-copybutton:where(:disabled) {
opacity: 1;
border-color: GrayText;
}
}
+15 -2
View File
@@ -58,13 +58,15 @@
}
.navds-dropdown__item:focus-visible {
outline: none;
outline: 2px solid transparent;
outline-offset: -2px;
box-shadow: inset 0 0 0 2px var(--a-border-focus);
}
@supports not selector(:focus-visible) {
.navds-dropdown__item:focus {
outline: none;
outline: 2px solid transparent;
outline-offset: -2px;
box-shadow: inset 0 0 0 2px var(--a-border-focus);
}
}
@@ -75,3 +77,14 @@
background: transparent;
cursor: not-allowed;
}
@media (forced-colors: active) {
.navds-dropdown__item:hover {
color: highlight;
}
.navds-dropdown__item:disabled {
opacity: 1;
color: graytext;
}
}
+10 -2
View File
@@ -145,13 +145,13 @@
}
.navds-expansioncard__header-button:focus-visible {
outline: none;
outline: 3px solid transparent;
box-shadow: var(--a-shadow-focus);
}
@supports not selector(:focus-visible) {
.navds-expansioncard__header-button:focus {
outline: none;
outline: 3px solid transparent;
box-shadow: var(--a-shadow-focus);
}
}
@@ -221,3 +221,11 @@
transform: translateY(0);
}
}
@media (forced-colors: active) {
.navds-expansioncard:hover {
--__ac-expansioncard-border-color: highlight;
outline: 1px solid highlight;
}
}
+57
View File
@@ -39,6 +39,8 @@
.navds-combobox--error
.navds-text-field__input:not(:hover):not(:disabled):not(.navds-combobox__wrapper-inner--virtually-unfocused):focus-within {
outline: 2px solid transparent;
outline-offset: 2px;
box-shadow:
0 0 0 1px var(--ac-combobox-error-border, var(--a-border-danger)),
var(--a-shadow-focus);
@@ -94,10 +96,13 @@
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;
}
.navds-combobox__wrapper-inner:has(.navds-combobox__input:focus-visible).navds-combobox__wrapper-inner--virtually-unfocused {
box-shadow: none;
outline: none;
}
@supports not selector(:focus-visible) {
@@ -112,10 +117,13 @@
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;
}
.navds-combobox__wrapper-inner:has(.navds-combobox__input:focus).navds-combobox__wrapper-inner--virtually-unfocused {
box-shadow: none;
outline: none;
}
}
@@ -125,10 +133,13 @@
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;
}
.navds-combobox--focused .navds-combobox__wrapper-inner.navds-combobox__wrapper-inner--virtually-unfocused {
box-shadow: none;
outline: none;
}
}
@@ -368,3 +379,49 @@
gap: var(--a-spacing-1);
}
}
@media (forced-colors: active) {
.navds-combobox__button-clear:hover {
color: highlight;
}
.navds-combobox__wrapper-inner:has(.navds-combobox__input:focus-visible) {
outline-color: highlight;
}
.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 {
border-left-color: highlight;
color: highlight;
}
.navds-combobox__list-item[data-no-focus="true"] {
opacity: 1;
color: graytext;
}
.navds-combobox__list-item--selected {
background-color: selecteditem;
color: selecteditemtext;
}
.navds-combobox__list-item--selected > * {
forced-color-adjust: none;
}
.navds-combobox__list-item--selected.navds-combobox__list-item--focus,
.navds-combobox__list--with-hover .navds-combobox__list-item--selected:hover {
border-left-color: highlight;
color: highlight;
}
.navds-combobox__list--with-hover .navds-combobox__list-item--new-option:hover {
color: highlight;
}
.navds-combobox__list-item--new-option--focus {
outline: 2px solid highlight;
outline-offset: -3px;
}
}
@@ -8,6 +8,7 @@
background-color: var(--ac-confirmation-panel-bg, var(--a-surface-warning-subtle));
transition: background-color linear 100ms;
justify-self: stretch;
position: relative;
}
.navds-confirmation-panel__content {
@@ -23,3 +24,26 @@
border-color: var(--ac-confirmation-panel-error-border, var(--a-border-danger));
background-color: var(--ac-confirmation-panel-error-bg, var(--a-surface-danger-subtle));
}
@media (forced-colors: active) {
.navds-confirmation-panel__inner::before {
content: "";
position: absolute;
left: 0;
top: 0;
height: 100%;
border-left: 8px solid;
border-color: orange;
forced-color-adjust: none;
border-start-start-radius: calc(var(--a-border-radius-medium) - 1px);
border-end-start-radius: calc(var(--a-border-radius-medium) - 1px);
}
.navds-confirmation-panel--checked .navds-confirmation-panel__inner::before {
border-color: green;
}
.navds-confirmation-panel--error .navds-confirmation-panel__inner::before {
border-color: red;
}
}
+7
View File
@@ -42,3 +42,10 @@
.navds-fieldset:disabled > .navds-fieldset__description {
opacity: 0.3;
}
@media (forced-colors: active) {
.navds-fieldset:disabled > .navds-fieldset__legend,
.navds-fieldset:disabled > .navds-fieldset__description {
opacity: 1;
}
}
+6
View File
@@ -51,3 +51,9 @@
flex-shrink: 0;
align-self: flex-start;
}
@media (forced-colors: active) {
.navds-form-field--disabled {
opacity: 1;
}
}
+86
View File
@@ -72,6 +72,8 @@
.navds-checkbox__input:focus-visible + .navds-checkbox__label::before,
.navds-radio__input:focus-visible + .navds-radio__label::before {
outline: 2px solid transparent;
outline-offset: 2px;
box-shadow:
0 0 0 2px var(--ac-radio-checkbox-border, var(--a-border-default)),
0 0 0 2px var(--ac-radio-checkbox-bg, var(--a-surface-default)),
@@ -81,6 +83,8 @@
@supports not selector(:focus-visible) {
.navds-checkbox__input:focus + .navds-checkbox__label::before,
.navds-radio__input:focus + .navds-radio__label::before {
outline: 2px solid transparent;
outline-offset: 2px;
box-shadow:
0 0 0 2px var(--ac-radio-checkbox-border, var(--a-border-default)),
0 0 0 4px var(--a-border-focus);
@@ -139,6 +143,10 @@
height: 1.5rem;
transform: translate(var(--a-spacing-1-alt));
pointer-events: none;
/* Fixed edcase where when using in shadow-dom, svg will not center */
display: flex;
align-items: center;
}
.navds-checkbox--small .navds-checkbox__input:checked + .navds-checkbox__label > .navds-checkbox__icon {
@@ -352,3 +360,81 @@
.navds-checkbox--readonly > .navds-checkbox__input:indeterminate + .navds-checkbox__label::after {
background-color: var(--a-icon-subtle);
}
@media (forced-colors: active) {
.navds-checkbox__input:focus-visible + .navds-checkbox__label::before,
.navds-radio__input:focus-visible + .navds-radio__label::before {
outline-color: highlight;
}
.navds-checkbox,
.navds-radio {
--__ac-radio-checkbox-high-contrast-bg: field;
--__ac-radio-checkbox-high-contrast-text: fieldtext;
--__ac-radio-checkbox-high-contrast-highlight: highlight;
}
.navds-checkbox__label::before,
.navds-radio__label::before {
border: 1px solid var(--__ac-radio-checkbox-high-contrast-text);
background-color: var(--__ac-radio-checkbox-high-contrast-bg);
}
.navds-checkbox__input:checked + .navds-checkbox__label > .navds-checkbox__icon {
color: var(--__ac-radio-checkbox-high-contrast-text);
}
.navds-checkbox__input:indeterminate + .navds-checkbox__label::after {
background-color: var(--__ac-radio-checkbox-high-contrast-text);
}
.navds-radio__input:checked + .navds-radio__label::before {
border: 1px solid var(--__ac-radio-checkbox-high-contrast-text);
outline: 3px solid var(--__ac-radio-checkbox-high-contrast-bg);
outline-offset: -4px;
background-color: var(--__ac-radio-checkbox-high-contrast-text);
}
.navds-radio__input:checked:focus-visible + .navds-radio__label::before {
border: 1px solid var(--__ac-radio-checkbox-high-contrast-bg);
outline: 2px solid highlight;
outline-offset: 2px;
}
:not(.navds-checkbox--readonly) > .navds-checkbox__input:hover:not(:disabled) + .navds-checkbox__label,
:not(.navds-radio--readonly) > .navds-radio__input:hover:not(:disabled) + .navds-radio__label {
color: highlight;
}
.navds-checkbox__input:focus-visible + .navds-checkbox__label::before {
outline: 2px solid var(--__ac-radio-checkbox-high-contrast-highlight);
}
.navds-checkbox--readonly > .navds-checkbox__input:checked + .navds-checkbox__label::before {
border: 1px solid var(--__ac-radio-checkbox-high-contrast-text);
background-color: var(--__ac-radio-checkbox-high-contrast-bg);
}
.navds-checkbox--readonly > .navds-checkbox__input:indeterminate + .navds-checkbox__label::after {
background-color: var(--__ac-radio-checkbox-high-contrast-text);
}
.navds-radio--readonly > .navds-radio__input:checked + .navds-radio__label::before {
border: 1px solid var(--__ac-radio-checkbox-high-contrast-text);
outline: 3px solid var(--__ac-radio-checkbox-high-contrast-bg);
outline-offset: -4px;
background-color: var(--__ac-radio-checkbox-high-contrast-text);
}
.navds-checkbox--disabled,
.navds-radio--disabled {
opacity: 1;
--__ac-radio-checkbox-high-contrast-bg: field;
--__ac-radio-checkbox-high-contrast-text: graytext;
}
:is(.navds-checkbox--disabled, .navds-radio--disabled) :is(.navds-checkbox__label, .navds-radio__label) {
color: graytext;
}
}
+12 -2
View File
@@ -99,14 +99,14 @@
}
.navds-search__button-clear:focus-visible {
outline: 2px solid transparent;
box-shadow: var(--a-shadow-focus);
outline: none;
}
@supports not selector(:focus-visible) {
.navds-search__button-clear:focus {
outline: 2px solid transparent;
box-shadow: var(--a-shadow-focus);
outline: none;
}
}
@@ -216,3 +216,13 @@
z-index: 1;
}
}
@media (forced-colors: active) {
.navds-modal {
outline: 2px solid transparent;
}
.navds-search__button-clear:hover {
color: highlight;
}
}
+21
View File
@@ -13,6 +13,21 @@
padding-right: 2rem;
}
@media (forced-colors: active) {
.navds-select__input.navds-select__input.navds-select__input {
background-color: ButtonFace;
border-color: ButtonText;
color: ButtonText;
forced-color-adjust: none;
box-shadow: none;
}
.navds-select__input.navds-select__input.navds-select__input:focus-visible {
outline: 2px solid highlight;
outline-offset: 2px;
}
}
.navds-select__input:hover {
border-color: var(--ac-select-hover-bg, var(--a-border-action));
cursor: pointer;
@@ -46,6 +61,12 @@
color: var(--ac-select-text, var(--a-text-default));
}
@media (forced-colors: active) {
.navds-select__chevron {
color: ButtonText;
}
}
.navds-form-field--small .navds-select__input {
min-height: 2rem;
padding: 0 var(--a-spacing-8) 0 var(--a-spacing-2);
+49
View File
@@ -111,6 +111,8 @@
}
.navds-switch__input:focus-visible ~ .navds-switch__track {
outline: 2px solid transparent;
outline-offset: 2px;
box-shadow:
0 0 0 1px var(--a-surface-default),
var(--a-shadow-focus);
@@ -118,6 +120,7 @@
@supports not selector(:focus-visible) {
.navds-switch__input:focus ~ .navds-switch__track {
outline: 2px solid transparent;
box-shadow:
0 0 0 1px var(--a-surface-default),
var(--a-shadow-focus);
@@ -218,3 +221,49 @@
transform: translateX(1.25rem);
}
}
@media (forced-colors: active) {
.navds-switch__input:hover ~ .navds-switch__label-wrapper,
.navds-switch__label-wrapper:hover {
color: highlight;
}
.navds-switch__thumb,
.navds-switch--readonly .navds-switch__thumb {
background-color: fieldtext;
}
.navds-switch__input:checked ~ .navds-switch__track > .navds-switch__thumb,
.navds-switch--readonly .navds-switch__input:checked ~ .navds-switch__track > .navds-switch__thumb {
color: field;
}
.navds-switch__track {
width: calc(2.75rem + 4px);
height: calc(1.5rem + 4px);
top: var(--a-spacing-3);
border: 2px solid fieldtext;
}
.navds-switch__input:focus-visible ~ .navds-switch__track {
outline: 2px solid highlight;
outline-offset: 2px;
}
.navds-switch--disabled:not(.navds-switch--loading) {
opacity: 1;
}
.navds-switch--disabled:not(.navds-switch--loading) .navds-switch__thumb {
background-color: graytext;
}
.navds-switch--disabled:not(.navds-switch--loading) .navds-switch__track {
border-color: graytext;
}
.navds-switch--disabled:not(.navds-switch--loading) .navds-switch__label-wrapper,
.navds-switch--disabled:not(.navds-switch--loading) .navds-switch__label-wrapper:hover {
color: graytext !important;
}
}
+9 -1
View File
@@ -45,7 +45,8 @@
}
.navds-text-field__input:focus-visible {
outline: none;
outline: 2px solid transparent;
outline-offset: 2px;
box-shadow: var(--a-shadow-focus);
}
@@ -101,3 +102,10 @@
.navds-text-field__input[type="search"]::-webkit-search-results-decoration {
-webkit-appearance: none;
}
@media (forced-colors: active) {
.navds-text-field__input {
background-color: field;
color: fieldtext;
}
}
+11 -2
View File
@@ -52,13 +52,15 @@
}
.navds-textarea__input:focus-visible {
outline: none;
outline: 2px solid transparent;
outline-offset: 2px;
box-shadow: var(--a-shadow-focus);
}
@supports not selector(:focus-visible) {
.navds-textarea__input:focus {
outline: none;
outline: 2px solid transparent;
outline-offset: 2px;
box-shadow: var(--a-shadow-focus);
}
}
@@ -141,3 +143,10 @@
border-color: var(--a-border-subtle);
cursor: default;
}
@media (forced-colors: active) {
.navds-textarea__input {
background-color: field;
color: fieldtext;
}
}
+16 -2
View File
@@ -13,7 +13,7 @@
}
.navds-help-text__button:focus-visible {
outline: none;
outline: 2px solid transparent;
box-shadow:
0 0 0 1px var(--a-border-focus),
inset 0 0 0 1px var(--a-border-focus);
@@ -21,7 +21,7 @@
@supports not selector(:focus-visible) {
.navds-help-text__button:focus {
outline: none;
outline: 2px solid transparent;
box-shadow:
0 0 0 1px var(--a-border-focus),
inset 0 0 0 1px var(--a-border-focus);
@@ -64,3 +64,17 @@
display: inherit;
}
}
@media (forced-colors: active) {
.navds-help-text__button:where(:hover, :focus-visible, [aria-expanded="true"]) > .navds-help-text__icon {
display: inherit;
}
.navds-help-text__button:hover > .navds-help-text__icon {
color: highlight;
}
.navds-help-text__button:where(:hover, :focus-visible, [aria-expanded="true"]) > .navds-help-text__icon--filled {
display: none;
}
}
+21
View File
@@ -7,6 +7,27 @@
--navds-internalheader-focus: inset 0 0 0 2px var(--a-border-focus-on-inverted);
}
@media (forced-colors: active) {
.navds-internalheader {
background-color: ButtonFace;
border-color: ButtonText;
border: solid 1px ButtonText;
color: ButtonText;
}
.navds-internalheader a:focus-visible {
box-shadow: none;
outline: 2px solid highlight;
outline-offset: 2px;
}
.navds-internalheader .navds-internalheader__button:focus-visible {
box-shadow: none;
outline: 2px solid highlight;
outline-offset: 2px;
}
}
.navds-internalheader__title {
border: none;
overflow: visible;
+4 -2
View File
@@ -18,14 +18,16 @@
}
.navds-link-panel:focus-visible {
outline: 3px solid transparent;
outline-offset: 2px;
box-shadow: var(--a-shadow-focus);
outline: none;
}
@supports not selector(:focus-visible) {
.navds-link-panel:focus {
outline: 3px solid transparent;
outline-offset: 2px;
box-shadow: var(--a-shadow-focus);
outline: none;
}
}
+3 -3
View File
@@ -36,7 +36,7 @@
}
.navds-link:focus-visible {
outline: none;
outline: 2px solid transparent;
color: var(--ac-link-focus-text, var(--a-text-on-action));
text-decoration: none;
background-color: var(--ac-link-focus-bg, var(--a-border-focus));
@@ -45,7 +45,7 @@
@supports not selector(:focus-visible) {
.navds-link:focus {
outline: none;
outline: 2px solid transparent;
color: var(--ac-link-focus-text, var(--a-text-on-action));
text-decoration: none;
background-color: var(--ac-link-focus-bg, var(--a-border-focus));
@@ -54,7 +54,7 @@
}
.navds-link:active {
outline: none;
outline: 2px solid transparent;
color: var(--ac-link-active-text, var(--a-text-on-action));
text-decoration: none;
background-color: var(--ac-link-active-bg, var(--a-border-focus));
+6
View File
@@ -111,3 +111,9 @@
stroke-dashoffset: -120px;
}
}
@media (forced-colors: active) {
.navds-loader__background {
stroke: canvastext;
}
}
+6
View File
@@ -168,3 +168,9 @@
opacity: 1;
}
}
@media (forced-colors: active) {
.navds-modal {
outline: 2px solid transparent;
}
}
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@navikt/ds-css",
"version": "5.16.0",
"version": "5.17.2",
"description": "CSS for NAV Designsystem",
"author": "Aksel | NAV designsystem team",
"keywords": [
@@ -27,7 +27,7 @@
"css:get-version": "node config/get-version.js"
},
"devDependencies": {
"@navikt/ds-tokens": "^5.16.0",
"@navikt/ds-tokens": "^5.17.2",
"cssnano": "6.0.0",
"fast-glob": "3.2.11",
"lodash": "4.17.21",
+23
View File
@@ -59,3 +59,26 @@
border-right-color: transparent;
border-top-color: transparent;
}
@media (forced-colors: active) {
.navds-popover[data-placement^="top"] > .navds-popover__arrow {
border-left-color: canvas;
border-top-color: canvas;
}
/* prettier-ignore */
.navds-popover[data-placement^="bottom"] > .navds-popover__arrow {
border-bottom-color: canvas;
border-right-color: canvas;
}
.navds-popover[data-placement^="left"] > .navds-popover__arrow {
border-left-color: canvas;
border-bottom-color: canvas;
}
.navds-popover[data-placement^="right"] > .navds-popover__arrow {
border-right-color: canvas;
border-top-color: canvas;
}
}
+15
View File
@@ -16,6 +16,21 @@
padding: var(--a-spacing-05) var(--a-spacing-1) var(--a-spacing-05) var(--a-spacing-05);
}
@media (forced-colors: active) {
.navds-read-more__button {
background-color: ButtonFace;
border-color: ButtonText;
border: solid 1px ButtonText;
color: ButtonText;
}
.navds-read-more__button.navds-read-more__button:focus-visible {
box-shadow: none;
outline: 2px solid highlight;
outline-offset: 2px;
}
}
.navds-read-more__button:hover {
background-color: var(--ac-read-more-hover-bg, var(--a-surface-hover));
}
+8
View File
@@ -57,3 +57,11 @@
opacity: 0.4;
}
}
@media (forced-colors: active) {
.navds-skeleton {
forced-color-adjust: none;
background-color: var(--a-surface-neutral);
animation-duration: 2s;
}
}
+35
View File
@@ -70,6 +70,41 @@
margin: calc(var(--navds-stepper-border-width) * -1) calc(var(--navds-stepper-border-width) * -1) 1.75rem;
}
@media (forced-colors: active) {
.navds-stepper__step {
background-color: ButtonFace;
color: ButtonText;
}
.navds-stepper__circle.navds-stepper__circle {
border: 0;
}
.navds-stepper__step .navds-stepper__circle {
forced-color-adjust: none;
background-color: ButtonText;
border-color: ButtonText;
color: ButtonFace;
}
.navds-stepper__step.navds-stepper__step:focus-visible {
box-shadow: none;
outline: 2px solid highlight;
outline-offset: 2px;
}
.navds-stepper__step.navds-stepper__step--active .navds-stepper__circle {
forced-color-adjust: none;
background-color: highlight;
border-color: highlighttext;
color: highlighttext;
}
.navds-stepper__line {
background-color: ButtonText;
}
}
button.navds-stepper__step {
appearance: none;
border: none;
+26
View File
@@ -264,3 +264,29 @@
.navds-table--small .navds-table__expanded-row-content {
padding: var(--a-spacing-2) calc(var(--a-spacing-2) + 3rem);
}
@media (forced-colors: active) {
.navds-date.navds-date button.rdp-day_selected {
forced-color-adjust: none;
background-color: highlight;
color: highlighttext;
box-shadow: none;
}
.navds-date.navds-date button {
color: buttontext;
forced-color-adjust: none;
outline: none;
box-shadow: none;
}
.navds-date button:focus-visible {
color: buttontext;
forced-color-adjust: none;
outline: 2px solid highlight;
}
.navds-date.navds-date button.rdp-day_disabled {
color: GrayText;
}
}
+21 -4
View File
@@ -63,14 +63,15 @@
}
.navds-tabs__tab:focus-visible {
outline: none;
outline: 2px solid transparent;
outline-offset: -2px;
box-shadow: inset var(--a-shadow-focus);
color: var(--ac-tabs-focus-text, var(--a-text-default));
}
@supports not selector(:focus-visible) {
.navds-tabs__tab:focus {
outline: none;
outline: 2px solid transparent;
box-shadow: inset var(--a-shadow-focus);
color: var(--ac-tabs-focus-text, var(--a-text-default));
}
@@ -117,13 +118,29 @@
}
.navds-tabs__tabpanel:focus-visible {
outline: none;
outline: 2px solid transparent;
box-shadow: inset 0 0 0 2px var(--a-border-focus);
}
@supports not selector(:focus-visible) {
.navds-tabs__tabpanel:focus {
outline: none;
outline: 2px solid transparent;
box-shadow: inset 0 0 0 2px var(--a-border-focus);
}
}
@media (forced-colors: active) {
.navds-tabs__tab[aria-selected="true"] {
border-bottom: 3px solid canvastext;
padding-block-end: calc(var(--a-spacing-3) - 3px);
}
.navds-tabs__tab--small[aria-selected="true"] {
padding-block-end: calc(var(--a-spacing-1-alt) - 3px);
}
.navds-tabs__tab-icon--top[aria-selected="true"],
.navds-tabs__tab--small.navds-tabs__tab-icon--top[aria-selected="true"] {
padding-block-end: calc(var(--a-spacing-1) - 3px);
}
}
+12
View File
@@ -180,3 +180,15 @@
background-color: var(--ac-tag-alt-3-moderate-bg, var(--a-surface-alt-3-moderate));
color: var(--ac-tag-alt-3-moderate-text, var(--a-text-default));
}
@media (forced-colors: active) {
.navds-tag {
forced-color-adjust: none;
}
.navds-tag--neutral,
.navds-tag--neutral-moderate {
border-color: canvastext;
color: canvastext;
}
}
+54
View File
@@ -393,3 +393,57 @@
border-right-color: transparent;
border-top-color: transparent;
}
@media (forced-colors: active) {
.navds-timeline__period:focus {
outline: 2px solid highlight;
outline-offset: 2px;
}
.navds-timeline__period--success,
.navds-timeline__period--warning,
.navds-timeline__period--info,
.navds-timeline__period--neutral,
.navds-timeline__period--danger {
forced-color-adjust: none;
}
.navds-timeline__row {
border: 1px solid transparent;
}
.navds-timeline__pin-wrapper::before {
border: 1px solid transparent;
}
.navds-timeline__pin-button {
outline: 4px solid transparent;
}
.navds-timeline__pin-button:focus,
.navds-timeline__pin-button:focus-visible {
outline: 4px solid highlight;
outline-offset: 2px;
box-shadow: none;
}
.navds-timeline__popover[data-placement^="top"] > .navds-timeline__popover-arrow {
border-left-color: canvas;
border-top-color: canvas;
}
.navds-timeline__popover[data-placement^="bottom"] > .navds-timeline__popover-arrow {
border-bottom-color: canvas;
border-right-color: canvas;
}
.navds-timeline__popover[data-placement^="left"] > .navds-timeline__popover-arrow {
border-left-color: canvas;
border-bottom-color: canvas;
}
.navds-timeline__popover[data-placement^="right"] > .navds-timeline__popover-arrow {
border-right-color: canvas;
border-top-color: canvas;
}
}
+33 -2
View File
@@ -65,7 +65,8 @@
}
.navds-toggle-group__button:focus-visible {
outline: none;
outline: 2px solid transparent;
outline-offset: 1px;
box-shadow:
0 0 0 1px var(--a-surface-default),
0 0 0 4px var(--a-border-focus);
@@ -73,7 +74,8 @@
@supports not selector(:focus-visible) {
.navds-toggle-group__button:focus {
outline: none;
outline: 2px solid transparent;
outline-offset: 1px;
box-shadow:
0 0 0 1px var(--a-surface-default),
0 0 0 4px var(--a-border-focus);
@@ -144,3 +146,32 @@
.navds-toggle-group--small > .navds-toggle-group__button > .navds-toggle-group__button-inner > svg {
font-size: 1.125rem;
}
@media (forced-colors: active) {
.navds-toggle-group {
border: 2px solid transparent;
}
.navds-toggle-group__button:hover {
color: highlight;
}
.navds-toggle-group__button[aria-checked="true"],
.navds-toggle-group__button[aria-pressed="true"] {
background-color: selecteditem;
color: selecteditemtext;
}
.navds-toggle-group__button[aria-checked="true"] > *,
.navds-toggle-group__button[aria-pressed="true"] > * {
forced-color-adjust: none;
}
.navds-toggle-group__button:active {
background-color: none !important;
}
.navds-toggle-group__button:focus-visible {
outline-color: highlight;
}
}
+28
View File
@@ -51,3 +51,31 @@
align-items: center;
justify-content: center;
}
@media (forced-colors: active) {
.navds-tooltip {
--__a-tooltip-high-contrast-border: 1px solid transparent;
border: var(--__a-tooltip-high-contrast-border);
}
.navds-tooltip[data-side="top"] .navds-tooltip__arrow {
border-bottom: var(--__a-tooltip-high-contrast-border);
border-right: var(--__a-tooltip-high-contrast-border);
}
.navds-tooltip[data-side="right"] .navds-tooltip__arrow {
border-bottom: var(--__a-tooltip-high-contrast-border);
border-left: var(--__a-tooltip-high-contrast-border);
}
.navds-tooltip[data-side="bottom"] .navds-tooltip__arrow {
border-left: var(--__a-tooltip-high-contrast-border);
border-top: var(--__a-tooltip-high-contrast-border);
}
.navds-tooltip[data-side="left"] .navds-tooltip__arrow {
border-top: var(--__a-tooltip-high-contrast-border);
border-right: var(--__a-tooltip-high-contrast-border);
}
}
+36
View File
@@ -1,5 +1,41 @@
# @navikt/ds-react
## 5.17.2
### Patch Changes
- :bug: Textarea: Sett riktig høyde når brukt i Modal + StrictMode ([#2679](https://github.com/navikt/aksel/pull/2679))
- DatePicker: Knapper fikk ikke riktig aria-label ([#2678](https://github.com/navikt/aksel/pull/2678))
- Textarea: debounce ResizeObserver for å unngå feilmelding ([#2685](https://github.com/navikt/aksel/pull/2685))
- Updated dependencies []:
- @navikt/ds-tokens@5.17.2
- @navikt/aksel-icons@5.17.2
## 5.17.1
### Patch Changes
- Eksponer variabelen "role" i Search-komponenten ([#2667](https://github.com/navikt/aksel/pull/2667))
- Updated dependencies []:
- @navikt/ds-tokens@5.17.1
- @navikt/aksel-icons@5.17.1
## 5.17.0
### Minor Changes
- Høykontrast: Komponenter støtter nå standard høykontrast-modus på Windows ([#2680](https://github.com/navikt/aksel/pull/2680))
### Patch Changes
- Updated dependencies []:
- @navikt/ds-tokens@5.17.0
- @navikt/aksel-icons@5.17.0
## 5.16.0
### Minor Changes
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@navikt/ds-react",
"version": "5.16.0",
"version": "5.17.2",
"description": "Aksel react-components for NAV designsystem",
"author": "Aksel | NAV designsystem team",
"license": "MIT",
@@ -38,8 +38,8 @@
},
"dependencies": {
"@floating-ui/react": "0.25.4",
"@navikt/aksel-icons": "^5.16.0",
"@navikt/ds-tokens": "^5.16.0",
"@navikt/aksel-icons": "^5.17.2",
"@navikt/ds-tokens": "^5.17.2",
"@radix-ui/react-tabs": "1.0.0",
"@radix-ui/react-toggle-group": "1.0.0",
"clsx": "^1.2.1",
@@ -11,7 +11,6 @@ import { DateWrapper } from "../parts/DateWrapper";
import { getLocaleFromString, labels } from "../utils";
import DatePickerStandalone from "./DatePickerStandalone";
import Caption from "./parts/Caption";
import DayButton from "./parts/DayButton";
import DropdownCaption from "./parts/DropdownCaption";
import { HeadRow } from "./parts/HeadRow";
import Row from "./parts/Row";
@@ -124,7 +123,6 @@ export const DatePicker = forwardRef<HTMLDivElement, DatePickerProps>(
HeadRow,
WeekNumber,
Row,
Day: DayButton,
}}
className={cl("navds-date", className)}
classNames={{
@@ -5,7 +5,6 @@ import { DateRange, DayPicker, isMatch } from "react-day-picker";
import { omit } from "../../util";
import { getLocaleFromString, labels } from "../utils";
import Caption from "./parts/Caption";
import DayButton from "./parts/DayButton";
import DropdownCaption from "./parts/DropdownCaption";
import { HeadRow } from "./parts/HeadRow";
import Row from "./parts/Row";
@@ -94,7 +93,6 @@ export const DatePickerStandalone: DatePickerStandaloneType = forwardRef<
HeadRow,
WeekNumber,
Row,
Day: DayButton,
}}
className="navds-date"
classNames={{ vhidden: "navds-sr-only" }}
@@ -27,13 +27,13 @@ export const Default: StoryObj<DefaultStoryProps> = {
const [open, setOpen] = useState(false);
const rangeCtx = useRangeDatepicker({
fromDate: new Date("Aug 23 2020"),
toDate: new Date("Aug 23 2023"),
fromDate: new Date("Aug 23 2023"),
toDate: new Date("Aug 23 2029"),
});
const singleCtx = useDatepicker({
fromDate: new Date("Aug 23 2020"),
toDate: new Date("Aug 23 2023"),
toDate: new Date("Aug 23 2029"),
});
const newProps = {
@@ -42,7 +42,7 @@ export const Default: StoryObj<DefaultStoryProps> = {
open,
onClose: () => setOpen(false),
fromDate: new Date("Aug 23 2020"),
toDate: new Date("Aug 23 2023"),
toDate: new Date("Aug 23 2029"),
}
: {}),
};
@@ -1,7 +1,8 @@
import { getUnixTime } from "date-fns";
import React from "react";
import { Day, useDayPicker } from "react-day-picker";
import { useDayPicker } from "react-day-picker";
import { Hide } from "../../../layout/responsive";
import DayButton from "./DayButton";
import WeekNumber from "./WeekNumber";
/**
@@ -37,7 +38,7 @@ function Row(props: RowProps): JSX.Element {
style={styles.cell}
key={getUnixTime(date)}
>
<Day displayMonth={props.displayMonth} date={date} />
<DayButton displayMonth={props.displayMonth} date={date} />
</td>
))}
</tr>
@@ -66,6 +66,10 @@ export interface SearchProps
* Exposes the HTML size attribute
*/
htmlSize?: number | string;
/*
* Exposes role attribute
*/
role?: string
}
interface SearchComponent
@@ -114,6 +118,7 @@ export const Search = forwardRef<HTMLInputElement, SearchProps>(
onChange,
onSearchClick,
htmlSize,
role,
...rest
} = props;
@@ -205,7 +210,7 @@ export const Search = forwardRef<HTMLInputElement, SearchProps>(
value={value ?? internalValue}
onChange={(e) => handleChange(e.target.value)}
type="search"
role="searchbox"
role={role ?? 'searchbox'}
className={cl(
className,
"navds-search__input",
@@ -1,6 +1,7 @@
import { Meta, StoryFn, StoryObj } from "@storybook/react";
import React, { useState } from "react";
import { Button } from "../../button";
import { Modal } from "../../modal";
import { Textarea } from "../index";
const meta: Meta<typeof Textarea> = {
@@ -186,3 +187,20 @@ AutoScrollbar.argTypes = {
maxRows: { type: "number" },
minRows: { type: "number" },
};
export const ModalStrictMode: StoryFn<typeof Textarea> = () => {
// Story added after fixing an issue where TextareaAutoSize would reach max re-renders
// and set the height to 2px when used in StrictMode in a Modal that is initially open.
return (
<React.StrictMode>
<Modal open>
<Modal.Body>
<Textarea label="Har du noen tilbakemeldinger?" />
</Modal.Body>
</Modal>
</React.StrictMode>
);
};
ModalStrictMode.parameters = {
chromatic: { disable: true }, // Not reproducable in Chromatic
};
@@ -10,7 +10,7 @@ type State = {
overflow?: boolean | undefined;
};
const updateState = (
const checkState = (
prevState: State,
newState: State,
renders: React.MutableRefObject<number>,
@@ -25,20 +25,12 @@ const updateState = (
prevState.overflow !== overflow)
) {
renders.current += 1;
return {
overflow,
outerHeightStyle,
};
return newState;
}
if (process.env.NODE_ENV !== "production") {
if (renders.current === 20) {
console.error(
[
"Textarea: Too many re-renders. The layout is unstable.",
"TextareaAutosize limits the number of renders to prevent an infinite loop.",
].join("\n"),
);
}
if (process.env.NODE_ENV !== "production" && renders.current === 20) {
console.error(
"Textarea: Too many re-renders. The layout is unstable. TextareaAutosize limits the number of renders to prevent an infinite loop.",
);
}
return prevState;
};
@@ -92,9 +84,7 @@ const TextareaAutosize = forwardRef<HTMLTextAreaElement, TextareaAutosizeProps>(
) => {
const { current: isControlled } = useRef(value != null);
const inputRef = useRef<HTMLTextAreaElement>(null);
const handleRef = useMergeRefs(inputRef, ref);
const shadowRef = useRef<HTMLTextAreaElement>(null);
const renders = useRef(0);
const [state, setState] = useState<State>({ outerHeightStyle: 0 });
@@ -153,35 +143,31 @@ const TextareaAutosize = forwardRef<HTMLTextAreaElement, TextareaAutosizeProps>(
return { outerHeightStyle, overflow };
}, [maxRows, minRows, other.placeholder]);
const syncHeight = React.useCallback(() => {
const syncHeight = () => {
const newState = getUpdatedState();
if (isEmpty(newState)) {
return;
}
setState((prevState) => updateState(prevState, newState, renders));
}, [getUpdatedState]);
setState((prevState) => checkState(prevState, newState, renders));
};
useClientLayoutEffect(() => {
const syncHeightWithFlushSync = () => {
const newState = getUpdatedState();
if (isEmpty(newState)) {
return;
}
// In React 18, state updates in a ResizeObserver's callback are happening after
// the paint, this leads to an infinite rendering.
//
// Using flushSync ensures that the states is updated before the next pain.
// Using flushSync ensures that the state is updated before the next paint.
// Related issue - https://github.com/facebook/react/issues/24331
ReactDOM.flushSync(() => {
setState((prevState) => updateState(prevState, newState, renders));
setState((prevState) => checkState(prevState, newState, renders));
});
};
const handleResize = () => {
const handleResize = debounce(() => {
renders.current = 0;
if (inputRef.current?.style.height || inputRef.current?.style.width) {
@@ -193,13 +179,12 @@ const TextareaAutosize = forwardRef<HTMLTextAreaElement, TextareaAutosizeProps>(
}
syncHeightWithFlushSync();
};
});
const debounceHandleResize = debounce(handleResize);
const input = inputRef.current!;
const containerWindow = ownerWindow(input);
containerWindow.addEventListener("resize", debounceHandleResize);
containerWindow.addEventListener("resize", handleResize);
let resizeObserver: ResizeObserver;
if (typeof ResizeObserver !== "undefined") {
@@ -208,8 +193,8 @@ const TextareaAutosize = forwardRef<HTMLTextAreaElement, TextareaAutosizeProps>(
}
return () => {
debounceHandleResize.clear();
containerWindow.removeEventListener("resize", debounceHandleResize);
handleResize.clear();
containerWindow.removeEventListener("resize", handleResize);
if (resizeObserver) {
resizeObserver.disconnect();
}
+6
View File
@@ -1,5 +1,11 @@
# @navikt/ds-tailwind
## 5.17.2
## 5.17.1
## 5.17.0
## 5.16.0
### Minor Changes
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@navikt/ds-tailwind",
"version": "5.16.0",
"version": "5.17.2",
"description": "Tailwind config based on @navikt/ds-tokens",
"author": "Aksel | NAV designsystem team",
"keywords": [
@@ -24,7 +24,7 @@
"directory": "@navikt/core/tailwind"
},
"devDependencies": {
"@navikt/ds-tokens": "^5.16.0",
"@navikt/ds-tokens": "^5.17.2",
"@types/jest": "^29.0.0",
"color": "4.2.3",
"jest": "^29.0.0",
+6
View File
@@ -1,5 +1,11 @@
# @navikt/ds-tokens
## 5.17.2
## 5.17.1
## 5.17.0
## 5.16.0
## 5.15.1
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@navikt/ds-tokens",
"version": "5.16.0",
"version": "5.17.2",
"description": "Design-tokens for NAV designsystem",
"author": "Aksel | NAV designsystem team",
"keywords": [
+20
View File
@@ -1,5 +1,25 @@
# Changelog
## 5.17
### @navikt/ds-css
- Checkbox: I noen edgecaser ved bruk av shadow-dom ble ikke checkmark sentert i Checkbox ([#2682](https://github.com/navikt/aksel/pull/2682))
* Høykontrast: Komponenter støtter nå standard høykontrast-modus på Windows ([#2680](https://github.com/navikt/aksel/pull/2680))
### @navikt/ds-react
- :bug: Textarea: Sett riktig høyde når brukt i Modal + StrictMode ([#2679](https://github.com/navikt/aksel/pull/2679))
- DatePicker: Knapper fikk ikke riktig aria-label ([#2678](https://github.com/navikt/aksel/pull/2678))
- Textarea: debounce ResizeObserver for å unngå feilmelding ([#2685](https://github.com/navikt/aksel/pull/2685))
* Eksponer variabelen "role" i Search-komponenten ([#2667](https://github.com/navikt/aksel/pull/2667))
- Høykontrast: Komponenter støtter nå standard høykontrast-modus på Windows ([#2680](https://github.com/navikt/aksel/pull/2680))
## 5.16
### @navikt/aksel-icons
+5 -5
View File
@@ -16,10 +16,10 @@
"playroom"
],
"dependencies": {
"@navikt/aksel-icons": "^5.16.0",
"@navikt/ds-css": "^5.16.0",
"@navikt/ds-react": "^5.16.0",
"@navikt/ds-tailwind": "^5.16.0",
"@navikt/ds-tokens": "^5.16.0"
"@navikt/aksel-icons": "^5.17.2",
"@navikt/ds-css": "^5.17.2",
"@navikt/ds-react": "^5.17.2",
"@navikt/ds-tailwind": "^5.17.2",
"@navikt/ds-tokens": "^5.17.2"
}
}