@engrate/components 0.0.2 → 0.0.4
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 +51 -32
- 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 +5 -12
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ A React component library built with Tailwind CSS, following Engrate's brand gui
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm install
|
|
8
|
+
npm install @engrate/components
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
### Peer Dependencies
|
|
@@ -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
|
|
@@ -89,17 +101,16 @@ npm install
|
|
|
89
101
|
```
|
|
90
102
|
src/
|
|
91
103
|
├── components/
|
|
92
|
-
│ ├── ui/
|
|
93
|
-
│ └── layout/
|
|
104
|
+
│ ├── ui/ # Base UI components (Button, etc.)
|
|
105
|
+
│ └── layout/ # Layout components
|
|
94
106
|
├── lib/
|
|
95
|
-
│ └── utils.ts
|
|
107
|
+
│ └── utils.ts # Utility functions (cn, etc.)
|
|
96
108
|
├── styles/
|
|
97
|
-
│ ├── fonts.css
|
|
98
|
-
│ └── index.css
|
|
109
|
+
│ ├── fonts.css # @font-face declarations
|
|
110
|
+
│ └── index.css # Tailwind v4 with @theme tokens
|
|
99
111
|
├── test/
|
|
100
|
-
│ └── setup.ts
|
|
101
|
-
|
|
102
|
-
└── index.ts # Main entry point
|
|
112
|
+
│ └── setup.ts # Test configuration
|
|
113
|
+
└── index.ts # Main entry point
|
|
103
114
|
```
|
|
104
115
|
|
|
105
116
|
### Adding a Component
|
|
@@ -142,6 +153,14 @@ This library follows Engrate's brand guidelines:
|
|
|
142
153
|
- **No bold fonts**: Use Regular weight only (Medium for emphasis)
|
|
143
154
|
- **Left-aligned text**: Default alignment
|
|
144
155
|
|
|
156
|
+
## Publishing to NPM
|
|
157
|
+
|
|
158
|
+
Make sure you have access to the @engrate org in NPM and then run:
|
|
159
|
+
|
|
160
|
+
```
|
|
161
|
+
npm publish --access public
|
|
162
|
+
```
|
|
163
|
+
|
|
145
164
|
## License
|
|
146
165
|
|
|
147
166
|
MIT License
|