@bcgov/design-tokens 3.2.0 → 4.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 +93 -87
- package/cjs/index.d.ts +204 -204
- package/cjs/index.js +208 -204
- package/cjs-prefixed/index.d.ts +204 -204
- package/cjs-prefixed/index.js +208 -204
- package/css/variables.css +157 -157
- package/css-prefixed/variables.css +157 -157
- package/js/index.d.ts +204 -204
- package/js/index.js +12 -6
- package/js-prefixed/index.d.ts +204 -204
- package/js-prefixed/index.js +14 -7
- package/package.json +24 -23
- package/scss/variables.scss +508 -0
- package/scss-prefixed/variables.scss +508 -0
package/README.md
CHANGED
|
@@ -1,87 +1,93 @@
|
|
|
1
|
-
# @bcgov/design-tokens
|
|
2
|
-
|
|
3
|
-
This package contains design tokens from the B.C. Design System.
|
|
4
|
-
|
|
5
|
-
Questions?
|
|
6
|
-
|
|
7
|
-
See main repository: https://github.com/bcgov/design-system
|
|
8
|
-
|
|
9
|
-
To use, install this package (`npm i @bcgov/design-tokens`) and import the design tokens for your platform. Reference the design tokens according to your platform's needs.
|
|
10
|
-
|
|
11
|
-
## Included file formats
|
|
12
|
-
|
|
13
|
-
This package includes tokens in JavaScript (ECMAScript Module and CommonJS) and
|
|
14
|
-
|
|
15
|
-
### JavaScript (ECMAScript Module)
|
|
16
|
-
|
|
17
|
-
> **Try this first!** Using JavaScript variables can give you a better developer experience with autocomplete.
|
|
18
|
-
|
|
19
|
-
The `js` directory contains an index file with the tokens in ESM format: `js/index.js`
|
|
20
|
-
|
|
21
|
-
TypeScript definitions are includes at: `js/index.d.ts`
|
|
22
|
-
|
|
23
|
-
Example import:
|
|
24
|
-
|
|
25
|
-
`import * as tokens from "@bcgov/design-tokens/js";`
|
|
26
|
-
|
|
27
|
-
To help avoid name collisions, prefixed versions of the ESM variables with `bcds` added are available: `js-prefixed/index.js`
|
|
28
|
-
|
|
29
|
-
### JavaScript (CommonJS)
|
|
30
|
-
|
|
31
|
-
Some environments don't support ESM imports. For these situations, a CommonJS module is included.
|
|
32
|
-
|
|
33
|
-
The `cjs` directory contains an index file with tokens in CJS format: `cjs/index.js`
|
|
34
|
-
|
|
35
|
-
TypeScript definitions are included at: `cjs/index.d.ts`
|
|
36
|
-
|
|
37
|
-
Example import:
|
|
38
|
-
|
|
39
|
-
`const tokens = require("@bcgov/design-tokens/cjs");`
|
|
40
|
-
|
|
41
|
-
To help avoid name collisions, prefixed versions of the CJS variables with `bcds` added are available: `cjs-prefixed/index.js`
|
|
42
|
-
|
|
43
|
-
### CSS
|
|
44
|
-
|
|
45
|
-
CSS variables are included at: `css/variables.css`
|
|
46
|
-
|
|
47
|
-
To help avoid name collisions, prefixed versions of the CSS variables with `bcds` added are available: `css-prefixed/variables.css`
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
1
|
+
# @bcgov/design-tokens
|
|
2
|
+
|
|
3
|
+
This package contains design tokens from the B.C. Design System.
|
|
4
|
+
|
|
5
|
+
Questions? [Open a GitHub issue](https://github.com/bcgov/design-system/issues) or <a href="mailto:DesignSystem@gov.bc.ca">email the design system team/a>.
|
|
6
|
+
|
|
7
|
+
See main repository: https://github.com/bcgov/design-system
|
|
8
|
+
|
|
9
|
+
To use, install this package (`npm i @bcgov/design-tokens`) and import the design tokens for your platform. Reference the design tokens according to your platform's needs.
|
|
10
|
+
|
|
11
|
+
## Included file formats
|
|
12
|
+
|
|
13
|
+
This package includes tokens in JavaScript (ECMAScript Module and CommonJS), CSS and SCSS formats.
|
|
14
|
+
|
|
15
|
+
### JavaScript (ECMAScript Module)
|
|
16
|
+
|
|
17
|
+
> **Try this first!** Using JavaScript variables can give you a better developer experience with autocomplete.
|
|
18
|
+
|
|
19
|
+
The `js` directory contains an index file with the tokens in ESM format: `js/index.js`
|
|
20
|
+
|
|
21
|
+
TypeScript definitions are includes at: `js/index.d.ts`
|
|
22
|
+
|
|
23
|
+
Example import:
|
|
24
|
+
|
|
25
|
+
`import * as tokens from "@bcgov/design-tokens/js";`
|
|
26
|
+
|
|
27
|
+
To help avoid name collisions, prefixed versions of the ESM variables with `bcds` added are available: `js-prefixed/index.js`
|
|
28
|
+
|
|
29
|
+
### JavaScript (CommonJS)
|
|
30
|
+
|
|
31
|
+
Some environments don't support ESM imports. For these situations, a CommonJS module is included.
|
|
32
|
+
|
|
33
|
+
The `cjs` directory contains an index file with tokens in CJS format: `cjs/index.js`
|
|
34
|
+
|
|
35
|
+
TypeScript definitions are included at: `cjs/index.d.ts`
|
|
36
|
+
|
|
37
|
+
Example import:
|
|
38
|
+
|
|
39
|
+
`const tokens = require("@bcgov/design-tokens/cjs");`
|
|
40
|
+
|
|
41
|
+
To help avoid name collisions, prefixed versions of the CJS variables with `bcds` added are available: `cjs-prefixed/index.js`
|
|
42
|
+
|
|
43
|
+
### CSS
|
|
44
|
+
|
|
45
|
+
CSS variables are included at: `css/variables.css`
|
|
46
|
+
|
|
47
|
+
To help avoid name collisions, prefixed versions of the CSS variables with `bcds` added are available: `css-prefixed/variables.css`
|
|
48
|
+
|
|
49
|
+
### SCSS
|
|
50
|
+
|
|
51
|
+
SCSS variables are included at: `scss/variables.scss`
|
|
52
|
+
|
|
53
|
+
To help avoid name collisions, prefixed versions of the SCSS variables with `bcds` added are available: `scss-prefixed/variables.scss`
|
|
54
|
+
|
|
55
|
+
## Examples
|
|
56
|
+
|
|
57
|
+
### ESM variables in React:
|
|
58
|
+
|
|
59
|
+
```jsx
|
|
60
|
+
import * as tokens from "@bcgov/design-tokens/js";
|
|
61
|
+
|
|
62
|
+
function Button({ children, ...props }) {
|
|
63
|
+
return (
|
|
64
|
+
<button
|
|
65
|
+
style={{
|
|
66
|
+
backgroundColor: tokens.surfaceColorPrimaryButtonDefault,
|
|
67
|
+
color: tokens.typographyColorPrimaryInvert,
|
|
68
|
+
}}
|
|
69
|
+
>
|
|
70
|
+
{children}
|
|
71
|
+
</button>
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### CSS variables in React:
|
|
77
|
+
|
|
78
|
+
```jsx
|
|
79
|
+
import "@bcgov/design-tokens/css/variables.css";
|
|
80
|
+
|
|
81
|
+
function Button({ children, ...props }) {
|
|
82
|
+
return (
|
|
83
|
+
<button
|
|
84
|
+
style={{
|
|
85
|
+
backgroundColor: "var(--surface-color-primary-button-default)",
|
|
86
|
+
color: "var(--typography-color-primary-invert)",
|
|
87
|
+
}}
|
|
88
|
+
>
|
|
89
|
+
{children}
|
|
90
|
+
</button>
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
```
|