@pxglobal/boreal-style-guidelines 0.0.0-stage โ 0.14.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 +413 -2
- package/dist/css/boreal.css +1699 -0
- package/dist/css/global.css +731 -0
- package/dist/css/theme-connect.css +241 -0
- package/dist/css/theme-engage.css +241 -0
- package/dist/css/theme-protect.css +241 -0
- package/dist/css/theme-proximus.css +241 -0
- package/dist/scss/global/_fonts.scss +1 -0
- package/dist/scss/global/_index.scss +3 -0
- package/dist/scss/global/_reset.scss +50 -0
- package/dist/scss/global/_typography.scss +156 -0
- package/dist/scss/maps/_primitives.scss +510 -0
- package/dist/scss/maps/_theme-connect.scss +241 -0
- package/dist/scss/maps/_theme-engage.scss +241 -0
- package/dist/scss/maps/_theme-protect.scss +241 -0
- package/dist/scss/maps/_theme-proximus.scss +241 -0
- package/dist/scss/variables/_primitives.scss +508 -0
- package/dist/scss/variables/_theme-connect.scss +239 -0
- package/dist/scss/variables/_theme-engage.scss +239 -0
- package/dist/scss/variables/_theme-protect.scss +239 -0
- package/dist/scss/variables/_theme-proximus.scss +239 -0
- package/dist/stencil/_breakpoints.scss +5 -0
- package/dist/stencil/_index.scss +3 -0
- package/dist/stencil/_primitives.scss +508 -0
- package/dist/stencil/_theme.scss +239 -0
- package/package.json +75 -4
- package/src/tokens/primitives/primitives.json +2358 -0
- package/src/tokens/theme/connect.json +364 -0
- package/src/tokens/theme/engage.json +364 -0
- package/src/tokens/theme/protect.json +364 -0
- package/src/tokens/theme/proximus.json +364 -0
- package/src/tokens/usage/colors-themes.json +712 -0
package/README.md
CHANGED
|
@@ -1,3 +1,414 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Boreal Design System - Style Guidelines
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> **Status: alpha.** APIs may still change based on feedback. Breaking changes bump the minor version (`0.15.0`), so a default caret range (`^0.14.0`) receives fixes and features without breaking changes.
|
|
4
|
+
> Previously published as `@telesign/boreal-style-guidelines` (up to `0.1.0-alpha.3`); those packages are deprecated.
|
|
5
|
+
|
|
6
|
+
Multi-brand design token system for Proximus, Engage, Protect, and Connect projects.
|
|
7
|
+
|
|
8
|
+
## ๐จ Features
|
|
9
|
+
|
|
10
|
+
- **Primitive Tokens**: Color palettes, spacing, layouts, radii, etc.
|
|
11
|
+
- **Multi-Brand Themes**: Support for 4 different brands
|
|
12
|
+
- **CSS Custom Properties**: CSS variables that change based on `data-theme`
|
|
13
|
+
- **SCSS Variables**: For use in Stencil components
|
|
14
|
+
- **Configurable Prefix**: Easily modify custom property prefix
|
|
15
|
+
- **Automatic Validation**: Ensures all generated tokens are valid
|
|
16
|
+
|
|
17
|
+
## โจ What's New in 0.0.2
|
|
18
|
+
|
|
19
|
+
- **Stencil Generator**: New SCSS variables that wrap CSS custom properties for Stencil integration
|
|
20
|
+
- **Global Generator**: Automatically compiles global SCSS files (reset, grid, etc.)
|
|
21
|
+
- **Fixed Variable References**: SCSS and CSS outputs now preserve variable references instead of resolving to values
|
|
22
|
+
- **New Package Exports**: Added `./stencil`, `./scss`, and `./scss/global` entry points
|
|
23
|
+
- **DTCG Token Format**: Supports the Design Token Community Group format (`$type`/`$value`), `$extensions` are automatically ignored
|
|
24
|
+
- **Updated Theme Names**: Replaced `masiv` โ `engage`, `telesign` โ `protect`, `bics` โ `connect`
|
|
25
|
+
- **Token Key Sanitization**: Underscores in token keys (e.g. `font_size`) are automatically converted to hyphens (`font-size`)
|
|
26
|
+
- **@import Ordering**: `@import` statements are placed at the top of generated CSS files
|
|
27
|
+
|
|
28
|
+
Release notes are published on the Changelog page of the Boreal Storybook.
|
|
29
|
+
|
|
30
|
+
## ๐ฆ Installation
|
|
31
|
+
|
|
32
|
+
This package is part of the Boreal DS monorepo. Install all dependencies from the **workspace root**:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
# From monorepo root
|
|
36
|
+
pnpm install
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
To add a new dependency to this package specifically:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
# From monorepo root
|
|
43
|
+
pnpm add -D <package> --filter @pxglobal/boreal-style-guidelines
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## ๐จ Usage
|
|
47
|
+
|
|
48
|
+
### Generate CSS and SCSS Files
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
pnpm build
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
This command generates:
|
|
55
|
+
|
|
56
|
+
- `dist/css/global.css` - Global variables (primitives) + compiled global styles
|
|
57
|
+
- `dist/css/boreal.css` - Complete bundle with all themes and global styles
|
|
58
|
+
- `dist/css/theme-{themeName}.css` - Individual theme CSS
|
|
59
|
+
- `dist/scss/_index.scss` - Main SCSS entry point
|
|
60
|
+
- `dist/scss/variables/_index.scss` - SCSS variables
|
|
61
|
+
- `dist/scss/maps/_index.scss` - SCSS maps
|
|
62
|
+
- `dist/scss/global/_index.scss` - Global SCSS files (reset, etc.)
|
|
63
|
+
- `dist/stencil/_index.scss` - Stencil integration (SCSS vars wrapping CSS vars)
|
|
64
|
+
|
|
65
|
+
### Use in HTML
|
|
66
|
+
|
|
67
|
+
```html
|
|
68
|
+
<!DOCTYPE html>
|
|
69
|
+
<html data-theme="proximus">
|
|
70
|
+
<head>
|
|
71
|
+
<!-- Option 1: Load complete bundle -->
|
|
72
|
+
<link rel="stylesheet" href="dist/css/boreal.css" />
|
|
73
|
+
|
|
74
|
+
<!-- Option 2: Load global + specific theme -->
|
|
75
|
+
<link rel="stylesheet" href="dist/css/global.css" />
|
|
76
|
+
<link rel="stylesheet" href="dist/css/theme-proximus.css" />
|
|
77
|
+
</head>
|
|
78
|
+
<body>
|
|
79
|
+
<div
|
|
80
|
+
style="background: var(--boreal-primary-base); color: var(--boreal-white);"
|
|
81
|
+
>
|
|
82
|
+
Hello Proximus!
|
|
83
|
+
</div>
|
|
84
|
+
</body>
|
|
85
|
+
</html>
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Switch Themes Dynamically
|
|
89
|
+
|
|
90
|
+
```javascript
|
|
91
|
+
// Switch to Engage theme
|
|
92
|
+
document.documentElement.setAttribute("data-theme", "engage");
|
|
93
|
+
|
|
94
|
+
// Switch to Protect theme
|
|
95
|
+
document.documentElement.setAttribute("data-theme", "protect");
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## ๐ฏ Available Themes
|
|
99
|
+
|
|
100
|
+
- `proximus`
|
|
101
|
+
- `engage`
|
|
102
|
+
- `protect`
|
|
103
|
+
- `connect`
|
|
104
|
+
|
|
105
|
+
## ๐ง Stencil Integration
|
|
106
|
+
|
|
107
|
+
### Load Global Styles in project you use components, IMPORTANT: the stencil vars point to this.
|
|
108
|
+
### Go to use in projects to see more options to include in projects
|
|
109
|
+
|
|
110
|
+
In your `src/global/global.css` or `src/app.css`:
|
|
111
|
+
|
|
112
|
+
```css
|
|
113
|
+
/* Load complete bundle with all themes and global styles (reset, etc.) */
|
|
114
|
+
@import "@pxglobal/boreal-style-guidelines/dist/css/boreal.css";
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Configure SASS in Stencil
|
|
118
|
+
|
|
119
|
+
Install SASS (run from **monorepo root**):
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
pnpm add -D @stencil/sass --filter @pxglobal/boreal-web-components
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
In `stencil.config.ts`:
|
|
126
|
+
|
|
127
|
+
```typescript
|
|
128
|
+
import { Config } from "@stencil/core";
|
|
129
|
+
import { sass } from "@stencil/sass";
|
|
130
|
+
|
|
131
|
+
export const config: Config = {
|
|
132
|
+
plugins: [
|
|
133
|
+
sass({
|
|
134
|
+
includePaths: ["node_modules"],
|
|
135
|
+
}),
|
|
136
|
+
],
|
|
137
|
+
// ... rest of config
|
|
138
|
+
};
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Use in Projects
|
|
142
|
+
|
|
143
|
+
#### Option 1: CSS Variables
|
|
144
|
+
|
|
145
|
+
**my-component.css:**
|
|
146
|
+
|
|
147
|
+
```css
|
|
148
|
+
.btn-primary {
|
|
149
|
+
background: var(--boreal-ui-primary);
|
|
150
|
+
color: var(--boreal-white);
|
|
151
|
+
padding: var(--boreal-spatial-padding-s) var(--boreal-spatial-padding-m);
|
|
152
|
+
border-radius: var(--boreal-radius-s);
|
|
153
|
+
border: none;
|
|
154
|
+
cursor: pointer;
|
|
155
|
+
transition: background 0.2s;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.btn-primary:hover {
|
|
159
|
+
background: var(--boreal-ui-primary-dark);
|
|
160
|
+
}
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
#### Option 2: SCSS Variables (Recommended for only one themes and reuse)
|
|
164
|
+
|
|
165
|
+
**my-component.scss:**
|
|
166
|
+
|
|
167
|
+
```scss
|
|
168
|
+
// Option A: Use main SCSS entry point (includes variables, maps, and global)
|
|
169
|
+
@use "@pxglobal/boreal-style-guidelines/scss" as boreal;
|
|
170
|
+
|
|
171
|
+
// Option B: Use only variables
|
|
172
|
+
@use "@pxglobal/boreal-style-guidelines/scss/variables" as boreal;
|
|
173
|
+
|
|
174
|
+
.card {
|
|
175
|
+
background: boreal.$boreal-ui-default;
|
|
176
|
+
border-radius: boreal.$boreal-radius-m;
|
|
177
|
+
padding: boreal.$boreal-spatial-padding-m;
|
|
178
|
+
}
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
#### Stencil Integration (CSS vars wrapped in SCSS) IMPORTANT: Dev Components
|
|
182
|
+
|
|
183
|
+
**my-component.scss:**
|
|
184
|
+
|
|
185
|
+
```scss
|
|
186
|
+
@use "@pxglobal/boreal-style-guidelines/stencil" as boreal;
|
|
187
|
+
|
|
188
|
+
.card {
|
|
189
|
+
// SCSS variables that reference CSS custom properties
|
|
190
|
+
background: boreal.$boreal-ui-default; // Outputs: var(--boreal-ui-default)
|
|
191
|
+
border-radius: boreal.$boreal-radius-m;
|
|
192
|
+
padding: boreal.$boreal-spatial-padding-m;
|
|
193
|
+
}
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
## โ๏ธ Configuration
|
|
197
|
+
|
|
198
|
+
### Change CSS Variable Prefix
|
|
199
|
+
|
|
200
|
+
Edit `src/config/constants.ts`:
|
|
201
|
+
|
|
202
|
+
```typescript
|
|
203
|
+
export const CSS_VAR_PREFIX = "--boreal-"; // Change to '--br-', '--my-ds-', etc.
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
Then regenerate:
|
|
207
|
+
|
|
208
|
+
```bash
|
|
209
|
+
pnpm build
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### Package Exports
|
|
213
|
+
|
|
214
|
+
The package provides several import paths for flexibility:
|
|
215
|
+
|
|
216
|
+
```javascript
|
|
217
|
+
// CSS imports
|
|
218
|
+
import '@pxglobal/boreal-style-guidelines'; // Main bundle (boreal.css)
|
|
219
|
+
import '@pxglobal/boreal-style-guidelines/css/global'; // Only global styles
|
|
220
|
+
import '@pxglobal/boreal-style-guidelines/css/theme-proximus'; // Specific theme
|
|
221
|
+
|
|
222
|
+
// SCSS imports
|
|
223
|
+
@use '@pxglobal/boreal-style-guidelines/scss'; // Main SCSS entry (variables + maps + global)
|
|
224
|
+
@use '@pxglobal/boreal-style-guidelines/scss/variables'; // Only variables
|
|
225
|
+
@use '@pxglobal/boreal-style-guidelines/scss/maps'; // Only maps
|
|
226
|
+
@use '@pxglobal/boreal-style-guidelines/scss/global'; // Only global SCSS
|
|
227
|
+
|
|
228
|
+
// Stencil integration
|
|
229
|
+
@use '@pxglobal/boreal-style-guidelines/stencil'; // SCSS vars wrapping CSS vars
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
## ๐ Project Structure
|
|
233
|
+
|
|
234
|
+
```
|
|
235
|
+
boreal-style-guidelines/
|
|
236
|
+
โโโ src/
|
|
237
|
+
โ โโโ config/ # Configuration and constants
|
|
238
|
+
โ โ โโโ constants.ts # CSS prefix, paths, themes
|
|
239
|
+
โ โ โโโ types.ts # TypeScript types
|
|
240
|
+
โ โโโ generators/ # CSS/SCSS generators
|
|
241
|
+
โ โ โโโ generate.ts # Main generation script
|
|
242
|
+
โ โ โโโ css-generator.ts # CSS custom properties generation
|
|
243
|
+
โ โ โโโ scss-generator.ts # SCSS variables and maps generation
|
|
244
|
+
โ โ โโโ token-processor.ts # Shared token processing logic
|
|
245
|
+
โ โ โโโ global-generator.ts # Global SCSS compilation
|
|
246
|
+
โ โ โโโ validate.ts # Token validation
|
|
247
|
+
โ โโโ styles/ # Base styles
|
|
248
|
+
โ โ โโโ global/
|
|
249
|
+
โ โ โโโ reset.scss # CSS Reset
|
|
250
|
+
โ โโโ tokens/ # Design tokens
|
|
251
|
+
โ โโโ primitives/ # Primitive tokens (colors, spacing, etc.)
|
|
252
|
+
โ โโโ theme/ # Brand/theme tokens
|
|
253
|
+
โ โโโ usage/ # Usage tokens (semantic)
|
|
254
|
+
โโโ dist/ # Generated files
|
|
255
|
+
โ โโโ css/ # CSS custom properties
|
|
256
|
+
โ โโโ scss/ # SCSS variables and maps
|
|
257
|
+
โ โ โโโ _index.scss # Main SCSS entry point
|
|
258
|
+
โ โ โโโ variables/ # SCSS variables
|
|
259
|
+
โ โ โโโ maps/ # SCSS maps
|
|
260
|
+
โ โ โโโ global/ # Global SCSS files
|
|
261
|
+
โ โโโ stencil/ # Stencil integration
|
|
262
|
+
โ โโโ _index.scss # SCSS vars wrapping CSS vars
|
|
263
|
+
โโโ package.json
|
|
264
|
+
โโโ tsconfig.json
|
|
265
|
+
โโโ README.md
|
|
266
|
+
โโโ CHANGELOG.md
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
## ๐ง Available Scripts
|
|
270
|
+
|
|
271
|
+
```bash
|
|
272
|
+
# Clean, generate and validate all styles
|
|
273
|
+
pnpm build
|
|
274
|
+
|
|
275
|
+
# Clean only
|
|
276
|
+
pnpm clean
|
|
277
|
+
|
|
278
|
+
# Generate only
|
|
279
|
+
pnpm generate
|
|
280
|
+
|
|
281
|
+
# Validate generated tokens
|
|
282
|
+
pnpm validate
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
## ๐ Naming Conventions
|
|
286
|
+
|
|
287
|
+
### CSS Custom Properties
|
|
288
|
+
|
|
289
|
+
Format: `--{prefix}{category}-{subcategory}-{variant}`
|
|
290
|
+
|
|
291
|
+
Examples:
|
|
292
|
+
|
|
293
|
+
- `--boreal-primary-base`
|
|
294
|
+
- `--boreal-spatial-spacing-m`
|
|
295
|
+
- `--boreal-neutral-700`
|
|
296
|
+
- `--boreal-text-default`
|
|
297
|
+
|
|
298
|
+
### SCSS Variables
|
|
299
|
+
|
|
300
|
+
Format: `${prefix}{category}-{subcategory}-{variant}`
|
|
301
|
+
|
|
302
|
+
Examples:
|
|
303
|
+
|
|
304
|
+
- `$boreal-primary-base`
|
|
305
|
+
- `$boreal-spatial-spacing-m`
|
|
306
|
+
- `$boreal-neutral-700`
|
|
307
|
+
|
|
308
|
+
### Token Naming Rules
|
|
309
|
+
|
|
310
|
+
โ
**Allowed:**
|
|
311
|
+
|
|
312
|
+
- Lowercase letters: `a-z`
|
|
313
|
+
- Numbers: `0-9`
|
|
314
|
+
- Hyphens: `-`
|
|
315
|
+
|
|
316
|
+
โ **Not Allowed:**
|
|
317
|
+
|
|
318
|
+
- Spaces
|
|
319
|
+
- Parentheses: `(` `)`
|
|
320
|
+
- Uppercase letters
|
|
321
|
+
- Special characters
|
|
322
|
+
|
|
323
|
+
**The system automatically sanitizes invalid names:**
|
|
324
|
+
|
|
325
|
+
- `"ui (components)"` โ `"ui"`
|
|
326
|
+
- `"bg (layout)"` โ `"bg"`
|
|
327
|
+
- `"base-alt-(text)"` โ `"base-alt"`
|
|
328
|
+
- `"font_size"` โ `"font-size"`
|
|
329
|
+
- `"line_height"` โ `"line-height"`
|
|
330
|
+
|
|
331
|
+
## ๐จ Semantic vs Primitive Tokens
|
|
332
|
+
|
|
333
|
+
### Primitives
|
|
334
|
+
|
|
335
|
+
Base values that don't change between themes (e.g., `color.proximus.cobalt.cobalt-50`)
|
|
336
|
+
|
|
337
|
+
### Semantic (Usage)
|
|
338
|
+
|
|
339
|
+
Tokens that reference primitives and change based on theme:
|
|
340
|
+
|
|
341
|
+
- `primary-base` โ `{color.proximus.cobalt.cobalt-40}` in Proximus theme
|
|
342
|
+
- `text-default` โ `{neutral-700}`
|
|
343
|
+
- `bg-primary` โ `{primary-base}`
|
|
344
|
+
|
|
345
|
+
## ๐ Adding a New Theme
|
|
346
|
+
|
|
347
|
+
1. Create `src/tokens/theme/new-theme.json` using the DTCG format (`$type`/`$value`)
|
|
348
|
+
2. Define theme tokens following existing format
|
|
349
|
+
3. Add theme to `src/config/constants.ts`:
|
|
350
|
+
|
|
351
|
+
```typescript
|
|
352
|
+
export const THEMES = {
|
|
353
|
+
PROXIMUS: "proximus",
|
|
354
|
+
ENGAGE: "engage",
|
|
355
|
+
PROTECT: "protect",
|
|
356
|
+
CONNECT: "connect",
|
|
357
|
+
NEW_THEME: "new-theme", // โ Add here
|
|
358
|
+
} as const;
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
4. Rebuild: `pnpm build`
|
|
362
|
+
|
|
363
|
+
## ๐งช Token Validation
|
|
364
|
+
|
|
365
|
+
The build process automatically validates all generated tokens to ensure:
|
|
366
|
+
|
|
367
|
+
- โ
Valid CSS variable names (no spaces or parentheses)
|
|
368
|
+
- โ
Valid SCSS variable names
|
|
369
|
+
- โ
Correct format (`--boreal-{name}` or `$boreal-{name}`)
|
|
370
|
+
|
|
371
|
+
Run validation manually:
|
|
372
|
+
|
|
373
|
+
```bash
|
|
374
|
+
pnpm validate
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
Example output:
|
|
378
|
+
|
|
379
|
+
```
|
|
380
|
+
๐ Validating generated tokens...
|
|
381
|
+
|
|
382
|
+
โ css/global.css - Valid
|
|
383
|
+
โ css/boreal.css - Valid
|
|
384
|
+
โ css/theme-proximus.css - Valid
|
|
385
|
+
โ scss/variables/_primitives.scss - Valid
|
|
386
|
+
|
|
387
|
+
โ
All tokens are valid!
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
## ๐ฏ Available Token Categories
|
|
391
|
+
|
|
392
|
+
### Colors
|
|
393
|
+
|
|
394
|
+
- **Primary, Accent**: Brand colors with variants (base, light, lighter, dark, darker)
|
|
395
|
+
- **Semantic**: success, danger, warning, information
|
|
396
|
+
- **Neutral**: 900, 800, 700, 600, 500, 400, 300, 200, 100, 50
|
|
397
|
+
- **Usage**: text, background, UI, icon, stroke
|
|
398
|
+
- **Extended**: Additional color palette
|
|
399
|
+
|
|
400
|
+
### Spacing
|
|
401
|
+
|
|
402
|
+
`4xs`, `3xs`, `2xs`, `1xs`, `xs`, `s`, `m`, `ml`, `l`, `xl`, `2xl`, `3xl`, `4xl`, `5xl`, `6xl`, `7xl`
|
|
403
|
+
|
|
404
|
+
### Layout
|
|
405
|
+
|
|
406
|
+
`xs`, `s`, `m`, `ml`, `l`, `xl`, `2xl`, `3xl`, `4xl`, `5xl`, `6xl`
|
|
407
|
+
|
|
408
|
+
### Border Radius
|
|
409
|
+
|
|
410
|
+
`none`, `xs2`, `xs`, `s`, `m`, `l`, `xl`, `full`
|
|
411
|
+
|
|
412
|
+
### Icons
|
|
413
|
+
|
|
414
|
+
`s`, `m`, `l`, `xl`
|