@marcoschwartz/lite-ui 0.1.1 → 0.2.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 +238 -134
- package/dist/index.d.mts +476 -2
- package/dist/index.d.ts +476 -2
- package/dist/index.js +3593 -52
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3520 -53
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +6 -1
package/README.md
CHANGED
|
@@ -1,208 +1,312 @@
|
|
|
1
1
|
# Lite UI
|
|
2
2
|
|
|
3
|
-
A lightweight UI component library built with Tailwind CSS
|
|
3
|
+
A lightweight, modern UI component library built with React, TypeScript, and Tailwind CSS v4.
|
|
4
4
|
|
|
5
|
-
## Features
|
|
5
|
+
## ✨ Features
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
7
|
+
- 🎨 **21 Production-Ready Components** - From basic inputs to complex data tables
|
|
8
|
+
- 🌙 **Dark Mode Support** - Built-in dark mode with system preference detection
|
|
9
|
+
- 🎭 **Theming System** - Multiple themes with easy customization
|
|
10
|
+
- 📦 **Tree-Shakeable** - Only bundle what you use (ESM & CJS)
|
|
11
|
+
- ⚡ **TypeScript First** - Full type safety and IntelliSense support
|
|
12
|
+
- 🚀 **Server Component Compatible** - Works with Next.js App Router and RSC
|
|
13
|
+
- 🎯 **Zero Runtime CSS** - Styles compiled with Tailwind CSS v4
|
|
14
|
+
- ♿ **Accessible** - ARIA-compliant components
|
|
14
15
|
|
|
15
|
-
##
|
|
16
|
-
|
|
17
|
-
### Quick Start
|
|
18
|
-
|
|
19
|
-
Run the library build watcher and demo app simultaneously:
|
|
16
|
+
## 📦 Installation
|
|
20
17
|
|
|
21
18
|
```bash
|
|
22
|
-
npm
|
|
19
|
+
npm install @marcoschwartz/lite-ui
|
|
23
20
|
```
|
|
24
21
|
|
|
25
|
-
|
|
26
|
-
1. Start the UI library build in watch mode (auto-rebuilds on changes)
|
|
27
|
-
2. Start the Next.js demo app on http://localhost:3000
|
|
28
|
-
3. Automatically reflect changes from the library in the demo app
|
|
29
|
-
|
|
30
|
-
### Individual Commands
|
|
22
|
+
### Setup
|
|
31
23
|
|
|
32
|
-
|
|
33
|
-
```bash
|
|
34
|
-
npm run build
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
Build the library in watch mode:
|
|
38
|
-
```bash
|
|
39
|
-
npm run dev
|
|
40
|
-
```
|
|
24
|
+
1. **Import the CSS** in your app's entry point:
|
|
41
25
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
26
|
+
```tsx
|
|
27
|
+
// app/layout.tsx (Next.js) or main.tsx (Vite)
|
|
28
|
+
import '@marcoschwartz/lite-ui/styles.css';
|
|
45
29
|
```
|
|
46
30
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
### Button
|
|
31
|
+
2. **Wrap your app with ThemeProvider** (recommended):
|
|
50
32
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
#### Variants
|
|
54
|
-
- `primary` (default) - Blue button
|
|
55
|
-
- `secondary` - Gray button
|
|
56
|
-
- `success` - Green button
|
|
57
|
-
- `danger` - Red button
|
|
58
|
-
- `warning` - Yellow button
|
|
59
|
-
- `info` - Cyan button
|
|
33
|
+
```tsx
|
|
34
|
+
import { ThemeProvider } from '@marcoschwartz/lite-ui';
|
|
60
35
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
36
|
+
export default function RootLayout({ children }) {
|
|
37
|
+
return (
|
|
38
|
+
<html lang="en">
|
|
39
|
+
<body>
|
|
40
|
+
<ThemeProvider defaultTheme="default" defaultColorMode="system">
|
|
41
|
+
{children}
|
|
42
|
+
</ThemeProvider>
|
|
43
|
+
</body>
|
|
44
|
+
</html>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
```
|
|
66
48
|
|
|
67
|
-
|
|
49
|
+
3. **Start using components:**
|
|
68
50
|
|
|
69
|
-
**In Server Components (Next.js App Router):**
|
|
70
51
|
```tsx
|
|
71
|
-
|
|
72
|
-
import { Button } from 'lite-ui';
|
|
52
|
+
import { Button, Card, TextInput } from '@marcoschwartz/lite-ui';
|
|
73
53
|
|
|
74
54
|
export default function Page() {
|
|
75
55
|
return (
|
|
76
|
-
<
|
|
77
|
-
<
|
|
78
|
-
|
|
79
|
-
</Button>
|
|
80
|
-
</
|
|
56
|
+
<Card>
|
|
57
|
+
<h1>Welcome to Lite UI</h1>
|
|
58
|
+
<TextInput placeholder="Enter your name" />
|
|
59
|
+
<Button variant="primary">Submit</Button>
|
|
60
|
+
</Card>
|
|
81
61
|
);
|
|
82
62
|
}
|
|
83
63
|
```
|
|
84
64
|
|
|
85
|
-
|
|
65
|
+
## 🎨 Components
|
|
66
|
+
|
|
67
|
+
### Form Controls
|
|
68
|
+
- **Button** - Versatile button with 6 variants and 4 sizes
|
|
69
|
+
- **TextInput** - Text input with validation and error states
|
|
70
|
+
- **Select** - Dropdown select with custom styling
|
|
71
|
+
- **Checkbox** - Checkbox with label and error support
|
|
72
|
+
- **Toggle** - Switch/toggle component with multiple sizes
|
|
73
|
+
- **DatePicker** - Date selection input
|
|
74
|
+
- **TimePicker** - Time selection input
|
|
75
|
+
- **DateTimePicker** - Combined date and time picker
|
|
76
|
+
|
|
77
|
+
### Layout & Navigation
|
|
78
|
+
- **Navbar** - Responsive navigation bar
|
|
79
|
+
- **Sidebar** - Collapsible sidebar with mobile support
|
|
80
|
+
- **Drawer** - Slide-out drawer panel
|
|
81
|
+
- **Modal** - Accessible modal dialog
|
|
82
|
+
- **Tabs** - Tabbed navigation component
|
|
83
|
+
|
|
84
|
+
### Feedback & Overlays
|
|
85
|
+
- **Alert** - Alert messages with 4 variants
|
|
86
|
+
- **Spinner** - Loading spinner with 3 sizes
|
|
87
|
+
- **Badge** - Status badges with 6 variants
|
|
88
|
+
|
|
89
|
+
### Data Display
|
|
90
|
+
- **Card** - Content container with optional header/footer
|
|
91
|
+
- **Table** - Data table with sorting and selection
|
|
92
|
+
- **Pagination** - Page navigation component
|
|
93
|
+
|
|
94
|
+
### Utilities
|
|
95
|
+
- **ActionMenu** - Dropdown action menu
|
|
96
|
+
- **Icons** - Set of common UI icons
|
|
97
|
+
|
|
98
|
+
[**📖 View Full Component Documentation**](./COMPONENTS.md)
|
|
99
|
+
|
|
100
|
+
## 🌙 Dark Mode
|
|
101
|
+
|
|
102
|
+
Lite UI includes built-in dark mode support with three color modes:
|
|
103
|
+
|
|
86
104
|
```tsx
|
|
87
|
-
|
|
88
|
-
"use client";
|
|
105
|
+
import { useTheme } from '@marcoschwartz/lite-ui';
|
|
89
106
|
|
|
90
|
-
|
|
107
|
+
function ThemeToggle() {
|
|
108
|
+
const { colorMode, setColorMode } = useTheme();
|
|
91
109
|
|
|
92
|
-
export function InteractiveButton() {
|
|
93
110
|
return (
|
|
94
|
-
<
|
|
95
|
-
|
|
96
|
-
|
|
111
|
+
<select value={colorMode} onChange={(e) => setColorMode(e.target.value)}>
|
|
112
|
+
<option value="system">System</option>
|
|
113
|
+
<option value="light">Light</option>
|
|
114
|
+
<option value="dark">Dark</option>
|
|
115
|
+
</select>
|
|
97
116
|
);
|
|
98
117
|
}
|
|
99
118
|
```
|
|
100
119
|
|
|
101
|
-
|
|
120
|
+
## 🎭 Theming
|
|
121
|
+
|
|
122
|
+
Switch between built-in themes or create your own:
|
|
123
|
+
|
|
102
124
|
```tsx
|
|
103
|
-
import {
|
|
125
|
+
import { useTheme } from '@marcoschwartz/lite-ui';
|
|
126
|
+
|
|
127
|
+
function ThemeSwitcher() {
|
|
128
|
+
const { themeName, setTheme } = useTheme();
|
|
104
129
|
|
|
105
|
-
function App() {
|
|
106
130
|
return (
|
|
107
131
|
<div>
|
|
108
|
-
<
|
|
109
|
-
|
|
110
|
-
</Button>
|
|
111
|
-
|
|
112
|
-
<Button variant="success" size="lg" onClick={() => alert('Success!')}>
|
|
113
|
-
Submit
|
|
114
|
-
</Button>
|
|
115
|
-
|
|
116
|
-
<Button variant="danger" disabled>
|
|
117
|
-
Disabled
|
|
118
|
-
</Button>
|
|
132
|
+
<button onClick={() => setTheme('default')}>Default Theme</button>
|
|
133
|
+
<button onClick={() => setTheme('minimalistic')}>Minimalistic Theme</button>
|
|
119
134
|
</div>
|
|
120
135
|
);
|
|
121
136
|
}
|
|
122
137
|
```
|
|
123
138
|
|
|
124
|
-
|
|
139
|
+
### Available Themes
|
|
125
140
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
├── src/ # UI library source code
|
|
129
|
-
│ ├── components/ # React components
|
|
130
|
-
│ └── index.ts # Main export file
|
|
131
|
-
├── demo/ # Next.js demo application
|
|
132
|
-
├── dist/ # Built library (generated)
|
|
133
|
-
└── dev.sh # Development script
|
|
134
|
-
```
|
|
141
|
+
- **Default** - Vibrant colors, shadows, and smooth animations
|
|
142
|
+
- **Minimalistic** - Flat design, subtle colors, minimal effects
|
|
135
143
|
|
|
136
|
-
##
|
|
144
|
+
## 🚀 Usage Examples
|
|
137
145
|
|
|
138
|
-
|
|
146
|
+
### Basic Form
|
|
139
147
|
|
|
140
|
-
|
|
148
|
+
```tsx
|
|
149
|
+
"use client";
|
|
141
150
|
|
|
142
|
-
|
|
143
|
-
|
|
151
|
+
import { useState } from 'react';
|
|
152
|
+
import { Card, TextInput, Button, Alert } from '@marcoschwartz/lite-ui';
|
|
153
|
+
|
|
154
|
+
export function ContactForm() {
|
|
155
|
+
const [email, setEmail] = useState('');
|
|
156
|
+
const [submitted, setSubmitted] = useState(false);
|
|
157
|
+
|
|
158
|
+
return (
|
|
159
|
+
<Card>
|
|
160
|
+
<h2>Contact Us</h2>
|
|
161
|
+
{submitted && (
|
|
162
|
+
<Alert variant="success">Message sent successfully!</Alert>
|
|
163
|
+
)}
|
|
164
|
+
<TextInput
|
|
165
|
+
label="Email"
|
|
166
|
+
type="email"
|
|
167
|
+
value={email}
|
|
168
|
+
onChange={(e) => setEmail(e.target.value)}
|
|
169
|
+
placeholder="your@email.com"
|
|
170
|
+
/>
|
|
171
|
+
<Button
|
|
172
|
+
variant="primary"
|
|
173
|
+
onClick={() => setSubmitted(true)}
|
|
174
|
+
>
|
|
175
|
+
Send Message
|
|
176
|
+
</Button>
|
|
177
|
+
</Card>
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
```
|
|
144
181
|
|
|
145
|
-
###
|
|
182
|
+
### Data Table
|
|
146
183
|
|
|
147
|
-
**Wrap your app with ThemeProvider:**
|
|
148
184
|
```tsx
|
|
149
|
-
import {
|
|
185
|
+
import { Table } from '@marcoschwartz/lite-ui';
|
|
186
|
+
|
|
187
|
+
const columns = [
|
|
188
|
+
{ key: 'name', label: 'Name', sortable: true },
|
|
189
|
+
{ key: 'email', label: 'Email', sortable: true },
|
|
190
|
+
{ key: 'status', label: 'Status' },
|
|
191
|
+
];
|
|
150
192
|
|
|
151
|
-
|
|
193
|
+
const data = [
|
|
194
|
+
{ id: 1, name: 'John Doe', email: 'john@example.com', status: 'Active' },
|
|
195
|
+
{ id: 2, name: 'Jane Smith', email: 'jane@example.com', status: 'Inactive' },
|
|
196
|
+
];
|
|
197
|
+
|
|
198
|
+
export function UserTable() {
|
|
152
199
|
return (
|
|
153
|
-
<
|
|
154
|
-
{
|
|
155
|
-
|
|
200
|
+
<Table
|
|
201
|
+
columns={columns}
|
|
202
|
+
data={data}
|
|
203
|
+
sortable
|
|
204
|
+
selectable
|
|
205
|
+
/>
|
|
156
206
|
);
|
|
157
207
|
}
|
|
158
208
|
```
|
|
159
209
|
|
|
160
|
-
|
|
210
|
+
### Modal Dialog
|
|
211
|
+
|
|
161
212
|
```tsx
|
|
162
213
|
"use client";
|
|
163
214
|
|
|
164
|
-
import {
|
|
215
|
+
import { useState } from 'react';
|
|
216
|
+
import { Modal, Button } from '@marcoschwartz/lite-ui';
|
|
165
217
|
|
|
166
|
-
function
|
|
167
|
-
const
|
|
218
|
+
export function ConfirmDialog() {
|
|
219
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
168
220
|
|
|
169
221
|
return (
|
|
170
|
-
|
|
171
|
-
<
|
|
172
|
-
<
|
|
173
|
-
|
|
174
|
-
|
|
222
|
+
<>
|
|
223
|
+
<Button onClick={() => setIsOpen(true)}>Open Dialog</Button>
|
|
224
|
+
<Modal
|
|
225
|
+
isOpen={isOpen}
|
|
226
|
+
onClose={() => setIsOpen(false)}
|
|
227
|
+
title="Confirm Action"
|
|
228
|
+
>
|
|
229
|
+
<p>Are you sure you want to proceed?</p>
|
|
230
|
+
<div className="flex gap-2 mt-4">
|
|
231
|
+
<Button variant="danger" onClick={() => setIsOpen(false)}>
|
|
232
|
+
Confirm
|
|
233
|
+
</Button>
|
|
234
|
+
<Button variant="secondary" onClick={() => setIsOpen(false)}>
|
|
235
|
+
Cancel
|
|
236
|
+
</Button>
|
|
237
|
+
</div>
|
|
238
|
+
</Modal>
|
|
239
|
+
</>
|
|
175
240
|
);
|
|
176
241
|
}
|
|
177
242
|
```
|
|
178
243
|
|
|
179
|
-
|
|
180
|
-
If you don't wrap your app in a ThemeProvider, components will automatically use the default theme.
|
|
244
|
+
## 🛠️ Development
|
|
181
245
|
|
|
182
|
-
###
|
|
246
|
+
### Running the Demo
|
|
183
247
|
|
|
184
|
-
|
|
248
|
+
```bash
|
|
249
|
+
# Clone the repository
|
|
250
|
+
git clone https://github.com/marcoschwartz/lite-ui.git
|
|
251
|
+
cd lite-ui-js
|
|
185
252
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
name: 'custom',
|
|
192
|
-
button: {
|
|
193
|
-
...themes.default.button,
|
|
194
|
-
variants: {
|
|
195
|
-
...themes.default.button.variants,
|
|
196
|
-
primary: 'bg-purple-600 hover:bg-purple-700 text-white',
|
|
197
|
-
},
|
|
198
|
-
},
|
|
199
|
-
};
|
|
253
|
+
# Install dependencies
|
|
254
|
+
npm install
|
|
255
|
+
|
|
256
|
+
# Run library + demo app in watch mode
|
|
257
|
+
npm run dev:all
|
|
200
258
|
```
|
|
201
259
|
|
|
202
|
-
|
|
260
|
+
This will:
|
|
261
|
+
1. Start the library build in watch mode (auto-rebuilds on changes)
|
|
262
|
+
2. Start the Next.js demo app on http://localhost:3000
|
|
263
|
+
3. Hot-reload changes from the library in the demo app
|
|
264
|
+
|
|
265
|
+
### Building
|
|
266
|
+
|
|
267
|
+
```bash
|
|
268
|
+
# Build library
|
|
269
|
+
npm run build
|
|
270
|
+
|
|
271
|
+
# Build CSS only
|
|
272
|
+
npm run build:css
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
## 📂 Project Structure
|
|
276
|
+
|
|
277
|
+
```
|
|
278
|
+
lite-ui-js/
|
|
279
|
+
├── src/ # Library source code
|
|
280
|
+
│ ├── components/ # React components
|
|
281
|
+
│ ├── theme/ # Theme system
|
|
282
|
+
│ ├── icons/ # Icon components
|
|
283
|
+
│ └── index.ts # Main exports
|
|
284
|
+
├── demo/ # Demo Next.js app
|
|
285
|
+
│ └── app/
|
|
286
|
+
│ ├── components/ # Component examples
|
|
287
|
+
│ └── page.tsx # Home page
|
|
288
|
+
├── dist/ # Built library (generated)
|
|
289
|
+
└── package.json
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
## 🤝 Contributing
|
|
293
|
+
|
|
294
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
295
|
+
|
|
296
|
+
## 📄 License
|
|
297
|
+
|
|
298
|
+
MIT © Marco Schwartz
|
|
299
|
+
|
|
300
|
+
## 🔗 Links
|
|
301
|
+
|
|
302
|
+
- [NPM Package](https://www.npmjs.com/package/@marcoschwartz/lite-ui)
|
|
303
|
+
- [GitHub Repository](https://github.com/marcoschwartz/lite-ui)
|
|
304
|
+
- [Component Documentation](./COMPONENTS.md)
|
|
305
|
+
|
|
306
|
+
## 💡 Technology Stack
|
|
203
307
|
|
|
204
308
|
- **React 19** - UI framework
|
|
205
|
-
- **TypeScript** - Type safety
|
|
206
|
-
- **Tailwind CSS v4** -
|
|
207
|
-
- **tsup** -
|
|
309
|
+
- **TypeScript 5** - Type safety
|
|
310
|
+
- **Tailwind CSS v4** - Utility-first styling
|
|
311
|
+
- **tsup** - TypeScript bundler
|
|
208
312
|
- **Next.js 15** - Demo app framework
|