@autonomys/design-tokens 1.4.18 → 1.4.22

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/LICENSE ADDED
@@ -0,0 +1,18 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Autonomys Network (autonomys.xyz)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ 1. **Attribution**: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
13
+
14
+ 2. **No Warranty**: THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
15
+
16
+ 3. **Limitation of Liability**: IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
17
+
18
+ ---
package/README.md CHANGED
@@ -4,11 +4,10 @@ A comprehensive design token system for Auto, providing consistent styling acros
4
4
 
5
5
  ## Features
6
6
 
7
- - CSS custom properties (variables) for colors, typography, spacing, and more
8
- - Utility classes with an `auto-` prefix for easy styling
7
+ - Design tokens prefixed with `auto-` for consistent naming
9
8
  - Tailwind CSS integration
10
9
  - Dark theme support
11
- - Explorer-specific styles
10
+ - Drive and Explorer specific styles
12
11
 
13
12
  ## Installation
14
13
 
@@ -18,80 +17,87 @@ npm install @autonomys/design-tokens
18
17
  yarn add @autonomys/design-tokens
19
18
  ```
20
19
 
21
- ## Usage
22
-
23
- ### Import All Styles
20
+ ## Usage with CSS
24
21
 
25
22
  ```js
26
- // Import all styles (variables + utility classes)
23
+ // global.css
24
+
27
25
  import '@autonomys/design-tokens/dist/index.css'
28
26
  ```
29
27
 
30
- ### Import Specific Style Categories
28
+ ## Usage with Tailwind CSS
31
29
 
32
- ```js
33
- // Import only CSS variables without utility classes
34
- import '@autonomys/design-tokens/dist/css/variables.css'
30
+ In your `tailwind.config.js` or `tailwind.config.ts` file:
35
31
 
36
- // Import only utility classes without variables
37
- import '@autonomys/design-tokens/dist/css/utilities.css'
32
+ ```js
33
+ // JavaScript (CommonJS)
34
+ /** @type {import('tailwindcss').Config} */
35
+ module.exports = {
36
+ theme: {
37
+ extend: require('@autonomys/design-tokens').autoTokens,
38
+ },
39
+ }
38
40
  ```
39
41
 
40
- ## Building the Tokens
42
+ ```ts
43
+ // TypeScript (ESM)
44
+ import type { Config } from 'tailwindcss'
45
+ import { autoTokens } from '@autonomys/design-tokens'
41
46
 
42
- To build the design tokens:
47
+ const config: Config = {
48
+ theme: {
49
+ extend: autoTokens,
50
+ },
51
+ }
43
52
 
44
- ```bash
45
- npm run build
53
+ export default config
46
54
  ```
47
55
 
48
- This will:
56
+ ## Available Tokens
49
57
 
50
- 1. Compile TypeScript tokens to JavaScript
51
- 2. Generate CSS files:
52
- - `index.css`: Complete bundle with all variables and utility classes
53
- - `css/variables.css`: Only CSS custom properties
54
- - `css/utilities.css`: Only utility classes
55
- 3. Output everything to the `dist` folder
58
+ ### Color Tokens
56
59
 
57
- ## Available Classes
60
+ - Drive colors: `auto-drive-primary`, `auto-drive-accent`, etc.
61
+ - Explorer colors: `auto-explorer-grayDark`, `auto-explorer-blueAccent`, etc.
58
62
 
59
- ### Color Classes
63
+ ### Typography Tokens
60
64
 
61
- - Text colors: `auto-text-primary`, `auto-text-secondary`, etc.
62
- - Background colors: `auto-bg-primary`, `auto-bg-secondary`, etc.
63
- - Border colors: `auto-border-primary`, `auto-border-secondary`, etc.
64
- - Button styles: `auto-button-primary`, `auto-button-secondary`, etc.
65
+ - Font families: `auto-sans`, `auto-mono`, `auto-display`, etc.
66
+ - Font sizes: `auto-xs`, `auto-sm`, `auto-base`, etc.
67
+ - Font weights: `auto-light`, `auto-normal`, `auto-bold`, etc.
68
+ - Line heights: `auto-tight`, `auto-normal`, `auto-relaxed`, etc.
69
+ - Letter spacings: `auto-tight`, `auto-normal`, `auto-wide`, etc.
65
70
 
66
- ### Typography Classes
71
+ ### Shadow Tokens
67
72
 
68
- - Headings: `auto-heading-1`, `auto-heading-2`, etc.
69
- - Body text: `auto-body-default`, `auto-body-small`, etc.
70
- - Font sizes: `auto-text-xs`, `auto-text-sm`, etc.
71
- - Font weights: `auto-font-light`, `auto-font-bold`, etc.
73
+ - Box shadows: `auto-sm`, `auto-md`, `auto-lg`, etc.
74
+ - Component shadows: `auto-button`, `auto-card`, `auto-modal`, etc.
72
75
 
73
- ### Spacing Classes
76
+ ### Spacing Tokens
74
77
 
75
- - Margin: `auto-m-1`, `auto-mt-2`, `auto-mx-4`, etc.
76
- - Padding: `auto-p-1`, `auto-pt-2`, `auto-px-4`, etc.
77
- - Border radius: `auto-rounded`, `auto-rounded-lg`, etc.
78
+ - Spacing scale: `auto-1`, `auto-2`, `auto-4`, etc.
79
+ - Border radius: `auto-none`, `auto-sm`, `auto-md`, etc.
80
+ - Breakpoints: `auto-sm`, `auto-md`, `auto-lg`, etc.
78
81
 
79
- ### Shadow Classes
82
+ ## Using Tokens in Components
80
83
 
81
- - Shadows: `auto-shadow-sm`, `auto-shadow-lg`, etc.
82
-
83
- ### Explorer-Specific Classes
84
-
85
- - Explorer background colors: `auto-explorer-bg-*`
86
- - Explorer text colors: `auto-explorer-text-*`
87
- - Explorer gradients: `auto-explorer-bg-gradient-*`, `auto-explorer-button-gradient-*`, etc.
84
+ ```jsx
85
+ // Example React component using Tailwind with Auto tokens
86
+ function Button({ children }) {
87
+ return (
88
+ <button className='bg-auto-drive-primary text-white hover:bg-auto-drive-primaryHover font-auto-semibold py-2 px-4 rounded-auto-lg shadow-auto-button'>
89
+ {children}
90
+ </button>
91
+ )
92
+ }
93
+ ```
88
94
 
89
- ## Theme Support
95
+ ## Building the Tokens
90
96
 
91
- Apply dark theme by adding the `auto-theme-dark` class to a container:
97
+ To build the design tokens:
92
98
 
93
- ```html
94
- <div class="auto-theme-dark">
95
- <!-- Content will use dark theme styles -->
96
- </div>
99
+ ```bash
100
+ npm run build
97
101
  ```
102
+
103
+ This will compile the TypeScript tokens and generate a distribution bundle that can be used in your project.
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Convert all design tokens to a format compatible with Tailwind CSS
3
+ * @returns Object containing all design tokens with 'auto-' prefix
4
+ */
5
+ export declare function convertTokens(): Record<string, any>;
6
+ export default convertTokens;