@raxrai/stylelab-ui 0.1.0 → 0.1.1
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 +23 -35
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,30 +1,8 @@
|
|
|
1
1
|
# StyleLab UI
|
|
2
2
|
|
|
3
|
-
A themeable, accessible React UI library with **8 themes**: Minimal, Night, Glass, Neubrutal, Clay, Cyberpunk, Retro, and Motion. Built with Tailwind CSS v4, CVA, and Lucide icons.
|
|
3
|
+
A themeable, accessible React UI library with **8 themes**: Minimal, Night, Glass, Neubrutal, Clay, Cyberpunk, Retro, and Motion. Built with Tailwind CSS v4, CVA, and Lucide icons. Zero extra dependencies at install time — only **React** and **React DOM** as peers; everything else is bundled.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install
|
|
9
|
-
npm run dev
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
Open [http://localhost:3000/gallery](http://localhost:3000/gallery) to see all components and the sticky theme switcher.
|
|
13
|
-
|
|
14
|
-
## Build library for distribution
|
|
15
|
-
|
|
16
|
-
```bash
|
|
17
|
-
npm run build:lib
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
Output: `dist/` (CJS, ESM, and `.d.ts`). The package is already configured for npm (`main`, `module`, `types`, `exports`, `files`). To publish, see **[docs/PUBLISHING-TO-NPM.md](docs/PUBLISHING-TO-NPM.md)** for detailed steps.
|
|
21
|
-
|
|
22
|
-
---
|
|
23
|
-
|
|
24
|
-
## Documentation
|
|
25
|
-
|
|
26
|
-
- **[docs/COMPONENTS.md](docs/COMPONENTS.md)** — Full component API: every prop, type, hook, and global (themes, `getThemeClass`, `cn`, etc.).
|
|
27
|
-
- **[docs/PUBLISHING-TO-NPM.md](docs/PUBLISHING-TO-NPM.md)** — How to publish this package to npm (maintainers).
|
|
5
|
+
**Live site (demo, gallery, docs):** [https://stylelab.rajarai.com](https://stylelab.rajarai.com)
|
|
28
6
|
|
|
29
7
|
---
|
|
30
8
|
|
|
@@ -34,18 +12,20 @@ Output: `dist/` (CJS, ESM, and `.d.ts`). The package is already configured for n
|
|
|
34
12
|
npm install @raxrai/stylelab-ui react react-dom
|
|
35
13
|
```
|
|
36
14
|
|
|
37
|
-
Peer dependencies:
|
|
15
|
+
Peer dependencies: **react** and **react-dom** (>=18). Other runtime deps (e.g. class-variance-authority, clsx, tailwind-merge, lucide-react, framer-motion) are bundled, so no extra install is required.
|
|
38
16
|
|
|
39
|
-
### Tailwind + styles
|
|
17
|
+
### 1. Tailwind + styles
|
|
40
18
|
|
|
41
|
-
Your app must use **Tailwind CSS v4**. Import StyleLab design tokens in your global CSS after Tailwind:
|
|
19
|
+
Your app must use **Tailwind CSS v4**. Import StyleLab design tokens in your global CSS **after** Tailwind:
|
|
42
20
|
|
|
43
21
|
```css
|
|
44
22
|
@import "tailwindcss";
|
|
45
23
|
@import "@raxrai/stylelab-ui/styles";
|
|
46
24
|
```
|
|
47
25
|
|
|
48
|
-
### ThemeProvider
|
|
26
|
+
### 2. ThemeProvider
|
|
27
|
+
|
|
28
|
+
Wrap your app so components receive the active theme:
|
|
49
29
|
|
|
50
30
|
```tsx
|
|
51
31
|
import { ThemeProvider } from "@raxrai/stylelab-ui";
|
|
@@ -61,7 +41,7 @@ export default function RootLayout({ children }) {
|
|
|
61
41
|
}
|
|
62
42
|
```
|
|
63
43
|
|
|
64
|
-
### Use components
|
|
44
|
+
### 3. Use components
|
|
65
45
|
|
|
66
46
|
```tsx
|
|
67
47
|
import { Button, Card, useTheme } from "@raxrai/stylelab-ui";
|
|
@@ -79,17 +59,20 @@ export function MyPage() {
|
|
|
79
59
|
|
|
80
60
|
**Themes:** `minimal` | `night` | `glass` | `neubrutal` | `clay` | `cyberpunk` | `retro` | `motion`
|
|
81
61
|
|
|
82
|
-
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## What’s in the package
|
|
83
65
|
|
|
84
66
|
**Components:** Accordion, Alert, Avatar, AvatarGroup, Badge, BentoGrid, Breadcrumbs, Button, Calendar, Card, CommandPalette, DashboardShell, DataTable, DocumentAccordion, Dropdown, Flashcard, GraphicCard, Input, Modal, Navbar, PricingCard, ProgressBar, SectionHeader, Sidebar, Skeleton, Slider, StatsCard, Tabs, Terminal, Timeline, Toast, Toggle, Tooltip.
|
|
85
67
|
|
|
86
68
|
**Global:** ThemeProvider, useTheme, getThemeClass, THEMES, StyleLabTheme, cn, getNextListIndex, useFocusTrap, useClickOutside, useKeyboardNavigation.
|
|
87
69
|
|
|
88
|
-
|
|
70
|
+
- **See all components and try themes:** [stylelab.rajarai.com](https://stylelab.rajarai.com)
|
|
71
|
+
- **Full API (props, types, hooks):** [docs/COMPONENTS.md](docs/COMPONENTS.md) in this repo.
|
|
89
72
|
|
|
90
73
|
---
|
|
91
74
|
|
|
92
|
-
## Component
|
|
75
|
+
## Component API (overview)
|
|
93
76
|
|
|
94
77
|
### Button
|
|
95
78
|
|
|
@@ -196,8 +179,8 @@ Implements focus trap and scroll lock when open.
|
|
|
196
179
|
|
|
197
180
|
| Prop | Type | Default | Description |
|
|
198
181
|
|----------------|-------------------------|---------|--------------------------|
|
|
199
|
-
| `trigger`
|
|
200
|
-
| `items`
|
|
182
|
+
| `trigger` | `ReactNode` | — | Button / element to open |
|
|
183
|
+
| `items` | `{ value, label, disabled? }[]` | — | Options |
|
|
201
184
|
| `value` / `defaultValue` | `string` | — | Controlled / initial |
|
|
202
185
|
| `onValueChange`| `(value: string) => void` | — | Selection callback |
|
|
203
186
|
|
|
@@ -211,10 +194,15 @@ Keyboard: Enter/Space to open, Arrows to move, Enter to select, Escape to close.
|
|
|
211
194
|
import { cn, useFocusTrap, useClickOutside, useKeyboardNavigation, getNextListIndex } from "@raxrai/stylelab-ui";
|
|
212
195
|
```
|
|
213
196
|
|
|
214
|
-
- **cn(...)** –
|
|
197
|
+
- **cn(...)** – clsx + tailwind-merge for class names.
|
|
215
198
|
- **useFocusTrap(active, options?)** – Traps focus in a container ref (e.g. Modal).
|
|
216
199
|
- **useClickOutside(ref(s), handler, options?)** – Fires when click is outside ref(s).
|
|
217
200
|
- **useKeyboardNavigation({ onEscape, onArrowLeft, onArrowRight, ... })** – Document-level key handlers.
|
|
218
201
|
- **getNextListIndex(current, direction, length)** – Index for arrow-key list/tab navigation.
|
|
219
202
|
|
|
220
203
|
---
|
|
204
|
+
|
|
205
|
+
## Links
|
|
206
|
+
|
|
207
|
+
- **Live demo & docs:** [https://stylelab.rajarai.com](https://stylelab.rajarai.com)
|
|
208
|
+
- **Full component API (this repo):** [docs/COMPONENTS.md](docs/COMPONENTS.md)
|