@memelabui/ui 0.6.1 → 0.8.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 +429 -215
- package/dist/index.cjs +126 -58
- package/dist/index.d.cts +34 -3
- package/dist/index.d.ts +34 -3
- package/dist/index.js +125 -60
- package/dist/styles/index.css +2496 -2489
- package/package.json +118 -120
package/README.md
CHANGED
|
@@ -1,215 +1,429 @@
|
|
|
1
|
-
# @memelabui/ui
|
|
2
|
-
|
|
3
|
-
Shared UI component library for MemeLab projects. Dark-first glassmorphism design system built with React, TypeScript, and Tailwind CSS.
|
|
4
|
-
|
|
5
|
-
[](https://www.npmjs.com/package/@memelabui/ui)
|
|
6
|
-
|
|
7
|
-
## Install
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
pnpm add @memelabui/ui
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
|
68
|
-
|
|
69
|
-
| `
|
|
70
|
-
| `
|
|
71
|
-
| `
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
|
76
|
-
|
|
77
|
-
| `
|
|
78
|
-
| `
|
|
79
|
-
| `
|
|
80
|
-
|
|
81
|
-
###
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
|
112
|
-
|
|
113
|
-
| `
|
|
114
|
-
| `
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
|
144
|
-
|
|
145
|
-
| `
|
|
146
|
-
| `
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
|
151
|
-
|
|
152
|
-
| `
|
|
153
|
-
| `
|
|
154
|
-
| `
|
|
155
|
-
| `
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
1
|
+
# @memelabui/ui
|
|
2
|
+
|
|
3
|
+
Shared UI component library for MemeLab projects. Dark-first glassmorphism design system built with React, TypeScript, and Tailwind CSS.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@memelabui/ui)
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pnpm add @memelabui/ui
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Peer dependencies: `react >= 18`, `react-dom >= 18`, `tailwindcss >= 3.4`.
|
|
14
|
+
|
|
15
|
+
## Setup
|
|
16
|
+
|
|
17
|
+
### 1. Tailwind preset
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
// tailwind.config.ts
|
|
21
|
+
import memelabPreset from '@memelabui/ui/preset';
|
|
22
|
+
|
|
23
|
+
export default {
|
|
24
|
+
presets: [memelabPreset],
|
|
25
|
+
content: [
|
|
26
|
+
'./src/**/*.{ts,tsx}',
|
|
27
|
+
'./node_modules/@memelabui/ui/dist/**/*.{js,mjs}',
|
|
28
|
+
],
|
|
29
|
+
};
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
The preset adds MemeLab colors (`primary`, `accent`, `surface`, `glow`), animations, border radius, and box shadow tokens to your Tailwind config. No component CSS is duplicated — component styles come from the CSS import below.
|
|
33
|
+
|
|
34
|
+
### 2. Import styles
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
// main.tsx (before your app code)
|
|
38
|
+
import '@memelabui/ui/styles';
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
This imports base styles, CSS variables (`--ml-*` tokens), glassmorphism utility classes, and component animations. Must be imported once at the root of your app.
|
|
42
|
+
|
|
43
|
+
### 3. Use components
|
|
44
|
+
|
|
45
|
+
```tsx
|
|
46
|
+
import { Button, Card, Input, ToastProvider } from '@memelabui/ui';
|
|
47
|
+
|
|
48
|
+
function App() {
|
|
49
|
+
return (
|
|
50
|
+
<ToastProvider>
|
|
51
|
+
<Card variant="glass" hoverable>
|
|
52
|
+
<h2 className="section-title">Login</h2>
|
|
53
|
+
<Input label="Email" placeholder="you@example.com" />
|
|
54
|
+
<Button variant="primary" className="mt-4">Submit</Button>
|
|
55
|
+
</Card>
|
|
56
|
+
</ToastProvider>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## CSS Utility Classes
|
|
64
|
+
|
|
65
|
+
These classes are available globally after importing `@memelabui/ui/styles`. They provide the MemeLab visual foundation.
|
|
66
|
+
|
|
67
|
+
| Class | Purpose | When to use |
|
|
68
|
+
|-------|---------|-------------|
|
|
69
|
+
| `.glass` | Glassmorphism panel — translucent `bg`, `backdrop-filter: blur(16px)`, inset border, rounded | Visual shell for containers. **Does not include padding** — use `Card` component for padded cards |
|
|
70
|
+
| `.surface` | Surface panel — slightly more opaque `bg`, `blur(12px)`, border shadow | Alternative to `.glass` with stronger background. Also **no padding** |
|
|
71
|
+
| `.surface-hover` | Hover elevation transition — adds `box-shadow` on hover | Pair with `.glass` or `.surface` for interactive cards |
|
|
72
|
+
| `.section-title` | Card section heading — `font-semibold`, `border-bottom`, `mb-4` | Use inside `Card` for titled sections (settings, forms) |
|
|
73
|
+
| `.text-gradient` | Gradient text (violet to pink) | Branding, hero headings |
|
|
74
|
+
| `.animated-gradient` | Animated gradient background | Decorative elements, loading placeholders |
|
|
75
|
+
| `.page-container` | Centered max-w-80rem container with responsive padding | Page-level wrapper |
|
|
76
|
+
| `.orb` / `.orb-purple` / `.orb-blue` / `.orb-pink` | Decorative blurred orbs | Background effects (see `PageShell`) |
|
|
77
|
+
| `.pb-safe` / `.pt-safe` | iOS safe area padding | Mobile bottom/top bars |
|
|
78
|
+
| `.no-scrollbar` | Hides scrollbar | Horizontal scroll areas, custom scrolling |
|
|
79
|
+
| `.link-soft` | Subtle underline link | Secondary navigation links |
|
|
80
|
+
|
|
81
|
+
### Important: `.glass` / `.surface` vs `Card`
|
|
82
|
+
|
|
83
|
+
The `.glass` and `.surface` CSS classes are **visual treatments only** — they add background, blur, border, and shadow. They intentionally do **not** include padding because they're used across diverse elements (headers, sidebars, modals, custom layouts).
|
|
84
|
+
|
|
85
|
+
**For content cards, always use the `Card` component** instead of raw `.glass`/`.surface` classes. `Card` provides built-in padding (`p-5` by default) plus correct ARIA semantics.
|
|
86
|
+
|
|
87
|
+
```tsx
|
|
88
|
+
// Correct — Card handles padding automatically
|
|
89
|
+
<Card variant="glass" hoverable>
|
|
90
|
+
<h2 className="section-title">Settings</h2>
|
|
91
|
+
<Input label="Name" />
|
|
92
|
+
</Card>
|
|
93
|
+
|
|
94
|
+
// Avoid — raw classes require manual padding
|
|
95
|
+
<div className="glass surface-hover p-5">
|
|
96
|
+
<h2 className="section-title">Settings</h2>
|
|
97
|
+
<Input label="Name" />
|
|
98
|
+
</div>
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## Components
|
|
104
|
+
|
|
105
|
+
### Cards & Containers
|
|
106
|
+
|
|
107
|
+
Use these to wrap content sections. Each has different levels of structure.
|
|
108
|
+
|
|
109
|
+
| Component | When to use | Key props |
|
|
110
|
+
|-----------|-------------|-----------|
|
|
111
|
+
| `Card` | Generic content container with glassmorphism | `variant` (`'surface'` / `'glass'`), `hoverable`, `padding` (`'none'` / `'sm'` / `'md'` / `'lg'`) |
|
|
112
|
+
| `SectionCard` | Settings/config section with title, description, and optional right slot | `title`, `description?`, `right?`, `overlay?` |
|
|
113
|
+
| `StatCard` | Dashboard metric tile with value, label, icon, and trend | `value`, `label`, `icon?`, `trend?` |
|
|
114
|
+
| `CollapsibleSection` | Expandable/collapsible content block | `title`, `defaultOpen?` |
|
|
115
|
+
|
|
116
|
+
**Choosing the right card:**
|
|
117
|
+
|
|
118
|
+
- Building a **settings form section** (title + form fields)? Use `SectionCard`
|
|
119
|
+
- Showing a **dashboard metric** (number + label + icon)? Use `StatCard`
|
|
120
|
+
- Need a **generic container** with glass/surface styling? Use `Card`
|
|
121
|
+
- Need an **expandable block**? Use `CollapsibleSection`
|
|
122
|
+
|
|
123
|
+
```tsx
|
|
124
|
+
// Settings page section
|
|
125
|
+
<SectionCard title="AI Provider" description="Choose the AI model for your bot">
|
|
126
|
+
<Select label="Provider" />
|
|
127
|
+
<Input label="Model" placeholder="Default" />
|
|
128
|
+
</SectionCard>
|
|
129
|
+
|
|
130
|
+
// Dashboard metric
|
|
131
|
+
<StatCard value="1,234" label="Messages today" trend={{ value: 12, direction: 'up' }} />
|
|
132
|
+
|
|
133
|
+
// Generic glass card
|
|
134
|
+
<Card variant="glass" hoverable padding="lg">
|
|
135
|
+
<p>Any content here</p>
|
|
136
|
+
</Card>
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### Form Inputs
|
|
140
|
+
|
|
141
|
+
All form components accept `label`, `error`, and `helperText` props with automatic ARIA linkage (`aria-invalid`, `aria-describedby`). They use `forwardRef` for ref forwarding and spread all native HTML attributes.
|
|
142
|
+
|
|
143
|
+
| Component | When to use | Key props |
|
|
144
|
+
|-----------|-------------|-----------|
|
|
145
|
+
| `Input` | Single-line text input | `label?`, `error?`, `helperText?`, `hasError?` + all `<input>` attrs |
|
|
146
|
+
| `SearchInput` | Search field with icon and clear button | `onClear?` + all `Input` props |
|
|
147
|
+
| `Textarea` | Multi-line text input | `label?`, `error?` + all `<textarea>` attrs |
|
|
148
|
+
| `Select` | Native dropdown select | `label?`, `error?` + all `<select>` attrs |
|
|
149
|
+
| `Combobox` | Searchable select with keyboard navigation | `options`, `value`, `onChange`, `placeholder?` |
|
|
150
|
+
| `Checkbox` | Checkbox with label and indeterminate support | `label?`, `indeterminate?`, `checked`, `onChange` |
|
|
151
|
+
| `RadioGroup` / `RadioItem` | Radio button group | `value`, `onChange` on Group; `value`, `label` on Item |
|
|
152
|
+
| `Toggle` | On/off switch | `checked`, `onChange(boolean)`, `label?`, `busy?`, `size?` |
|
|
153
|
+
| `Slider` | Range slider with value display | `min`, `max`, `value`, `onChange` |
|
|
154
|
+
| `TagInput` | Tag input with Enter/comma/paste support | `value: string[]`, `onChange`, `maxTags?` |
|
|
155
|
+
| `ColorInput` | Hex color picker with swatch | `value`, `onChange` |
|
|
156
|
+
| `FormField` | Generic wrapper for any input (label + error + helper) | `label`, `error?`, `helperText?`, `children` |
|
|
157
|
+
|
|
158
|
+
```tsx
|
|
159
|
+
// Full form with Toggle + Input + Select
|
|
160
|
+
<Card variant="glass" hoverable>
|
|
161
|
+
<h2 className="section-title">Bot Personality</h2>
|
|
162
|
+
<Input label="Bot name" value="MemeBot" />
|
|
163
|
+
<Textarea label="Personality" placeholder="Friendly, humorous..." />
|
|
164
|
+
<Select label="Response style">
|
|
165
|
+
<option value="concise">Concise</option>
|
|
166
|
+
<option value="detailed">Detailed</option>
|
|
167
|
+
</Select>
|
|
168
|
+
<Toggle
|
|
169
|
+
label="Respond to @mentions"
|
|
170
|
+
checked={mentionEnabled}
|
|
171
|
+
onChange={setMentionEnabled}
|
|
172
|
+
/>
|
|
173
|
+
</Card>
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### Buttons
|
|
177
|
+
|
|
178
|
+
| Component | When to use | Key props |
|
|
179
|
+
|-----------|-------------|-----------|
|
|
180
|
+
| `Button` | Primary actions, form submits, navigation | `variant` (`'primary'` / `'secondary'` / `'danger'` / `'success'` / `'warning'` / `'ghost'`), `loading?`, `size?` |
|
|
181
|
+
| `IconButton` | Icon-only actions (close, menu, refresh) | `aria-label` (required), `variant?`, `size?` |
|
|
182
|
+
| `ProgressButton` | Button with shimmer loading state | `loading?`, `progress?` |
|
|
183
|
+
|
|
184
|
+
### Data Display
|
|
185
|
+
|
|
186
|
+
| Component | When to use | Key props |
|
|
187
|
+
|-----------|-------------|-----------|
|
|
188
|
+
| `Badge` / `Pill` | Status labels, tags, categories | `variant` (`'neutral'` / `'primary'` / `'success'` / `'danger'` / `'warning'` / `'accent'` / `'successSolid'` / `'dangerSolid'`), `size?` |
|
|
189
|
+
| `Table` / `TableHeader` / `TableBody` / `TableRow` / `TableHead` / `TableCell` | Data tables | Compound — compose like native `<table>` |
|
|
190
|
+
| `Tabs` / `TabList` / `Tab` / `TabPanel` | Tabbed content switching | `variant` (`'underline'` / `'pill'`); compound pattern |
|
|
191
|
+
| `EmptyState` | Empty content placeholder | `icon?`, `title`, `description?`, `action?` |
|
|
192
|
+
| `Skeleton` | Loading placeholder | `width?`, `height?`, `rounded?` |
|
|
193
|
+
| `Spinner` | Loading indicator | `size` (`'sm'` / `'md'` / `'lg'`) |
|
|
194
|
+
| `Avatar` | User avatar with fallback | `src?`, `name?`, `size?` |
|
|
195
|
+
| `Divider` | Separator line | `orientation?`, `label?` |
|
|
196
|
+
| `ActiveFilterPills` | Filter pill bar with clear-all | `filters`, `onRemove`, `onClearAll` |
|
|
197
|
+
| `DotIndicator` | Remaining count dots | `count`, `max?` |
|
|
198
|
+
|
|
199
|
+
### Navigation
|
|
200
|
+
|
|
201
|
+
| Component | When to use | Key props |
|
|
202
|
+
|-----------|-------------|-----------|
|
|
203
|
+
| `Pagination` | Page navigation | `page`, `totalPages`, `onChange` |
|
|
204
|
+
| `Stepper` | Multi-step wizard indicator | `steps`, `currentStep` |
|
|
205
|
+
| `Breadcrumbs` | Breadcrumb path | `items` (links/buttons) |
|
|
206
|
+
|
|
207
|
+
### Overlay & Popups
|
|
208
|
+
|
|
209
|
+
| Component | When to use | Key props |
|
|
210
|
+
|-----------|-------------|-----------|
|
|
211
|
+
| `Modal` | Dialog / fullscreen overlay | `open`, `onClose`, children |
|
|
212
|
+
| `ConfirmDialog` | Confirmation prompts (delete, discard) | `open`, `onConfirm`, `onCancel`, `title`, `description` |
|
|
213
|
+
| `Tooltip` | Hover/focus info text | `content`, `children` (trigger) |
|
|
214
|
+
| `Dropdown` | Dropdown menu (context menu, actions) | Compound: `DropdownTrigger` + `DropdownMenu` + `DropdownItem` + `DropdownSeparator` |
|
|
215
|
+
| `Popover` | Click-triggered popup | `trigger`, `children` (content) |
|
|
216
|
+
| `Drawer` | Slide-in side panel | `open`, `onClose`, `position` (`'left'` / `'right'` / `'bottom'`) |
|
|
217
|
+
| `MutationOverlay` | Saving/saved/error status indicator | `status` (`'idle'` / `'saving'` / `'saved'` / `'error'`) |
|
|
218
|
+
| `NotificationBell` | Notification button with badge | `count`, `onClick` |
|
|
219
|
+
|
|
220
|
+
### Progress & Status
|
|
221
|
+
|
|
222
|
+
| Component | When to use | Key props |
|
|
223
|
+
|-----------|-------------|-----------|
|
|
224
|
+
| `ProgressBar` | Linear progress indicator | `value`, `max?`, `variant?`, `size?` |
|
|
225
|
+
| `CooldownRing` | Circular countdown timer | `remaining`, `total` |
|
|
226
|
+
| `StageProgress` | Multi-stage process tracker | `stages`, `currentStage` |
|
|
227
|
+
|
|
228
|
+
### Typography
|
|
229
|
+
|
|
230
|
+
| Component | When to use | Key props |
|
|
231
|
+
|-----------|-------------|-----------|
|
|
232
|
+
| `Heading` | Section headings h1-h6 | `as` (`'h1'` - `'h6'`), `size?`, `gradient?` |
|
|
233
|
+
| `Text` | Body text, captions, labels | `as` (`'p'` / `'span'`), `size?`, `color?`, `weight?`, `truncate?` |
|
|
234
|
+
|
|
235
|
+
### Layout
|
|
236
|
+
|
|
237
|
+
These components provide the overall page structure. Use them together for full-page layouts.
|
|
238
|
+
|
|
239
|
+
| Component | When to use | Key props |
|
|
240
|
+
|-----------|-------------|-----------|
|
|
241
|
+
| `PageShell` | Page wrapper with animated gradient orbs | `children` |
|
|
242
|
+
| `DashboardLayout` | Full dashboard (navbar + sidebar + content) | `navbar`, `sidebar`, `children` |
|
|
243
|
+
| `Navbar` | Fixed top navigation bar with glass effect | `logo?`, `children` (right-side content), `glass?` |
|
|
244
|
+
| `Sidebar` | Collapsible side navigation | `collapsed?`, `onToggle?`, `children` (nav items) |
|
|
245
|
+
| `Stack` | Flex container | `direction?`, `gap?`, `align?`, `justify?` |
|
|
246
|
+
| `ScrollArea` | Scrollable container with styled scrollbar | `children` |
|
|
247
|
+
|
|
248
|
+
**Full page layout example:**
|
|
249
|
+
|
|
250
|
+
```tsx
|
|
251
|
+
import { PageShell, DashboardLayout, Navbar, Sidebar, Card } from '@memelabui/ui';
|
|
252
|
+
|
|
253
|
+
function App() {
|
|
254
|
+
return (
|
|
255
|
+
<PageShell>
|
|
256
|
+
<DashboardLayout
|
|
257
|
+
navbar={
|
|
258
|
+
<Navbar logo={<span className="text-gradient font-bold">MyApp</span>}>
|
|
259
|
+
<Button variant="ghost">Sign out</Button>
|
|
260
|
+
</Navbar>
|
|
261
|
+
}
|
|
262
|
+
sidebar={
|
|
263
|
+
<Sidebar>
|
|
264
|
+
<a href="/dashboard" className="px-4 py-2.5 rounded-lg text-sm text-white/60 hover:text-white">
|
|
265
|
+
Overview
|
|
266
|
+
</a>
|
|
267
|
+
<a href="/settings" className="px-4 py-2.5 rounded-lg text-sm bg-accent/20 text-accent">
|
|
268
|
+
Settings
|
|
269
|
+
</a>
|
|
270
|
+
</Sidebar>
|
|
271
|
+
}
|
|
272
|
+
>
|
|
273
|
+
<Card variant="glass" hoverable>
|
|
274
|
+
<h2 className="section-title">Settings</h2>
|
|
275
|
+
<Input label="Bot name" />
|
|
276
|
+
</Card>
|
|
277
|
+
</DashboardLayout>
|
|
278
|
+
</PageShell>
|
|
279
|
+
);
|
|
280
|
+
}
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
### Feedback
|
|
284
|
+
|
|
285
|
+
| Component | When to use | Key props |
|
|
286
|
+
|-----------|-------------|-----------|
|
|
287
|
+
| `ToastProvider` / `useToast` | Toast notifications (wrap app root in Provider) | `useToast()` returns `{ toast }` function |
|
|
288
|
+
| `Alert` | Inline notification banner | `variant` (`'info'` / `'success'` / `'warning'` / `'error'`), `title?`, `children` |
|
|
289
|
+
| `CopyField` | Read-only field with copy button | `value`, `masked?` |
|
|
290
|
+
| `Transition` | Enter/exit animations | `show`, `preset` (`'fade'` / `'scale'` / `'slide'`) |
|
|
291
|
+
|
|
292
|
+
### Accessibility
|
|
293
|
+
|
|
294
|
+
| Component | When to use |
|
|
295
|
+
|-----------|-------------|
|
|
296
|
+
| `VisuallyHidden` | Screen reader-only text (hidden visually but accessible) |
|
|
297
|
+
|
|
298
|
+
### Hooks
|
|
299
|
+
|
|
300
|
+
| Hook | When to use | Returns |
|
|
301
|
+
|------|-------------|---------|
|
|
302
|
+
| `useClipboard` | Copy text with status feedback | `{ copy, copied }` |
|
|
303
|
+
| `useDisclosure` | Toggle open/close state for modals, menus | `{ isOpen, onOpen, onClose, onToggle }` |
|
|
304
|
+
| `useMediaQuery` | Respond to viewport changes | `boolean` |
|
|
305
|
+
| `useDebounce` | Debounce fast-changing values (search, resize) | debounced value |
|
|
306
|
+
| `useHotkeys` | Global keyboard shortcuts | bind key combos to callbacks |
|
|
307
|
+
| `useIntersectionObserver` | Lazy loading, infinite scroll | `{ ref, isIntersecting }` |
|
|
308
|
+
| `useSharedNow` | Live clock for "X ago" labels, countdowns | `Date` that updates every N ms |
|
|
309
|
+
|
|
310
|
+
---
|
|
311
|
+
|
|
312
|
+
## Common Patterns
|
|
313
|
+
|
|
314
|
+
### Settings page with sections
|
|
315
|
+
|
|
316
|
+
```tsx
|
|
317
|
+
import { Card, Input, Textarea, Select, Toggle } from '@memelabui/ui';
|
|
318
|
+
|
|
319
|
+
function SettingsPage() {
|
|
320
|
+
return (
|
|
321
|
+
<div className="space-y-6">
|
|
322
|
+
<Card variant="glass" hoverable>
|
|
323
|
+
<h2 className="section-title">Bot Personality</h2>
|
|
324
|
+
<div className="space-y-4">
|
|
325
|
+
<Input label="Bot name" value={name} onChange={...} />
|
|
326
|
+
<Textarea label="Personality description" value={desc} onChange={...} />
|
|
327
|
+
<div className="grid grid-cols-3 gap-4">
|
|
328
|
+
<Select label="Style"><option>Concise</option></Select>
|
|
329
|
+
<Select label="Language"><option>Auto</option></Select>
|
|
330
|
+
<Input label="Max length" type="number" />
|
|
331
|
+
</div>
|
|
332
|
+
</div>
|
|
333
|
+
</Card>
|
|
334
|
+
|
|
335
|
+
<Card variant="glass" hoverable>
|
|
336
|
+
<h2 className="section-title">Triggers</h2>
|
|
337
|
+
<div className="space-y-3">
|
|
338
|
+
<Toggle label="Respond to @mentions" checked={...} onChange={...} />
|
|
339
|
+
<Toggle label="Respond to keywords" checked={...} onChange={...} />
|
|
340
|
+
<TagInput value={keywords} onChange={...} placeholder="Add keyword" />
|
|
341
|
+
</div>
|
|
342
|
+
</Card>
|
|
343
|
+
</div>
|
|
344
|
+
);
|
|
345
|
+
}
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
### Dashboard with stats
|
|
349
|
+
|
|
350
|
+
```tsx
|
|
351
|
+
import { StatCard, SectionCard, Table, TableHeader, TableBody, TableRow, TableHead, TableCell } from '@memelabui/ui';
|
|
352
|
+
|
|
353
|
+
function Dashboard() {
|
|
354
|
+
return (
|
|
355
|
+
<>
|
|
356
|
+
<div className="grid grid-cols-3 gap-4 mb-6">
|
|
357
|
+
<StatCard value="1,234" label="Messages" trend={{ value: 12, direction: 'up' }} />
|
|
358
|
+
<StatCard value="89%" label="Response rate" />
|
|
359
|
+
<StatCard value="2.3s" label="Avg. response" />
|
|
360
|
+
</div>
|
|
361
|
+
|
|
362
|
+
<SectionCard title="Recent Activity" description="Last 24 hours">
|
|
363
|
+
<Table>
|
|
364
|
+
<TableHeader>
|
|
365
|
+
<TableRow><TableHead>Time</TableHead><TableHead>Message</TableHead></TableRow>
|
|
366
|
+
</TableHeader>
|
|
367
|
+
<TableBody>
|
|
368
|
+
<TableRow><TableCell>12:30</TableCell><TableCell>Hello bot!</TableCell></TableRow>
|
|
369
|
+
</TableBody>
|
|
370
|
+
</Table>
|
|
371
|
+
</SectionCard>
|
|
372
|
+
</>
|
|
373
|
+
);
|
|
374
|
+
}
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
---
|
|
378
|
+
|
|
379
|
+
## Customization
|
|
380
|
+
|
|
381
|
+
Override CSS variables to customize the theme. Values must be **space-separated RGB channels** (not hex) for Tailwind opacity support:
|
|
382
|
+
|
|
383
|
+
```css
|
|
384
|
+
:root {
|
|
385
|
+
--ml-bg: 10 10 15; /* Page background */
|
|
386
|
+
--ml-primary: 139 92 246; /* Primary color (buttons, toggles, active states) */
|
|
387
|
+
--ml-accent: 102 126 234; /* Accent / gradient start */
|
|
388
|
+
--ml-glow-purple: 118 75 162; /* Gradient middle */
|
|
389
|
+
--ml-glow-pink: 240 147 251; /* Gradient end */
|
|
390
|
+
--ml-surface-50: 20 20 32; /* Surface tint */
|
|
391
|
+
--ml-surface-100: 30 30 48; /* Surface tint darker */
|
|
392
|
+
}
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
Additional tokens:
|
|
396
|
+
|
|
397
|
+
| Token | Default | Purpose |
|
|
398
|
+
|-------|---------|---------|
|
|
399
|
+
| `--ml-glass-bg` | `rgba(255,255,255,0.05)` | Glass panel background |
|
|
400
|
+
| `--ml-glass-blur` | `16px` | Glass backdrop blur |
|
|
401
|
+
| `--ml-glass-border` | `rgba(255,255,255,0.1)` | Glass inset border |
|
|
402
|
+
| `--ml-radius-md` | `0.75rem` | Default border radius |
|
|
403
|
+
| `--ml-font-sans` | System font stack | Base font family |
|
|
404
|
+
| `--ml-transition-fast` | `150ms ease` | Hover/focus transition speed |
|
|
405
|
+
|
|
406
|
+
## Features
|
|
407
|
+
|
|
408
|
+
- **Dark-first glassmorphism** design system
|
|
409
|
+
- **Zero runtime dependencies** — only peer deps (react, react-dom, tailwindcss)
|
|
410
|
+
- **Tree-shakeable** — each component independently importable
|
|
411
|
+
- **Fully accessible** — ARIA attributes, keyboard navigation, focus management, `prefers-reduced-motion` support
|
|
412
|
+
- **SSR-safe** — no `document`/`window` access during server render
|
|
413
|
+
- **TypeScript-first** — all components and hooks fully typed with exported types
|
|
414
|
+
- **Tailwind preset** — tokens, colors, and animations included
|
|
415
|
+
|
|
416
|
+
## Development
|
|
417
|
+
|
|
418
|
+
```bash
|
|
419
|
+
pnpm dev # Storybook on :6006
|
|
420
|
+
pnpm build # Build package (tsup + postcss)
|
|
421
|
+
pnpm test # Run tests (vitest watch)
|
|
422
|
+
pnpm test:ci # Run tests once
|
|
423
|
+
pnpm typecheck # TypeScript check
|
|
424
|
+
pnpm lint # ESLint
|
|
425
|
+
```
|
|
426
|
+
|
|
427
|
+
## License
|
|
428
|
+
|
|
429
|
+
MIT
|