@latte-macchiat-io/latte-vanilla-components 0.0.189 → 0.0.191

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,6 +1,9 @@
1
- # 🥤 Latte Vanilla Components
1
+ # 🥤 Latte Vanilla Components [![npm version](https://img.shields.io/npm/v/@latte-macchiat-io/latte-vanilla-components?style=flat-square)](https://www.npmjs.com/package/@latte-macchiat-io/latte-vanilla-components)
2
2
 
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.
3
+ Beautiful, type-safe React components powered by Vanilla Extract CSS for amazing projects, with a touch of Vanilla 🥤
4
+
5
+ Intended for internal use by the 👩‍💻🧑‍💻 [latte-macchiat.io](https://latte-macchiat.io) team, we can't offer official support, but feel free to reach out
6
+ with questions, feedback or project ideas!
4
7
 
5
8
  ## ✨ Features
6
9
 
@@ -8,9 +11,17 @@ Beautiful, type-safe React components powered by Vanilla Extract CSS. Build mode
8
11
  - 🚀 **Zero Runtime CSS-in-JS** - Vanilla Extract for optimal performance
9
12
  - 📱 **Responsive Design** - Mobile-first, accessible components
10
13
  - 🔒 **Type Safety** - Full TypeScript support throughout
11
- - ⚡ **Developer Experience** - Hot reloading, IntelliSense, great docs
14
+ - ⚡ **Developer Experience** - Hot reloading, IntelliSense, documentation
12
15
  - 🎯 **Production Ready** - Optimized builds, minimal bundle size
13
16
 
17
+ ## 🤓 Philosophy
18
+
19
+ This library is shipped as raw code (ESM + TypeScript) to be compiled in your project, allowing full
20
+ customization and tree-shaking. It is not a pre-built design system, but rather a set of building blocks
21
+ to create your own unique designs.
22
+
23
+ You will need to set up Vanilla Extract in your build system (Next.js, Vite, etc.) to use this library.
24
+
14
25
  ## 📦 Installation
15
26
 
16
27
  ```bash
@@ -25,36 +36,57 @@ yarn add @latte-macchiat-io/latte-vanilla-components
25
36
 
26
37
  ### 1. Set up your theme (choose one approach):
27
38
 
28
- **Option A: Zero Config (Quickest)**
39
+ **Option A: Reuse default theme**
29
40
 
30
41
  ```typescript
31
42
  // src/styles/theme.css.ts
32
- import { quickTheme } from '@latte-macchiat-io/latte-vanilla-components';
33
- export { quickTheme };
43
+ import { createDarkTheme, createLightTheme } from "@latte-macchiat-io/latte-vanilla-components";
44
+
45
+ // Create and apply the default light theme (minimal setup)
46
+ createLightTheme();
47
+
48
+ // Optional: enable dark theme support
49
+ createDarkTheme();
34
50
  ```
35
51
 
36
- **Option B: Brand Colors**
52
+ **Option B: Customize partially themes**
37
53
 
38
54
  ```typescript
39
55
  // src/styles/theme.css.ts
40
- import { createQuickTheme } from '@latte-macchiat-io/latte-vanilla-components';
56
+ import { createDarkTheme, createLightTheme } from '@latte-macchiat-io/latte-vanilla-components';
41
57
 
42
- export const myTheme = createQuickTheme({
58
+ // Override only specific properties in light and dark themes
59
+ createLightTheme({
43
60
  colors: {
44
- primary: '#FF7377', // Your brand color
45
- secondary: '#FCEFE6', // Secondary brand color
61
+ background: '#f0f0f0', // Custom light background color
62
+ text: '#333333', // Custom light text color
63
+ },
64
+ fonts: {
65
+ body: 'Arial, sans-serif', // Custom font for body
66
+ },
67
+ fontSizes: {
68
+ md: '18px', // Custom medium font size
46
69
  },
47
70
  });
71
+
72
+ // Optional: customize dark theme as well
73
+ createDarkTheme({
74
+ colors: {
75
+ background: '#121212', // Custom dark background color
76
+ text: '#e0e0e0', // Custom dark text color
77
+ },
78
+
79
+ });
48
80
  ```
49
81
 
50
- **Option C: Professional Custom Theme**
82
+ **Option C: Full Custom Theme (= contract redefinition)**
51
83
 
52
84
  ```typescript
53
85
  // src/styles/theme.css.ts
54
86
  import { createGlobalTheme } from '@vanilla-extract/css';
55
87
  import { themeContract } from '@latte-macchiat-io/latte-vanilla-components';
56
88
 
57
- export const lightTheme = createGlobalTheme(':root', themeContract, {
89
+ createGlobalTheme(':root', themeContract, {
58
90
  colors: {
59
91
  primary: '#FF7377',
60
92
  background: '#ffffff',
@@ -70,7 +102,7 @@ export const lightTheme = createGlobalTheme(':root', themeContract, {
70
102
  // ... define all theme properties
71
103
  });
72
104
 
73
- export const darkTheme = createGlobalTheme('html[data-theme="dark"]', themeContract, {
105
+ createGlobalTheme('html[data-theme="dark"]', themeContract, {
74
106
  colors: {
75
107
  primary: '#FF7377',
76
108
  background: '#1a1a1a',
@@ -81,7 +113,7 @@ export const darkTheme = createGlobalTheme('html[data-theme="dark"]', themeContr
81
113
  });
82
114
  ```
83
115
 
84
- ### 2. Import your theme:
116
+ ### 2. Import your theme globally:
85
117
 
86
118
  ```typescript
87
119
  // src/app/layout.tsx (Next.js)
@@ -119,25 +151,7 @@ export default function App() {
119
151
 
120
152
  ### Available Theme Properties
121
153
 
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
- ```
154
+ - [ ] TODO @Gaelle
141
155
 
142
156
  ### Theme Switching
143
157
 
@@ -217,12 +231,20 @@ All components are mobile-first and responsive:
217
231
 
218
232
  ```typescript
219
233
  // next.config.js
220
- const { createVanillaExtractPlugin } = require('@vanilla-extract/next-plugin');
221
- const withVanillaExtract = createVanillaExtractPlugin();
234
+ import type { NextConfig } from "next";
235
+ import { createVanillaExtractPlugin } from "@vanilla-extract/next-plugin";
222
236
 
223
- module.exports = withVanillaExtract({
224
- // your config
237
+ const nextConfig: NextConfig = {
238
+ /* config options here */
239
+ transpilePackages: ['@latte-macchiat-io/latte-vanilla-components']
240
+ };
241
+
242
+ const withVanillaExtract = createVanillaExtractPlugin({
243
+ identifiers: process.env.NODE_ENV === 'production' ? 'short' : 'debug',
225
244
  });
245
+
246
+ export default withVanillaExtract(nextConfig);
247
+
226
248
  ```
227
249
 
228
250
  ### Using with Vite
@@ -233,6 +255,9 @@ import { vanillaExtractPlugin } from '@vanilla-extract/vite-plugin';
233
255
 
234
256
  export default {
235
257
  plugins: [vanillaExtractPlugin()],
258
+ optimizeDeps: {
259
+ exclude: ['@latte-macchiat-io/latte-vanilla-components'],
260
+ },
236
261
  };
237
262
  ```
238
263
 
@@ -279,7 +304,7 @@ const customButton = style({
279
304
 
280
305
  ---
281
306
 
282
- ## 🛠 Development & Contributing
307
+ ## 🛠 Development & storybook testing
283
308
 
284
309
  ### Run Storybook
285
310
 
@@ -295,4 +320,4 @@ Push changes to `main` branch and GitHub Actions will automatically publish to N
295
320
 
296
321
  ---
297
322
 
298
- Made with by the Latte team. Build beautiful interfaces! ✨
323
+ Made with ❤️ by the Latte team 🥤
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@latte-macchiat-io/latte-vanilla-components",
3
- "version": "0.0.189",
3
+ "version": "0.0.191",
4
4
  "description": "Beautiful components for amazing projects, with a touch of Vanilla 🥤",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
@@ -1,5 +1,5 @@
1
- import React from 'react';
2
1
  import type { Meta, StoryObj } from '@storybook/react-vite';
2
+ import React from 'react';
3
3
  import { Button } from './Button';
4
4
  import { Section } from '../Section/Section';
5
5
 
@@ -2,8 +2,8 @@ import { clsx } from 'clsx';
2
2
  import { forwardRef, useEffect, useState } from 'react';
3
3
  import { consentActions, consentContent, type ConsentCookieVariants, consentRecipe } from './ConsentCookie.css';
4
4
  import { sprinkles, type Sprinkles } from '../../styles/sprinkles.css';
5
- import { getCookie, setCookie } from '../../utils/cookie';
6
5
  import { Button } from '../Button/Button';
6
+ import { getCookie, setCookie } from './cookie';
7
7
 
8
8
  // Declare window object including gtag to avoid TypeScript errors
9
9
  declare const window: Window &
@@ -1,5 +1,5 @@
1
- import React from 'react';
2
1
  import type { Meta, StoryObj } from '@storybook/react-vite';
2
+ import React from 'react';
3
3
 
4
4
  import { Logo } from '../../index';
5
5
 
@@ -1,6 +1,5 @@
1
- import React from 'react';
2
1
  import type { Meta, StoryObj } from '@storybook/react-vite';
3
- import { useState } from 'react';
2
+ import React, { useState } from 'react';
4
3
  import { Modal } from './Modal';
5
4
  import { Button } from '../Button/Button';
6
5
  import { Section } from '../Section/Section';
@@ -1,5 +1,5 @@
1
- import React from 'react';
2
1
  import type { Meta, StoryObj } from '@storybook/react-vite';
2
+ import React from 'react';
3
3
  import { Section } from './Section';
4
4
  import { Button } from '../Button/Button';
5
5