@matheusrizzati/ui 0.1.1 → 0.1.3

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,307 @@
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), 45 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
+ - ðŸ“Ķ **45 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
+ | `Toggle` | Pressed/unpressed button | Toolbar toggles, view modes |
105
+ | `ToggleGroup` | Group of toggles | Single/multiple selection |
106
+ | `DatePicker` | Date input with calendar | Popover calendar, clearable, min/max dates |
107
+
108
+ ### Data Display
109
+
110
+ | Component | Description | Key Features |
111
+ |-----------|-------------|--------------|
112
+ | `Table` | Basic table primitives | Thead, Tbody, Tr, Th, Td |
113
+ | `DataTable` | Feature-rich data table | Sorting, pagination, row selection |
114
+ | `Badge` | Status/category label | 6 variants, 3 sizes |
115
+ | `Avatar` | User/entity image | Sizes, shapes, status indicator |
116
+ | `AvatarGroup` | Stacked avatars | `max` prop, +N overflow counter |
117
+ | `Card` | Content container | Elevated, outlined, ghost variants |
118
+ | `StatCard` | KPI metric card | Change indicator, icon slot |
119
+ | `Skeleton` | Loading placeholder | Pulse animation |
120
+ | `Progress` | Progress bar | Variants, sizes, label |
121
+ | `Calendar` | Date grid | Month nav, min/max, locale support |
122
+
123
+ ### Navigation
124
+
125
+ | Component | Description | Key Features |
126
+ |-----------|-------------|--------------|
127
+ | `Tabs` | Tab switcher | Segmented style |
128
+ | `Breadcrumb` | Path navigation | Separator, active state |
129
+ | `Pagination` | Page navigation | Page numbers, ellipsis |
130
+ | `Sidebar` | App sidebar | Collapsible, sections, active items |
131
+ | `Navbar` | Top navigation bar | — |
132
+ | `Steps` | Step indicator | Completed/active/upcoming states |
133
+
134
+ ### Overlays
135
+
136
+ | Component | Description | Key Features |
137
+ |-----------|-------------|--------------|
138
+ | `Modal` | Dialog window | Radix Dialog, title/description/footer |
139
+ | `Drawer` | Slide-out panel | **4 sides**, 5 sizes, header/body/footer |
140
+ | `Dropdown` | Context/action menu | Radix DropdownMenu, labels, groups, separators |
141
+ | `Tooltip` | Hover info | Radix Tooltip |
142
+ | `Popover` | Click popover | Radix Popover |
143
+ | `HoverCard` | Rich hover preview | Radix HoverCard, configurable delays |
144
+ | `ConfirmDialog` | Destructive action confirm | Danger/primary variants, loading state |
145
+
146
+ ### Feedback
147
+
148
+ | Component | Description | Key Features |
149
+ |-----------|-------------|--------------|
150
+ | `Alert` | Inline message | Info, success, warning, danger |
151
+ | `Toast` | Notification popup | Provider + `useToast()` hook |
152
+ | `EmptyState` | No-data placeholder | Icon, title, description, action |
153
+ | `Spinner` | Loading spinner | 5 sizes, primary color |
154
+
155
+ ### Layout
156
+
157
+ | Component | Description | Key Features |
158
+ |-----------|-------------|--------------|
159
+ | `AppShell` | Full page layout | Sidebar + content areas |
160
+ | `PageHeader` | Page title section | Title, description, action slot |
161
+ | `Separator` | Visual divider | Horizontal/vertical |
162
+ | `Accordion` | Collapsible sections | Single/multiple mode, smooth animation |
163
+ | `Collapsible` | Simple expand/collapse | Controlled/uncontrolled, Trigger + Content |
164
+
165
+ ### Utilities
166
+
167
+ | Export | Description |
168
+ |--------|-------------|
169
+ | `ThemeProvider` | Light/dark/system toggle + persistence |
170
+ | `useTheme()` | Access theme state and controls |
171
+ | `cn()` | Class merging utility (clsx + tailwind-merge) |
172
+ | `CommandPalette` | ⌘K search palette |
173
+
174
+ ---
175
+
176
+ ## ðŸŽŊ Quick Start Example
121
177
 
122
178
  ```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 }) {
179
+ import {
180
+ ThemeProvider,
181
+ AppShell,
182
+ Sidebar,
183
+ SidebarHeader,
184
+ SidebarContent,
185
+ SidebarSection,
186
+ SidebarItem,
187
+ Navbar,
188
+ PageHeader,
189
+ Button,
190
+ Card,
191
+ CardHeader,
192
+ CardBody,
193
+ StatCard,
194
+ Input,
195
+ Select,
196
+ DataTable,
197
+ useTheme,
198
+ } from "@matheusrizzati/ui";
199
+
200
+ function Dashboard() {
201
+ const { toggleTheme, resolvedTheme } = useTheme();
202
+
134
203
  return (
135
- <div className="flex h-screen bg-bg">
204
+ <AppShell>
136
205
  <Sidebar>
137
- <SidebarHeader logo={<MyLogo />} />
206
+ <SidebarHeader>My App</SidebarHeader>
138
207
  <SidebarContent>
139
- <SidebarItem active>Dashboard</SidebarItem>
140
- <SidebarItem>Settings</SidebarItem>
208
+ <SidebarSection label="Menu">
209
+ <SidebarItem active>Dashboard</SidebarItem>
210
+ <SidebarItem>Users</SidebarItem>
211
+ <SidebarItem>Settings</SidebarItem>
212
+ </SidebarSection>
141
213
  </SidebarContent>
142
- <SidebarToggle />
143
214
  </Sidebar>
144
- <main className="flex-1 p-6">{children}</main>
145
- </div>
215
+
216
+ <main>
217
+ <Navbar>
218
+ <Button variant="ghost" onClick={toggleTheme}>
219
+ {resolvedTheme === "dark" ? "☀ïļ" : "🌙"}
220
+ </Button>
221
+ </Navbar>
222
+
223
+ <div className="p-6">
224
+ <PageHeader
225
+ title="Dashboard"
226
+ description="Overview of your metrics"
227
+ />
228
+
229
+ <div className="grid grid-cols-3 gap-4 mb-6">
230
+ <StatCard title="Revenue" value="$12,345" change="+12%" />
231
+ <StatCard title="Users" value="1,234" change="+5%" />
232
+ <StatCard title="Orders" value="567" change="-2%" />
233
+ </div>
234
+
235
+ <Card>
236
+ <CardHeader>Recent Orders</CardHeader>
237
+ <CardBody>
238
+ <DataTable
239
+ columns={[
240
+ { key: "id", header: "ID" },
241
+ { key: "customer", header: "Customer" },
242
+ { key: "total", header: "Total" },
243
+ ]}
244
+ data={[
245
+ { id: "#001", customer: "John Doe", total: "$99.00" },
246
+ { id: "#002", customer: "Jane Smith", total: "$149.00" },
247
+ ]}
248
+ />
249
+ </CardBody>
250
+ </Card>
251
+ </div>
252
+ </main>
253
+ </AppShell>
146
254
  );
147
255
  }
148
256
  ```
149
257
 
150
- ## Theming
258
+ ---
151
259
 
152
- The library uses CSS variables for theming. You can override these in your `:root` or a specific scope to change the appearance.
260
+ ## ðŸŽĻ Customizing Tokens
261
+
262
+ Override CSS variables in your own stylesheet to customize the theme:
153
263
 
154
264
  ```css
155
265
  :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;
266
+ /* Change the primary color to emerald */
267
+ --color-primary-500: #10b981;
268
+ --color-primary-600: #059669;
269
+ --color-primary-700: #047857;
270
+ --color-primary: var(--color-primary-600);
271
+ --color-primary-hover: var(--color-primary-700);
272
+
273
+ /* Change the font */
274
+ --font-sans: "Inter", sans-serif;
275
+
276
+ /* Adjust border radius */
277
+ --radius: 0.75rem;
163
278
  }
164
279
  ```
165
280
 
166
- See all available tokens in `node_modules/@matheusrizzati/ui/dist/tokens.css`.
281
+ ---
282
+
283
+ ## 🛠ïļ Tech Stack
284
+
285
+ - **React 18+** with TypeScript
286
+ - **Tailwind CSS** for utility classes
287
+ - **Radix UI** for accessible primitives (Dialog, Dropdown, Tooltip, Popover, AlertDialog)
288
+ - **CVA** (class-variance-authority) for variant management
289
+ - **tsup** for building ESM + CJS bundles
290
+
291
+ ---
292
+
293
+ ## ðŸ“Ķ Exports
294
+
295
+ ```
296
+ dist/
297
+ ├── index.js # ESM
298
+ ├── index.cjs # CommonJS
299
+ ├── index.d.ts # TypeScript declarations
300
+ ├── index.d.cts # CTS declarations
301
+ ├── styles.css # Compiled styles
302
+ └── tokens.css # Design tokens (import this!)
303
+ ```
304
+
305
+ ## 📄 License
306
+
307
+ MIT