Compare commits

...
Author SHA1 Message Date
github-actions[bot] 2ad9183b09 Lerna versionbump [ci skip]
- @navikt/ds-react@0.13.2
 - @navikt/ds-react-internal@0.8.2
2021-12-02 13:23:57 +00:00
Andreas Nordahl 627b4f06cb [fix] field description as div (#1353) 2021-12-02 14:05:07 +01:00
Ken 3977927ac8 Update README.md 2021-11-26 10:57:26 +01:00
Ken 6f81c2cf4e Update update-tokens.yml 2021-11-18 11:57:06 +01:00
github-actions[bot] 46f97b006f Lerna versionbump [ci skip]
- @navikt/ds-css@0.11.4
 - @navikt/ds-tokens@0.6.3
2021-11-17 14:28:50 +00:00
Ken 9338995a3c [FIX] Nested token-parsing (#1347) 2021-11-17 15:09:59 +01:00
25 changed files with 107 additions and 22 deletions

No files matched your search

+1 -1
View File
@@ -36,6 +36,6 @@ jobs:
branch: figma-tokens-sync
delete-branch: true
title: "[FEATURE] Tokens sync Figma"
commit-message: "Ikoner synket fra figma"
commit-message: "Tokens synket fra figma"
committer: GitHub <noreply@github.com>
signoff: false
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@navikt/ds-css",
"version": "0.11.3",
"version": "0.11.4",
"private": false,
"description": "Css for NAV Designsystem components",
"author": "NAV Designsystem team",
@@ -21,7 +21,7 @@
"watch": "postcss --watch --use postcss-import -o dist/index.css index.css"
},
"devDependencies": {
"@navikt/ds-tokens": "^0.6.2",
"@navikt/ds-tokens": "^0.6.3",
"normalize.css": "^8.0.1",
"postcss": "^8.3.6",
"postcss-cli": "^8.3.1",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@navikt/ds-react",
"version": "0.13.1",
"version": "0.13.2",
"private": false,
"description": "NAV designsystem react components",
"author": "NAV Designsystem team",
@@ -103,6 +103,7 @@ const Fieldset = forwardRef<HTMLFieldSetElement, FieldsetProps>(
</Label>
{!!description && (
<BodyShort
as="div"
className={cl("navds-fieldset__description", {
"sr-only": !!hideLegend,
})}
+1
View File
@@ -67,6 +67,7 @@ const Select = forwardRef<HTMLSelectElement, SelectProps>((props, ref) => {
</Label>
{!!description && (
<BodyShort
as="div"
className={cl("navds-select__description", {
"sr-only": hideLabel,
})}
@@ -66,6 +66,7 @@ const TextField = forwardRef<HTMLInputElement, TextFieldProps>((props, ref) => {
{!!description && (
<BodyShort
as="div"
className={cl("navds-text-field__description", {
"sr-only": hideLabel,
})}
+1
View File
@@ -81,6 +81,7 @@ const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(
</Label>
{!!description && (
<BodyShort
as="div"
className={cl("navds-textarea__description", {
"sr-only": hideLabel,
})}
@@ -72,6 +72,7 @@ const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>((props, ref) => {
</BodyShort>
{props.description && (
<BodyShort
as="div"
size={size}
id={inputDescriptionId}
className="navds-checkbox__description"
@@ -21,7 +21,7 @@ export const All = () => {
description="Exercitation do labore"
>
<Checkbox value="Apple">Apple</Checkbox>
<Checkbox value="Orange" description="Laborum ad">
<Checkbox value="Orange" description={<div>Laborum ad</div>}>
Orange
</Checkbox>
<Checkbox value="Melon">Melon</Checkbox>
@@ -55,6 +55,7 @@ const Radio = forwardRef<HTMLInputElement, RadioProps>((props, ref) => {
</BodyShort>
{props.description && (
<BodyShort
as="div"
size={size}
id={inputDescriptionId}
className="navds-radio__description"
@@ -16,9 +16,12 @@ export const All = () => {
<Radio value="Melon">Melon</Radio>
</RadioGroup>
<h2>description</h2>
<RadioGroup legend="Mollit eiusmod" description="Exercitation do labore">
<RadioGroup
legend="Mollit eiusmod"
description={<div>Exercitation do labore</div>}
>
<Radio value="Apple">Apple</Radio>
<Radio value="Orange" description="Laborum ad">
<Radio value="Orange" description={<div>Laborum ad</div>}>
Orange
</Radio>
<Radio value="Melon">Melon</Radio>
@@ -94,6 +94,7 @@ const SearchField = forwardRef<HTMLDivElement, SearchFieldProps>(
</Label>
{!!description && (
<BodyShort
as="div"
className={cl("navds-text-field__description", {
"sr-only": hideLabel,
})}
@@ -15,7 +15,7 @@ export const All = () => {
<h1>SearchField</h1>
<SearchField
label="Mollit eiusmod"
description="Ea cupidatat eu sunt commodo"
description={<div>Ea cupidatat eu sunt commodo</div>}
>
<SearchField.Input />
<SearchField.Button>
@@ -21,9 +21,13 @@ export const All = () => {
<Fieldset
legend="Mollit eiusmod"
description="Quis reprehenderit esse cillum"
description={<div>Quis reprehenderit esse cillum</div>}
>
<TextField label="Textfield label" hideLabel />
<TextField
label="Textfield label"
hideLabel
description={<div>Quis reprehenderit esse cillum</div>}
/>
<TextField label="Textfield label" hideLabel />
</Fieldset>
@@ -19,7 +19,7 @@ export const All = () => {
<h2>Description</h2>
<Select label="Ipsum enim quis culpa" description="Aute enim">
<Select label="Ipsum enim quis culpa" description={<div>Aute enim</div>}>
<option value="">Velg land</option>
<option value="norge">Norge</option>
<option value="sverige">Sverige</option>
@@ -15,7 +15,10 @@ export const All = () => {
<h2>Description</h2>
<TextField label="Laborum excepteur" description="Cillum mollit" />
<TextField
label="Laborum excepteur"
description={<div>Cillum mollit</div>}
/>
<h2>Passord-type</h2>
<TextField label="Passord" type="password" />
@@ -23,7 +23,7 @@ export const All = () => {
<Textarea
label="In anim elit"
description="Reprehenderit esse proident"
description={<div>Reprehenderit esse proident</div>}
value={value}
onChange={handleChange}
/>
+1 -1
View File
@@ -44,7 +44,7 @@
},
{
"destination": "tokens-cjs.js",
"format": "javascript/module"
"format": "javascript/module-flat"
}
]
}
+6 -3
View File
@@ -1,8 +1,12 @@
import unifyNestedLevel from "./unify-nested-level";
const deepen = (obj: { [key: string]: { value: string } }) => {
const result = {};
const workObj = unifyNestedLevel(obj);
// For each object path (property key) in the object
for (const objectPath in obj) {
for (const objectPath in workObj) {
// Split path into component parts
const parts = objectPath.split("-");
@@ -12,9 +16,8 @@ const deepen = (obj: { [key: string]: { value: string } }) => {
const part = parts.shift();
target = target[part] = target[part] || {};
}
// Set value at end of path
target[parts[0]] = obj[objectPath];
target[parts[0]] = workObj[objectPath];
}
return result;
@@ -30,10 +30,10 @@ describe("Check conversion to Styled-dictionary format", () => {
semantic: {
color: {
danger: {
value: "{navds.global.color.red.400.value}",
hover: {
value: "{navds.global.color.red.300.value}",
},
"@": { value: "{navds.global.color.red.400.value}" },
},
},
},
@@ -0,0 +1,43 @@
import unifyNestedLevel from "../unify-nested-level";
describe("Check unifying of nested levels", () => {
test("Check color nesting", () => {
const obj = {
"navds-global-color-green-50": { value: "rbga(0,1,0,0)" },
"navds-global-color-green-500": { value: "rbga(0,2,0,0)" },
"navds-semantic-color-primary-hover": {
value: "rbga(0,3,0,0)",
},
"navds-semantic-color-primary-hover-subtle": {
value: "rbga(0,4,0,0)",
},
"navds-semantic-color-danger": { value: "rbga(0,5,0,0)" },
"navds-semantic-color-danger-hover": {
value: "rbga(0,6,0,0)",
},
"navds-semantic-color-danger-hover-subtle": {
value: "rbga(0,7,0,0)",
},
};
const newObj = unifyNestedLevel(obj);
expect(newObj).toEqual({
"navds-global-color-green-50": { value: "rbga(0,1,0,0)" },
"navds-global-color-green-500": { value: "rbga(0,2,0,0)" },
"navds-semantic-color-primary-hover-@": {
value: "rbga(0,3,0,0)",
},
"navds-semantic-color-primary-hover-subtle": {
value: "rbga(0,4,0,0)",
},
"navds-semantic-color-danger-@-@": { value: "rbga(0,5,0,0)" },
"navds-semantic-color-danger-hover-@": {
value: "rbga(0,6,0,0)",
},
"navds-semantic-color-danger-hover-subtle": {
value: "rbga(0,7,0,0)",
},
});
});
});
@@ -0,0 +1,22 @@
const unifyNestedLevel = (obj: { [key: string]: { value: string } }) => {
// deep copy
const workObj = JSON.parse(JSON.stringify(obj));
Object.keys(workObj).forEach((k) => {
const deeperKeys = Object.keys(workObj).filter(
(k2) => k2.startsWith(`${k}-`) && k2.length > k.length
);
if (deeperKeys.length > 0) {
const neededNestedLevel =
Math.max(...deeperKeys.map((k) => k.split("-").length)) -
k.split("-").length;
delete Object.assign(workObj, {
[k + "-@".repeat(neededNestedLevel)]: workObj[k],
})[k];
}
});
return workObj;
};
export default unifyNestedLevel;
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@navikt/ds-tokens",
"version": "0.6.2",
"version": "0.6.3",
"private": false,
"description": "Auto-generated design-tokens for NAV design-systems framework",
"author": "NAV Designsystem team",
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@navikt/ds-react-internal",
"version": "0.8.1",
"version": "0.8.2",
"private": false,
"description": "NAV internal designsystem react components",
"author": "NAV Designsystem team",
@@ -34,7 +34,7 @@
},
"dependencies": {
"@navikt/ds-icons": "^0.6.3",
"@navikt/ds-react": "^0.13.1",
"@navikt/ds-react": "^0.13.2",
"@popperjs/core": "^2.10.1",
"classnames": "^2.3.1",
"copy-to-clipboard": "^3.3.1",
+1 -1
View File
@@ -26,7 +26,7 @@ Repoet inneholder følgende:
- [Eksempler på forskjellige frontend-oppsett](https://github.com/navikt/nav-frontend-moduler/tree/master/examples) til applikasjoner som skal bruke komponentene
- [Storybook](https://navikt.github.io/Designsystemet/?path=/story/ds-react-kom-i-gang--page) for v2 komponenter (wip) og eldre komponenter.
## Bidra
## Bidrag
Gå til [CONTRIBUTING.md](https://github.com/navikt/nav-frontend-moduler/blob/master/CONTRIBUTING.md)