@equinor/eds-tokens 2.2.0 → 2.3.0-beta.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 (39) hide show
  1. package/README.md +11 -1
  2. package/build/js/spacing/comfortable.d.ts +0 -1
  3. package/build/js/spacing/comfortable.js +0 -1
  4. package/build/js/spacing/spacious.d.ts +0 -1
  5. package/build/js/spacing/spacious.js +0 -1
  6. package/build/ts/color/color-scheme/dark-color-scheme.ts +116 -0
  7. package/build/ts/color/color-scheme/dark-semantic.ts +162 -0
  8. package/build/ts/color/color-scheme/light-color-scheme.ts +116 -0
  9. package/build/ts/color/color-scheme/light-semantic.ts +162 -0
  10. package/build/ts/spacing/comfortable.ts +558 -0
  11. package/build/ts/spacing/index.ts +6 -0
  12. package/build/ts/spacing/spacious.ts +558 -0
  13. package/build/ts/typography/font-family-header.ts +122 -0
  14. package/build/ts/typography/font-family-ui.ts +122 -0
  15. package/build/ts/typography/font-size-2xl.ts +21 -0
  16. package/build/ts/typography/font-size-3xl.ts +21 -0
  17. package/build/ts/typography/font-size-4xl.ts +21 -0
  18. package/build/ts/typography/font-size-5xl.ts +21 -0
  19. package/build/ts/typography/font-size-6xl.ts +21 -0
  20. package/build/ts/typography/font-size-lg.ts +21 -0
  21. package/build/ts/typography/font-size-md.ts +21 -0
  22. package/build/ts/typography/font-size-sm.ts +21 -0
  23. package/build/ts/typography/font-size-xl.ts +21 -0
  24. package/build/ts/typography/font-size-xs.ts +21 -0
  25. package/build/ts/typography/font-weight-bolder.ts +9 -0
  26. package/build/ts/typography/font-weight-lighter.ts +9 -0
  27. package/build/ts/typography/font-weight-normal.ts +9 -0
  28. package/build/ts/typography/line-height-default.ts +9 -0
  29. package/build/ts/typography/line-height-squished.ts +9 -0
  30. package/build/ts/typography/tracking-loose.ts +9 -0
  31. package/build/ts/typography/tracking-normal.ts +9 -0
  32. package/build/ts/typography/tracking-tight.ts +9 -0
  33. package/build/ts/typography/tracking-wide.ts +9 -0
  34. package/instructions/colors-dynamic.md +29 -0
  35. package/instructions/colors-static.md +78 -0
  36. package/instructions/colors.md +13 -0
  37. package/instructions/typography.md +161 -0
  38. package/package.json +31 -28
  39. package/LICENSE +0 -21
@@ -0,0 +1,122 @@
1
+ /**
2
+ * Do not edit directly, this file was auto-generated.
3
+ */
4
+
5
+ export const typography = {
6
+ documentation: 'ui-body',
7
+ typography: {
8
+ fontFamily: 'Inter',
9
+ },
10
+ fontFamilySize: {
11
+ xs: {
12
+ fontSize: 10.5,
13
+ trackingTight: -1.149999976158142,
14
+ trackingNormal: 0,
15
+ trackingWide: 1.149999976158142,
16
+ fontWeightLighter: 300,
17
+ fontWeightNormal: 400,
18
+ fontWeightBolder: 500,
19
+ lineHeightDefault: 16,
20
+ lineHeightSquished: 12,
21
+ },
22
+ sm: {
23
+ fontSize: 12,
24
+ trackingTight: -1.3200000524520874,
25
+ trackingNormal: 0,
26
+ trackingWide: 1.3200000524520874,
27
+ fontWeightLighter: 300,
28
+ fontWeightNormal: 400,
29
+ fontWeightBolder: 500,
30
+ lineHeightDefault: 16,
31
+ lineHeightSquished: 12,
32
+ },
33
+ md: {
34
+ fontSize: 14,
35
+ trackingTight: -1.5399999618530273,
36
+ trackingNormal: 0,
37
+ trackingWide: 1.5399999618530273,
38
+ fontWeightLighter: 300,
39
+ fontWeightNormal: 400,
40
+ fontWeightBolder: 500,
41
+ lineHeightDefault: 20,
42
+ lineHeightSquished: 16,
43
+ },
44
+ lg: {
45
+ fontSize: 16,
46
+ trackingTight: -1.7599999904632568,
47
+ trackingNormal: 0,
48
+ trackingWide: 1.7599999904632568,
49
+ fontWeightLighter: 300,
50
+ fontWeightNormal: 400,
51
+ fontWeightBolder: 500,
52
+ lineHeightDefault: 24,
53
+ lineHeightSquished: 20,
54
+ },
55
+ xl: {
56
+ fontSize: 18.5,
57
+ trackingTight: -1.7599999904632568,
58
+ trackingNormal: 0,
59
+ trackingWide: 2.0350000858306885,
60
+ fontWeightLighter: 300,
61
+ fontWeightNormal: 400,
62
+ fontWeightBolder: 500,
63
+ lineHeightDefault: 24,
64
+ lineHeightSquished: 20,
65
+ },
66
+ twoXl: {
67
+ fontSize: 21,
68
+ trackingTight: -2.309999942779541,
69
+ trackingNormal: 0,
70
+ trackingWide: 2.309999942779541,
71
+ fontWeightLighter: 300,
72
+ fontWeightNormal: 400,
73
+ fontWeightBolder: 500,
74
+ lineHeightDefault: 28,
75
+ lineHeightSquished: 24,
76
+ },
77
+ threeXl: {
78
+ fontSize: 24.5,
79
+ trackingTight: -2.694999933242798,
80
+ trackingNormal: 0,
81
+ trackingWide: 2.694999933242798,
82
+ fontWeightLighter: 300,
83
+ fontWeightNormal: 400,
84
+ fontWeightBolder: 500,
85
+ lineHeightDefault: 32,
86
+ lineHeightSquished: 28,
87
+ },
88
+ fourXl: {
89
+ fontSize: 28,
90
+ trackingTight: -3.0799999237060547,
91
+ trackingNormal: 0,
92
+ trackingWide: 3.0799999237060547,
93
+ fontWeightLighter: 300,
94
+ fontWeightNormal: 400,
95
+ fontWeightBolder: 500,
96
+ lineHeightDefault: 32,
97
+ lineHeightSquished: 28,
98
+ },
99
+ fiveXl: {
100
+ fontSize: 32,
101
+ trackingTight: -3.5199999809265137,
102
+ trackingNormal: 0,
103
+ trackingWide: 300,
104
+ fontWeightLighter: 300,
105
+ fontWeightNormal: 400,
106
+ fontWeightBolder: 500,
107
+ lineHeightDefault: 36,
108
+ lineHeightSquished: 32,
109
+ },
110
+ sixXl: {
111
+ fontSize: 37,
112
+ trackingTight: -4.070000171661377,
113
+ trackingNormal: 0,
114
+ trackingWide: 4.070000171661377,
115
+ fontWeightLighter: 300,
116
+ fontWeightNormal: 400,
117
+ fontWeightBolder: 500,
118
+ lineHeightDefault: 40,
119
+ lineHeightSquished: 36,
120
+ },
121
+ },
122
+ } as const
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Do not edit directly, this file was auto-generated.
3
+ */
4
+
5
+ export const typography = {
6
+ documentation: '2xl',
7
+ typography: {
8
+ fontSize: 21,
9
+ lineHeightDefault: 28,
10
+ lineHeightSquished: 24,
11
+ iconSize: 32,
12
+ gapHorizontal: 13,
13
+ gapVertical: 13,
14
+ trackingTight: -2.309999942779541,
15
+ trackingNormal: 0,
16
+ trackingWide: 2.309999942779541,
17
+ fontWeightLighter: 300,
18
+ fontWeightNormal: 400,
19
+ fontWeightBolder: 500,
20
+ },
21
+ } as const
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Do not edit directly, this file was auto-generated.
3
+ */
4
+
5
+ export const typography = {
6
+ documentation: '3xl',
7
+ typography: {
8
+ fontSize: 24.5,
9
+ lineHeightDefault: 32,
10
+ lineHeightSquished: 28,
11
+ iconSize: 37,
12
+ gapHorizontal: 15,
13
+ gapVertical: 15,
14
+ trackingTight: -2.694999933242798,
15
+ trackingNormal: 0,
16
+ trackingWide: 2.694999933242798,
17
+ fontWeightLighter: 300,
18
+ fontWeightNormal: 400,
19
+ fontWeightBolder: 500,
20
+ },
21
+ } as const
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Do not edit directly, this file was auto-generated.
3
+ */
4
+
5
+ export const typography = {
6
+ documentation: '4xl',
7
+ typography: {
8
+ fontSize: 28,
9
+ lineHeightDefault: 32,
10
+ lineHeightSquished: 28,
11
+ iconSize: 42,
12
+ gapHorizontal: 17.5,
13
+ gapVertical: 17.5,
14
+ trackingTight: -3.0799999237060547,
15
+ trackingNormal: 0,
16
+ trackingWide: 3.0799999237060547,
17
+ fontWeightLighter: 300,
18
+ fontWeightNormal: 400,
19
+ fontWeightBolder: 500,
20
+ },
21
+ } as const
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Do not edit directly, this file was auto-generated.
3
+ */
4
+
5
+ export const typography = {
6
+ documentation: '5xl',
7
+ typography: {
8
+ fontSize: 32,
9
+ lineHeightDefault: 36,
10
+ lineHeightSquished: 32,
11
+ iconSize: 48,
12
+ gapHorizontal: 20,
13
+ gapVertical: 20,
14
+ trackingTight: -3.5199999809265137,
15
+ trackingNormal: 0,
16
+ trackingWide: 300,
17
+ fontWeightLighter: 300,
18
+ fontWeightNormal: 400,
19
+ fontWeightBolder: 500,
20
+ },
21
+ } as const
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Do not edit directly, this file was auto-generated.
3
+ */
4
+
5
+ export const typography = {
6
+ documentation: '6xl',
7
+ typography: {
8
+ fontSize: 37,
9
+ lineHeightDefault: 40,
10
+ lineHeightSquished: 36,
11
+ iconSize: 56,
12
+ gapHorizontal: 23,
13
+ gapVertical: 23,
14
+ trackingTight: -4.070000171661377,
15
+ trackingNormal: 0,
16
+ trackingWide: 4.070000171661377,
17
+ fontWeightLighter: 300,
18
+ fontWeightNormal: 400,
19
+ fontWeightBolder: 500,
20
+ },
21
+ } as const
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Do not edit directly, this file was auto-generated.
3
+ */
4
+
5
+ export const typography = {
6
+ documentation: 'lg',
7
+ typography: {
8
+ fontSize: 16,
9
+ lineHeightDefault: 24,
10
+ lineHeightSquished: 20,
11
+ iconSize: 24,
12
+ gapHorizontal: 10,
13
+ gapVertical: 10,
14
+ trackingTight: -1.7599999904632568,
15
+ trackingNormal: 0,
16
+ trackingWide: 1.7599999904632568,
17
+ fontWeightLighter: 300,
18
+ fontWeightNormal: 400,
19
+ fontWeightBolder: 500,
20
+ },
21
+ } as const
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Do not edit directly, this file was auto-generated.
3
+ */
4
+
5
+ export const typography = {
6
+ documentation: 'md',
7
+ typography: {
8
+ fontSize: 14,
9
+ lineHeightDefault: 20,
10
+ lineHeightSquished: 16,
11
+ iconSize: 20,
12
+ gapHorizontal: 8.5,
13
+ gapVertical: 8.5,
14
+ trackingTight: -1.5399999618530273,
15
+ trackingNormal: 0,
16
+ trackingWide: 1.5399999618530273,
17
+ fontWeightLighter: 300,
18
+ fontWeightNormal: 400,
19
+ fontWeightBolder: 500,
20
+ },
21
+ } as const
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Do not edit directly, this file was auto-generated.
3
+ */
4
+
5
+ export const typography = {
6
+ documentation: 'sm',
7
+ typography: {
8
+ fontSize: 12,
9
+ lineHeightDefault: 16,
10
+ lineHeightSquished: 12,
11
+ iconSize: 18,
12
+ gapHorizontal: 7.5,
13
+ gapVertical: 7.5,
14
+ trackingTight: -1.3200000524520874,
15
+ trackingNormal: 0,
16
+ trackingWide: 1.3200000524520874,
17
+ fontWeightLighter: 300,
18
+ fontWeightNormal: 400,
19
+ fontWeightBolder: 500,
20
+ },
21
+ } as const
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Do not edit directly, this file was auto-generated.
3
+ */
4
+
5
+ export const typography = {
6
+ documentation: 'xl',
7
+ typography: {
8
+ fontSize: 18.5,
9
+ lineHeightDefault: 24,
10
+ lineHeightSquished: 20,
11
+ iconSize: 28,
12
+ gapHorizontal: 11.5,
13
+ gapVertical: 11.5,
14
+ trackingTight: -1.7599999904632568,
15
+ trackingNormal: 0,
16
+ trackingWide: 2.0350000858306885,
17
+ fontWeightLighter: 300,
18
+ fontWeightNormal: 400,
19
+ fontWeightBolder: 500,
20
+ },
21
+ } as const
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Do not edit directly, this file was auto-generated.
3
+ */
4
+
5
+ export const typography = {
6
+ documentation: 'xs',
7
+ typography: {
8
+ fontSize: 10.5,
9
+ lineHeightDefault: 16,
10
+ lineHeightSquished: 12,
11
+ iconSize: 16,
12
+ gapHorizontal: 6.5,
13
+ gapVertical: 6.5,
14
+ trackingTight: -1.149999976158142,
15
+ trackingNormal: 0,
16
+ trackingWide: 1.149999976158142,
17
+ fontWeightLighter: 300,
18
+ fontWeightNormal: 400,
19
+ fontWeightBolder: 500,
20
+ },
21
+ } as const
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Do not edit directly, this file was auto-generated.
3
+ */
4
+
5
+ export const typography = {
6
+ typography: {
7
+ fontWeight: 500,
8
+ },
9
+ } as const
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Do not edit directly, this file was auto-generated.
3
+ */
4
+
5
+ export const typography = {
6
+ typography: {
7
+ fontWeight: 300,
8
+ },
9
+ } as const
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Do not edit directly, this file was auto-generated.
3
+ */
4
+
5
+ export const typography = {
6
+ typography: {
7
+ fontWeight: 400,
8
+ },
9
+ } as const
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Do not edit directly, this file was auto-generated.
3
+ */
4
+
5
+ export const typography = {
6
+ typography: {
7
+ lineHeight: 16,
8
+ },
9
+ } as const
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Do not edit directly, this file was auto-generated.
3
+ */
4
+
5
+ export const typography = {
6
+ typography: {
7
+ lineHeight: 12,
8
+ },
9
+ } as const
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Do not edit directly, this file was auto-generated.
3
+ */
4
+
5
+ export const typography = {
6
+ typography: {
7
+ tracking: 1.149999976158142,
8
+ },
9
+ } as const
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Do not edit directly, this file was auto-generated.
3
+ */
4
+
5
+ export const typography = {
6
+ typography: {
7
+ tracking: 0,
8
+ },
9
+ } as const
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Do not edit directly, this file was auto-generated.
3
+ */
4
+
5
+ export const typography = {
6
+ typography: {
7
+ tracking: -1.149999976158142,
8
+ },
9
+ } as const
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Do not edit directly, this file was auto-generated.
3
+ */
4
+
5
+ export const typography = {
6
+ typography: {
7
+ tracking: 1.149999976158142,
8
+ },
9
+ } as const
@@ -104,6 +104,35 @@ Use one of these values for the `data-color-appearance` attribute:
104
104
  - `warning` -- Cautionary states
105
105
  - `danger` -- Destructive or error states
106
106
 
107
+ ## JavaScript Tokens (Flat)
108
+
109
+ The dynamic color tokens are available as flat ES6 exports with `SCREAMING_SNAKE_CASE` constants. These resolve to the concrete color values for each appearance.
110
+
111
+ ### Import
112
+
113
+ ```typescript
114
+ import {
115
+ BG_FILL_EMPHASIS_DEFAULT,
116
+ TEXT_STRONG_ON_EMPHASIS,
117
+ BORDER_STRONG,
118
+ } from '@equinor/eds-tokens/js/color/dynamic/accent'
119
+ ```
120
+
121
+ Each appearance has its own file:
122
+
123
+ - `@equinor/eds-tokens/js/color/dynamic/accent`
124
+ - `@equinor/eds-tokens/js/color/dynamic/neutral`
125
+ - `@equinor/eds-tokens/js/color/dynamic/success`
126
+ - `@equinor/eds-tokens/js/color/dynamic/info`
127
+ - `@equinor/eds-tokens/js/color/dynamic/warning`
128
+ - `@equinor/eds-tokens/js/color/dynamic/danger`
129
+
130
+ :::note
131
+
132
+ The dynamic approach does **not** include a nested TypeScript format. Dynamic tokens are designed to be resolved at runtime via CSS variables and the `data-color-appearance` attribute. Use the CSS variables for dynamic usage and the JS constants when you need resolved values for a specific appearance.
133
+
134
+ :::
135
+
107
136
  ## Best Practices
108
137
 
109
138
  - **Use abstraction** -- Write CSS once, reuse with different appearances
@@ -72,6 +72,84 @@ Background fill-muted and fill-emphasis include state variants for hover and act
72
72
  }
73
73
  ```
74
74
 
75
+ ## TypeScript Tokens
76
+
77
+ The static color tokens are also available as a nested TypeScript object with full type safety and autocomplete. The object mirrors the CSS variable hierarchy using camelCase keys and `as const` for literal type inference.
78
+
79
+ ### Import
80
+
81
+ ```typescript
82
+ import { color } from '@equinor/eds-tokens/ts/color/static/semantic'
83
+ ```
84
+
85
+ ### Usage
86
+
87
+ Access tokens through dot notation with full autocomplete:
88
+
89
+ ```typescript
90
+ // Background tokens
91
+ color.bg.accent.canvas // resolved color value
92
+ color.bg.neutral.surface
93
+ color.bg.accent.fillMuted.default
94
+ color.bg.accent.fillMuted.hover
95
+
96
+ // Text tokens
97
+ color.text.accent.strong
98
+ color.text.neutral.subtleOnEmphasis
99
+
100
+ // Border tokens
101
+ color.border.danger.medium
102
+ color.border.accent.strong
103
+ ```
104
+
105
+ ### Example: Styled components / CSS-in-JS
106
+
107
+ ```typescript
108
+ import { color } from '@equinor/eds-tokens/ts/color/static/semantic'
109
+
110
+ const styles = {
111
+ backgroundColor: color.bg.accent.fillEmphasis.default,
112
+ color: color.text.accent.strongOnEmphasis,
113
+ borderColor: color.border.accent.strong,
114
+ }
115
+ ```
116
+
117
+ ### Example: Runtime token lookup
118
+
119
+ ```typescript
120
+ import { color } from '@equinor/eds-tokens/ts/color/static/semantic'
121
+
122
+ // Type-safe access to semantic categories
123
+ const categories = ['accent', 'neutral', 'danger'] as const
124
+
125
+ for (const cat of categories) {
126
+ console.log(color.bg[cat].canvas)
127
+ }
128
+ ```
129
+
130
+ ### Naming Conversion
131
+
132
+ CSS variable segments are converted to camelCase:
133
+
134
+ | CSS variable | TypeScript path |
135
+ |---|---|
136
+ | `--eds-color-bg-accent-canvas` | `color.bg.accent.canvas` |
137
+ | `--eds-color-bg-neutral-fill-muted-default` | `color.bg.neutral.fillMuted.default` |
138
+ | `--eds-color-text-success-strong-on-emphasis` | `color.text.success.strongOnEmphasis` |
139
+ | `--eds-color-border-danger-medium` | `color.border.danger.medium` |
140
+
141
+ ## JavaScript Tokens (Flat)
142
+
143
+ A flat ES6 export with `SCREAMING_SNAKE_CASE` constants is also available:
144
+
145
+ ```typescript
146
+ import {
147
+ BG_ACCENT_CANVAS,
148
+ TEXT_NEUTRAL_STRONG,
149
+ BORDER_DANGER_MEDIUM,
150
+ } from '@equinor/eds-tokens/js/color/static/semantic'
151
+ ```
152
+
75
153
  ## Best Practices
76
154
 
77
155
  - **Be explicit** -- Choose the specific semantic category your element needs
@@ -115,6 +115,19 @@ Both the static and dynamic libraries support light and dark modes automatically
115
115
  pnpm add @equinor/eds-tokens
116
116
  ```
117
117
 
118
+ ## Output Formats
119
+
120
+ The color tokens are available in multiple formats:
121
+
122
+ | Format | Import path | Use case |
123
+ |--------|-------------|----------|
124
+ | **CSS variables** | `@equinor/eds-tokens/css/variables` | Standard web styling |
125
+ | **TypeScript (nested)** | `@equinor/eds-tokens/ts/color/static/*` | Type-safe access with autocomplete |
126
+ | **JavaScript (flat)** | `@equinor/eds-tokens/js/color/static/*` | CSS-in-JS, utilities |
127
+ | **JSON** | `@equinor/eds-tokens/json/color/*` | Tooling, custom transforms |
128
+
129
+ See the static and dynamic guides for format-specific usage examples.
130
+
118
131
  ## Next Steps
119
132
 
120
133
  Choose your approach and refer to the specific guide: