suus-design-tokens 1.0.0 → 1.0.2

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.
Files changed (2) hide show
  1. package/README.md +120 -1
  2. package/package.json +6 -3
package/README.md CHANGED
@@ -1 +1,120 @@
1
- # suus-design-tokens
1
+ # suus-design-tokens
2
+
3
+ Design tokens for the SUUS project, built with Style Dictionary.
4
+
5
+ ## Installation
6
+
7
+ To use these design tokens in your project, install the package from npm:
8
+
9
+ ```bash
10
+ npm install suus-design-tokens
11
+ ```
12
+
13
+ ## Usage in a React TypeScript Project
14
+
15
+ You can import the design tokens in different formats depending on your needs.
16
+
17
+ ### Importing CSS Variables
18
+
19
+ Import the CSS file to use the tokens as CSS custom properties:
20
+
21
+ ```typescript
22
+ import 'suus-design-tokens/css';
23
+ ```
24
+
25
+ Then use them in your CSS or styled components:
26
+
27
+ ```css
28
+ .my-component {
29
+ color: var(--color-brand-primary);
30
+ padding: var(--spacing-small);
31
+ }
32
+ ```
33
+
34
+ ### Importing JavaScript Object
35
+
36
+ Import the tokens as a JavaScript object:
37
+
38
+ ```typescript
39
+ import { tokens } from 'suus-design-tokens/tokens';
40
+ ```
41
+
42
+ Use in your React components:
43
+
44
+ ```tsx
45
+ import React from 'react';
46
+ import { tokens } from 'suus-design-tokens/tokens';
47
+
48
+ const MyComponent: React.FC = () => {
49
+ return (
50
+ <div
51
+ style={{
52
+ color: tokens.color.brand.primary.$value,
53
+ padding: tokens.spacing.small.$value,
54
+ borderRadius: tokens.radius.small.$value,
55
+ }}
56
+ >
57
+ Hello World
58
+ </div>
59
+ );
60
+ };
61
+
62
+ export default MyComponent;
63
+ ```
64
+
65
+ ### Importing JSON
66
+
67
+
68
+
69
+ ## Development
70
+
71
+ ### Prerequisites
72
+
73
+ - Node.js (version 14 or higher)
74
+ - npm
75
+
76
+ ### Building the Project
77
+
78
+ 1. Install dependencies:
79
+ ```bash
80
+ npm install
81
+ ```
82
+
83
+ 2. Build the tokens:
84
+ ```bash
85
+ npm run build
86
+ ```
87
+
88
+ This will generate the output files in the `dist/` directory.
89
+
90
+ ### Publishing to npm
91
+
92
+ 1. Ensure you are logged in to npm:
93
+ ```bash
94
+ npm login
95
+ ```
96
+
97
+ 2. Update the version in `package.json` (e.g., patch, minor, or major):
98
+ ```bash
99
+ npm version patch
100
+ ```
101
+
102
+ 3. Publish the package:
103
+ ```bash
104
+ npm run publish
105
+ ```
106
+
107
+ Note: The `prepublishOnly` script will automatically run the build before publishing.
108
+
109
+ ### Project Structure
110
+
111
+ - `tokens/`: Source token files organized by category (primitive, semantic, component)
112
+ - `style-dictionary.config.mjs`: Configuration for Style Dictionary
113
+ - `dist/`: Generated output files (CSS, JS, JSON)
114
+
115
+ ## Contributing
116
+
117
+ 1. Make changes to the token files in `tokens/`
118
+ 2. Run `npm run build` to generate updated outputs
119
+ 3. Test your changes
120
+ 4. Commit and push your changes
package/package.json CHANGED
@@ -1,21 +1,24 @@
1
1
  {
2
2
  "name": "suus-design-tokens",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "author": "",
7
7
  "license": "ISC",
8
8
  "main": "index.js",
9
9
  "type": "module",
10
- "files": ["dist"],
10
+ "files": [
11
+ "dist"
12
+ ],
11
13
  "exports": {
12
- "./css": "./dist/tokens.css",
14
+ "./tokens.css": "./dist/tokens.css",
13
15
  "./tokens": "./dist/tokens.js",
14
16
  "./tokens.json": "./dist/tokens.json"
15
17
  },
16
18
  "scripts": {
17
19
  "test": "echo \"Error: no test specified\" && exit 1",
18
20
  "build": "style-dictionary build --config style-dictionary.config.mjs",
21
+ "publish": "npm version patch && npm publish",
19
22
  "prepublishOnly": "npm run build"
20
23
  },
21
24
  "repository": {