@bcc-code/design-tokens 3.0.7 → 3.0.9

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
@@ -10,15 +10,16 @@ npm install @bcc-code/design-tokens
10
10
 
11
11
  ## Usage
12
12
 
13
- ### CSS Variables
13
+ ### CSS Variables (Recommended)
14
14
 
15
- Import theme-specific CSS variables:
15
+ Import auto-switching CSS variables with light/dark mode support:
16
16
 
17
17
  ```css
18
- @import '@bcc-code/design-tokens/css/light';
19
- @import '@bcc-code/design-tokens/css/dark';
18
+ @import '@bcc-code/design-tokens/css';
20
19
  ```
21
20
 
21
+ This automatically provides light theme by default and switches to dark theme when `prefers-color-scheme: dark` is detected.
22
+
22
23
  Use semantic tokens in your styles:
23
24
 
24
25
  ```css
@@ -31,21 +32,41 @@ Use semantic tokens in your styles:
31
32
  }
32
33
  ```
33
34
 
34
- ### Tailwind CSS v4
35
+ **Alternative theme-specific imports (optional):**
36
+ ```css
37
+ @import '@bcc-code/design-tokens/css/light';
38
+ @import '@bcc-code/design-tokens/css/dark';
39
+ ```
40
+
41
+ ### Tailwind CSS v4 (Recommended)
35
42
 
36
- Import Tailwind utilities with design tokens:
43
+ Import Tailwind utilities with auto-switching themes and `.dark` class support:
37
44
 
38
45
  ```css
39
- @import '@bcc-code/design-tokens/tailwind/light';
40
- @import '@bcc-code/design-tokens/tailwind/dark';
46
+ @import '@bcc-code/design-tokens/tailwind';
41
47
  ```
42
48
 
49
+ This provides light theme by default and dark theme when using the `.dark` class on any parent element.
50
+
43
51
  Use utility classes:
44
52
 
45
53
  ```html
46
- <div class="bg-surface-default text-default p-300 rounded-md">
54
+ <div class="bg-elevation-surface-default text-default p-300 radius-md">
47
55
  Content with BCC design tokens
48
56
  </div>
57
+
58
+ <!-- Dark mode with .dark class -->
59
+ <div class="dark">
60
+ <div class="bg-elevation-surface-default text-default p-300 radius-md">
61
+ Content in dark mode
62
+ </div>
63
+ </div>
64
+ ```
65
+
66
+ **Alternative theme-specific imports (optional):**
67
+ ```css
68
+ @import '@bcc-code/design-tokens/tailwind/light';
69
+ @import '@bcc-code/design-tokens/tailwind/dark';
49
70
  ```
50
71
 
51
72
  ### PrimeVue Integration
@@ -64,18 +85,18 @@ app.use(PrimeVue, {
64
85
  preset: BCCPreset,
65
86
  options: {
66
87
  prefix: 'p',
67
- darkModeSelector: '.p-dark',
88
+ darkModeSelector: '.dark',
68
89
  cssLayer: false
69
90
  }
70
91
  }
71
92
  })
72
93
  ```
73
94
 
74
- Enable dark mode by adding the `p-dark` class to your root element:
95
+ Enable dark mode by adding the `dark` class to your root element:
75
96
 
76
97
  ```javascript
77
98
  // Toggle dark mode
78
- document.documentElement.classList.toggle('p-dark')
99
+ document.documentElement.classList.toggle('.dark')
79
100
  ```
80
101
 
81
102
  ## Token Categories
@@ -89,10 +110,57 @@ document.documentElement.classList.toggle('p-dark')
89
110
  ## CDN Usage
90
111
 
91
112
  ```html
92
- <link rel="stylesheet" href="https://unpkg.com/@bcc-code/design-tokens@latest/build/bcc/light.css">
93
- <link rel="stylesheet" href="https://unpkg.com/@bcc-code/design-tokens@latest/build/bcc/dark.css">
113
+ <!-- Auto-switching CSS variables (recommended) -->
114
+ <link rel="stylesheet" href="https://unpkg.com/@bcc-code/design-tokens@latest/build/bcc/css/auto.css">
115
+
116
+ <!-- Or Tailwind utilities with .dark class support -->
117
+ <link rel="stylesheet" href="https://unpkg.com/@bcc-code/design-tokens@latest/build/bcc/css/tailwind-auto.css">
94
118
  ```
95
119
 
120
+ ## Contributing
121
+
122
+ We welcome contributions! Here's how to get started:
123
+
124
+ ### Development Setup
125
+
126
+ 1. **Clone and install dependencies:**
127
+ ```bash
128
+ git clone https://github.com/bcc-code/design-tokens.git
129
+ cd design-tokens
130
+ npm install
131
+ ```
132
+
133
+ 2. **Build tokens:**
134
+ ```bash
135
+ npm run build
136
+ ```
137
+
138
+ 3. **Test with demo application:**
139
+ ```bash
140
+ cd demo
141
+ npm install
142
+ npm run dev
143
+ ```
144
+
145
+ ### Token Structure
146
+
147
+ - **Source tokens** are located in `tokens/` directory, synced from Figma Token Studio
148
+ - **Build configuration** is in `export-tokens/build.js` using Style Dictionary
149
+ - **Output files** are generated in `build/bcc/` with organized folders for `css/` and `js/`
150
+
151
+ ### Making Changes
152
+
153
+ 1. **Token updates:** Modify files in `tokens/` directory or sync from Figma Token Studio
154
+ 2. **Build system changes:** Update `export-tokens/build.js` for new formats or transformations
155
+ 3. **PrimeVue preset:** Modify `config/primevue.config.js` for theme mapping changes
156
+
157
+ ### Pull Requests
158
+
159
+ - Ensure `npm run build` runs successfully
160
+ - Test changes with the demo application
161
+ - Update documentation if adding new features
162
+ - Follow conventional commit messages
163
+
96
164
  ## Development
97
165
 
98
166
  A demo application is available in the `demo/` directory to test and showcase the design token integration with PrimeVue components.