@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 +244 -110
- package/dist/index.cjs +2706 -195
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +535 -3
- package/dist/index.d.ts +535 -3
- package/dist/index.js +2615 -158
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1821 -0
- package/dist/styles.css.map +1 -0
- package/dist/styles.d.cts +2 -0
- package/dist/styles.d.ts +2 -0
- package/dist/tokens.css +107 -41
- package/dist/tokens.css.map +1 -1
- package/package.json +79 -63
package/README.md
CHANGED
|
@@ -1,166 +1,300 @@
|
|
|
1
1
|
# @matheusrizzati/ui
|
|
2
2
|
|
|
3
|
-
A
|
|
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
|
-
|
|
6
|
-

|
|
5
|
+
## âĻ Features
|
|
7
6
|
|
|
8
|
-
|
|
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
|
-
|
|
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
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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
|
-
|
|
27
|
+
---
|
|
52
28
|
|
|
53
|
-
|
|
29
|
+
## ð Setup
|
|
54
30
|
|
|
55
|
-
|
|
56
|
-
@import "@matheusrizzati/ui/tokens.css";
|
|
31
|
+
### 1. Import the CSS
|
|
57
32
|
|
|
58
|
-
|
|
59
|
-
@tailwind components;
|
|
60
|
-
@tailwind utilities;
|
|
61
|
-
```
|
|
33
|
+
In your app's entry file (e.g., `main.tsx` or `layout.tsx`):
|
|
62
34
|
|
|
63
|
-
|
|
35
|
+
```tsx
|
|
36
|
+
import "@matheusrizzati/ui/tokens.css";
|
|
37
|
+
```
|
|
64
38
|
|
|
65
|
-
###
|
|
39
|
+
### 2. Add the ThemeProvider
|
|
66
40
|
|
|
67
41
|
```tsx
|
|
68
|
-
import {
|
|
42
|
+
import { ThemeProvider } from "@matheusrizzati/ui";
|
|
69
43
|
|
|
70
|
-
|
|
44
|
+
function App() {
|
|
71
45
|
return (
|
|
72
|
-
<
|
|
73
|
-
|
|
74
|
-
|
|
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
|
-
|
|
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 {
|
|
61
|
+
import { useTheme } from "@matheusrizzati/ui";
|
|
87
62
|
|
|
88
|
-
|
|
63
|
+
function ThemeToggle() {
|
|
64
|
+
const { resolvedTheme, toggleTheme } = useTheme();
|
|
89
65
|
return (
|
|
90
|
-
<
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
</div>
|
|
66
|
+
<button onClick={toggleTheme}>
|
|
67
|
+
{resolvedTheme === "dark" ? "âïļ" : "ð"}
|
|
68
|
+
</button>
|
|
94
69
|
);
|
|
95
70
|
}
|
|
96
71
|
```
|
|
97
72
|
|
|
98
|
-
###
|
|
73
|
+
### 4. Tailwind CSS (if using)
|
|
99
74
|
|
|
100
|
-
|
|
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
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
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
|
-
|
|
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
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
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
|
-
<
|
|
197
|
+
<AppShell>
|
|
136
198
|
<Sidebar>
|
|
137
|
-
<SidebarHeader
|
|
199
|
+
<SidebarHeader>My App</SidebarHeader>
|
|
138
200
|
<SidebarContent>
|
|
139
|
-
<
|
|
140
|
-
|
|
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
|
-
|
|
145
|
-
|
|
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
|
-
|
|
251
|
+
---
|
|
151
252
|
|
|
152
|
-
|
|
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
|
-
/*
|
|
157
|
-
--color-primary: #
|
|
158
|
-
--color-primary-
|
|
159
|
-
--color-primary-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
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
|
-
|
|
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
|