@matheusrizzati/ui 0.1.1 → 0.1.2

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,166 +1,300 @@
1
1
  # @matheusrizzati/ui
2
2
 
3
- A lightweight, premium dark-themed React UI library for modern SaaS dashboards. Built with React, Tailwind CSS, and Radix UI.
3
+ A premium React UI component library built for modern SaaS applications. Features a dual light/dark theme (Obsidian), 39 production-ready components, and a flexible token-based design system.
4
4
 
5
- ![License](https://img.shields.io/npm/l/@matheusrizzati/ui)
6
- ![Version](https://img.shields.io/npm/v/@matheusrizzati/ui)
5
+ ## âœĻ Features
7
6
 
8
- ## Features
7
+ - ðŸŽĻ **Dual Theme** — Light mode + Obsidian dark mode with seamless toggle
8
+ - ðŸ“Ķ **39 Components** — Forms, data display, overlays, navigation, feedback, and layout
9
+ - 🔧 **Token-Based** — Fully customizable via CSS variables
10
+ - â™ŋ **Accessible** — Built on Radix UI primitives where it matters
11
+ - 📐 **TypeScript** — Full type safety and IntelliSense
12
+ - ðŸŠķ **Lightweight** — Tree-shakeable ESM + CJS output
9
13
 
10
- - 🌑 **Premium Dark Theme**: Designed for modern, dark-mode first applications.
11
- - ðŸŽĻ **Tailwind CSS**: Built on top of Tailwind for easy customization.
12
- - ðŸ§Đ **Radix UI Primitives**: Accessible and robust interactive components.
13
- - ⚡ **Lightweight**: Tree-shakable ESM and CJS builds.
14
- - âŒĻïļ **Typed**: Written in TypeScript with full type definitions.
14
+ ---
15
15
 
16
- ## Installation
16
+ ## ðŸ“Ĩ Installation
17
17
 
18
18
  ```bash
19
19
  npm install @matheusrizzati/ui
20
- # or
21
- yarn add @matheusrizzati/ui
22
- # or
23
- pnpm add @matheusrizzati/ui
24
20
  ```
25
21
 
26
- ## Setup
27
-
28
- ### 1. Configure Tailwind CSS
29
-
30
- Add the library's content path and tokens to your `tailwind.config.ts` (or `.js`):
31
-
32
- ```ts
33
- // tailwind.config.ts
34
- import type { Config } from "tailwindcss";
35
-
36
- const config: Config = {
37
- content: [
38
- "./src/**/*.{js,ts,jsx,tsx}",
39
- // Add this line to include the library's components
40
- "./node_modules/@matheusrizzati/ui/dist/**/*.{js,ts,jsx,tsx}",
41
- ],
42
- theme: {
43
- extend: {},
44
- },
45
- plugins: [],
46
- };
47
-
48
- export default config;
22
+ **Peer dependencies:**
23
+ ```bash
24
+ npm install react react-dom
49
25
  ```
50
26
 
51
- ### 2. Import Styles
27
+ ---
52
28
 
53
- Import the CSS tokens in your global CSS file (e.g., `src/index.css` or `src/globals.css`):
29
+ ## 🚀 Setup
54
30
 
55
- ```css
56
- @import "@matheusrizzati/ui/tokens.css";
31
+ ### 1. Import the CSS
57
32
 
58
- @tailwind base;
59
- @tailwind components;
60
- @tailwind utilities;
61
- ```
33
+ In your app's entry file (e.g., `main.tsx` or `layout.tsx`):
62
34
 
63
- ## Usage
35
+ ```tsx
36
+ import "@matheusrizzati/ui/tokens.css";
37
+ ```
64
38
 
65
- ### Button
39
+ ### 2. Add the ThemeProvider
66
40
 
67
41
  ```tsx
68
- import { Button } from "@matheusrizzati/ui";
42
+ import { ThemeProvider } from "@matheusrizzati/ui";
69
43
 
70
- export function App() {
44
+ function App() {
71
45
  return (
72
- <div className="flex gap-4">
73
- <Button variant="primary">Primary Action</Button>
74
- <Button variant="secondary">Secondary</Button>
75
- <Button variant="outline">Outline</Button>
76
- <Button variant="ghost">Ghost</Button>
77
- <Button variant="danger">Delete</Button>
78
- </div>
46
+ <ThemeProvider defaultTheme="system">
47
+ {/* your app */}
48
+ </ThemeProvider>
79
49
  );
80
50
  }
81
51
  ```
82
52
 
83
- ### Input
53
+ The `ThemeProvider` supports three modes:
54
+ - `"light"` — Light theme
55
+ - `"dark"` — Obsidian dark theme
56
+ - `"system"` — Follows OS preference (default)
57
+
58
+ ### 3. Toggle themes
84
59
 
85
60
  ```tsx
86
- import { Input } from "@matheusrizzati/ui";
61
+ import { useTheme } from "@matheusrizzati/ui";
87
62
 
88
- export function LoginForm() {
63
+ function ThemeToggle() {
64
+ const { resolvedTheme, toggleTheme } = useTheme();
89
65
  return (
90
- <div className="space-y-4">
91
- <Input label="Email" placeholder="hello@example.com" type="email" />
92
- <Input label="Password" type="password" />
93
- </div>
66
+ <button onClick={toggleTheme}>
67
+ {resolvedTheme === "dark" ? "☀ïļ" : "🌙"}
68
+ </button>
94
69
  );
95
70
  }
96
71
  ```
97
72
 
98
- ### Card
73
+ ### 4. Tailwind CSS (if using)
99
74
 
100
- ```tsx
101
- import { Card, CardHeader, CardBody, CardFooter, Button } from "@matheusrizzati/ui";
75
+ Add `darkMode: "class"` to your `tailwind.config.ts` and include the library in `content`:
102
76
 
103
- export function PricingCard() {
104
- return (
105
- <Card>
106
- <CardHeader>
107
- <h3 className="text-lg font-medium text-text-primary">Pro Plan</h3>
108
- </CardHeader>
109
- <CardBody>
110
- <p className="text-text-secondary">Access to all premium features.</p>
111
- </CardBody>
112
- <CardFooter>
113
- <Button className="w-full">Upgrade</Button>
114
- </CardFooter>
115
- </Card>
116
- );
117
- }
77
+ ```ts
78
+ export default {
79
+ darkMode: "class",
80
+ content: [
81
+ "./src/**/*.{ts,tsx}",
82
+ "./node_modules/@matheusrizzati/ui/dist/**/*.{js,cjs}",
83
+ ],
84
+ };
118
85
  ```
119
86
 
120
- ### Sidebar
87
+ ---
88
+
89
+ ## 📚 Component Catalog
90
+
91
+ ### Forms & Inputs
92
+
93
+ | Component | Description | Key Features |
94
+ |-----------|-------------|--------------|
95
+ | `Button` | Primary action trigger | 5 variants, 3 sizes, loading state, icon support |
96
+ | `Input` | Text input field | Start/end icons, clearable (`onClear`), error state |
97
+ | `Textarea` | Multi-line text input | Auto-resize, character count |
98
+ | `Select` | Custom dropdown select | **Searchable**, clearable, groups, icons, descriptions, keyboard nav |
99
+ | `Combobox` | Autocomplete/typeahead | Multi-select, **creatable**, groups, loading state |
100
+ | `Checkbox` | Boolean toggle box | Indeterminate state |
101
+ | `Radio` | Single selection group | RadioGroup + Radio |
102
+ | `Switch` | Toggle switch | Labels, sizes |
103
+ | `Slider` | Range input | Pointer drag, keyboard, step snapping, value display |
104
+
105
+ ### Data Display
106
+
107
+ | Component | Description | Key Features |
108
+ |-----------|-------------|--------------|
109
+ | `Table` | Basic table primitives | Thead, Tbody, Tr, Th, Td |
110
+ | `DataTable` | Feature-rich data table | Sorting, pagination, row selection |
111
+ | `Badge` | Status/category label | 6 variants, 3 sizes |
112
+ | `Avatar` | User/entity image | Sizes, shapes, status indicator |
113
+ | `AvatarGroup` | Stacked avatars | `max` prop, +N overflow counter |
114
+ | `Card` | Content container | Elevated, outlined, ghost variants |
115
+ | `StatCard` | KPI metric card | Change indicator, icon slot |
116
+ | `Skeleton` | Loading placeholder | Pulse animation |
117
+ | `Progress` | Progress bar | Variants, sizes, label |
118
+
119
+ ### Navigation
120
+
121
+ | Component | Description | Key Features |
122
+ |-----------|-------------|--------------|
123
+ | `Tabs` | Tab switcher | Segmented style |
124
+ | `Breadcrumb` | Path navigation | Separator, active state |
125
+ | `Pagination` | Page navigation | Page numbers, ellipsis |
126
+ | `Sidebar` | App sidebar | Collapsible, sections, active items |
127
+ | `Navbar` | Top navigation bar | — |
128
+ | `Steps` | Step indicator | Completed/active/upcoming states |
129
+
130
+ ### Overlays
131
+
132
+ | Component | Description | Key Features |
133
+ |-----------|-------------|--------------|
134
+ | `Modal` | Dialog window | Radix Dialog, title/description/footer |
135
+ | `Drawer` | Slide-out panel | **4 sides**, 5 sizes, header/body/footer |
136
+ | `Dropdown` | Context/action menu | Radix DropdownMenu, labels, groups, separators |
137
+ | `Tooltip` | Hover info | Radix Tooltip |
138
+ | `Popover` | Click popover | Radix Popover |
139
+ | `ConfirmDialog` | Destructive action confirm | Danger/primary variants, loading state |
140
+
141
+ ### Feedback
142
+
143
+ | Component | Description | Key Features |
144
+ |-----------|-------------|--------------|
145
+ | `Alert` | Inline message | Info, success, warning, danger |
146
+ | `Toast` | Notification popup | Provider + `useToast()` hook |
147
+ | `EmptyState` | No-data placeholder | Icon, title, description, action |
148
+
149
+ ### Layout
150
+
151
+ | Component | Description | Key Features |
152
+ |-----------|-------------|--------------|
153
+ | `AppShell` | Full page layout | Sidebar + content areas |
154
+ | `PageHeader` | Page title section | Title, description, action slot |
155
+ | `Separator` | Visual divider | Horizontal/vertical |
156
+ | `Accordion` | Collapsible sections | Single/multiple mode, smooth animation |
157
+
158
+ ### Utilities
159
+
160
+ | Export | Description |
161
+ |--------|-------------|
162
+ | `ThemeProvider` | Light/dark/system toggle + persistence |
163
+ | `useTheme()` | Access theme state and controls |
164
+ | `cn()` | Class merging utility (clsx + tailwind-merge) |
165
+ | `CommandPalette` | ⌘K search palette |
166
+
167
+ ---
168
+
169
+ ## ðŸŽŊ Quick Start Example
121
170
 
122
171
  ```tsx
123
- import {
124
- Sidebar,
125
- SidebarHeader,
126
- SidebarContent,
127
- SidebarItem,
128
- SidebarToggle,
129
- LayoutDashboard,
130
- Settings
131
- } from "@matheusrizzati/ui"; // Note: Icons like LayoutDashboard need to be installed separately (e.g. lucide-react)
132
-
133
- export function DashboardLayout({ children }) {
172
+ import {
173
+ ThemeProvider,
174
+ AppShell,
175
+ Sidebar,
176
+ SidebarHeader,
177
+ SidebarContent,
178
+ SidebarSection,
179
+ SidebarItem,
180
+ Navbar,
181
+ PageHeader,
182
+ Button,
183
+ Card,
184
+ CardHeader,
185
+ CardBody,
186
+ StatCard,
187
+ Input,
188
+ Select,
189
+ DataTable,
190
+ useTheme,
191
+ } from "@matheusrizzati/ui";
192
+
193
+ function Dashboard() {
194
+ const { toggleTheme, resolvedTheme } = useTheme();
195
+
134
196
  return (
135
- <div className="flex h-screen bg-bg">
197
+ <AppShell>
136
198
  <Sidebar>
137
- <SidebarHeader logo={<MyLogo />} />
199
+ <SidebarHeader>My App</SidebarHeader>
138
200
  <SidebarContent>
139
- <SidebarItem active>Dashboard</SidebarItem>
140
- <SidebarItem>Settings</SidebarItem>
201
+ <SidebarSection label="Menu">
202
+ <SidebarItem active>Dashboard</SidebarItem>
203
+ <SidebarItem>Users</SidebarItem>
204
+ <SidebarItem>Settings</SidebarItem>
205
+ </SidebarSection>
141
206
  </SidebarContent>
142
- <SidebarToggle />
143
207
  </Sidebar>
144
- <main className="flex-1 p-6">{children}</main>
145
- </div>
208
+
209
+ <main>
210
+ <Navbar>
211
+ <Button variant="ghost" onClick={toggleTheme}>
212
+ {resolvedTheme === "dark" ? "☀ïļ" : "🌙"}
213
+ </Button>
214
+ </Navbar>
215
+
216
+ <div className="p-6">
217
+ <PageHeader
218
+ title="Dashboard"
219
+ description="Overview of your metrics"
220
+ />
221
+
222
+ <div className="grid grid-cols-3 gap-4 mb-6">
223
+ <StatCard title="Revenue" value="$12,345" change="+12%" />
224
+ <StatCard title="Users" value="1,234" change="+5%" />
225
+ <StatCard title="Orders" value="567" change="-2%" />
226
+ </div>
227
+
228
+ <Card>
229
+ <CardHeader>Recent Orders</CardHeader>
230
+ <CardBody>
231
+ <DataTable
232
+ columns={[
233
+ { key: "id", header: "ID" },
234
+ { key: "customer", header: "Customer" },
235
+ { key: "total", header: "Total" },
236
+ ]}
237
+ data={[
238
+ { id: "#001", customer: "John Doe", total: "$99.00" },
239
+ { id: "#002", customer: "Jane Smith", total: "$149.00" },
240
+ ]}
241
+ />
242
+ </CardBody>
243
+ </Card>
244
+ </div>
245
+ </main>
246
+ </AppShell>
146
247
  );
147
248
  }
148
249
  ```
149
250
 
150
- ## Theming
251
+ ---
151
252
 
152
- The library uses CSS variables for theming. You can override these in your `:root` or a specific scope to change the appearance.
253
+ ## ðŸŽĻ Customizing Tokens
254
+
255
+ Override CSS variables in your own stylesheet to customize the theme:
153
256
 
154
257
  ```css
155
258
  :root {
156
- /* Override primary color to Blue */
157
- --color-primary: #3b82f6;
158
- --color-primary-hover: #60a5fa;
159
- --color-primary-active: #2563eb;
160
-
161
- /* Override radius */
162
- --radius: 8px;
259
+ /* Change the primary color to emerald */
260
+ --color-primary-500: #10b981;
261
+ --color-primary-600: #059669;
262
+ --color-primary-700: #047857;
263
+ --color-primary: var(--color-primary-600);
264
+ --color-primary-hover: var(--color-primary-700);
265
+
266
+ /* Change the font */
267
+ --font-sans: "Inter", sans-serif;
268
+
269
+ /* Adjust border radius */
270
+ --radius: 0.75rem;
163
271
  }
164
272
  ```
165
273
 
166
- See all available tokens in `node_modules/@matheusrizzati/ui/dist/tokens.css`.
274
+ ---
275
+
276
+ ## 🛠ïļ Tech Stack
277
+
278
+ - **React 18+** with TypeScript
279
+ - **Tailwind CSS** for utility classes
280
+ - **Radix UI** for accessible primitives (Dialog, Dropdown, Tooltip, Popover, AlertDialog)
281
+ - **CVA** (class-variance-authority) for variant management
282
+ - **tsup** for building ESM + CJS bundles
283
+
284
+ ---
285
+
286
+ ## ðŸ“Ķ Exports
287
+
288
+ ```
289
+ dist/
290
+ ├── index.js # ESM
291
+ ├── index.cjs # CommonJS
292
+ ├── index.d.ts # TypeScript declarations
293
+ ├── index.d.cts # CTS declarations
294
+ ├── styles.css # Compiled styles
295
+ └── tokens.css # Design tokens (import this!)
296
+ ```
297
+
298
+ ## 📄 License
299
+
300
+ MIT