@latte-macchiat-io/latte-vanilla-components 0.0.186 → 0.0.187
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
CHANGED
@@ -1,22 +1,298 @@
|
|
1
|
-
#
|
1
|
+
# 🥤 Latte Vanilla Components
|
2
2
|
|
3
|
-
Beautiful components
|
3
|
+
Beautiful, type-safe React components powered by Vanilla Extract CSS. Build modern interfaces with a professional design system that's both powerful and easy to use.
|
4
4
|
|
5
|
-
##
|
5
|
+
## ✨ Features
|
6
6
|
|
7
|
-
|
7
|
+
- 🎨 **Professional Theme System** - Light/dark themes with full customization
|
8
|
+
- 🚀 **Zero Runtime CSS-in-JS** - Vanilla Extract for optimal performance
|
9
|
+
- 📱 **Responsive Design** - Mobile-first, accessible components
|
10
|
+
- 🔒 **Type Safety** - Full TypeScript support throughout
|
11
|
+
- ⚡ **Developer Experience** - Hot reloading, IntelliSense, great docs
|
12
|
+
- 🎯 **Production Ready** - Optimized builds, minimal bundle size
|
8
13
|
|
9
|
-
##
|
14
|
+
## 📦 Installation
|
10
15
|
|
11
16
|
```bash
|
12
|
-
|
17
|
+
npm install @latte-macchiat-io/latte-vanilla-components
|
18
|
+
# or
|
19
|
+
pnpm add @latte-macchiat-io/latte-vanilla-components
|
20
|
+
# or
|
21
|
+
yarn add @latte-macchiat-io/latte-vanilla-components
|
22
|
+
```
|
23
|
+
|
24
|
+
## 🚀 Quick Start
|
25
|
+
|
26
|
+
### 1. Set up your theme (choose one approach):
|
27
|
+
|
28
|
+
**Option A: Zero Config (Quickest)**
|
29
|
+
|
30
|
+
```typescript
|
31
|
+
// src/styles/theme.css.ts
|
32
|
+
import { quickTheme } from '@latte-macchiat-io/latte-vanilla-components';
|
33
|
+
export { quickTheme };
|
34
|
+
```
|
35
|
+
|
36
|
+
**Option B: Brand Colors**
|
37
|
+
|
38
|
+
```typescript
|
39
|
+
// src/styles/theme.css.ts
|
40
|
+
import { createQuickTheme } from '@latte-macchiat-io/latte-vanilla-components';
|
41
|
+
|
42
|
+
export const myTheme = createQuickTheme({
|
43
|
+
colors: {
|
44
|
+
primary: '#FF7377', // Your brand color
|
45
|
+
secondary: '#FCEFE6', // Secondary brand color
|
46
|
+
},
|
47
|
+
});
|
48
|
+
```
|
49
|
+
|
50
|
+
**Option C: Professional Custom Theme**
|
51
|
+
|
52
|
+
```typescript
|
53
|
+
// src/styles/theme.css.ts
|
54
|
+
import { createGlobalTheme } from '@vanilla-extract/css';
|
55
|
+
import { themeContract } from '@latte-macchiat-io/latte-vanilla-components';
|
56
|
+
|
57
|
+
export const lightTheme = createGlobalTheme(':root', themeContract, {
|
58
|
+
colors: {
|
59
|
+
primary: '#FF7377',
|
60
|
+
background: '#ffffff',
|
61
|
+
text: '#000000',
|
62
|
+
// ... define all colors
|
63
|
+
},
|
64
|
+
space: {
|
65
|
+
xs: '4px',
|
66
|
+
sm: '8px',
|
67
|
+
md: '16px',
|
68
|
+
// ... define all spacing
|
69
|
+
},
|
70
|
+
// ... define all theme properties
|
71
|
+
});
|
72
|
+
|
73
|
+
export const darkTheme = createGlobalTheme('html[data-theme="dark"]', themeContract, {
|
74
|
+
colors: {
|
75
|
+
primary: '#FF7377',
|
76
|
+
background: '#1a1a1a',
|
77
|
+
text: '#ffffff',
|
78
|
+
// ... dark theme colors
|
79
|
+
},
|
80
|
+
// ... same structure as light theme
|
81
|
+
});
|
82
|
+
```
|
83
|
+
|
84
|
+
### 2. Import your theme:
|
85
|
+
|
86
|
+
```typescript
|
87
|
+
// src/app/layout.tsx (Next.js)
|
88
|
+
import '../styles/theme.css';
|
89
|
+
|
90
|
+
// src/main.tsx (Vite)
|
91
|
+
import './styles/theme.css';
|
92
|
+
```
|
93
|
+
|
94
|
+
### 3. Start using components:
|
95
|
+
|
96
|
+
```tsx
|
97
|
+
import { Button, Section, Header, Modal } from '@latte-macchiat-io/latte-vanilla-components';
|
98
|
+
|
99
|
+
export default function App() {
|
100
|
+
return (
|
101
|
+
<Section>
|
102
|
+
<Header>
|
103
|
+
<h1>My App</h1>
|
104
|
+
</Header>
|
105
|
+
|
106
|
+
<Button variant="primary" size="large">
|
107
|
+
Get Started
|
108
|
+
</Button>
|
109
|
+
|
110
|
+
<Modal>
|
111
|
+
<p>Beautiful, accessible modal content!</p>
|
112
|
+
</Modal>
|
113
|
+
</Section>
|
114
|
+
);
|
115
|
+
}
|
116
|
+
```
|
117
|
+
|
118
|
+
## 🎨 Theme Customization
|
119
|
+
|
120
|
+
### Available Theme Properties
|
121
|
+
|
122
|
+
```typescript
|
123
|
+
{
|
124
|
+
colors: {
|
125
|
+
primary, secondary, accent, background, surface, text,
|
126
|
+
textSecondary, textLight, border, error, warning, success, info
|
127
|
+
},
|
128
|
+
space: { none, xs, sm, md, lg, xl, '2xl' }, // 0px to 128px
|
129
|
+
radii: { none, sm, md, lg, xl, full }, // Border radius
|
130
|
+
fonts: { body, heading, mono }, // Font families
|
131
|
+
fontSizes: { xs, sm, md, lg, xl, '2xl', '3xl', '4xl' }, // 12px to 40px
|
132
|
+
fontWeights: { light, normal, medium, semibold, bold },
|
133
|
+
lineHeights: { tight, normal, relaxed },
|
134
|
+
shadows: { none, sm, md, lg, xl }, // Box shadows
|
135
|
+
maxWidth: string, // Container width
|
136
|
+
section: { paddingTop, paddingBottom }, // Section spacing
|
137
|
+
header: { height }, // Header height
|
138
|
+
footer: { height }, // Footer height
|
139
|
+
}
|
140
|
+
```
|
141
|
+
|
142
|
+
### Theme Switching
|
143
|
+
|
144
|
+
Add dark mode support:
|
145
|
+
|
146
|
+
```tsx
|
147
|
+
import { setTheme, toggleTheme } from '@latte-macchiat-io/latte-vanilla-components';
|
148
|
+
|
149
|
+
function ThemeToggle() {
|
150
|
+
return <button onClick={() => toggleTheme()}>Toggle Dark Mode</button>;
|
151
|
+
}
|
152
|
+
|
153
|
+
// Or set specific theme
|
154
|
+
setTheme('dark'); // Switch to dark
|
155
|
+
setTheme('light'); // Switch to light
|
156
|
+
```
|
157
|
+
|
158
|
+
## 🧩 Available Components
|
159
|
+
|
160
|
+
### Layout Components
|
161
|
+
|
162
|
+
- **Section** - Content sections with consistent spacing
|
163
|
+
- **Header** - App headers with navigation support
|
164
|
+
- **Footer** - App footers with links and info
|
165
|
+
- **Main** - Main content areas
|
166
|
+
- **Columns** - Responsive column layouts
|
167
|
+
|
168
|
+
### Interactive Components
|
169
|
+
|
170
|
+
- **Button** - Primary, secondary, and variant buttons
|
171
|
+
- **Modal** - Accessible modals with animations
|
172
|
+
- **Form** - Complete form system with validation
|
173
|
+
- **TextField** - Text inputs with labels and validation
|
174
|
+
- **Carousel** - Image and content carousels
|
175
|
+
|
176
|
+
### Content Components
|
177
|
+
|
178
|
+
- **Video** - Responsive video players
|
179
|
+
- **VideoFullWidth** - Full-width video backgrounds
|
180
|
+
- **Logo** - Responsive logo display
|
181
|
+
- **Icon** - Icon system with multiple sizes
|
182
|
+
- **KeyNumber** - Highlight important numbers/stats
|
183
|
+
|
184
|
+
### Navigation Components
|
185
|
+
|
186
|
+
- **Nav** - Primary navigation
|
187
|
+
- **NavSocial** - Social media links
|
188
|
+
- **NavLegal** - Legal/policy links
|
189
|
+
- **LanguageSwitcher** - Multi-language support
|
190
|
+
|
191
|
+
### Utility Components
|
192
|
+
|
193
|
+
- **Actions** - Action button groups
|
194
|
+
- **ConsentCookie** - GDPR cookie consent
|
195
|
+
|
196
|
+
## 📱 Responsive Design
|
197
|
+
|
198
|
+
All components are mobile-first and responsive:
|
199
|
+
|
200
|
+
```tsx
|
201
|
+
// Responsive spacing using sprinkles
|
202
|
+
<Section className={sprinkles({
|
203
|
+
padding: { mobile: 'md', desktop: 'xl' }
|
204
|
+
})}>
|
205
|
+
Content adapts to screen size
|
206
|
+
</Section>
|
207
|
+
|
208
|
+
// Built-in responsive variants
|
209
|
+
<Button size={{ mobile: 'small', desktop: 'large' }}>
|
210
|
+
Responsive Button
|
211
|
+
</Button>
|
212
|
+
```
|
213
|
+
|
214
|
+
## 🛠 Development
|
215
|
+
|
216
|
+
### Using with Next.js
|
217
|
+
|
218
|
+
```typescript
|
219
|
+
// next.config.js
|
220
|
+
const { createVanillaExtractPlugin } = require('@vanilla-extract/next-plugin');
|
221
|
+
const withVanillaExtract = createVanillaExtractPlugin();
|
222
|
+
|
223
|
+
module.exports = withVanillaExtract({
|
224
|
+
// your config
|
225
|
+
});
|
226
|
+
```
|
227
|
+
|
228
|
+
### Using with Vite
|
229
|
+
|
230
|
+
```typescript
|
231
|
+
// vite.config.ts
|
232
|
+
import { vanillaExtractPlugin } from '@vanilla-extract/vite-plugin';
|
233
|
+
|
234
|
+
export default {
|
235
|
+
plugins: [vanillaExtractPlugin()],
|
236
|
+
};
|
237
|
+
```
|
238
|
+
|
239
|
+
## 📚 Advanced Usage
|
240
|
+
|
241
|
+
### Custom Component Styling
|
242
|
+
|
243
|
+
```tsx
|
244
|
+
import { sprinkles } from '@latte-macchiat-io/latte-vanilla-components';
|
245
|
+
|
246
|
+
// Use the sprinkles utility for custom styling
|
247
|
+
<div
|
248
|
+
className={sprinkles({
|
249
|
+
padding: 'lg',
|
250
|
+
backgroundColor: 'primary',
|
251
|
+
borderRadius: 'md',
|
252
|
+
color: 'white',
|
253
|
+
})}>
|
254
|
+
Custom styled element
|
255
|
+
</div>;
|
256
|
+
```
|
257
|
+
|
258
|
+
### Extending Components
|
259
|
+
|
260
|
+
```tsx
|
261
|
+
// Create your own component using the theme
|
262
|
+
import { style } from '@vanilla-extract/css';
|
263
|
+
import { themeContract } from '@latte-macchiat-io/latte-vanilla-components';
|
264
|
+
|
265
|
+
const customButton = style({
|
266
|
+
backgroundColor: themeContract.colors.primary,
|
267
|
+
color: themeContract.colors.background,
|
268
|
+
padding: `${themeContract.space.md} ${themeContract.space.lg}`,
|
269
|
+
borderRadius: themeContract.radii.full,
|
270
|
+
});
|
13
271
|
```
|
14
|
-
Then open [http://localhost:6006](http://localhost:6006) in your browser.
|
15
272
|
|
16
|
-
|
273
|
+
## 🎯 Performance
|
274
|
+
|
275
|
+
- **Zero Runtime CSS-in-JS** - All styles compiled at build time
|
276
|
+
- **Atomic CSS** - Reusable utility classes reduce bundle size
|
277
|
+
- **Tree Shaking** - Only import components you use
|
278
|
+
- **Optimized Builds** - Minimal CSS output in production
|
279
|
+
|
280
|
+
---
|
281
|
+
|
282
|
+
## 🛠 Development & Contributing
|
283
|
+
|
284
|
+
### Run Storybook
|
17
285
|
|
18
286
|
```bash
|
19
|
-
pnpm
|
287
|
+
pnpm run storybook
|
20
288
|
```
|
21
289
|
|
22
|
-
|
290
|
+
Then open [http://localhost:6006](http://localhost:6006) to explore components.
|
291
|
+
|
292
|
+
### Publishing
|
293
|
+
|
294
|
+
Push changes to `main` branch and GitHub Actions will automatically publish to NPM.
|
295
|
+
|
296
|
+
---
|
297
|
+
|
298
|
+
Made with ☕ by the Latte team. Build beautiful interfaces! ✨
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@latte-macchiat-io/latte-vanilla-components",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.187",
|
4
4
|
"description": "Beautiful components for amazing projects, with a touch of Vanilla 🥤",
|
5
5
|
"type": "module",
|
6
6
|
"main": "./src/index.ts",
|
@@ -32,6 +32,7 @@
|
|
32
32
|
"devDependencies": {
|
33
33
|
"@chromatic-com/storybook": "^4.1.1",
|
34
34
|
"@playwright/test": "^1.50.0",
|
35
|
+
"@storybook/addon-docs": "^9.1.5",
|
35
36
|
"@storybook/addon-onboarding": "^9.1.5",
|
36
37
|
"@storybook/react-vite": "^9.1.5",
|
37
38
|
"@types/node": "^20",
|
@@ -42,6 +43,7 @@
|
|
42
43
|
"@vanilla-extract/dynamic": "^2.1.5",
|
43
44
|
"@vanilla-extract/recipes": "^0.5.7",
|
44
45
|
"@vanilla-extract/sprinkles": "^1.6.5",
|
46
|
+
"@vanilla-extract/vite-plugin": "^5.1.1",
|
45
47
|
"clsx": "^2.1.1",
|
46
48
|
"eslint": "^9.15.0",
|
47
49
|
"eslint-config-prettier": "^10.0.1",
|
@@ -51,8 +53,7 @@
|
|
51
53
|
"prettier": "^3.4.2",
|
52
54
|
"storybook": "^9.1.5",
|
53
55
|
"typescript": "5.6.3",
|
54
|
-
"typescript-eslint": "^8.21.0"
|
55
|
-
"@storybook/addon-docs": "^9.1.5"
|
56
|
+
"typescript-eslint": "^8.21.0"
|
56
57
|
},
|
57
58
|
"engines": {
|
58
59
|
"node": ">=20.9.0",
|