@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 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? Please email the <a href="mailto:DesignSystem@gov.bc.ca">GDX OSS Design 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) and CSS 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
- ## Examples
50
-
51
- ### ESM variables in React:
52
-
53
- ```jsx
54
- import * as tokens from "@bcgov/design-tokens/js";
55
-
56
- function Button({ children, ...props }) {
57
- return (
58
- <button
59
- style={{
60
- backgroundColor: tokens.surfaceColorPrimaryButtonDefault,
61
- color: tokens.typographyColorPrimaryInvert,
62
- }}
63
- >
64
- {children}
65
- </button>
66
- );
67
- }
68
- ```
69
-
70
- ### CSS variables in React:
71
-
72
- ```jsx
73
- import "@bcgov/design-tokens/css/variables.css";
74
-
75
- function Button({ children, ...props }) {
76
- return (
77
- <button
78
- style={{
79
- backgroundColor: "var(--surface-color-primary-button-default)",
80
- color: "var(--typography-color-primary-invert)",
81
- }}
82
- >
83
- {children}
84
- </button>
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
+ ```