@atxp/design-system 0.1.0 → 0.1.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.
- package/README.md +109 -0
- package/dist/index.cjs +1000 -92
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +340 -1
- package/dist/index.d.ts +340 -1
- package/dist/index.js +956 -93
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +17 -15
package/README.md
CHANGED
|
@@ -40,6 +40,115 @@ function App() {
|
|
|
40
40
|
}
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
+
### Peer Dependencies
|
|
44
|
+
|
|
45
|
+
This design system requires the following peer dependencies to be installed in your project:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
npm install lucide-react sonner
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
These are included as peer dependencies because:
|
|
52
|
+
- **lucide-react**: Icons are re-exported through the design system's API
|
|
53
|
+
- **sonner**: Toast notifications are re-exported for direct use
|
|
54
|
+
|
|
55
|
+
## Optional: Using Design Tokens in Your Own Code
|
|
56
|
+
|
|
57
|
+
The design system ships with pre-compiled CSS that includes all styles for the components. **You do not need Tailwind CSS installed** to use the components.
|
|
58
|
+
|
|
59
|
+
However, if you want to use the design system's color tokens (like `bg-primary`, `text-destructive`) and other design tokens in your own custom components, you can optionally set up Tailwind CSS in your project:
|
|
60
|
+
|
|
61
|
+
### 1. Install Tailwind CSS
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
npm install -D tailwindcss autoprefixer postcss
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### 2. Create a Tailwind Config
|
|
68
|
+
|
|
69
|
+
Create a `tailwind.config.js` in your project root:
|
|
70
|
+
|
|
71
|
+
```js
|
|
72
|
+
/** @type {import('tailwindcss').Config} */
|
|
73
|
+
export default {
|
|
74
|
+
content: [
|
|
75
|
+
'./index.html',
|
|
76
|
+
'./src/**/*.{js,ts,jsx,tsx}',
|
|
77
|
+
],
|
|
78
|
+
theme: {
|
|
79
|
+
extend: {
|
|
80
|
+
colors: {
|
|
81
|
+
border: 'hsl(var(--theme-border))',
|
|
82
|
+
input: 'hsl(var(--theme-input))',
|
|
83
|
+
ring: 'hsl(var(--theme-ring))',
|
|
84
|
+
background: 'hsl(var(--theme-background))',
|
|
85
|
+
foreground: 'hsl(var(--theme-foreground))',
|
|
86
|
+
primary: {
|
|
87
|
+
DEFAULT: 'hsl(var(--theme-primary))',
|
|
88
|
+
foreground: 'hsl(var(--theme-primary-foreground))',
|
|
89
|
+
},
|
|
90
|
+
secondary: {
|
|
91
|
+
DEFAULT: 'hsl(var(--theme-secondary))',
|
|
92
|
+
foreground: 'hsl(var(--theme-secondary-foreground))',
|
|
93
|
+
},
|
|
94
|
+
destructive: {
|
|
95
|
+
DEFAULT: 'hsl(var(--theme-destructive))',
|
|
96
|
+
foreground: 'hsl(var(--theme-destructive-foreground))',
|
|
97
|
+
},
|
|
98
|
+
muted: {
|
|
99
|
+
DEFAULT: 'hsl(var(--theme-muted))',
|
|
100
|
+
foreground: 'hsl(var(--theme-muted-foreground))',
|
|
101
|
+
},
|
|
102
|
+
accent: {
|
|
103
|
+
DEFAULT: 'hsl(var(--theme-accent))',
|
|
104
|
+
foreground: 'hsl(var(--theme-accent-foreground))',
|
|
105
|
+
},
|
|
106
|
+
// Add other tokens as needed
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
plugins: [],
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### 3. Create a CSS File
|
|
115
|
+
|
|
116
|
+
Create a `src/index.css` with Tailwind directives:
|
|
117
|
+
|
|
118
|
+
```css
|
|
119
|
+
@tailwind base;
|
|
120
|
+
@tailwind components;
|
|
121
|
+
@tailwind utilities;
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### 4. Import Both Stylesheets
|
|
125
|
+
|
|
126
|
+
In your app entry point (e.g., `main.tsx`):
|
|
127
|
+
|
|
128
|
+
```tsx
|
|
129
|
+
import '@atxp/design-system/styles.css'; // Design system styles
|
|
130
|
+
import './index.css'; // Your Tailwind utilities
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### 5. Use Design Tokens in Your Code
|
|
134
|
+
|
|
135
|
+
Now you can use design tokens in your custom components:
|
|
136
|
+
|
|
137
|
+
```tsx
|
|
138
|
+
function MyCustomComponent() {
|
|
139
|
+
return (
|
|
140
|
+
<div className="bg-primary text-primary-foreground p-4 rounded-lg">
|
|
141
|
+
<h2 className="text-xl font-bold">Custom Component</h2>
|
|
142
|
+
<p className="text-muted-foreground">
|
|
143
|
+
Using design system tokens in custom code
|
|
144
|
+
</p>
|
|
145
|
+
</div>
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
**Note**: This is completely optional. The design system components work perfectly without any Tailwind setup in your project.
|
|
151
|
+
|
|
43
152
|
## Development
|
|
44
153
|
|
|
45
154
|
### Prerequisites
|