vxui-react 1.3.2 → 1.3.4
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.en.md +29 -2
- package/README.md +29 -2
- package/dist/index.cjs +2 -2
- package/dist/index.js +38 -40
- package/dist/src/components/Dialog.d.ts +3 -1
- package/dist/src/components/Toast.d.ts +2 -7
- package/dist/vxui-react.css +1 -1
- package/llms.txt +303 -0
- package/package.json +4 -3
package/llms.txt
ADDED
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
# VXUI React
|
|
2
|
+
|
|
3
|
+
> A pure-CSS, zero-dependency React UI library for building admin dashboards and operator interfaces. v1.3.3.
|
|
4
|
+
|
|
5
|
+
> ℹ️ This file (`llms.txt`) is included in the npm package. AI tools can read it directly to obtain component documentation and usage guides.
|
|
6
|
+
|
|
7
|
+
VXUI React provides layout shells, navigation, form controls, data display, overlays, and mobile components. It relies solely on CSS custom properties (design tokens) for theming — no Tailwind, no CSS-in-JS. Radix UI primitives are used for accessibility-critical components (dialogs, menus, tooltips, etc.).
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install vxui-react
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Import the base stylesheet once at your app entry:
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
import 'vxui-react/styles';
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Core Layout: AppShell
|
|
22
|
+
|
|
23
|
+
`AppShell` is the top-level layout component. It composes a collapsible sidebar, sticky topbar, and scrollable content area.
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
import { AppShell } from 'vxui-react';
|
|
27
|
+
|
|
28
|
+
<AppShell
|
|
29
|
+
brand="My App"
|
|
30
|
+
brandIcon={<img src="/logo.svg" alt="" />}
|
|
31
|
+
title="Dashboard"
|
|
32
|
+
navSections={[
|
|
33
|
+
{
|
|
34
|
+
key: 'main',
|
|
35
|
+
items: [
|
|
36
|
+
{ key: 'home', label: 'Home', icon: <HomeIcon />, href: '/' },
|
|
37
|
+
{ key: 'reports', label: 'Reports', icon: <ChartIcon />, href: '/reports' },
|
|
38
|
+
],
|
|
39
|
+
},
|
|
40
|
+
]}
|
|
41
|
+
headerActions={<UserMenu />}
|
|
42
|
+
sidebarWidth={280}
|
|
43
|
+
>
|
|
44
|
+
<p>Page content</p>
|
|
45
|
+
</AppShell>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### AppShell Props
|
|
49
|
+
|
|
50
|
+
| Prop | Type | Default | Description |
|
|
51
|
+
|------|------|---------|-------------|
|
|
52
|
+
| brand | string | "VXUI" | Brand/product name shown in the sidebar header |
|
|
53
|
+
| brandCaption | string | — | Secondary subtitle below the brand name |
|
|
54
|
+
| brandIcon | ReactNode | — | Logo element rendered in the sidebar header |
|
|
55
|
+
| title | string | — | Page title shown in the topbar |
|
|
56
|
+
| description | string | — | Page subtitle shown below the topbar title |
|
|
57
|
+
| breadcrumb | ReactNode | — | Breadcrumb element rendered in the topbar |
|
|
58
|
+
| navSections | AppShellNavSection[] | — | Structured nav tree grouped by sections. Preferred over navItems |
|
|
59
|
+
| navItems | AppShellNavItem[] | — | Flat nav list, auto-wrapped in a single unnamed section |
|
|
60
|
+
| sidebarCollapsed | boolean | false | Collapse sidebar to icon-only rail mode |
|
|
61
|
+
| sidebarWidth | number \| string | 240px | Custom sidebar width. Number = px (e.g. 280), string = CSS value (e.g. "18rem") |
|
|
62
|
+
| density | "comfortable" \| "compact" | — | Layout density. "compact" tightens vertical rhythm for high-density UIs |
|
|
63
|
+
| headerActions | ReactNode | — | Slot for right-aligned topbar actions |
|
|
64
|
+
| sidebarFooter | ReactNode | — | Slot rendered at the bottom of the sidebar |
|
|
65
|
+
| mobileNavOpen | boolean | false | Controls whether the mobile nav overlay is visible |
|
|
66
|
+
| onSidebarToggle | () => void | — | Called when the collapse/expand button is clicked |
|
|
67
|
+
| onMobileNavToggle | () => void | — | Called when the mobile overlay toggle is clicked |
|
|
68
|
+
| children | ReactNode | **required** | Main content area rendered inside ShellContent |
|
|
69
|
+
|
|
70
|
+
### AppShellNavSection
|
|
71
|
+
|
|
72
|
+
```ts
|
|
73
|
+
interface AppShellNavSection {
|
|
74
|
+
key: string;
|
|
75
|
+
label?: string; // section heading text
|
|
76
|
+
items: AppShellNavItem[];
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### AppShellNavItem
|
|
81
|
+
|
|
82
|
+
```ts
|
|
83
|
+
interface AppShellNavItem {
|
|
84
|
+
key: string;
|
|
85
|
+
label: string;
|
|
86
|
+
icon?: ReactNode;
|
|
87
|
+
href?: string;
|
|
88
|
+
active?: boolean;
|
|
89
|
+
disabled?: boolean;
|
|
90
|
+
defaultOpen?: boolean; // for expandable items with children
|
|
91
|
+
children?: AppShellNavItem[]; // nest to create expandable sub-menus
|
|
92
|
+
onClick?: (e: React.MouseEvent) => void;
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Shell (low-level)
|
|
97
|
+
|
|
98
|
+
`Shell` is the underlying layout primitive used by AppShell. Use it for fully custom layouts.
|
|
99
|
+
|
|
100
|
+
```tsx
|
|
101
|
+
import { Shell, ShellSidebar, ShellContent } from 'vxui-react';
|
|
102
|
+
|
|
103
|
+
<Shell sidebarWidth={300} density="compact">
|
|
104
|
+
<ShellSidebar>{/* nav content */}</ShellSidebar>
|
|
105
|
+
<ShellContent>{/* page content */}</ShellContent>
|
|
106
|
+
</Shell>
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Shell Props
|
|
110
|
+
|
|
111
|
+
| Prop | Type | Default | Description |
|
|
112
|
+
|------|------|---------|-------------|
|
|
113
|
+
| collapsed | boolean | false | Collapse sidebar to rail mode |
|
|
114
|
+
| mobileNavOpen | boolean | false | Show mobile nav overlay |
|
|
115
|
+
| density | "comfortable" \| "compact" | — | Layout density |
|
|
116
|
+
| sidebarWidth | number \| string | 240px | Custom sidebar width |
|
|
117
|
+
| className | string | — | Additional CSS class |
|
|
118
|
+
| children | ReactNode | **required** | Layout children |
|
|
119
|
+
|
|
120
|
+
## Dialog
|
|
121
|
+
|
|
122
|
+
Modal dialog component built on Radix UI. Supports size presets, placement options, and fullscreen mode for mobile devices.
|
|
123
|
+
|
|
124
|
+
```tsx
|
|
125
|
+
import { Dialog, DialogClose } from 'vxui-react';
|
|
126
|
+
import { Button } from 'vxui-react';
|
|
127
|
+
|
|
128
|
+
<Dialog
|
|
129
|
+
trigger={<Button>Open Dialog</Button>}
|
|
130
|
+
title="Dialog Title"
|
|
131
|
+
description="Optional description text."
|
|
132
|
+
size="md" // 'sm' | 'md' | 'lg' | 'xl' | 'full'
|
|
133
|
+
placement="center" // 'center' | 'top' | 'bottom' | etc.
|
|
134
|
+
fullscreen={false} // Enable fullscreen on mobile devices
|
|
135
|
+
scrollable={true}
|
|
136
|
+
closable={true}
|
|
137
|
+
>
|
|
138
|
+
<p>Dialog content goes here.</p>
|
|
139
|
+
{{/* footer */}}
|
|
140
|
+
<DialogClose asChild><Button variant="outline">Close</Button></DialogClose>
|
|
141
|
+
</Dialog>
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### Dialog Props
|
|
145
|
+
|
|
146
|
+
| Prop | Type | Default | Description |
|
|
147
|
+
|------|------|---------|-------------|
|
|
148
|
+
| trigger | ReactNode | **required** | Element that opens the dialog |
|
|
149
|
+
| title | string | **required** | Dialog title |
|
|
150
|
+
| description | string | — | Optional description below the title |
|
|
151
|
+
| children | ReactNode | **required** | Dialog body content |
|
|
152
|
+
| footer | ReactNode | — | Footer content (e.g., action buttons) |
|
|
153
|
+
| size | 'sm' \| 'md' \| 'lg' \| 'xl' \| 'full' | 'md' | Width preset |
|
|
154
|
+
| placement | 'center' \| 'top' \| 'right' \| 'bottom' \| 'left' \| 'top-left' \| 'top-right' \| 'bottom-left' \| 'bottom-right' \| 'top-half' \| 'right-half' \| 'bottom-half' \| 'left-half' | 'center' | Position on screen (desktop only) |
|
|
155
|
+
| padding | 'none' \| 'sm' \| 'md' \| 'lg' | 'md' | Inner padding preset |
|
|
156
|
+
| scrollable | boolean | true | Enable body scroll when content overflows |
|
|
157
|
+
| closable | boolean | true | Show the close (×) button |
|
|
158
|
+
| fullscreen | boolean | false | When true, the dialog occupies the full viewport (ideal for mobile) |
|
|
159
|
+
| className | string | — | Additional CSS class |
|
|
160
|
+
| defaultOpen | boolean | false | Whether the dialog is open by default |
|
|
161
|
+
| open | boolean | — | Controlled open state |
|
|
162
|
+
| onOpenChange | (open: boolean) => void | — | Open state change handler |
|
|
163
|
+
|
|
164
|
+
## Component Index
|
|
165
|
+
|
|
166
|
+
### Layout & Navigation
|
|
167
|
+
- **AppShell** — Full-featured app shell with sidebar, topbar, and content area
|
|
168
|
+
- **Shell / ShellSidebar / ShellContent** — Low-level layout primitives
|
|
169
|
+
- **NavigationMenu** — Horizontal navigation bar with dropdown menus
|
|
170
|
+
- **Breadcrumb** — Breadcrumb trail with separator support
|
|
171
|
+
- **Pagination** — Page navigation with first/last/prev/next controls
|
|
172
|
+
- **Tabs** — Horizontal tab strip with panel content
|
|
173
|
+
- **Menubar** — Desktop-style menu bar
|
|
174
|
+
- **Stepper** — Multi-step wizard indicator
|
|
175
|
+
|
|
176
|
+
### Buttons & Actions
|
|
177
|
+
- **Button** — Primary action button with variants (default, outline, ghost, destructive) and sizes (sm, md, lg)
|
|
178
|
+
- **Toggle** — Two-state toggle button
|
|
179
|
+
- **SegmentedControl** — Mutually exclusive option group
|
|
180
|
+
- **DropdownMenu** — Trigger + popover menu list (Radix UI)
|
|
181
|
+
- **ContextMenu** — Right-click context menu (Radix UI)
|
|
182
|
+
|
|
183
|
+
### Forms & Inputs
|
|
184
|
+
- **Input** — Text input with label, error, and description support
|
|
185
|
+
- **Textarea** — Multi-line text input
|
|
186
|
+
- **Select** — Native-style select with custom styling (Radix UI)
|
|
187
|
+
- **Checkbox** — Single checkbox or checkbox group
|
|
188
|
+
- **Radio** — Radio button group
|
|
189
|
+
- **Switch** — Toggle switch
|
|
190
|
+
- **Slider** — Range slider
|
|
191
|
+
- **NumberInput** — Numeric input with increment/decrement controls
|
|
192
|
+
- **TagInput** — Multi-tag token input
|
|
193
|
+
- **Rating** — Star rating input
|
|
194
|
+
- **DatePicker** — Calendar-based date picker
|
|
195
|
+
- **ColorPicker** — Color swatch/hex picker
|
|
196
|
+
- **Select** — Searchable single-select input with custom overlay behavior
|
|
197
|
+
- **Form** — Form wrapper with validation helpers
|
|
198
|
+
|
|
199
|
+
### Overlays & Popovers
|
|
200
|
+
- **Dialog** — Modal dialog (Radix UI)
|
|
201
|
+
- **AlertDialog** — Confirmation dialog with destructive action pattern
|
|
202
|
+
- **Sheet** — Slide-in panel (drawer) from any edge
|
|
203
|
+
- **Popover** — Floating content anchored to a trigger (Radix UI)
|
|
204
|
+
- **Tooltip** — Short contextual hover label (Radix UI)
|
|
205
|
+
- **HoverCard** — Rich hover preview card (Radix UI)
|
|
206
|
+
|
|
207
|
+
### Feedback & Status
|
|
208
|
+
- **Toast** — Ephemeral notification (info / success / warning / danger tones)
|
|
209
|
+
- **Alert** — Inline alert banner (info / success / warning / danger)
|
|
210
|
+
- **Progress** — Linear progress bar (determinate and indeterminate)
|
|
211
|
+
- **Spinner** — Loading spinner
|
|
212
|
+
- **Skeleton** — Placeholder loading skeleton
|
|
213
|
+
|
|
214
|
+
### Data Display
|
|
215
|
+
- **Table** — Sortable, filterable data table
|
|
216
|
+
- **Badge** — Inline status label with tone variants
|
|
217
|
+
- **Avatar** — User avatar with fallback initials
|
|
218
|
+
- **Card** — Content container card
|
|
219
|
+
- **Accordion** — Collapsible content sections (Radix UI)
|
|
220
|
+
- **Calendar** — Month calendar view
|
|
221
|
+
- **Carousel** — Horizontal content carousel
|
|
222
|
+
- **TreeView** — Hierarchical tree list
|
|
223
|
+
- **Timeline** — Vertical timeline list
|
|
224
|
+
- **ScrollArea** — Custom-styled scrollable container (Radix UI)
|
|
225
|
+
- **Resizable** — Resizable panel layout
|
|
226
|
+
|
|
227
|
+
### Utility
|
|
228
|
+
- **CodeBlock** — Syntax-highlighted code block (Prism.js)
|
|
229
|
+
- **CommandPalette** — Global keyboard command search
|
|
230
|
+
- **EmptyState** — Empty content placeholder with action
|
|
231
|
+
- **FileUpload** — Drag-and-drop file upload area
|
|
232
|
+
- **LanguageSwitcher** — Locale toggle button
|
|
233
|
+
- **Separator** — Horizontal or vertical rule
|
|
234
|
+
- **Heading / Text / Label** — Typography primitives
|
|
235
|
+
|
|
236
|
+
### Mobile-specific (vxui-react/mobile)
|
|
237
|
+
- **MobileApp** — Root mobile layout
|
|
238
|
+
- **MobileShell** — Mobile screen wrapper
|
|
239
|
+
- **MobileDrawer** — Bottom-sheet style drawer
|
|
240
|
+
- **BottomNav** — Mobile tab bar
|
|
241
|
+
- **MobileList** — List with dividers optimized for touch
|
|
242
|
+
- **ActionSheet** — iOS-style action sheet
|
|
243
|
+
|
|
244
|
+
## Theming (CSS Custom Properties)
|
|
245
|
+
|
|
246
|
+
Override any token in your own stylesheet or via a `<style>` block:
|
|
247
|
+
|
|
248
|
+
```css
|
|
249
|
+
:root {
|
|
250
|
+
--vx-primary: #7c3aed; /* primary action color */
|
|
251
|
+
--vx-primary-strong: #6d28d9; /* hover/pressed state */
|
|
252
|
+
--vx-primary-soft: rgba(124, 58, 237, 0.1);
|
|
253
|
+
|
|
254
|
+
--vx-secondary: #64748b; /* secondary/muted color */
|
|
255
|
+
--vx-success: #10b981;
|
|
256
|
+
--vx-warning: #f59e0b;
|
|
257
|
+
--vx-danger: #ef4444;
|
|
258
|
+
|
|
259
|
+
--vx-bg: #f8fafc; /* page background */
|
|
260
|
+
--vx-bg-accent: #f1f5f9; /* subtle accent background */
|
|
261
|
+
--vx-surface: #ffffff; /* card/panel surfaces */
|
|
262
|
+
--vx-border: #e2e8f0; /* default border */
|
|
263
|
+
--vx-border-strong: #cbd5e1;
|
|
264
|
+
|
|
265
|
+
--vx-text: #0f172a; /* primary text */
|
|
266
|
+
--vx-text-secondary: #64748b;
|
|
267
|
+
--vx-text-muted: #94a3b8;
|
|
268
|
+
|
|
269
|
+
--vx-radius-sm: 8px;
|
|
270
|
+
--vx-radius: 10px;
|
|
271
|
+
--vx-radius-lg: 14px;
|
|
272
|
+
|
|
273
|
+
--vx-sidebar-width: 240px; /* sidebar width (default) */
|
|
274
|
+
--vx-sidebar-width-collapsed: 72px;
|
|
275
|
+
--vx-header-height: 92px;
|
|
276
|
+
}
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
Dark mode tokens are applied automatically when `<html>` has `class="dark"` or `data-theme="dark"`.
|
|
280
|
+
|
|
281
|
+
## Key Design Principles
|
|
282
|
+
|
|
283
|
+
1. **No global side-effects** — CSS is scoped to `.vx-*` class names. VXUI will not override your existing styles.
|
|
284
|
+
2. **Token-first theming** — All visual decisions (color, radius, spacing) are CSS variables. Override any of them to rebrand in minutes.
|
|
285
|
+
3. **Accessible by default** — Overlay and interactive components are built on Radix UI primitives, providing keyboard navigation and ARIA semantics out of the box.
|
|
286
|
+
4. **Mobile-first responsive** — Sidebar collapses to an overlay on narrow viewports. Mobile-specific components live in a separate import path.
|
|
287
|
+
5. **No runtime CSS injection** — Styles ship as a single static stylesheet. No flash-of-unstyled-content from runtime injection.
|
|
288
|
+
|
|
289
|
+
## File Structure (library source)
|
|
290
|
+
|
|
291
|
+
```
|
|
292
|
+
src/
|
|
293
|
+
components/ # All React components
|
|
294
|
+
mobile/ # Mobile-specific components
|
|
295
|
+
pages/ # Full-page template components
|
|
296
|
+
styles/
|
|
297
|
+
base.css # All CSS (design tokens + component styles)
|
|
298
|
+
i18n/
|
|
299
|
+
index.tsx # English & Chinese translations
|
|
300
|
+
lib/
|
|
301
|
+
cx.ts # className utility
|
|
302
|
+
version.ts # library version
|
|
303
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vxui-react",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.4",
|
|
4
4
|
"description": "A general-purpose React UI framework rebuilt from VXUI principles.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -24,7 +24,8 @@
|
|
|
24
24
|
"**/*.css"
|
|
25
25
|
],
|
|
26
26
|
"files": [
|
|
27
|
-
"dist"
|
|
27
|
+
"dist",
|
|
28
|
+
"llms.txt"
|
|
28
29
|
],
|
|
29
30
|
"main": "./dist/index.cjs",
|
|
30
31
|
"module": "./dist/index.js",
|
|
@@ -61,7 +62,7 @@
|
|
|
61
62
|
"@types/prismjs": "^1.26.6",
|
|
62
63
|
"lucide-react": "^0.511.0",
|
|
63
64
|
"prismjs": "^1.30.0",
|
|
64
|
-
"vxui-react": "^1.3.
|
|
65
|
+
"vxui-react": "^1.3.1"
|
|
65
66
|
},
|
|
66
67
|
"devDependencies": {
|
|
67
68
|
"@testing-library/jest-dom": "^6.9.1",
|