@vertis-components/components 1.0.0
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 +57 -0
- package/USAGE.md +236 -0
- package/dist/index.css +102 -0
- package/dist/index.d.mts +2196 -0
- package/dist/index.d.ts +2196 -0
- package/dist/index.js +10244 -0
- package/dist/index.mjs +10172 -0
- package/dist/styles.css +885 -0
- package/dist/tailwind-helper.js +60 -0
- package/package.json +66 -0
- package/scripts/build-css.js +54 -0
- package/scripts/color.js +49 -0
- package/scripts/convert-tailwind.js +288 -0
- package/scripts/figma-api.js +37 -0
- package/scripts/sync-figma.js +63 -0
- package/scripts/token-export.js +79 -0
- package/scripts/utils.js +11 -0
package/README.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# @vertis/components
|
|
2
|
+
|
|
3
|
+
Production-ready React UI component library with Figma design token integration and Tailwind CSS styling.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- 🎨 **Figma Integration**: Generate themes directly from Figma design tokens
|
|
8
|
+
- 🌗 **Dark Mode**: Built-in dark mode support with class-based toggle
|
|
9
|
+
- 📦 **TypeScript**: Fully typed components
|
|
10
|
+
- âš¡ **Tailwind CSS**: Utility-first styling
|
|
11
|
+
- 🎯 **Atomic Design**: Organized component structure
|
|
12
|
+
- 🔧 **Customizable**: Override any theme value in your project
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install @vertis/components
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Quick Start
|
|
21
|
+
|
|
22
|
+
1. Generate your theme from Figma tokens
|
|
23
|
+
2. Configure Tailwind with auto-loaded theme
|
|
24
|
+
3. Import styles and start using components
|
|
25
|
+
|
|
26
|
+
See [USAGE.md](./USAGE.md) for complete setup instructions.
|
|
27
|
+
|
|
28
|
+
## Development (Monorepo Contributors)
|
|
29
|
+
|
|
30
|
+
### Start Storybook
|
|
31
|
+
|
|
32
|
+
To develop components in isolation:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
npm run storybook
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
This will start Storybook at `http://localhost:6006`.
|
|
39
|
+
|
|
40
|
+
### Build Package
|
|
41
|
+
|
|
42
|
+
To build the package:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
npm run build
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Tech Stack
|
|
49
|
+
|
|
50
|
+
- **React** + **TypeScript**
|
|
51
|
+
- **Tailwind CSS** for styling
|
|
52
|
+
- **Storybook** for component development
|
|
53
|
+
- **tsup** for bundling
|
|
54
|
+
|
|
55
|
+
## License
|
|
56
|
+
|
|
57
|
+
[Your License Here]
|
package/USAGE.md
ADDED
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
# @vertis/components - Usage Guide
|
|
2
|
+
|
|
3
|
+
The Vertis Component Library with Figma design token integration.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @vertis/components
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start (3 Steps)
|
|
12
|
+
|
|
13
|
+
### 1. Generate Your Theme from Figma
|
|
14
|
+
|
|
15
|
+
Create `.env.local` in your project root:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
FIGMA_PAT=your_personal_access_token
|
|
19
|
+
FIGMA_FILE_KEY=your_figma_file_key
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
**Get credentials:**
|
|
23
|
+
- FIGMA_PAT: Figma → Settings → Account → Personal access tokens
|
|
24
|
+
- FIGMA_FILE_KEY: From Figma URL: `https://www.figma.com/file/FILE_KEY/...`
|
|
25
|
+
|
|
26
|
+
**Run theme generation:**
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
# Sync tokens from Figma
|
|
30
|
+
npx vertis-sync-figma
|
|
31
|
+
|
|
32
|
+
# Generate theme.js
|
|
33
|
+
npx vertis-generate-theme
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
This creates:
|
|
37
|
+
- `./tokens/` - Raw Figma design tokens (JSON)
|
|
38
|
+
- `./theme.js` - Tailwind theme config with your colors, spacing, and border radius
|
|
39
|
+
|
|
40
|
+
**Optional: Add to package.json scripts for convenience:**
|
|
41
|
+
|
|
42
|
+
```json
|
|
43
|
+
{
|
|
44
|
+
"scripts": {
|
|
45
|
+
"sync-figma": "vertis-sync-figma",
|
|
46
|
+
"generate-theme": "vertis-generate-theme"
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
### 2. Configure Tailwind
|
|
54
|
+
|
|
55
|
+
**Create or update `tailwind.config.js`:**
|
|
56
|
+
|
|
57
|
+
```javascript
|
|
58
|
+
const { loadTheme } = require('@vertis/components/tailwind-helper');
|
|
59
|
+
const theme = loadTheme();
|
|
60
|
+
|
|
61
|
+
module.exports = {
|
|
62
|
+
darkMode: 'class', // Required for dark mode
|
|
63
|
+
|
|
64
|
+
content: [
|
|
65
|
+
'./src/**/*.{js,ts,jsx,tsx}',
|
|
66
|
+
'./app/**/*.{js,ts,jsx,tsx}',
|
|
67
|
+
'./pages/**/*.{js,ts,jsx,tsx}',
|
|
68
|
+
'./components/**/*.{js,ts,jsx,tsx}',
|
|
69
|
+
// Include @vertis/components
|
|
70
|
+
'./node_modules/@vertis/components/dist/**/*.{js,mjs}',
|
|
71
|
+
],
|
|
72
|
+
|
|
73
|
+
theme: {
|
|
74
|
+
extend: {
|
|
75
|
+
// Auto-loaded from your theme.js
|
|
76
|
+
colors: theme.colors,
|
|
77
|
+
spacing: theme.spacing,
|
|
78
|
+
borderRadius: theme.borderRadius,
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
|
|
82
|
+
plugins: [],
|
|
83
|
+
};
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
**Create or update `postcss.config.js`:**
|
|
87
|
+
|
|
88
|
+
```javascript
|
|
89
|
+
module.exports = {
|
|
90
|
+
plugins: {
|
|
91
|
+
tailwindcss: {},
|
|
92
|
+
autoprefixer: {},
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
### 3. Import Styles & Use Components
|
|
100
|
+
|
|
101
|
+
**In your main CSS file (e.g., `globals.css` or `app/globals.css`):**
|
|
102
|
+
|
|
103
|
+
```css
|
|
104
|
+
@import '@vertis/components/styles.css';
|
|
105
|
+
|
|
106
|
+
@tailwind base;
|
|
107
|
+
@tailwind components;
|
|
108
|
+
@tailwind utilities;
|
|
109
|
+
|
|
110
|
+
/* Your custom styles */
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
**In your React components:**
|
|
114
|
+
|
|
115
|
+
```tsx
|
|
116
|
+
import { Button, Card, Input, cn } from '@vertis/components';
|
|
117
|
+
|
|
118
|
+
export default function App() {
|
|
119
|
+
return (
|
|
120
|
+
<div className="p-8 bg-white dark:bg-grey-900">
|
|
121
|
+
<Button variant="primary">Click Me</Button>
|
|
122
|
+
|
|
123
|
+
<Card title="Welcome">
|
|
124
|
+
<p>Using Vertis components with your Figma theme!</p>
|
|
125
|
+
</Card>
|
|
126
|
+
|
|
127
|
+
<Input label="Email" placeholder="Enter email" />
|
|
128
|
+
</div>
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## Dark Mode
|
|
136
|
+
|
|
137
|
+
Toggle dark mode by adding/removing the `dark` class on `<html>`:
|
|
138
|
+
|
|
139
|
+
```javascript
|
|
140
|
+
// Toggle
|
|
141
|
+
document.documentElement.classList.toggle('dark');
|
|
142
|
+
|
|
143
|
+
// Enable
|
|
144
|
+
document.documentElement.classList.add('dark');
|
|
145
|
+
|
|
146
|
+
// Disable
|
|
147
|
+
document.documentElement.classList.remove('dark');
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
**React hook example:**
|
|
151
|
+
|
|
152
|
+
```tsx
|
|
153
|
+
import { useEffect, useState } from 'react';
|
|
154
|
+
|
|
155
|
+
function useDarkMode() {
|
|
156
|
+
const [isDark, setIsDark] = useState(false);
|
|
157
|
+
|
|
158
|
+
useEffect(() => {
|
|
159
|
+
document.documentElement.classList.toggle('dark', isDark);
|
|
160
|
+
}, [isDark]);
|
|
161
|
+
|
|
162
|
+
return [isDark, setIsDark] as const;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function App() {
|
|
166
|
+
const [isDark, setIsDark] = useDarkMode();
|
|
167
|
+
|
|
168
|
+
return (
|
|
169
|
+
<button onClick={() => setIsDark(!isDark)}>
|
|
170
|
+
Toggle {isDark ? 'Light' : 'Dark'} Mode
|
|
171
|
+
</button>
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
## Updating Your Theme
|
|
179
|
+
|
|
180
|
+
When your Figma design tokens change:
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
npm run sync-figma # Fetch latest tokens
|
|
184
|
+
npm run generate-theme # Regenerate theme.js
|
|
185
|
+
# Restart your dev server
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## Available Components
|
|
191
|
+
|
|
192
|
+
See the [Storybook documentation](https://vertis-components.vercel.app/) for live examples.
|
|
193
|
+
|
|
194
|
+
**Atoms:**
|
|
195
|
+
- Button, Link, Badge, Avatar, Input, Textarea, Checkbox, Toggle, Rating, etc.
|
|
196
|
+
|
|
197
|
+
**Molecules:**
|
|
198
|
+
- Card, Alert, Dropdown, DatePicker, Pagination, ProgressBar, Toast, Tooltip, etc.
|
|
199
|
+
|
|
200
|
+
**Organisms:**
|
|
201
|
+
- Carousel, Tabs, Stepper, Accordion, etc.
|
|
202
|
+
|
|
203
|
+
---
|
|
204
|
+
|
|
205
|
+
## TypeScript
|
|
206
|
+
|
|
207
|
+
All components are fully typed. Import types:
|
|
208
|
+
|
|
209
|
+
```tsx
|
|
210
|
+
import type { ButtonProps, CardProps, InputProps } from '@vertis/components';
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
---
|
|
214
|
+
|
|
215
|
+
## Troubleshooting
|
|
216
|
+
|
|
217
|
+
### "No theme.js found in project root"
|
|
218
|
+
|
|
219
|
+
Run `npx vertis-sync-figma && npx vertis-generate-theme` to generate your theme.
|
|
220
|
+
|
|
221
|
+
### Components not styled correctly
|
|
222
|
+
|
|
223
|
+
1. Ensure `@import '@vertis/components/styles.css';` is in your main CSS
|
|
224
|
+
2. Check `tailwind.config.js` includes `./node_modules/@vertis/components/dist/**/*.{js,mjs}` in `content`
|
|
225
|
+
3. Verify `darkMode: 'class'` is set in Tailwind config
|
|
226
|
+
4. Restart your dev server after config changes
|
|
227
|
+
|
|
228
|
+
### Colors don't match my Figma design
|
|
229
|
+
|
|
230
|
+
Regenerate your theme: `npx vertis-sync-figma && npx vertis-generate-theme`
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
## Support
|
|
235
|
+
|
|
236
|
+
- [Documentation](https://github.com/your-org/vertis-accelerator)
|
package/dist/index.css
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/* src/components/Carousel.css */
|
|
2
|
+
.carousel-container {
|
|
3
|
+
position: relative;
|
|
4
|
+
}
|
|
5
|
+
.carousel-container .swiper {
|
|
6
|
+
overflow: visible;
|
|
7
|
+
}
|
|
8
|
+
.carousel-full-image .swiper {
|
|
9
|
+
overflow: hidden;
|
|
10
|
+
border-radius: 0.75rem;
|
|
11
|
+
}
|
|
12
|
+
.carousel-full-image .swiper-slide {
|
|
13
|
+
overflow: hidden;
|
|
14
|
+
}
|
|
15
|
+
.carousel-full-image .swiper-slide img {
|
|
16
|
+
width: 100%;
|
|
17
|
+
height: 100%;
|
|
18
|
+
-o-object-fit: cover;
|
|
19
|
+
object-fit: cover;
|
|
20
|
+
}
|
|
21
|
+
.carousel-pagination-inside .swiper-pagination {
|
|
22
|
+
position: absolute;
|
|
23
|
+
bottom: 1.5rem !important;
|
|
24
|
+
left: 50% !important;
|
|
25
|
+
transform: translateX(-50%);
|
|
26
|
+
width: auto !important;
|
|
27
|
+
display: flex;
|
|
28
|
+
align-items: center;
|
|
29
|
+
justify-content: center;
|
|
30
|
+
gap: 0.5rem;
|
|
31
|
+
z-index: 10;
|
|
32
|
+
}
|
|
33
|
+
.carousel-pagination-outside .swiper-pagination {
|
|
34
|
+
position: relative !important;
|
|
35
|
+
bottom: auto !important;
|
|
36
|
+
left: auto !important;
|
|
37
|
+
width: auto !important;
|
|
38
|
+
display: flex;
|
|
39
|
+
align-items: center;
|
|
40
|
+
justify-content: center;
|
|
41
|
+
gap: 0.75rem;
|
|
42
|
+
margin-top: 2rem;
|
|
43
|
+
}
|
|
44
|
+
.carousel-bullet {
|
|
45
|
+
width: 0.875rem;
|
|
46
|
+
height: 0.875rem;
|
|
47
|
+
background: var(--grey-200, #e5e7eb);
|
|
48
|
+
border-radius: 9999px;
|
|
49
|
+
border: none;
|
|
50
|
+
padding: 0;
|
|
51
|
+
cursor: pointer;
|
|
52
|
+
opacity: 1 !important;
|
|
53
|
+
transition: all 0.2s ease;
|
|
54
|
+
margin: 0 !important;
|
|
55
|
+
}
|
|
56
|
+
.carousel-bullet:hover {
|
|
57
|
+
background: var(--grey-300, #d1d5db);
|
|
58
|
+
}
|
|
59
|
+
.carousel-bullet-active {
|
|
60
|
+
background: var(--grey-900, #111827) !important;
|
|
61
|
+
}
|
|
62
|
+
.carousel-full-image .carousel-bullet {
|
|
63
|
+
width: 0.5rem;
|
|
64
|
+
height: 0.5rem;
|
|
65
|
+
background: rgba(255, 255, 255, 0.5);
|
|
66
|
+
}
|
|
67
|
+
.carousel-full-image .carousel-bullet:hover {
|
|
68
|
+
background: rgba(255, 255, 255, 0.7);
|
|
69
|
+
}
|
|
70
|
+
.carousel-full-image .carousel-bullet-active {
|
|
71
|
+
width: 1.5rem;
|
|
72
|
+
background: white !important;
|
|
73
|
+
}
|
|
74
|
+
.dark .carousel-multi-slide .carousel-bullet {
|
|
75
|
+
background: var(--grey-700, #374151);
|
|
76
|
+
}
|
|
77
|
+
.dark .carousel-multi-slide .carousel-bullet:hover {
|
|
78
|
+
background: var(--grey-600, #4b5563);
|
|
79
|
+
}
|
|
80
|
+
.dark .carousel-multi-slide .carousel-bullet-active {
|
|
81
|
+
background: var(--grey-100, #f3f4f6) !important;
|
|
82
|
+
}
|
|
83
|
+
.carousel-nav-button {
|
|
84
|
+
display: flex;
|
|
85
|
+
align-items: center;
|
|
86
|
+
justify-content: center;
|
|
87
|
+
border: none;
|
|
88
|
+
cursor: pointer;
|
|
89
|
+
transition: all 0.2s ease;
|
|
90
|
+
flex-shrink: 0;
|
|
91
|
+
}
|
|
92
|
+
.carousel-nav-button:disabled {
|
|
93
|
+
opacity: 0.5;
|
|
94
|
+
cursor: not-allowed;
|
|
95
|
+
}
|
|
96
|
+
.carousel-container .swiper-slide {
|
|
97
|
+
height: auto;
|
|
98
|
+
}
|
|
99
|
+
.carousel-slide-content {
|
|
100
|
+
width: 100%;
|
|
101
|
+
height: 100%;
|
|
102
|
+
}
|