@engrate/components 0.0.3 → 0.0.5
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 +36 -25
- package/dist/{eg-components.cjs.js → index.cjs.js} +1 -1
- package/dist/index.d.ts +0 -21
- package/dist/{eg-components.es.js → index.es.js} +715 -782
- package/dist/styles.css +1 -1
- package/package.json +8 -14
package/README.md
CHANGED
|
@@ -18,46 +18,58 @@ npm install react react-dom
|
|
|
18
18
|
|
|
19
19
|
## Usage
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
Import the compiled CSS bundle for projects not using Tailwind:
|
|
21
|
+
Import the styles and use the components:
|
|
24
22
|
|
|
25
23
|
```tsx
|
|
26
|
-
import { Button } from '
|
|
27
|
-
import '
|
|
24
|
+
import { Button } from '@engrate/components'
|
|
25
|
+
import '@engrate/components/styles.css'
|
|
28
26
|
|
|
29
27
|
function App() {
|
|
30
28
|
return <Button variant="primary">Click me</Button>
|
|
31
29
|
}
|
|
32
30
|
```
|
|
33
31
|
|
|
34
|
-
###
|
|
35
|
-
|
|
36
|
-
Extend your Tailwind config with Engrate's design tokens:
|
|
32
|
+
### Using with Tailwind CSS v4
|
|
37
33
|
|
|
38
|
-
|
|
39
|
-
// tailwind.config.js
|
|
40
|
-
import { egComponentsPreset } from 'eg-components/tailwind.preset'
|
|
34
|
+
If your project uses Tailwind CSS v4, import the styles in your main CSS file. The component library exports all design tokens as CSS custom properties which Tailwind v4 will automatically detect:
|
|
41
35
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
'./node_modules/eg-components/dist/**/*.js',
|
|
47
|
-
],
|
|
48
|
-
}
|
|
36
|
+
```css
|
|
37
|
+
/* app.css */
|
|
38
|
+
@import 'tailwindcss';
|
|
39
|
+
@import '@engrate/components/styles.css';
|
|
49
40
|
```
|
|
50
41
|
|
|
51
|
-
|
|
42
|
+
This gives you access to all Engrate design tokens in your own components:
|
|
52
43
|
|
|
53
44
|
```tsx
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
45
|
+
// Your custom component can use Engrate's design tokens
|
|
46
|
+
function CustomCard({ children }) {
|
|
47
|
+
return (
|
|
48
|
+
<div className="bg-card border-border text-primary rounded-lg p-4">
|
|
49
|
+
{children}
|
|
50
|
+
</div>
|
|
51
|
+
)
|
|
58
52
|
}
|
|
59
53
|
```
|
|
60
54
|
|
|
55
|
+
### Available Design Tokens
|
|
56
|
+
|
|
57
|
+
The library provides the following CSS custom properties:
|
|
58
|
+
|
|
59
|
+
**Colors:**
|
|
60
|
+
|
|
61
|
+
- `sunflower`, `sunflower-hover` - Primary brand color
|
|
62
|
+
- `primary`, `secondary`, `tertiary` - Text colors
|
|
63
|
+
- `main`, `alt`, `card`, `contrast` - Background colors
|
|
64
|
+
- `border` - Border color
|
|
65
|
+
- `error` - Error state color
|
|
66
|
+
|
|
67
|
+
**Typography:**
|
|
68
|
+
|
|
69
|
+
- `font-display` - Libre Baskerville (headings)
|
|
70
|
+
- `font-sans` - Work Sans (body text)
|
|
71
|
+
- `font-mono` - IBM Plex Mono (code)
|
|
72
|
+
|
|
61
73
|
## Development
|
|
62
74
|
|
|
63
75
|
### Setup
|
|
@@ -95,10 +107,9 @@ src/
|
|
|
95
107
|
│ └── utils.ts # Utility functions (cn, etc.)
|
|
96
108
|
├── styles/
|
|
97
109
|
│ ├── fonts.css # @font-face declarations
|
|
98
|
-
│ └── index.css # Tailwind
|
|
110
|
+
│ └── index.css # Tailwind v4 with @theme tokens
|
|
99
111
|
├── test/
|
|
100
112
|
│ └── setup.ts # Test configuration
|
|
101
|
-
├── tailwind.preset.ts # Exportable design tokens
|
|
102
113
|
└── index.ts # Main entry point
|
|
103
114
|
```
|
|
104
115
|
|