@equinor/eds-tokens 1.1.3 → 2.0.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.
- package/README.md +191 -0
- package/build/css/color/color-scheme/color-scheme.css +2 -2
- package/build/css/color/color-scheme/dark-color-scheme-trimmed.css +1 -1
- package/build/css/color/color-scheme/dark-semantic-trimmed.css +1 -1
- package/build/css/color/color-scheme/light-color-scheme-trimmed.css +1 -1
- package/build/css/color/color-scheme/light-semantic-trimmed.css +1 -1
- package/build/css/foundation.css +443 -0
- package/build/css/foundation.min.css +1 -0
- package/build/css/index-variables.css +12 -2
- package/build/css/spacing/comfortable-trimmed.css +40 -40
- package/build/css/spacing/comfortable-verbose.css +34 -34
- package/build/css/spacing/primitives-trimmed.css +22 -22
- package/build/css/spacing/selectable-space-lg.css +8 -0
- package/build/css/spacing/selectable-space-md.css +8 -0
- package/build/css/spacing/selectable-space-sm.css +8 -0
- package/build/css/spacing/selectable-space-xl.css +8 -0
- package/build/css/spacing/selectable-space-xs.css +8 -0
- package/build/css/spacing/space-proportions-squared.css +16 -0
- package/build/css/spacing/space-proportions-squished.css +16 -0
- package/build/css/spacing/space-proportions-stretched.css +16 -0
- package/build/css/spacing/spacing-trimmed.css +40 -40
- package/build/css/spacing/spacing-verbose.css +34 -34
- package/build/css/spacing/spacious-trimmed.css +40 -40
- package/build/css/spacing/spacious-verbose.css +34 -34
- package/build/css/spacing.css +116 -0
- package/build/css/typography.css +546 -0
- package/build/css/variables.css +591 -274
- package/build/css/variables.min.css +1 -1
- package/build/js/color/color-scheme/dark-color-scheme.js +1 -1
- package/build/js/color/color-scheme/dark-semantic.js +1 -1
- package/build/js/color/color-scheme/light-color-scheme.js +1 -1
- package/build/js/color/color-scheme/light-semantic.js +1 -1
- package/build/js/color/dynamic/semantic-danger.js +1 -1
- package/build/js/color/static/semantic.js +1 -1
- package/build/js/spacing/comfortable.d.ts +40 -40
- package/build/js/spacing/comfortable.js +40 -40
- package/build/js/spacing/primitives.d.ts +22 -22
- package/build/js/spacing/primitives.js +22 -22
- package/build/js/spacing/spacious.d.ts +40 -40
- package/build/js/spacing/spacious.js +40 -40
- package/build/json/color/color-scheme/flat/dark-color-scheme.json +1 -1
- package/build/json/color/color-scheme/flat/dark-semantic.json +1 -1
- package/build/json/color/color-scheme/flat/light-color-scheme.json +1 -1
- package/build/json/color/color-scheme/flat/light-semantic.json +1 -1
- package/build/json/color/color-scheme/nested/dark-color-scheme.json +1 -1
- package/build/json/color/color-scheme/nested/dark-semantic.json +1 -1
- package/build/json/color/color-scheme/nested/light-color-scheme.json +1 -1
- package/build/json/color/color-scheme/nested/light-semantic.json +1 -1
- package/build/json/color/dynamic/flat/semantic-danger.json +1 -1
- package/build/json/color/dynamic/nested/semantic-danger.json +1 -1
- package/build/json/color/static/flat/semantic.json +1 -1
- package/build/json/color/static/nested/semantic.json +1 -1
- package/build/json/spacing/flat/comfortable.json +40 -40
- package/build/json/spacing/flat/primitives.json +22 -22
- package/build/json/spacing/flat/spacious.json +40 -40
- package/build/json/spacing/nested/comfortable.json +44 -44
- package/build/json/spacing/nested/primitives.json +22 -22
- package/build/json/spacing/nested/spacious.json +44 -44
- package/dist/types/generate-variables/createSpacingAndTypographyVariables.d.ts +1 -1
- package/package.json +20 -19
package/README.md
CHANGED
|
@@ -142,6 +142,197 @@ The spacing system supports different density modes:
|
|
|
142
142
|
* `comfortable` -- Default density for most applications
|
|
143
143
|
* `spacious` -- Increased spacing for better readability
|
|
144
144
|
|
|
145
|
+
### Foundation CSS (Typography & Spacing)
|
|
146
|
+
|
|
147
|
+
The foundation stylesheet provides typography and spacing styles for the EDS design system. This includes utility classes and data attributes for:
|
|
148
|
+
|
|
149
|
+
* **Typography:** Font families, sizes, weights, line heights, letter spacing, and baseline alignment
|
|
150
|
+
* **Spacing:** Inline spacing, stack spacing, inset spacing (padding), border radius, and icon spacing
|
|
151
|
+
|
|
152
|
+
> **Note:** The foundation CSS includes typography and spacing utility classes. For CSS variables (colors, spacing variables, typography variables), import `@equinor/eds-tokens/css/variables` separately.
|
|
153
|
+
|
|
154
|
+
#### Import Foundation CSS
|
|
155
|
+
|
|
156
|
+
```css
|
|
157
|
+
@import '@equinor/eds-tokens/css/foundation';
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
Or in JavaScript/TypeScript:
|
|
161
|
+
|
|
162
|
+
```tsx
|
|
163
|
+
import '@equinor/eds-tokens/css/foundation.css'
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
The foundation stylesheet includes:
|
|
167
|
+
|
|
168
|
+
* **Typography Styles** -- Complete typography system with:
|
|
169
|
+
* Font family setup (UI and Header fonts)
|
|
170
|
+
* Font size utilities (`text-xs`, `text-sm`, `text-md`, etc.)
|
|
171
|
+
* Line height utilities (`line-height-default`, `line-height-squished`)
|
|
172
|
+
* Font weight utilities (`font-lighter`, `font-normal`, `font-bolder`)
|
|
173
|
+
* Letter spacing utilities (`tracking-tight`, `tracking-normal`, `tracking-wide`)
|
|
174
|
+
* Baseline grid alignment (`text-baseline-grid`, `text-baseline-center`)
|
|
175
|
+
* Icon sizing utilities (`.text-icon`)
|
|
176
|
+
|
|
177
|
+
* **Spacing Utilities** -- Complete spacing system with:
|
|
178
|
+
* Inline spacing utilities (`spacing-inline-xs`, `spacing-inline-sm`, `spacing-inline-md`, etc.) for horizontal spacing between elements
|
|
179
|
+
* Stack spacing utilities (`spacing-stack-xs`, `spacing-stack-sm`, `spacing-stack-md`, etc.) for vertical spacing between stacked elements
|
|
180
|
+
* Inset spacing utilities (`spacing-inset-xs-inline`, `spacing-inset-md-squared`, etc.) for padding within elements
|
|
181
|
+
* Border radius utilities (`spacing-border-radius-rounded`, `spacing-border-radius-pill`, `spacing-border-radius-none`)
|
|
182
|
+
* Icon spacing utilities (`spacing-icon-gap-xs`, `spacing-icon-gap-sm`, etc.) for spacing between icons and text
|
|
183
|
+
|
|
184
|
+
> **For EDS React components:** When using `@equinor/eds-core-react`, you need to import both the CSS variables and foundation CSS:
|
|
185
|
+
>
|
|
186
|
+
> ```tsx
|
|
187
|
+
> import '@equinor/eds-tokens/css/variables.css'
|
|
188
|
+
> import '@equinor/eds-tokens/css/foundation.css'
|
|
189
|
+
> ```
|
|
190
|
+
|
|
191
|
+
#### Using Typography Classes
|
|
192
|
+
|
|
193
|
+
The foundation CSS provides utility classes and data attributes for typography:
|
|
194
|
+
|
|
195
|
+
```html
|
|
196
|
+
<!-- Using data attributes -->
|
|
197
|
+
<div data-font-family="ui" data-text-size="md" data-line-height="default">
|
|
198
|
+
UI font text
|
|
199
|
+
</div>
|
|
200
|
+
|
|
201
|
+
<div data-font-family="header" data-text-size="xl" data-font-weight="bolder">
|
|
202
|
+
Header font text
|
|
203
|
+
</div>
|
|
204
|
+
|
|
205
|
+
<!-- Using utility classes -->
|
|
206
|
+
<div class="font-ui text-md line-height-default">
|
|
207
|
+
UI font text
|
|
208
|
+
</div>
|
|
209
|
+
|
|
210
|
+
<div class="font-heading text-xl font-bolder">
|
|
211
|
+
Header font text
|
|
212
|
+
</div>
|
|
213
|
+
|
|
214
|
+
<!-- Baseline grid alignment -->
|
|
215
|
+
<div class="font-ui text-md text-baseline-grid">
|
|
216
|
+
Aligned to 4px baseline grid
|
|
217
|
+
</div>
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
#### Using Spacing Classes
|
|
221
|
+
|
|
222
|
+
The foundation CSS provides utility classes and data attributes for spacing:
|
|
223
|
+
|
|
224
|
+
```html
|
|
225
|
+
<!-- Inline spacing - horizontal spacing between elements -->
|
|
226
|
+
<div class="spacing-inline-md">
|
|
227
|
+
<!-- Uses gap property for horizontal spacing -->
|
|
228
|
+
<span>Item 1</span>
|
|
229
|
+
<span>Item 2</span>
|
|
230
|
+
</div>
|
|
231
|
+
|
|
232
|
+
<!-- Or using data attributes -->
|
|
233
|
+
<div data-spacing-inline="md">
|
|
234
|
+
<span>Item 1</span>
|
|
235
|
+
<span>Item 2</span>
|
|
236
|
+
</div>
|
|
237
|
+
|
|
238
|
+
<!-- Stack spacing - vertical spacing between stacked elements -->
|
|
239
|
+
<div class="spacing-stack-lg">
|
|
240
|
+
<!-- Uses gap property for vertical spacing -->
|
|
241
|
+
<div>Item 1</div>
|
|
242
|
+
<div>Item 2</div>
|
|
243
|
+
</div>
|
|
244
|
+
|
|
245
|
+
<!-- Or using data attributes -->
|
|
246
|
+
<div data-spacing-stack="lg">
|
|
247
|
+
<div>Item 1</div>
|
|
248
|
+
<div>Item 2</div>
|
|
249
|
+
</div>
|
|
250
|
+
|
|
251
|
+
<!-- Inset spacing - padding within elements -->
|
|
252
|
+
<div class="spacing-inset-md-squared">
|
|
253
|
+
<!-- Padding both inline and block -->
|
|
254
|
+
Content with padding
|
|
255
|
+
</div>
|
|
256
|
+
|
|
257
|
+
<div class="spacing-inset-sm-inline">
|
|
258
|
+
<!-- Padding only inline (horizontal) -->
|
|
259
|
+
Content with horizontal padding
|
|
260
|
+
</div>
|
|
261
|
+
|
|
262
|
+
<div class="spacing-inset-xs-stack-squished">
|
|
263
|
+
<!-- Padding only block (vertical), squished variant -->
|
|
264
|
+
Content with vertical padding
|
|
265
|
+
</div>
|
|
266
|
+
|
|
267
|
+
<!-- Using data attributes for inset -->
|
|
268
|
+
<div data-spacing-inset-size="md" data-spacing-inset-variation="squared">
|
|
269
|
+
Content with padding
|
|
270
|
+
</div>
|
|
271
|
+
|
|
272
|
+
<!-- Border radius -->
|
|
273
|
+
<div class="spacing-border-radius-rounded">
|
|
274
|
+
Rounded corners
|
|
275
|
+
</div>
|
|
276
|
+
|
|
277
|
+
<div class="spacing-border-radius-pill">
|
|
278
|
+
Pill-shaped (fully rounded)
|
|
279
|
+
</div>
|
|
280
|
+
|
|
281
|
+
<!-- Icon spacing -->
|
|
282
|
+
<div class="spacing-icon-gap-md">
|
|
283
|
+
<icon />Text with icon
|
|
284
|
+
</div>
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
#### Spacing Variables
|
|
288
|
+
|
|
289
|
+
The spacing system uses CSS custom properties that automatically adapt to density modes (comfortable/spacious). These variables are provided by the CSS variables stylesheet (`@equinor/eds-tokens/css/variables`):
|
|
290
|
+
|
|
291
|
+
```css
|
|
292
|
+
.my-custom-layout {
|
|
293
|
+
/* Use spacing variables */
|
|
294
|
+
gap: var(--eds-spacing-inline-md);
|
|
295
|
+
padding-inline: var(--eds-spacing-inset-md-inline);
|
|
296
|
+
padding-block: var(--eds-spacing-inset-md-stack-squared);
|
|
297
|
+
border-radius: var(--eds-spacing-border-radius-rounded);
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
.my-flex-container {
|
|
301
|
+
display: flex;
|
|
302
|
+
gap: var(--eds-spacing-inline-lg);
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
.my-stacked-container {
|
|
306
|
+
display: flex;
|
|
307
|
+
flex-direction: column;
|
|
308
|
+
gap: var(--eds-spacing-stack-md);
|
|
309
|
+
}
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
#### Typography Variables
|
|
313
|
+
|
|
314
|
+
The typography system uses CSS custom properties that are automatically set based on the font family and size. These variables are provided by the CSS variables stylesheet (`@equinor/eds-tokens/css/variables`):
|
|
315
|
+
|
|
316
|
+
```css
|
|
317
|
+
.my-custom-text {
|
|
318
|
+
/* Use typography variables */
|
|
319
|
+
font-family: var(--eds-typography-ui-body-font-family);
|
|
320
|
+
font-size: var(--eds-typography-ui-body-md-font-size);
|
|
321
|
+
line-height: var(--eds-typography-ui-body-md-lineheight-default);
|
|
322
|
+
font-weight: var(--eds-typography-ui-body-md-font-weight-normal);
|
|
323
|
+
letter-spacing: var(--eds-typography-ui-body-md-tracking-normal);
|
|
324
|
+
}
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
#### Baseline Grid Alignment
|
|
328
|
+
|
|
329
|
+
The foundation CSS includes baseline grid alignment for consistent vertical rhythm:
|
|
330
|
+
|
|
331
|
+
* `text-baseline-grid` -- Aligns text baseline to 4px grid intervals
|
|
332
|
+
* `text-baseline-center` -- Centers text vertically while maintaining 4px grid alignment
|
|
333
|
+
|
|
334
|
+
These utilities use modern CSS features (`text-box-trim`) and gracefully degrade in older browsers.
|
|
335
|
+
|
|
145
336
|
---
|
|
146
337
|
|
|
147
338
|
## Legacy Tokens (Backward Compatible)
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
--eds-color-success-4: light-dark(#bbe0b8, #3e793c);
|
|
69
69
|
--eds-color-success-5: light-dark(#a2d49e, #418e3e);
|
|
70
70
|
--eds-color-success-6: light-dark(#bbe0b8, #3c673a);
|
|
71
|
-
--eds-color-success-7: light-dark(#7cc278, #
|
|
71
|
+
--eds-color-success-7: light-dark(#7cc278, #439941);
|
|
72
72
|
--eds-color-success-8: light-dark(#227e22, #6eca6a);
|
|
73
73
|
--eds-color-success-9: light-dark(#207720, #8cdb87);
|
|
74
74
|
--eds-color-success-10: light-dark(#20621f, #aceba8);
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
--eds-color-danger-4: light-dark(#ffbcba, #b03940);
|
|
99
99
|
--eds-color-danger-5: light-dark(#ffa3a1, #d43745);
|
|
100
100
|
--eds-color-danger-6: light-dark(#ffbcba, #923a3c);
|
|
101
|
-
--eds-color-danger-7: light-dark(#
|
|
101
|
+
--eds-color-danger-7: light-dark(#ff7a7d, #e53748);
|
|
102
102
|
--eds-color-danger-8: light-dark(#c6002d, #ff8082);
|
|
103
103
|
--eds-color-danger-9: light-dark(#bc002a, #ffa3a1);
|
|
104
104
|
--eds-color-danger-10: light-dark(#9a1026, #ffc1bf);
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
--eds-color-success-4: #3e793c;
|
|
60
60
|
--eds-color-success-5: #418e3e;
|
|
61
61
|
--eds-color-success-6: #3c673a;
|
|
62
|
-
--eds-color-success-7: #
|
|
62
|
+
--eds-color-success-7: #439941;
|
|
63
63
|
--eds-color-success-8: #6eca6a;
|
|
64
64
|
--eds-color-success-9: #8cdb87;
|
|
65
65
|
--eds-color-success-10: #aceba8;
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
--eds-color-border-accent-medium: #439199;
|
|
59
59
|
--eds-color-border-accent-strong: #6ec0c9;
|
|
60
60
|
--eds-color-border-success-subtle: #3c673a;
|
|
61
|
-
--eds-color-border-success-medium: #
|
|
61
|
+
--eds-color-border-success-medium: #439941;
|
|
62
62
|
--eds-color-border-success-strong: #6eca6a;
|
|
63
63
|
--eds-color-border-info-subtle: #33607e;
|
|
64
64
|
--eds-color-border-info-medium: #2d8bc5;
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
--eds-color-danger-4: #ffbcba;
|
|
90
90
|
--eds-color-danger-5: #ffa3a1;
|
|
91
91
|
--eds-color-danger-6: #ffbcba;
|
|
92
|
-
--eds-color-danger-7: #
|
|
92
|
+
--eds-color-danger-7: #ff7a7d;
|
|
93
93
|
--eds-color-danger-8: #c6002d;
|
|
94
94
|
--eds-color-danger-9: #bc002a;
|
|
95
95
|
--eds-color-danger-10: #9a1026;
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
--eds-color-border-warning-medium: #e89959;
|
|
68
68
|
--eds-color-border-warning-strong: #a34e00;
|
|
69
69
|
--eds-color-border-danger-subtle: #ffbcba;
|
|
70
|
-
--eds-color-border-danger-medium: #
|
|
70
|
+
--eds-color-border-danger-medium: #ff7a7d;
|
|
71
71
|
--eds-color-border-danger-strong: #c6002d;
|
|
72
72
|
--eds-color-text-neutral-subtle: #585858; /** Used for text and icons */
|
|
73
73
|
--eds-color-text-neutral-strong: #1d1d1d; /** Used for text and icons */
|