@pantheon-systems/pds-design-tokens 2.0.0-alpha.6 → 2.0.0-alpha.60
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 +53 -40
- package/build/css/breakpoints.css +5 -5
- package/build/css/fonts.css +1 -1
- package/build/css/variables.dark.css +400 -208
- package/build/css/variables.global.css +53 -80
- package/build/css/variables.light.css +405 -215
- package/build/css/variables.typography.css +36 -0
- package/build/figma/tokens.json +12624 -6886
- package/build/js/variables.global.d.ts +110 -0
- package/build/js/variables.global.js +110 -0
- package/build/js/variables.typography.d.ts +67 -0
- package/build/js/variables.typography.js +54 -0
- package/build/json/tokens.json +708 -534
- package/codemods/v1-to-v2/README.md +203 -0
- package/codemods/v1-to-v2/generate-migration-guide.js +384 -0
- package/codemods/v1-to-v2/mappings.json +1645 -0
- package/codemods/v1-to-v2/validate.js +132 -0
- package/package.json +25 -4
- package/build/css/variables.compact.css +0 -17
- package/build/css/variables.expanded.css +0 -17
- package/build/js/variables.d.ts +0 -153
- package/build/js/variables.js +0 -153
package/README.md
CHANGED
|
@@ -30,9 +30,8 @@ Import the token files you need:
|
|
|
30
30
|
@import '@pantheon-systems/pds-design-tokens/build/css/variables.light.css';
|
|
31
31
|
@import '@pantheon-systems/pds-design-tokens/build/css/variables.dark.css';
|
|
32
32
|
|
|
33
|
-
/* Required: Typography
|
|
34
|
-
@import '@pantheon-systems/pds-design-tokens/build/css/variables.
|
|
35
|
-
@import '@pantheon-systems/pds-design-tokens/build/css/variables.expanded.css';
|
|
33
|
+
/* Required: Typography sizes */
|
|
34
|
+
@import '@pantheon-systems/pds-design-tokens/build/css/variables.typography.css';
|
|
36
35
|
```
|
|
37
36
|
|
|
38
37
|
Use tokens in your styles:
|
|
@@ -42,19 +41,28 @@ Use tokens in your styles:
|
|
|
42
41
|
color: var(--pds-color-fg-default);
|
|
43
42
|
background: var(--pds-color-bg-default);
|
|
44
43
|
padding: var(--pds-spacing-m);
|
|
45
|
-
font-family: var(--pds-typography-ff-
|
|
44
|
+
font-family: var(--pds-typography-ff-default);
|
|
46
45
|
}
|
|
47
46
|
```
|
|
48
47
|
|
|
49
|
-
#### Using Breakpoints
|
|
48
|
+
#### Using Breakpoints
|
|
50
49
|
|
|
51
|
-
Breakpoint custom media queries require PostCSS configuration
|
|
50
|
+
Breakpoint custom media queries require PostCSS configuration and a CSS import.
|
|
51
|
+
|
|
52
|
+
**Step 1: Install required plugins**
|
|
52
53
|
|
|
53
54
|
```bash
|
|
54
55
|
npm install postcss-custom-media @csstools/postcss-global-data --save-dev
|
|
55
56
|
```
|
|
56
57
|
|
|
57
|
-
|
|
58
|
+
**Step 2: Import breakpoints in your global CSS file**
|
|
59
|
+
|
|
60
|
+
```css
|
|
61
|
+
/* In your main/global CSS file */
|
|
62
|
+
@import '@pantheon-systems/pds-design-tokens/build/css/breakpoints.css';
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
**Step 3: Configure PostCSS**
|
|
58
66
|
|
|
59
67
|
```javascript
|
|
60
68
|
// postcss.config.js
|
|
@@ -74,7 +82,7 @@ export default {
|
|
|
74
82
|
};
|
|
75
83
|
```
|
|
76
84
|
|
|
77
|
-
Use breakpoints in your CSS
|
|
85
|
+
**Step 4: Use breakpoints in your CSS**
|
|
78
86
|
|
|
79
87
|
```css
|
|
80
88
|
.my-component {
|
|
@@ -90,39 +98,60 @@ Use breakpoints in your CSS without imports:
|
|
|
90
98
|
|
|
91
99
|
### JavaScript Constants
|
|
92
100
|
|
|
93
|
-
Import tokens as JavaScript constants:
|
|
101
|
+
Import tokens as JavaScript constants from the appropriate file:
|
|
94
102
|
|
|
95
103
|
```javascript
|
|
104
|
+
// Import global tokens (colors, borders, spacing, z-index, etc.)
|
|
96
105
|
import {
|
|
97
|
-
|
|
106
|
+
BORDER_RADIUS_DEFAULT,
|
|
98
107
|
SPACING_M,
|
|
108
|
+
Z_INDEX_MODAL,
|
|
109
|
+
} from '@pantheon-systems/pds-design-tokens/build/js/variables.global.js';
|
|
110
|
+
|
|
111
|
+
// Import typography tokens (font families, weights, sizes, line heights, letter spacing)
|
|
112
|
+
import {
|
|
99
113
|
TYPOGRAPHY_FF_SANS,
|
|
114
|
+
TYPOGRAPHY_FW_BOLD,
|
|
100
115
|
TYPOGRAPHY_SIZE_XL,
|
|
101
|
-
|
|
116
|
+
TYPOGRAPHY_LH_M,
|
|
117
|
+
} from '@pantheon-systems/pds-design-tokens/build/js/variables.typography.js';
|
|
102
118
|
|
|
103
119
|
const styles = {
|
|
104
|
-
color: COLOR_FG_DEFAULT,
|
|
105
120
|
padding: SPACING_M,
|
|
106
121
|
fontFamily: TYPOGRAPHY_FF_SANS,
|
|
122
|
+
fontWeight: TYPOGRAPHY_FW_BOLD,
|
|
107
123
|
fontSize: TYPOGRAPHY_SIZE_XL,
|
|
124
|
+
lineHeight: TYPOGRAPHY_LH_M,
|
|
125
|
+
borderRadius: BORDER_RADIUS_DEFAULT,
|
|
108
126
|
};
|
|
109
127
|
```
|
|
110
128
|
|
|
111
|
-
**Note:** All values are exported as strings with units (e.g., `SPACING_M = "1rem"`).
|
|
129
|
+
**Note:** All values are exported as strings with units (e.g., `SPACING_M = "1rem"`, `TYPOGRAPHY_SIZE_XL = "1.25rem"`).
|
|
130
|
+
|
|
131
|
+
**File organization:**
|
|
132
|
+
|
|
133
|
+
- `variables.global.js` - Global tokens (colors, borders, spacing scale, z-index, animations, etc.)
|
|
134
|
+
- `variables.typography.js` - Typography tokens (font families, weights, sizes, line heights, letter spacing)
|
|
112
135
|
|
|
113
136
|
#### Spacing Scale Object
|
|
114
137
|
|
|
115
|
-
For convenience, spacing scale tokens (8XS → 8XL) are
|
|
138
|
+
For convenience, spacing scale tokens (8XS → 8XL) are available as a grouped object in the global file:
|
|
116
139
|
|
|
117
140
|
```javascript
|
|
118
|
-
import { SPACING } from '@pantheon-systems/pds-design-tokens/build/js/variables.js';
|
|
141
|
+
import { SPACING } from '@pantheon-systems/pds-design-tokens/build/js/variables.global.js';
|
|
119
142
|
|
|
120
|
-
// Access scale tokens via the object
|
|
121
143
|
const padding = SPACING.SPACING_M; // "1rem"
|
|
122
144
|
const margin = SPACING.SPACING_2XL; // "1.728rem"
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
#### Typography Scale Object
|
|
123
148
|
|
|
124
|
-
|
|
125
|
-
|
|
149
|
+
Typography size tokens are available as a grouped object:
|
|
150
|
+
|
|
151
|
+
```javascript
|
|
152
|
+
import { TYPOGRAPHY_SIZE } from '@pantheon-systems/pds-design-tokens/build/js/variables.typography.js';
|
|
153
|
+
|
|
154
|
+
const fontSize = TYPOGRAPHY_SIZE.TYPOGRAPHY_SIZE_XL; // "1.25rem"
|
|
126
155
|
```
|
|
127
156
|
|
|
128
157
|
### JSON
|
|
@@ -135,12 +164,12 @@ import tokens from '@pantheon-systems/pds-design-tokens/build/json/tokens.json';
|
|
|
135
164
|
|
|
136
165
|
## Available Formats
|
|
137
166
|
|
|
138
|
-
| Format | Location | Use Case
|
|
139
|
-
| ------------------------- | -------------- |
|
|
140
|
-
| **CSS Custom Properties** | `build/css/` | Styling (recommended)
|
|
141
|
-
| **JavaScript Constants** | `build/js/` | JS/TS when CSS variables can't be used
|
|
142
|
-
| **JSON** | `build/json/` | Programmatic access, build tools
|
|
143
|
-
| **Figma** | `build/figma/` | Design tool integration
|
|
167
|
+
| Format | Location | Use Case |
|
|
168
|
+
| ------------------------- | -------------- | -------------------------------------- |
|
|
169
|
+
| **CSS Custom Properties** | `build/css/` | Styling (recommended) |
|
|
170
|
+
| **JavaScript Constants** | `build/js/` | JS/TS when CSS variables can't be used |
|
|
171
|
+
| **JSON** | `build/json/` | Programmatic access, build tools |
|
|
172
|
+
| **Figma** | `build/figma/` | Design tool integration |
|
|
144
173
|
|
|
145
174
|
## Theming
|
|
146
175
|
|
|
@@ -160,22 +189,6 @@ Control color themes with the `data-theme` attribute:
|
|
|
160
189
|
</body>
|
|
161
190
|
```
|
|
162
191
|
|
|
163
|
-
### Type Scale (Compact/Expanded)
|
|
164
|
-
|
|
165
|
-
Control typography scale with the `data-scale` attribute:
|
|
166
|
-
|
|
167
|
-
```html
|
|
168
|
-
<!-- Compact scale (default) -->
|
|
169
|
-
<body data-scale="compact">
|
|
170
|
-
<h1 style="font-size: var(--pds-typography-size-xl);">Compact</h1>
|
|
171
|
-
</body>
|
|
172
|
-
|
|
173
|
-
<!-- Expanded scale -->
|
|
174
|
-
<body data-scale="expanded">
|
|
175
|
-
<h1 style="font-size: var(--pds-typography-size-xl);">Expanded</h1>
|
|
176
|
-
</body>
|
|
177
|
-
```
|
|
178
|
-
|
|
179
192
|
## Token Categories
|
|
180
193
|
|
|
181
194
|
- **Animation** - Durations, delays, timing functions
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
/* Standard min-width queries (mobile-first) */
|
|
6
|
-
@custom-media --pds-bp-
|
|
7
|
-
@custom-media --pds-bp-
|
|
6
|
+
@custom-media --pds-bp-m (min-width: 768px);
|
|
7
|
+
@custom-media --pds-bp-l (min-width: 1280px);
|
|
8
8
|
@custom-media --pds-bp-xl (min-width: 1440px);
|
|
9
9
|
|
|
10
10
|
/* Range queries (specific breakpoint only) */
|
|
11
|
-
@custom-media --pds-bp-
|
|
12
|
-
@custom-media --pds-bp-
|
|
13
|
-
@custom-media --pds-bp-
|
|
11
|
+
@custom-media --pds-bp-s-only (max-width: 767px);
|
|
12
|
+
@custom-media --pds-bp-m-only (min-width: 768px) and (max-width: 1279px);
|
|
13
|
+
@custom-media --pds-bp-l-only (min-width: 1280px) and (max-width: 1439px);
|
package/build/css/fonts.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
@import url('https://fonts.googleapis.com/css2?family=
|
|
1
|
+
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Serif:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;1,100;1,200;1,300;1,400;1,500;1,600;1,700&family=Inter+Tight:ital,wght@0,100..900;1,100..900&family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&family=Source+Code+Pro:ital,wght@0,200..900;1,200..900&display=swap');
|