Skip to content

Commit 7621866

Browse files
feat(eds-core-react, eds-tokens)!: add spacing foundation variables, fix names in old variables and remove density specific spacing variables. eds-tokens package is now a peerDependency in eds-core-react to support using the new variables. (#4200)
1 parent 278d9e9 commit 7621866

92 files changed

Lines changed: 6337 additions & 9773 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ module.exports = {
167167
files: [
168168
'**/playwright.config.ts',
169169
'**/vite.config.ts',
170+
'**/vite.*.config.ts',
170171
'**/vitest.config.ts',
171172
],
172173
rules: {

packages/eds-core-react/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Read the [changelog](https://github.com/equinor/design-system/blob/main/packages
88
## Installation
99

1010
```sh
11-
npm install @equinor/eds-core-react styled-components
11+
npm install @equinor/eds-core-react @equinor/eds-tokens styled-components
1212
```
1313
If you use Typescript, make sure you have typescript >= 3.8 as a devDependency:
1414
```sh

packages/eds-core-react/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@
9595
"peerDependencies": {
9696
"react": "^19",
9797
"react-dom": "^19",
98-
"styled-components": "^6"
98+
"styled-components": "^6",
99+
"@equinor/eds-tokens": "^2"
99100
},
100101
"dependencies": {
101102
"@babel/runtime": "^7.28.4",
Lines changed: 29 additions & 220 deletions
Original file line numberDiff line numberDiff line change
@@ -1,271 +1,80 @@
11
/* Demo-specific styles for Spacing stories */
22

3-
/* Container styles */
4-
.spacing-demo-container {
3+
.flex {
54
display: flex;
6-
flex-direction: column;
7-
gap: 2rem;
8-
}
9-
10-
.spacing-demo-row {
11-
display: flex;
12-
flex-direction: row;
13-
flex-wrap: wrap;
14-
gap: 1.5rem;
15-
}
16-
17-
.spacing-demo-item {
18-
display: flex;
19-
flex-direction: column;
20-
gap: 0.5rem;
21-
min-width: 120px;
225
}
236

24-
.spacing-demo-density-section {
25-
display: flex;
7+
.flex-col {
268
flex-direction: column;
27-
gap: 2rem;
289
}
2910

30-
.spacing-demo-density-container {
31-
display: flex;
32-
flex-direction: column;
33-
gap: 1rem;
34-
}
35-
36-
.spacing-demo-flex {
37-
display: flex;
11+
.flex-row {
3812
flex-direction: row;
3913
}
4014

41-
/* Typography styles */
42-
.spacing-demo-heading {
43-
margin: 0 0 1rem 0;
44-
font-size: 1.5rem;
45-
font-weight: 600;
15+
.flex-wrap {
16+
flex-wrap: wrap;
4617
}
4718

48-
.spacing-demo-subheading {
49-
margin: 0 0 0.75rem 0;
50-
font-size: 1.125rem;
51-
font-weight: 600;
19+
.items-start {
20+
align-items: flex-start;
5221
}
5322

54-
.spacing-demo-label {
55-
margin: 0 0 0.5rem 0;
56-
font-size: 0.875rem;
57-
color: var(--eds-color-text-neutral-subtle);
23+
/* Margin-bottom utilities (4px grid) */
24+
.mb-2 {
25+
margin-bottom: 0.5rem; /* 8px */
5826
}
5927

60-
.spacing-demo-text {
61-
margin: 0 0 1rem 0;
62-
font-size: 0.875rem;
63-
color: var(--eds-color-text-neutral-subtle);
28+
.mb-3 {
29+
margin-bottom: 0.75rem; /* 12px */
6430
}
6531

66-
/* Box demo styles */
67-
.spacing-demo-box-container {
68-
display: flex;
69-
flex-direction: row;
70-
align-items: center;
71-
}
72-
73-
.spacing-demo-box-container-column {
74-
display: flex;
75-
flex-direction: column;
32+
.mb-4 {
33+
margin-bottom: 1rem; /* 16px */
7634
}
7735

7836
.spacing-demo-box {
79-
width: 40px;
80-
height: 40px;
81-
background-color: var(--eds-color-bg-accent-fill-emphasis-default);
82-
border: 1px solid var(--eds-color-border-accent-strong);
83-
}
84-
85-
.spacing-demo-box-horizontal {
86-
width: 100%;
87-
height: 40px;
88-
background-color: var(--eds-color-bg-accent-fill-emphasis-default);
89-
border: 1px solid var(--eds-color-border-accent-strong);
90-
}
91-
92-
/* Inset demo styles */
93-
.spacing-demo-inset {
9437
display: inline-block;
95-
background-color: var(--eds-color-bg-neutral-fill-muted-default);
96-
border: 1px solid var(--eds-color-border-neutral-medium);
97-
color: var(--eds-color-text-neutral-strong);
38+
background-color: var(--eds-color-bg-accent-fill-muted-default);
39+
border: 1px solid var(--eds-color-border-accent-medium);
40+
color: var(--eds-color-text-accent-strong);
9841
text-align: center;
9942
white-space: nowrap;
43+
width: fit-content;
44+
max-width: 100%;
10045
}
10146

102-
/* Border radius demo styles */
103-
.spacing-demo-border-none,
104-
.spacing-demo-border-rounded,
105-
.spacing-demo-border-pill {
106-
display: inline-block;
107-
padding: 0.75rem 1.5rem;
108-
background-color: var(--eds-color-bg-neutral-fill-muted-default);
109-
border: 1px solid var(--eds-color-border-neutral-medium);
110-
color: var(--eds-color-text-neutral-strong);
111-
text-align: center;
112-
font-size: 0.875rem;
113-
}
114-
115-
/* Icon demo styles */
116-
.spacing-demo-icon {
117-
display: flex;
118-
flex-direction: row;
119-
align-items: center;
47+
.size-32 {
48+
width: 32px;
49+
height: 32px;
12050
}
12151

122-
.spacing-demo-icon-box {
123-
width: 1em;
124-
height: 1em;
125-
background-color: var(--eds-color-bg-accent-fill-emphasis-default);
126-
border: 1px solid var(--eds-color-border-accent-strong);
127-
flex-shrink: 0;
128-
}
129-
130-
.spacing-demo-icon-xs {
131-
font-size: 0.75rem;
132-
}
133-
134-
.spacing-demo-icon-sm {
135-
font-size: 0.875rem;
136-
}
137-
138-
.spacing-demo-icon-md {
139-
font-size: 1rem;
140-
}
141-
142-
.spacing-demo-icon-lg {
143-
font-size: 1.125rem;
144-
}
145-
146-
.spacing-demo-icon-xl {
147-
font-size: 1.25rem;
148-
}
149-
150-
.spacing-demo-icon-2xl {
151-
font-size: 1.5rem;
52+
.spacing-demo-button-primary,
53+
.spacing-demo-button-secondary {
54+
border-width: 1px;
55+
border-style: solid;
56+
cursor: pointer;
15257
}
15358

154-
/* Button demo styles */
15559
.spacing-demo-button-primary {
15660
background-color: var(--eds-color-bg-accent-fill-emphasis-default);
15761
color: var(--eds-color-text-accent-strong-on-emphasis);
158-
border: 1px solid var(--eds-color-border-accent-strong);
159-
cursor: pointer;
62+
border-color: var(--eds-color-border-accent-strong);
16063
}
16164

16265
.spacing-demo-button-secondary {
16366
background-color: var(--eds-color-bg-neutral-surface);
16467
color: var(--eds-color-text-neutral-strong);
165-
border: 1px solid var(--eds-color-border-neutral-medium);
166-
cursor: pointer;
68+
border-color: var(--eds-color-border-neutral-medium);
16769
}
16870

16971
.spacing-demo-button-primary:hover,
17072
.spacing-demo-button-secondary:hover {
17173
opacity: 0.9;
17274
}
17375

174-
/* Card demo styles */
17576
.spacing-demo-card {
17677
background-color: var(--eds-color-bg-neutral-surface);
17778
border: 1px solid var(--eds-color-border-neutral-medium);
17879
max-width: 400px;
17980
}
180-
181-
.spacing-demo-card-content {
182-
display: flex;
183-
flex-direction: column;
184-
}
185-
186-
.spacing-demo-card-title {
187-
margin: 0;
188-
font-size: 1.125rem;
189-
font-weight: 600;
190-
color: var(--eds-color-text-neutral-strong);
191-
}
192-
193-
.spacing-demo-card-text {
194-
margin: 0;
195-
font-size: 0.875rem;
196-
color: var(--eds-color-text-neutral-subtle);
197-
}
198-
199-
.spacing-demo-card-actions {
200-
display: flex;
201-
flex-direction: row;
202-
}
203-
204-
/* Form demo styles */
205-
.spacing-demo-form {
206-
display: flex;
207-
flex-direction: column;
208-
max-width: 300px;
209-
}
210-
211-
.spacing-demo-form-field {
212-
display: flex;
213-
flex-direction: column;
214-
}
215-
216-
.spacing-demo-form-label {
217-
margin: 0 0 0.25rem 0;
218-
font-size: 0.875rem;
219-
font-weight: 500;
220-
color: var(--eds-color-text-neutral-strong);
221-
}
222-
223-
.spacing-demo-form-input {
224-
background-color: var(--eds-color-bg-input);
225-
border: 1px solid var(--eds-color-border-neutral-medium);
226-
color: var(--eds-color-text-neutral-strong);
227-
font-size: 0.875rem;
228-
outline: none;
229-
}
230-
231-
.spacing-demo-form-input:focus {
232-
border-color: var(--eds-color-border-focus);
233-
}
234-
235-
.spacing-demo-form-submit {
236-
background-color: var(--eds-color-bg-accent-fill-emphasis-default);
237-
color: var(--eds-color-text-accent-strong-on-emphasis);
238-
border: 1px solid var(--eds-color-border-accent-strong);
239-
cursor: pointer;
240-
}
241-
242-
.spacing-demo-form-submit:hover {
243-
opacity: 0.9;
244-
}
245-
246-
/* Navigation demo styles */
247-
.spacing-demo-nav {
248-
background-color: var(--eds-color-bg-neutral-surface);
249-
border: 1px solid var(--eds-color-border-neutral-medium);
250-
max-width: 200px;
251-
}
252-
253-
.spacing-demo-nav-list {
254-
margin: 0;
255-
padding: 0;
256-
list-style: none;
257-
display: flex;
258-
flex-direction: column;
259-
}
260-
261-
.spacing-demo-nav-item {
262-
display: block;
263-
padding: 0.5rem;
264-
color: var(--eds-color-text-link);
265-
text-decoration: none;
266-
font-size: 0.875rem;
267-
}
268-
269-
.spacing-demo-nav-item:hover {
270-
background-color: var(--eds-color-bg-neutral-fill-muted-default);
271-
}

0 commit comments

Comments
 (0)