@amsterdam/design-system-tokens 4.0.0 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/AGENTS.md +71 -0
  2. package/CHANGELOG.md +25 -0
  3. package/CONTRIBUTING.md +18 -0
  4. package/README.md +29 -41
  5. package/dist/compact.css +4 -1
  6. package/dist/compact.d.ts +9 -0
  7. package/dist/compact.json +10 -1
  8. package/dist/compact.mjs +5 -0
  9. package/dist/compact.scss +4 -1
  10. package/dist/compact.theme.css +4 -1
  11. package/dist/index.css +110 -31
  12. package/dist/index.d.ts +138 -5
  13. package/dist/index.json +178 -45
  14. package/dist/index.mjs +148 -45
  15. package/dist/index.scss +110 -31
  16. package/dist/index.theme.css +110 -31
  17. package/package.json +6 -5
  18. package/src/brand/ams/typography.tokens.json +2 -2
  19. package/src/common/ams/query-containers.tokens.json +12 -0
  20. package/src/components/ams/calendar.compact.tokens.json +10 -0
  21. package/src/components/ams/calendar.tokens.json +87 -0
  22. package/src/components/ams/date-picker.tokens.json +103 -0
  23. package/src/components/ams/description-list.tokens.json +4 -4
  24. package/src/components/ams/dialog.tokens.json +13 -7
  25. package/src/components/ams/grid.compact.tokens.json +19 -1
  26. package/src/components/ams/grid.tokens.json +10 -4
  27. package/src/components/ams/menu.tokens.json +4 -4
  28. package/src/components/ams/page-footer.tokens.json +2 -2
  29. package/src/components/ams/page-header.tokens.json +2 -2
  30. package/src/components/ams/page.tokens.json +6 -0
  31. package/src/components/ams/pagination.tokens.json +219 -2
  32. package/src/components/ams/progress-list.tokens.json +2 -2
  33. package/src/components/ams/switch.tokens.json +8 -0
  34. package/src/components/ams/table-of-contents.tokens.json +65 -14
package/AGENTS.md ADDED
@@ -0,0 +1,71 @@
1
+ <!-- @license CC0-1.0 -->
2
+
3
+ # Tokens Package — Agent Instructions
4
+
5
+ These instructions are additive to the root [AGENTS.md](../../AGENTS.md). Read that first.
6
+
7
+ See [README.md](README.md) for full token usage and design guidance; this file focuses on agent-specific rules for editing token source files.
8
+
9
+ ## Overview
10
+
11
+ This package defines design tokens using the [Design Tokens Community Group (DTCG)](https://tr.designtokens.org/format/) format and builds them into CSS custom properties, JSON, and Sass variables via [Style Dictionary](https://styledictionary.com/).
12
+
13
+ ## Token structure
14
+
15
+ Tokens are organized into three layers:
16
+
17
+ | Directory | Purpose |
18
+ | ------------------ | ------------------------------------------------- |
19
+ | `src/brand/ams/` | Brand-level values (colors, typography, spacing) |
20
+ | `src/common/ams/` | Shared patterns across components (inputs, links) |
21
+ | `src/components/ams/` | Component-specific tokens |
22
+
23
+ ## Token file format
24
+
25
+ Token files use the `.tokens.json` extension and follow the DTCG format:
26
+
27
+ ```json
28
+ {
29
+ "ams": {
30
+ "<component-name>": {
31
+ "<property>": {
32
+ "$value": "{ams.<reference>}",
33
+ "$type": "<dtcg-type>"
34
+ }
35
+ }
36
+ }
37
+ }
38
+ ```
39
+
40
+ - Always reference existing brand or common tokens where possible — do not hardcode raw values.
41
+ - Valid `$type` values used in this project: `color`, `dimension`, `fontFamily`, `fontWeight`, `shadow`. Do not invent other `$type` values.
42
+ - Use the `$extensions` field for Amsterdam-specific metadata (e.g. `nl.amsterdam.type`, `nl.amsterdam.subtype`). Common `$extensions` types include `fontSize`, `lineHeight`, and `space` (via `nl.amsterdam.subtype`). See existing component tokens for examples.
43
+ - Variant tokens are nested under the component (e.g. `ams.badge.azure.background-color`).
44
+
45
+ ## Compact mode
46
+
47
+ Some token categories have `.compact.tokens.json` variants (e.g. `space.compact.tokens.json`, `typography.compact.tokens.json`). These provide denser values for compact layouts.
48
+
49
+ ## Build
50
+
51
+ - Build command: `pnpm build` (runs `node build.js`)
52
+ - Watch mode: `pnpm build:watch`
53
+ - Output: `dist/` — never edit generated output directly.
54
+ - Build config: `build.js` with custom Style Dictionary logic in `style-dictionary/` (includes `transforms/` and `dimensionToString.js`).
55
+
56
+ ## File locations
57
+
58
+ - Component tokens: `src/components/ams/<name>.tokens.json`
59
+ - Brand tokens: `src/brand/ams/`
60
+ - Common tokens: `src/common/ams/`
61
+ - Build script: `build.js`
62
+ - Custom transforms: `style-dictionary/transforms/`
63
+
64
+ ## Key rules
65
+
66
+ - Every token must have a `$value`. Type information is provided through either `$type` (DTCG standard) or `$extensions` with `nl.amsterdam.type` / `nl.amsterdam.subtype`. Some tokens (e.g. cursors, aspect ratios) have no type annotation — follow the existing pattern for the token category you are editing.
67
+ - Token names use kebab-case and mirror CSS property names where applicable.
68
+ - No unused tokens — every defined token must be consumed by CSS or another token.
69
+ - No hardcoded design values in CSS or React — if a value is missing, add a token here first.
70
+ - Changes to brand-level tokens in `src/brand/ams/` have wide impact; do not change them unless the task explicitly calls for brand updates.
71
+ - When adding new component tokens, wire them into CSS (and React where applicable) in the same change so they are immediately used.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,31 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [4.1.0](https://github.com/Amsterdam/design-system/compare/design-system-tokens-v4.0.1...design-system-tokens-v4.1.0) (2026-06-23)
7
+
8
+
9
+ ### Features
10
+
11
+ * **Calendar:** Add Calendar component ([#2659](https://github.com/Amsterdam/design-system/issues/2659)) ([03e51f3](https://github.com/Amsterdam/design-system/commit/03e51f3bfff4062f9523a57e3aad920c324665ff))
12
+ * **Date Picker:** Add Date Picker component ([#2660](https://github.com/Amsterdam/design-system/issues/2660)) ([b7c5a10](https://github.com/Amsterdam/design-system/commit/b7c5a1091aeafac1b3f75f657c2dce7e92c5da50))
13
+ * Decrease font weight for all bold text ([#2647](https://github.com/Amsterdam/design-system/issues/2647)) ([d0bac44](https://github.com/Amsterdam/design-system/commit/d0bac44d15f40c53f6640564a1f08698ad4b44e9))
14
+ * **Dialog, Grid Cell, Page:** Add containment context to allow container-based layouts ([#2562](https://github.com/Amsterdam/design-system/issues/2562)) ([7e4fc6a](https://github.com/Amsterdam/design-system/commit/7e4fc6af2ad12c1a0778513269922b2f2ab5f148))
15
+ * **Pagination:** Add tokens and elements for theming, active state, ellipsis, and relative-link ([#2690](https://github.com/Amsterdam/design-system/issues/2690)) ([f1ad13a](https://github.com/Amsterdam/design-system/commit/f1ad13a5ec9f8dca214090eff8064a0b2e5b24d8))
16
+ * **Table of Contents:** Make items with nested lists optionally collapsible ([#2584](https://github.com/Amsterdam/design-system/issues/2584)) ([cf6871b](https://github.com/Amsterdam/design-system/commit/cf6871b51dedb727255708425c3a9723965b9169))
17
+
18
+
19
+ ### Bug Fixes
20
+
21
+ * **Switch:** Keep the track border visible in forced colors mode ([#2656](https://github.com/Amsterdam/design-system/issues/2656)) ([b402c31](https://github.com/Amsterdam/design-system/commit/b402c31cc326c1cea0524fcd4da96ded54a56a88))
22
+ * **tokens:** Restore real values to deprecated tokens ([#2707](https://github.com/Amsterdam/design-system/issues/2707)) ([6363654](https://github.com/Amsterdam/design-system/commit/6363654e98312aed6e5f9b053300f5d02424f99f))
23
+
24
+ ## [4.0.1](https://github.com/Amsterdam/design-system/compare/design-system-tokens-v4.0.0...design-system-tokens-v4.0.1) (2026-04-24)
25
+
26
+
27
+ ### Bug Fixes
28
+
29
+ * **Grid:** Set correct horizontal padding in Compact Mode ([#2582](https://github.com/Amsterdam/design-system/issues/2582)) ([049fa6c](https://github.com/Amsterdam/design-system/commit/049fa6c205e2a73f3a4eac66642e000e90aa8369))
30
+
6
31
  ## [4.0.0](https://github.com/Amsterdam/design-system/compare/design-system-tokens-v3.4.0...design-system-tokens-v4.0.0) (2026-04-20)
7
32
 
8
33
 
@@ -0,0 +1,18 @@
1
+ <!-- @license CC0-1.0 -->
2
+
3
+ # Contributing to the tokens package
4
+
5
+ See the [repository-wide contributing guidelines](../../CONTRIBUTING.md) for general instructions.
6
+ The notes below apply specifically to design tokens.
7
+
8
+ ## Compact Mode and responsive overrides
9
+
10
+ Components may expose separate tokens for responsive variants, such as `vi-medium` and `vi-wide` for the Grid.
11
+ These are applied at breakpoints in the component stylesheet and override the base token.
12
+
13
+ When you add or change a token in a `*.compact.tokens.json` file, check whether the component stylesheet also applies a responsive variant of that token at larger breakpoints.
14
+ If it does, override every responsive variant in the compact file as well.
15
+ Otherwise, the compact value only applies below the first breakpoint, and the component silently reverts to the default token at larger viewports.
16
+
17
+ For example, the Grid mixin sets `padding-inline` from `--ams-grid-padding-inline`, then overrides it with `--ams-grid-vi-medium-padding-inline` and `--ams-grid-vi-wide-padding-inline` at the medium and wide breakpoints.
18
+ Compact Mode must override all three, not just the base.
package/README.md CHANGED
@@ -176,68 +176,56 @@ Note that redefining the value of a token is a much better approach than redecla
176
176
 
177
177
  ## Deprecating tokens
178
178
 
179
- We deprecate tokens using the DTCG `$deprecated` field. The [official definition](https://www.designtokens.org/tr/drafts/format/#deprecated) allows `$deprecated` to be `true`, `false` or a string explanation.
179
+ A deprecated token keeps working until it is removed, so it must always hold a real value.
180
180
 
181
- In ADS, `$deprecated` should be a string so consumers always get a reason + migration path.
181
+ We provide a reason and a migration path through the DTCG `$deprecated` field.
182
+ When there is a direct replacement, start the message with ``Use `<replacement-token>` instead.``
183
+ End every message with a removal date: `Will be removed on or after YYYY-MM-DD.`
182
184
 
183
- ### Deprecation message format
185
+ ### Renaming a token
184
186
 
185
- - Always include a removal date: `Will be removed on or after YYYY-MM-DD.`
186
- - If there is a direct replacement, start with: ``Use `<replacement-token>` instead.``
187
+ Keep the old name intact during the deprecation window, while adding the new name for the same value.
188
+ Wire the rename through a `var()` fallback, so downstream overrides of the old name keep working.
187
189
 
188
- ### Simple deprecation (no fallback)
189
-
190
- If a deprecated token is still used directly, keep its existing `$value` until removal.
191
- Also add a deprecation comment next to the token usage in the consuming CSS.
192
-
193
- Token JSON:
190
+ 1. Point the deprecated token’s `$value` at the replacement, so it resolves to the same value:
194
191
 
195
192
  ```jsonc
196
- "row-gap": {
197
- "$deprecated": "Whitespace is now applied through the `ams.description-list.*.margin-block-end` tokens. Will be removed on or after 2026-10-20.",
198
- "$value": "0"
193
+ "medium": {
194
+ "padding-inline": {
195
+ "$deprecated": "Use `ams.grid.vi-medium.padding-inline` instead. Will be removed on or after 2026-10-20.",
196
+ "$value": "{ams.grid.vi-medium.padding-inline}"
197
+ }
199
198
  }
200
199
  ```
201
200
 
202
- Component CSS:
201
+ 2. In the component CSS, reference the deprecated token first, with the replacement as the fallback:
202
+ Mark the deprecation in the component stylesheet as well; no need to copy the details from the tokens file.
203
203
 
204
204
  ```css
205
- row-gap: var(--ams-description-list-row-gap); /* This token is @deprecated. Will be removed on or after 2026-10-20. */
205
+ padding-inline: var(--ams-grid-medium-padding-inline /* @deprecated */, var(--ams-grid-vi-medium-padding-inline));
206
206
  ```
207
207
 
208
- ### Renames that use `var()` fallback
209
-
210
- When a token is renamed but we still want (downstream) overrides of the old token to keep working, we implement the rename through CSS `var()` fallback.
208
+ 3. If a theme overrides the replacement (for example Compact Mode), overriding the replacement token is enough because the deprecated token references it.
209
+ Only repeat the deprecated token in a theme tokens file if you need to override the deprecated token itself for legacy consumers.
211
210
 
212
- Always add an inline deprecation comment next to the deprecated custom property inside the `var()` call.
211
+ ### Removing a token
213
212
 
214
- 1. Update the component CSS to reference the deprecated token first, and the replacement token as the fallback:
215
-
216
- ```css
217
- padding-inline: var(
218
- --ams-grid-medium-padding-inline /* This token is @deprecated. Will be removed on or after 2026-10-20. */,
219
- var(--ams-grid-vi-medium-padding-inline)
220
- );
221
- ```
222
-
223
- 2. In the token JSON, mark the old token as deprecated and set its `$value` to the CSS-wide keyword `initial`:
213
+ A removal will always be a breaking change, so it must be part of a major release.
214
+ Plan the deprecation early, as it must stay in place for at least six months.
215
+ The value of the token cannot change during the deprecation window, as we consider visual consequences for downstream users a breaking change.
224
216
 
225
217
  ```jsonc
226
- "medium": {
227
- "padding-inline": {
228
- "$deprecated": "Use `ams.grid.vi-medium.padding-inline` instead. Will be removed on or after 2026-10-20.",
229
- "$value": "initial"
230
- }
218
+ "row-gap": {
219
+ "$deprecated": "Whitespace is now applied through the `ams.description-list.*.margin-block-end` tokens. Will be removed on or after 2026-10-20.",
220
+ "$value": "(unchanged value)"
231
221
  }
232
222
  ```
233
223
 
234
- Why `initial`? Per CSS `var()` rules, when a custom property is [not set or is set to a CSS-wide keyword](https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Values/var#syntax) like `initial`, the fallback value is used. This makes the replacement token the default while keeping the deprecated token visible and overrideable.
235
-
236
- Only apply this `initial` rule when the deprecated token is used in a `var(--deprecated, <fallback>)` pattern.
237
-
238
- ### Deprecations without a 1:1 replacement
224
+ Surface the deprecation in the stylesheet as well.
239
225
 
240
- If there is no 1:1 replacement (design/behavior changed), keep the existing `$value` until removal and update the consuming CSS/markup before deleting the token.
226
+ ```css
227
+ row-gap: var(--ams-description-list-row-gap); /* @deprecated Will be removed on or after 2026-10-20. */
228
+ ```
241
229
 
242
230
  ## Token types
243
231
 
package/dist/compact.css CHANGED
@@ -31,13 +31,16 @@
31
31
  --ams-typography-heading-3-line-height: 1.3;
32
32
  --ams-typography-heading-4-line-height: 1.4;
33
33
  --ams-typography-heading-5-line-height: 1.4;
34
+ --ams-calendar-inline-size: 16rem;
34
35
  --ams-page-header-mega-menu-padding-block: 0;
35
36
  --ams-typography-heading-2-font-size: var(--ams-typography-body-text-x-large-font-size);
36
37
  --ams-typography-heading-3-font-size: var(--ams-typography-body-text-large-font-size);
37
38
  --ams-typography-heading-4-font-size: var(--ams-typography-body-text-font-size);
38
39
  --ams-typography-heading-5-font-size: var(--ams-typography-body-text-small-font-size);
39
40
  --ams-body-background-color: var(--ams-color-background-body);
40
- --ams-grid-padding-inline: var(--ams-space-xl);
41
+ --ams-grid-padding-inline: var(--ams-space-m);
42
+ --ams-grid-vi-medium-padding-inline: var(--ams-space-l);
43
+ --ams-grid-vi-wide-padding-inline: var(--ams-space-xl);
41
44
  --ams-grid-cell-background-color: var(--ams-color-background);
42
45
  --ams-grid-cell-padding-block: var(--ams-space-m);
43
46
  --ams-grid-cell-padding-inline: var(--ams-space-m);
package/dist/compact.d.ts CHANGED
@@ -85,8 +85,17 @@ declare const tokens: {
85
85
  body: {
86
86
  "background-color": DesignToken;
87
87
  };
88
+ calendar: {
89
+ "inline-size": DesignToken;
90
+ };
88
91
  grid: {
89
92
  "padding-inline": DesignToken;
93
+ "vi-medium": {
94
+ "padding-inline": DesignToken;
95
+ };
96
+ "vi-wide": {
97
+ "padding-inline": DesignToken;
98
+ };
90
99
  cell: {
91
100
  "background-color": DesignToken;
92
101
  "padding-block": DesignToken;
package/dist/compact.json CHANGED
@@ -69,8 +69,17 @@
69
69
  "body": {
70
70
  "background-color": "#e8e8e8"
71
71
  },
72
+ "calendar": {
73
+ "inline-size": "16rem"
74
+ },
72
75
  "grid": {
73
- "padding-inline": "clamp(1.5rem, 1.2857rem + 1.0714vw, 2.25rem)",
76
+ "padding-inline": "clamp(0.75rem, 0.6786rem + 0.3571vw, 1rem)",
77
+ "vi-medium": {
78
+ "padding-inline": "clamp(1rem, 0.8571rem + 0.7143vw, 1.5rem)"
79
+ },
80
+ "vi-wide": {
81
+ "padding-inline": "clamp(1.5rem, 1.2857rem + 1.0714vw, 2.25rem)"
82
+ },
74
83
  "cell": {
75
84
  "background-color": "#ffffff",
76
85
  "padding-block": "clamp(0.75rem, 0.6786rem + 0.3571vw, 1rem)",
package/dist/compact.mjs CHANGED
@@ -40,7 +40,12 @@ export const amsTypographyHeading_4LineHeight = 1.4;
40
40
  export const amsTypographyHeading_5FontSize = "0.875rem";
41
41
  export const amsTypographyHeading_5LineHeight = 1.4;
42
42
  export const amsBodyBackgroundColor = "#e8e8e8";
43
+ export const amsCalendarInlineSize = "16rem";
43
44
  export const amsGridPaddingInline =
45
+ "clamp(0.75rem, 0.6786rem + 0.3571vw, 1rem)";
46
+ export const amsGridViMediumPaddingInline =
47
+ "clamp(1rem, 0.8571rem + 0.7143vw, 1.5rem)";
48
+ export const amsGridViWidePaddingInline =
44
49
  "clamp(1.5rem, 1.2857rem + 1.0714vw, 2.25rem)";
45
50
  export const amsGridCellBackgroundColor = "#ffffff";
46
51
  export const amsGridCellPaddingBlock =
package/dist/compact.scss CHANGED
@@ -29,13 +29,16 @@ $ams-typography-heading-2-line-height: 1.3;
29
29
  $ams-typography-heading-3-line-height: 1.3;
30
30
  $ams-typography-heading-4-line-height: 1.4;
31
31
  $ams-typography-heading-5-line-height: 1.4;
32
+ $ams-calendar-inline-size: 16rem;
32
33
  $ams-page-header-mega-menu-padding-block: 0;
33
34
  $ams-typography-heading-2-font-size: $ams-typography-body-text-x-large-font-size;
34
35
  $ams-typography-heading-3-font-size: $ams-typography-body-text-large-font-size;
35
36
  $ams-typography-heading-4-font-size: $ams-typography-body-text-font-size;
36
37
  $ams-typography-heading-5-font-size: $ams-typography-body-text-small-font-size;
37
38
  $ams-body-background-color: $ams-color-background-body;
38
- $ams-grid-padding-inline: $ams-space-xl;
39
+ $ams-grid-padding-inline: $ams-space-m;
40
+ $ams-grid-vi-medium-padding-inline: $ams-space-l;
41
+ $ams-grid-vi-wide-padding-inline: $ams-space-xl;
39
42
  $ams-grid-cell-background-color: $ams-color-background;
40
43
  $ams-grid-cell-padding-block: $ams-space-m;
41
44
  $ams-grid-cell-padding-inline: $ams-space-m;
@@ -31,13 +31,16 @@
31
31
  --ams-typography-heading-3-line-height: 1.3;
32
32
  --ams-typography-heading-4-line-height: 1.4;
33
33
  --ams-typography-heading-5-line-height: 1.4;
34
+ --ams-calendar-inline-size: 16rem;
34
35
  --ams-page-header-mega-menu-padding-block: 0;
35
36
  --ams-typography-heading-2-font-size: var(--ams-typography-body-text-x-large-font-size);
36
37
  --ams-typography-heading-3-font-size: var(--ams-typography-body-text-large-font-size);
37
38
  --ams-typography-heading-4-font-size: var(--ams-typography-body-text-font-size);
38
39
  --ams-typography-heading-5-font-size: var(--ams-typography-body-text-small-font-size);
39
40
  --ams-body-background-color: var(--ams-color-background-body);
40
- --ams-grid-padding-inline: var(--ams-space-xl);
41
+ --ams-grid-padding-inline: var(--ams-space-m);
42
+ --ams-grid-vi-medium-padding-inline: var(--ams-space-l);
43
+ --ams-grid-vi-wide-padding-inline: var(--ams-space-xl);
41
44
  --ams-grid-cell-background-color: var(--ams-color-background);
42
45
  --ams-grid-cell-padding-block: var(--ams-space-m);
43
46
  --ams-grid-cell-padding-inline: var(--ams-space-m);