Skip to content

Commit

Permalink
Merge branch 'main' into form-border-bleed
Browse files Browse the repository at this point in the history
  • Loading branch information
KenAJoh authored Oct 20, 2023
2 parents 6a8c3d9 + a1678d3 commit 5c66344
Show file tree
Hide file tree
Showing 96 changed files with 1,075 additions and 1,088 deletions.
5 changes: 5 additions & 0 deletions .changeset/heavy-shoes-pay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@navikt/ds-react": patch
---

Loader: Har nå riktig `ref`-type.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ module.exports = {
files: ["**/*.ts?(x)"],
extends: ["plugin:@typescript-eslint/recommended"],
rules: {
"@typescript-eslint/no-shadow": ["error", { hoist: "all" }], // TODO: Consider { builtinGlobals: true }
"@typescript-eslint/no-explicit-any": "off", // Temporary
},
},
Expand Down
4 changes: 4 additions & 0 deletions @navikt/aksel-icons/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# @navikt/aksel-icons

## 5.7.4

## 5.7.3

## 5.7.2

## 5.7.1
Expand Down
2 changes: 1 addition & 1 deletion @navikt/aksel-icons/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@navikt/aksel-icons",
"version": "5.7.2",
"version": "5.7.4",
"author": "Aksel | NAV",
"homepage": "https://aksel.nav.no/ikoner",
"repository": {
Expand Down
4 changes: 4 additions & 0 deletions @navikt/aksel-stylelint/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# @navikt/aksel-stylelint

## 5.7.4

## 5.7.3

## 5.7.2

## 5.7.1
Expand Down
6 changes: 3 additions & 3 deletions @navikt/aksel-stylelint/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@navikt/aksel-stylelint",
"version": "5.7.2",
"version": "5.7.4",
"author": "Aksel | NAV",
"homepage": "https://aksel.nav.no/grunnleggende/kode/stylelint",
"repository": {
Expand Down Expand Up @@ -35,8 +35,8 @@
"dev": "yarn watch:lint"
},
"devDependencies": {
"@navikt/ds-css": "^5.7.2",
"@navikt/ds-tokens": "^5.7.2",
"@navikt/ds-css": "^5.7.4",
"@navikt/ds-tokens": "^5.7.4",
"@types/jest": "^29.0.0",
"concurrently": "7.2.1",
"copyfiles": "2.4.1",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import stylelint from "stylelint";
import valueParser from "postcss-value-parser";
import { readFileSync } from "node:fs";
import { Node as PostCSSNode } from "postcss";
import valueParser from "postcss-value-parser";
import stylelint from "stylelint";

import { isCustomProperty, tokenExists } from "../../utils";

Expand Down Expand Up @@ -34,7 +34,6 @@ export const messages = stylelint.utils.ruleMessages(ruleName, {
});

const checkDeclValue = (
controlledPrefixes: string[],
value: string,
postcssResult: stylelint.PostcssResult,
rootNode: PostCSSNode
Expand All @@ -58,7 +57,6 @@ const checkDeclValue = (
};

const checkDeclProp = (
controlledPrefixes: string[],
prop: string,
postcssResult: stylelint.PostcssResult,
rootNode: PostCSSNode
Expand All @@ -81,8 +79,8 @@ const checkDeclProp = (
const ruleFunction: stylelint.Rule = () => {
return (postcssRoot, postcssResult) => {
postcssRoot.walkDecls((node) => {
checkDeclValue(controlledPrefixes, node.value, postcssResult, node);
checkDeclProp(controlledPrefixes, node.prop, postcssResult, node);
checkDeclValue(node.value, postcssResult, node);
checkDeclProp(node.prop, postcssResult, node);
});
};
};
Expand Down
15 changes: 3 additions & 12 deletions @navikt/aksel-stylelint/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,6 @@ const tokenJsonFile = "./tokens.json";

const allowedTokenNames = [];

export const addTokens = (
tokenJSONFile: string,
allowedTokenNames: string[]
) => {
const jsonFileBuffer = readFileSync(`${__dirname}/${tokenJSONFile}`);
const fileString = jsonFileBuffer.toString();
const flattened = flattenObject(JSON.parse(fileString));
flattened.forEach((token) => allowedTokenNames.push(token));
};

export const tokenExists = (
controlledPrefixes: string[],
inputToken: string
Expand All @@ -110,7 +100,6 @@ export const tokenExists = (
if (!allowedTokenNames.length) {
const cssFileBuffer = readFileSync(`${__dirname}/${tokenCSSFile}`);
const cssFileString = cssFileBuffer.toString();

valueParser(cssFileString).walk((node) => {
if (
node.type === "word" &&
Expand All @@ -121,7 +110,9 @@ export const tokenExists = (
}
});

addTokens(tokenJsonFile, allowedTokenNames);
const jsonFileBuffer = readFileSync(`${__dirname}/${tokenJsonFile}`);
const flattened = flattenObject(JSON.parse(jsonFileBuffer.toString()));
flattened.forEach((token) => allowedTokenNames.push(token));
}

return allowedTokenNames.includes(inputToken);
Expand Down
14 changes: 14 additions & 0 deletions @navikt/aksel/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# @navikt/aksel

## 5.7.4

### Patch Changes

- Updated dependencies []:
- @navikt/ds-css@5.7.4

## 5.7.3

### Patch Changes

- Updated dependencies [[`3d3e90760`](https://github.com/navikt/aksel/commit/3d3e9076088c5e72ed89fb97109b75dcf6e09d96), [`d8a4097c8`](https://github.com/navikt/aksel/commit/d8a4097c82ceee95bd216b36e1dc8eb99e75d7ee), [`a6b673386`](https://github.com/navikt/aksel/commit/a6b67338612b7944dc4e6b3d541244f521e94500)]:
- @navikt/ds-css@5.7.3

## 5.7.2

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions @navikt/aksel/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@navikt/aksel",
"version": "5.7.2",
"version": "5.7.4",
"description": "Aksel command line interface. Handles css-imports, codemods and more",
"author": "Aksel | NAV designsystem team",
"license": "MIT",
Expand Down Expand Up @@ -29,7 +29,7 @@
},
"homepage": "https://aksel.nav.no/grunnleggende/kode/kommandolinje",
"dependencies": {
"@navikt/ds-css": "5.7.2",
"@navikt/ds-css": "5.7.4",
"axios": "1.3.6",
"chalk": "4.1.0",
"clipboardy": "^2.3.0",
Expand Down
4 changes: 2 additions & 2 deletions @navikt/aksel/src/codemod/migrations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@ export function getMigrationNames() {
export function getMigrationString() {
let str = "";

Object.entries(migrations).forEach(([version, migrations]) => {
Object.entries(migrations).forEach(([version, vMigrations]) => {
str += `\n${chalk.underline(version)}\n`;
migrations.forEach((migration) => {
vMigrations.forEach((migration) => {
str += `${chalk.blue(migration.value)}: ${migration.description}\n`;
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ export default function transformer(file, api) {
function addMigrationTag(node) {
const attributes = node.openingElement.attributes;
const isMigrated = attributes.find(
(node) =>
node.type === "JSXAttribute" &&
node.name.name === "data-version" &&
node.value.value === "v1"
(attr) =>
attr.type === "JSXAttribute" &&
attr.name.name === "data-version" &&
attr.value.value === "v1"
);

if (!isMigrated) {
Expand All @@ -30,7 +30,7 @@ export default function transformer(file, api) {
function addExplicitStandardProp(node) {
const attributes = node.openingElement.attributes;
const variant = attributes.find(
(node) => node.type === "JSXAttribute" && node.name.name === "size"
(attr) => attr.type === "JSXAttribute" && attr.name.name === "size"
);

if (!variant) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import type { JSCodeshift } from "jscodeshift";
import { tokens } from "../../../tokens-map.mjs";
import {
getImportSpecifier,
getImportSpecifierName,
renameImportSpecifier,
} from "../../../utils/imports";
import { translateToken } from "../../../utils/translate-token";
import { tokens } from "../../../tokens-map.mjs";
import { getLineTerminator } from "../../../utils/lineterminator";
import { translateToken } from "../../../utils/translate-token";

/**
* @param {import('jscodeshift').FileInfo} file
Expand All @@ -29,9 +29,9 @@ export default function transformer(file: JSCodeshift, api) {
return src;
}

tokens.forEach((x) => {
const name = translateToken(x[0], "js");
const out = translateToken(x[1], "js");
tokens.forEach((token) => {
const name = translateToken(token[0], "js");
const out = translateToken(token[1], "js");

let foundName: string = "";

Expand Down
12 changes: 12 additions & 0 deletions @navikt/core/css/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# @navikt/ds-css

## 5.7.4

## 5.7.3

### Patch Changes

- Ny spacing token på 0.375rem ([#2370](https://github.com/navikt/aksel/pull/2370))

- Select: Tokenstøtte for å endre chevronfarge sammen med tekst ([#2383](https://github.com/navikt/aksel/pull/2383))

- HelpText: Knapp er visuelt mindre. Klikkflate er fortsatt 24px ([#2376](https://github.com/navikt/aksel/pull/2376))

## 5.7.2

## 5.7.1
Expand Down
4 changes: 2 additions & 2 deletions @navikt/core/css/chips.css
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,11 @@
}

.navds-chips--icon-left {
padding-left: 0.375rem;
padding-left: var(--a-spacing-1-alt);
}

.navds-chips--icon-right {
padding-right: 0.375rem;
padding-right: var(--a-spacing-1-alt);
}

.navds-chips--small .navds-chips--icon-right {
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 @@ -175,7 +175,7 @@
}

.navds-copybutton--small > .navds-copybutton__content {
gap: 0.375rem;
gap: var(--a-spacing-1-alt);
}

.navds-copybutton--xsmall > .navds-copybutton__content {
Expand Down
6 changes: 3 additions & 3 deletions @navikt/core/css/form/radio-checkbox.css
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@

.navds-checkbox--small > .navds-checkbox__label,
.navds-radio--small > .navds-radio__label {
padding: 0.375rem 0;
padding: var(--a-spacing-1-alt) 0;
}

.navds-checkbox--small > .navds-checkbox__label::before,
Expand Down Expand Up @@ -104,7 +104,7 @@
content: "";
position: absolute;
top: 50%;
transform: translate(0.375rem, -50%);
transform: translate(var(--a-spacing-1-alt), -50%);
background-color: var(--ac-radio-checkbox-bg, var(--a-surface-default));
width: 0.75rem;
height: 0.25rem;
Expand All @@ -129,7 +129,7 @@
color: var(--ac-radio-checkbox-bg, var(--a-surface-default));
position: absolute;
height: 1.5rem;
transform: translate(0.375rem);
transform: translate(var(--a-spacing-1-alt));
pointer-events: none;
}

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 @@ -43,6 +43,7 @@
right: var(--a-spacing-2);
pointer-events: none;
align-self: center;
color: var(--ac-select-text, var(--a-text-default));
}

.navds-form-field--small .navds-select__input {
Expand All @@ -51,7 +52,7 @@
}

.navds-form-field--small .navds-select__chevron {
right: 0.375rem;
right: var(--a-spacing-1-alt);
}

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

.navds-form-field--small .navds-textarea__input {
padding: 0.375rem;
padding: var(--a-spacing-1-alt);
}

.navds-form-field--small .navds-textarea--counter.navds-textarea__input {
Expand Down
9 changes: 5 additions & 4 deletions @navikt/core/css/help-text.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
.navds-help-text__button {
margin: 0;
padding: 0;
border: 0;
cursor: pointer;
background-color: transparent;
Expand All @@ -9,17 +8,19 @@
justify-content: center;
align-items: center;
color: var(--ac-help-text-button-color, var(--a-surface-action));
font-size: 1.5rem;
font-size: 1.25rem;
padding: calc(var(--a-spacing-1) / 2);
}

.navds-help-text__button:focus-visible {
box-shadow: 0 0 0 1px var(--a-surface-default), 0 0 0 4px var(--a-border-focus);
outline: none;
box-shadow: 0 0 0 1px var(--a-border-focus), inset 0 0 0 1px var(--a-border-focus);
}

@supports not selector(:focus-visible) {
.navds-help-text__button:focus {
outline: none;
box-shadow: 0 0 0 1px var(--a-surface-default), 0 0 0 4px var(--a-border-focus);
box-shadow: 0 0 0 1px var(--a-border-focus), inset 0 0 0 1px var(--a-border-focus);
}
}

Expand Down
4 changes: 2 additions & 2 deletions @navikt/core/css/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@navikt/ds-css",
"version": "5.7.2",
"version": "5.7.4",
"description": "CSS for NAV Designsystem",
"author": "Aksel | NAV designsystem team",
"keywords": [
Expand All @@ -27,7 +27,7 @@
"css:get-version": "node config/get-version.js"
},
"devDependencies": {
"@navikt/ds-tokens": "^5.7.2",
"@navikt/ds-tokens": "^5.7.4",
"cssnano": "6.0.0",
"fast-glob": "3.2.11",
"lodash": "4.17.21",
Expand Down
3 changes: 1 addition & 2 deletions @navikt/core/css/pagination.css
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@
}

.navds-pagination--small .navds-pagination__prev-next:where(.navds-pagination--prev-next--with-text) {
padding-left: 0.375rem;
padding-right: 0.375rem;
padding-inline: var(--a-spacing-1-alt);
}

.navds-pagination--xsmall .navds-pagination__prev-next:where(.navds-pagination--prev-next--with-text) {
Expand Down
Loading

0 comments on commit 5c66344

Please sign in to comment.