From d72497aa8c716a6bd22901a88860543330d2e655 Mon Sep 17 00:00:00 2001 From: Marwa Date: Tue, 22 Oct 2024 14:45:44 +0200 Subject: [PATCH 1/5] feat: add basis typography scale to voorbeeld tokens --- .../figma/voorbeeld.tokens.json | 69 +++++++++++++++---- 1 file changed, 56 insertions(+), 13 deletions(-) diff --git a/packages/voorbeeld-design-tokens/figma/voorbeeld.tokens.json b/packages/voorbeeld-design-tokens/figma/voorbeeld.tokens.json index caf4d9a68..1873d5fa9 100644 --- a/packages/voorbeeld-design-tokens/figma/voorbeeld.tokens.json +++ b/packages/voorbeeld-design-tokens/figma/voorbeeld.tokens.json @@ -914,6 +914,21 @@ } }, "common": { + "basis": { + "typography": { + "scale": { + "xx-small": { "font-size": { "value": "8px", "comment": "8px" } }, + "x-small": { "font-size": { "value": "12px", "comment": "12px" } }, + "small": { "font-size": { "value": "14px", "comment": "14px" } }, + "medium": { "font-size": { "value": "16px", "comment": "16px" } }, + "large": { "font-size": { "value": "20px", "comment": "20px" } }, + "x-large": { "font-size": { "value": "24px", "comment": "24px" } }, + "xx-large": { "font-size": { "value": "32px", "comment": "32px" } }, + "xxx-large": { "font-size": { "value": "40px", "comment": "40px" } }, + "xxxx-large": { "font-size": { "value": "48px", "comment": "48px" } } + } + } + }, "utrecht": { "document": { "background-color": { @@ -930,7 +945,7 @@ }, "font-size": { "$type": "fontSizes", - "$value": "{voorbeeld.typography.font-size.md}" + "$value": "{basis.typography.scale.medium}" }, "font-weight": { "$type": "fontWeights", @@ -1697,7 +1712,7 @@ }, "font-size": { "$type": "fontSizes", - "$value": "{voorbeeld.typography.font-size.xl}" + "$value": "{basis.typography.scale.x-large}" } } } @@ -1816,6 +1831,30 @@ "$type": "textCase", "$value": "None" }, + "font-size": { + "$type": "fontSizes", + "$value": "{basis.typography.scale.small}" + }, + "min-block-size": { + "$type": "sizing", + "$value": "{voorbeeld.size.xs}" + }, + "min-inline-size": { + "$type": "sizing", + "$value": "{voorbeeld.size.xs}" + }, + "font-weight": { + "$type": "fontWeights", + "$value": "{voorbeeld.document.strong.font-weight}" + }, + "border-radius": { + "$type": "borderRadius", + "$value": "{voorbeeld.border-radius.round}" + }, + "font-family": { + "$type": "fontFamilies", + "$value": "{utrecht.document.font-family}" + }, "letter-spacing": { "$type": "letterSpacing", "$value": "None" @@ -1917,7 +1956,7 @@ "attribution": { "font-size": { "$type": "fontSizes", - "$value": "{voorbeeld.typography.font-size.sm}" + "$value": "{basis.typography.scale.small}" }, "color": { "$type": "color", @@ -1927,7 +1966,7 @@ "content": { "font-size": { "$type": "fontSizes", - "$value": "{voorbeeld.typography.font-size.xl}" + "$value": "{basis.typography.scale.x-large}" }, "color": { "$type": "color", @@ -3590,7 +3629,7 @@ }, "font-size": { "$type": "fontSizes", - "$value": "{voorbeeld.typography.font-size.3xl}" + "$value": "{basis.typography.scale.xxx-large}" } }, "heading-2": { @@ -3612,7 +3651,7 @@ }, "font-size": { "$type": "fontSizes", - "$value": "{voorbeeld.typography.font-size.2xl}" + "$value": "{basis.typography.scale.xx-large}" } }, "heading-3": { @@ -3634,7 +3673,7 @@ }, "font-size": { "$type": "fontSizes", - "$value": "{voorbeeld.typography.font-size.xl}" + "$value": "{basis.typography.scale.x-large}" } }, "heading-4": { @@ -3656,7 +3695,7 @@ }, "font-size": { "$type": "fontSizes", - "$value": "{voorbeeld.typography.font-size.lg}" + "$value": "{basis.typography.scale.large}" } }, "heading-5": { @@ -3678,7 +3717,7 @@ }, "font-size": { "$type": "fontSizes", - "$value": "{voorbeeld.typography.font-size.md}" + "$value": "{basis.typography.scale.medium}" } }, "heading-6": { @@ -3700,7 +3739,7 @@ }, "font-size": { "$type": "fontSizes", - "$value": "{voorbeeld.typography.font-size.sm}" + "$value": "{basis.typography.scale.small}" } } } @@ -4521,7 +4560,7 @@ }, "font-size": { "$type": "fontSizes", - "$value": "{voorbeeld.typography.font-size.lg}" + "$value": "{basis.typography.scale.large}" }, "font-weight": { "$type": "fontWeights", @@ -4539,7 +4578,7 @@ }, "font-size": { "$type": "fontSizes", - "$value": "{voorbeeld.typography.font-size.sm}" + "$value": "{basis.typography.scale.small}" }, "font-weight": { "$type": "fontWeights", @@ -5210,7 +5249,7 @@ "status-badge": { "font-size": { "$type": "fontSizes", - "$value": "{voorbeeld.typography.font-size.sm}" + "$value": "{basis.typography.scale.small}" }, "line-height": { "$type": "lineHeights", @@ -5656,6 +5695,10 @@ "margin-block-end": { "$type": "spacing", "$value": "{voorbeeld.space.block.rabbit}" + }, + "font-size": { + "$type": "fontSizes", + "$value": "{basis.typography.scale.x-large}" } }, "cell": { From 364155d2c7075c9edd8fc9f11636af81cc54008c Mon Sep 17 00:00:00 2001 From: Marwa Date: Tue, 22 Oct 2024 15:11:29 +0200 Subject: [PATCH 2/5] refactor: remove scss files --- .../basic-theme-design-tokens/src/_responsive.scss | 7 ------- proprietary/basic-theme-design-tokens/src/custom.scss | 7 ------- proprietary/basic-theme-design-tokens/src/index.scss | 8 -------- 3 files changed, 22 deletions(-) delete mode 100644 proprietary/basic-theme-design-tokens/src/_responsive.scss delete mode 100644 proprietary/basic-theme-design-tokens/src/custom.scss delete mode 100644 proprietary/basic-theme-design-tokens/src/index.scss diff --git a/proprietary/basic-theme-design-tokens/src/_responsive.scss b/proprietary/basic-theme-design-tokens/src/_responsive.scss deleted file mode 100644 index 6258ac8e8..000000000 --- a/proprietary/basic-theme-design-tokens/src/_responsive.scss +++ /dev/null @@ -1,7 +0,0 @@ -/** - * @license SEE LICENSE.md - * Copyright (c) 2021 NL Design System Community - * All rights reserved - */ - -/* stylelint-disable no-duplicate-selectors */ diff --git a/proprietary/basic-theme-design-tokens/src/custom.scss b/proprietary/basic-theme-design-tokens/src/custom.scss deleted file mode 100644 index f3ba0c515..000000000 --- a/proprietary/basic-theme-design-tokens/src/custom.scss +++ /dev/null @@ -1,7 +0,0 @@ -/** - * @license SEE LICENSE.md - * Copyright (c) 2021 NL Design System Community - * All rights reserved - */ - -@import "./index.css"; diff --git a/proprietary/basic-theme-design-tokens/src/index.scss b/proprietary/basic-theme-design-tokens/src/index.scss deleted file mode 100644 index 404f0becc..000000000 --- a/proprietary/basic-theme-design-tokens/src/index.scss +++ /dev/null @@ -1,8 +0,0 @@ -/** - * @license SEE LICENSE.md - * Copyright (c) 2021 NL Design System Community - * All rights reserved - */ - -@import "./design-tokens.css"; -@import "./responsive"; From 4ef1a1215d71e4b4ebd873b4284da39b4ef111a7 Mon Sep 17 00:00:00 2001 From: Marwa Date: Wed, 23 Oct 2024 10:14:11 +0200 Subject: [PATCH 3/5] refactor: add value dollar sign and right value name --- .../figma/voorbeeld.tokens.json | 52 +++++++++---------- 1 file changed, 24 insertions(+), 28 deletions(-) diff --git a/packages/voorbeeld-design-tokens/figma/voorbeeld.tokens.json b/packages/voorbeeld-design-tokens/figma/voorbeeld.tokens.json index 1873d5fa9..3edd71502 100644 --- a/packages/voorbeeld-design-tokens/figma/voorbeeld.tokens.json +++ b/packages/voorbeeld-design-tokens/figma/voorbeeld.tokens.json @@ -917,15 +917,15 @@ "basis": { "typography": { "scale": { - "xx-small": { "font-size": { "value": "8px", "comment": "8px" } }, - "x-small": { "font-size": { "value": "12px", "comment": "12px" } }, - "small": { "font-size": { "value": "14px", "comment": "14px" } }, - "medium": { "font-size": { "value": "16px", "comment": "16px" } }, - "large": { "font-size": { "value": "20px", "comment": "20px" } }, - "x-large": { "font-size": { "value": "24px", "comment": "24px" } }, - "xx-large": { "font-size": { "value": "32px", "comment": "32px" } }, - "xxx-large": { "font-size": { "value": "40px", "comment": "40px" } }, - "xxxx-large": { "font-size": { "value": "48px", "comment": "48px" } } + "xx-small": { "font-size": { "$value": "8px", "comment": "8px" } }, + "x-small": { "font-size": { "$value": "12px", "comment": "12px" } }, + "small": { "font-size": { "$value": "14px", "comment": "14px" } }, + "medium": { "font-size": { "$value": "16px", "comment": "16px" } }, + "large": { "font-size": { "$value": "20px", "comment": "20px" } }, + "x-large": { "font-size": { "$value": "24px", "comment": "24px" } }, + "xx-large": { "font-size": { "$value": "32px", "comment": "32px" } }, + "xxx-large": { "font-size": { "$value": "40px", "comment": "40px" } }, + "xxxx-large": { "font-size": { "$value": "48px", "comment": "48px" } } } } }, @@ -945,7 +945,7 @@ }, "font-size": { "$type": "fontSizes", - "$value": "{basis.typography.scale.medium}" + "$value": "{basis.typography.scale.medium.font-size}" }, "font-weight": { "$type": "fontWeights", @@ -1712,7 +1712,7 @@ }, "font-size": { "$type": "fontSizes", - "$value": "{basis.typography.scale.x-large}" + "$value": "{basis.typography.scale.x-large.font-size}" } } } @@ -1833,7 +1833,7 @@ }, "font-size": { "$type": "fontSizes", - "$value": "{basis.typography.scale.small}" + "$value": "{basis.typography.scale.small.font-size}" }, "min-block-size": { "$type": "sizing", @@ -1956,7 +1956,7 @@ "attribution": { "font-size": { "$type": "fontSizes", - "$value": "{basis.typography.scale.small}" + "$value": "{basis.typography.scale.small.font-size}" }, "color": { "$type": "color", @@ -1966,7 +1966,7 @@ "content": { "font-size": { "$type": "fontSizes", - "$value": "{basis.typography.scale.x-large}" + "$value": "{basis.typography.scale.x-large.font-size}" }, "color": { "$type": "color", @@ -3629,7 +3629,7 @@ }, "font-size": { "$type": "fontSizes", - "$value": "{basis.typography.scale.xxx-large}" + "$value": "{basis.typography.scale.xxx-large.font-size}" } }, "heading-2": { @@ -3651,7 +3651,7 @@ }, "font-size": { "$type": "fontSizes", - "$value": "{basis.typography.scale.xx-large}" + "$value": "{basis.typography.scale.xx-large.font-size}" } }, "heading-3": { @@ -3673,7 +3673,7 @@ }, "font-size": { "$type": "fontSizes", - "$value": "{basis.typography.scale.x-large}" + "$value": "{basis.typography.scale.x-large.font-size}" } }, "heading-4": { @@ -3695,7 +3695,7 @@ }, "font-size": { "$type": "fontSizes", - "$value": "{basis.typography.scale.large}" + "$value": "{basis.typography.scale.large.font-size}" } }, "heading-5": { @@ -3717,7 +3717,7 @@ }, "font-size": { "$type": "fontSizes", - "$value": "{basis.typography.scale.medium}" + "$value": "{basis.typography.scale.medium.font-size}" } }, "heading-6": { @@ -3739,7 +3739,7 @@ }, "font-size": { "$type": "fontSizes", - "$value": "{basis.typography.scale.small}" + "$value": "{basis.typography.scale.small.font-size}" } } } @@ -4560,7 +4560,7 @@ }, "font-size": { "$type": "fontSizes", - "$value": "{basis.typography.scale.large}" + "$value": "{basis.typography.scale.large.font-size}" }, "font-weight": { "$type": "fontWeights", @@ -4578,7 +4578,7 @@ }, "font-size": { "$type": "fontSizes", - "$value": "{basis.typography.scale.small}" + "$value": "{basis.typography.scale.small.font-size}" }, "font-weight": { "$type": "fontWeights", @@ -5249,7 +5249,7 @@ "status-badge": { "font-size": { "$type": "fontSizes", - "$value": "{basis.typography.scale.small}" + "$value": "{basis.typography.scale.small.font-size}" }, "line-height": { "$type": "lineHeights", @@ -5686,7 +5686,7 @@ }, "font-size": { "$type": "fontSizes", - "$value": "{voorbeeld.typography.font-size.xl}" + "$value": "{basis.typography.scale.x-large.font-size}" }, "font-weight": { "$type": "fontWeights", @@ -5695,10 +5695,6 @@ "margin-block-end": { "$type": "spacing", "$value": "{voorbeeld.space.block.rabbit}" - }, - "font-size": { - "$type": "fontSizes", - "$value": "{basis.typography.scale.x-large}" } }, "cell": { From 2b72e6b278032769c5a7971f473b51a236f2e4e7 Mon Sep 17 00:00:00 2001 From: Robbert Broersma Date: Mon, 4 Nov 2024 08:32:03 +0100 Subject: [PATCH 4/5] feat: add fluid font-size scale to voorbeeld-theme --- packages/storybook/config/preview.ts | 1 + .../figma/voorbeeld.tokens.json | 57 ++++++++++--- .../voorbeeld-design-tokens/src/fluid.scss | 80 +++++++++++++++++++ 3 files changed, 128 insertions(+), 10 deletions(-) create mode 100644 packages/voorbeeld-design-tokens/src/fluid.scss diff --git a/packages/storybook/config/preview.ts b/packages/storybook/config/preview.ts index 48333a8e8..0f830c0f9 100644 --- a/packages/storybook/config/preview.ts +++ b/packages/storybook/config/preview.ts @@ -45,6 +45,7 @@ import '@nl-design-system-unstable/tubbergen-design-tokens/dist/index.css'; import '@nl-design-system-unstable/tubbergen-design-tokens/src/font'; import '@nl-design-system-unstable/venray-design-tokens/dist/index.css'; import '@nl-design-system-unstable/voorbeeld-design-tokens/dist/theme.css'; +import '@nl-design-system-unstable/voorbeeld-design-tokens/dist/fluid.css'; import '@nl-design-system-unstable/voorbeeld-design-tokens/src/custom.scss'; import '@nl-design-system-unstable/voorbeeld-design-tokens/src/font'; import '@nl-design-system-unstable/vught-design-tokens/dist/index.css'; diff --git a/packages/voorbeeld-design-tokens/figma/voorbeeld.tokens.json b/packages/voorbeeld-design-tokens/figma/voorbeeld.tokens.json index 3edd71502..c66492737 100644 --- a/packages/voorbeeld-design-tokens/figma/voorbeeld.tokens.json +++ b/packages/voorbeeld-design-tokens/figma/voorbeeld.tokens.json @@ -916,17 +916,54 @@ "common": { "basis": { "typography": { + "min": { + "small": { "font-size": { "$value": "0.9643rem" } }, + "medium": { "font-size": { "$value": "1.125rem" } }, + "large": { "font-size": { "$value": "1.3125rem" } }, + "x-large": { "font-size": { "$value": "1.5313rem" } }, + "xx-large": { "font-size": { "$value": "1.7865rem" } }, + "xxx-large": { "font-size": { "$value": "2.0842rem" } }, + "xxxx-large": { "font-size": { "$value": "2.4316rem" } } + }, "scale": { - "xx-small": { "font-size": { "$value": "8px", "comment": "8px" } }, - "x-small": { "font-size": { "$value": "12px", "comment": "12px" } }, - "small": { "font-size": { "$value": "14px", "comment": "14px" } }, - "medium": { "font-size": { "$value": "16px", "comment": "16px" } }, - "large": { "font-size": { "$value": "20px", "comment": "20px" } }, - "x-large": { "font-size": { "$value": "24px", "comment": "24px" } }, - "xx-large": { "font-size": { "$value": "32px", "comment": "32px" } }, - "xxx-large": { "font-size": { "$value": "40px", "comment": "40px" } }, - "xxxx-large": { "font-size": { "$value": "48px", "comment": "48px" } } - } + "small": { + "font-size": { "$value": "14px" }, + "line-height": { "$value": "1.6" } + }, + "medium": { + "font-size": { "$value": "16px" }, + "line-height": { "$value": "1.6" } + }, + "large": { + "font-size": { "$value": "20px" }, + "line-height": { "$value": "1.5" } + }, + "x-large": { + "font-size": { "$value": "24px" }, + "line-height": { "$value": "1.3" } + }, + "xx-large": { + "font-size": { "$value": "32px" }, + "line-height": { "$value": "1.25" } + }, + "xxx-large": { + "font-size": { "$value": "40px" }, + "line-height": { "$value": "1.2" } + }, + "xxxx-large": { + "font-size": { "$value": "48px" }, + "line-height": { "$value": "1.15" } + } + }, + "max": { + "small": { "font-size": { "$value": "1.2rem" } }, + "medium": { "font-size": { "$value": "1.5rem" } }, + "large": { "font-size": { "$value": "1.875rem" } }, + "x-large": { "font-size": { "$value": "2.3438rem" } }, + "xx-large": { "font-size": { "$value": "2.9297rem" } }, + "xxx-large": { "font-size": { "$value": "3.6621rem" } }, + "xxxx-large": { "font-size": { "$value": "4.5776rem" } } + }, } }, "utrecht": { diff --git a/packages/voorbeeld-design-tokens/src/fluid.scss b/packages/voorbeeld-design-tokens/src/fluid.scss new file mode 100644 index 000000000..34c2eb3c2 --- /dev/null +++ b/packages/voorbeeld-design-tokens/src/fluid.scss @@ -0,0 +1,80 @@ +/* + * Prefer `vi` over `vw` when available. + * Like `inline-size` and other logical properties, `vi` is based on the `inline` axis, + * instead of making assumptions about the text direction. + * The `vi` unit is unfortunately not yet implemented by all evergreen browsers. + */ + +@property --100vw { + syntax: ""; + initial-value: 0px; + inherits: true; +} + +@property --100vi { + syntax: ""; + initial-value: 0px; + inherits: true; +} + +.voorbeeld-theme { + --100vw: 100vw; + --100vi: 100vi; + + --viewport-small-inline-size: 320; + --viewport-large-inline-size: 1600; + --viewport-size: tan(atan2(var(--100vi, var(--100vw)), 1px)); + --font-size-scale: calc( + ( + clamp(var(--viewport-small-inline-size), var(--viewport-size), var(--viewport-large-inline-size)) - + var(--viewport-small-inline-size) + ) / (var(--viewport-large-inline-size) - var(--viewport-small-inline-size)) + ); + + /* + --basis-typography-min-xxxx-large-font-size: 2.4316rem; + --basis-typography-max-xxxx-large-font-size: 4.5776rem; + */ + + --basis-typography-scale-small-font-size: calc( + var(--basis-typography-min-small-font-size) + + (var(--basis-typography-max-small-font-size) - var(--basis-typography-min-small-font-size)) * + var(--font-size-scale) + ); + + --basis-typography-scale-medium-font-size: calc( + var(--basis-typography-min-medium-font-size) + + (var(--basis-typography-max-medium-font-size) - var(--basis-typography-min-medium-font-size)) * + var(--font-size-scale) + ); + + --basis-typography-scale-large-font-size: calc( + var(--basis-typography-min-large-font-size) + + (var(--basis-typography-max-large-font-size) - var(--basis-typography-min-large-font-size)) * + var(--font-size-scale) + ); + + --basis-typography-scale-x-large-font-size: calc( + var(--basis-typography-min-x-large-font-size) + + (var(--basis-typography-max-x-large-font-size) - var(--basis-typography-min-x-large-font-size)) * + var(--font-size-scale) + ); + + --basis-typography-scale-xx-large-font-size: calc( + var(--basis-typography-min-xx-large-font-size) + + (var(--basis-typography-max-xx-large-font-size) - var(--basis-typography-min-xx-large-font-size)) * + var(--font-size-scale) + ); + + --basis-typography-scale-xxx-large-font-size: calc( + var(--basis-typography-min-xxx-large-font-size) + + (var(--basis-typography-max-xxx-large-font-size) - var(--basis-typography-min-xxx-large-font-size)) * + var(--font-size-scale) + ); + + --basis-typography-scale-xxxx-large-font-size: calc( + var(--basis-typography-min-xxxx-large-font-size) + + (var(--basis-typography-max-xxxx-large-font-size) - var(--basis-typography-min-xxxx-large-font-size)) * + var(--font-size-scale) + ); +} From 174ca11f94e45e7337a301cf2a749b73a1314dc3 Mon Sep 17 00:00:00 2001 From: Marwa Date: Mon, 4 Nov 2024 11:24:47 +0100 Subject: [PATCH 5/5] refactor: remove unnecessary comma from voorbeeld tokens --- packages/voorbeeld-design-tokens/figma/voorbeeld.tokens.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/voorbeeld-design-tokens/figma/voorbeeld.tokens.json b/packages/voorbeeld-design-tokens/figma/voorbeeld.tokens.json index c66492737..538daed56 100644 --- a/packages/voorbeeld-design-tokens/figma/voorbeeld.tokens.json +++ b/packages/voorbeeld-design-tokens/figma/voorbeeld.tokens.json @@ -963,7 +963,7 @@ "xx-large": { "font-size": { "$value": "2.9297rem" } }, "xxx-large": { "font-size": { "$value": "3.6621rem" } }, "xxxx-large": { "font-size": { "$value": "4.5776rem" } } - }, + } } }, "utrecht": {