@moontra/moonui 0.1.1 → 2.0.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/LICENSE +21 -0
- package/README.md +282 -34
- package/dist/index.d.mts +307 -9
- package/dist/index.d.ts +307 -9
- package/dist/index.js +11424 -813
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +11114 -580
- package/dist/index.mjs.map +1 -0
- package/package.json +26 -10
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 MoonUI
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,24 +1,33 @@
|
|
|
1
|
-
# MoonUI
|
|
1
|
+
# MoonUI - Modern React Component Library
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@moontra/moonui)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
[](https://www.typescriptlang.org/)
|
|
6
|
+
|
|
7
|
+
A premium React component library built on top of Radix UI and Tailwind CSS. Fully customizable, accessible, and production-ready components for modern web applications.
|
|
4
8
|
|
|
5
9
|
## Features
|
|
6
10
|
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
- ♿ **
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
11
|
+
- 🎨 **Beautiful by default** - Carefully crafted components with modern design
|
|
12
|
+
- 🌙 **Dark mode ready** - Built-in dark mode support with smooth transitions
|
|
13
|
+
- ♿ **Fully accessible** - WAI-ARIA compliant components built on Radix UI
|
|
14
|
+
- 🎯 **TypeScript first** - Written in TypeScript with complete type definitions
|
|
15
|
+
- 🎨 **Highly customizable** - Easy to customize with Tailwind CSS
|
|
16
|
+
- 📦 **Tree-shakeable** - Only import what you need
|
|
17
|
+
- 🚀 **Production ready** - Used in production by many companies
|
|
13
18
|
|
|
14
19
|
## Installation
|
|
15
20
|
|
|
16
21
|
```bash
|
|
17
|
-
npm install moonui
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
+
npm install @moontra/moonui
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
yarn add @moontra/moonui
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
pnpm add @moontra/moonui
|
|
22
31
|
```
|
|
23
32
|
|
|
24
33
|
## Setup
|
|
@@ -174,42 +183,281 @@ Add the following CSS variables to your global CSS file:
|
|
|
174
183
|
}
|
|
175
184
|
```
|
|
176
185
|
|
|
177
|
-
## Usage
|
|
186
|
+
## Installation & Usage
|
|
187
|
+
|
|
188
|
+
### Recommended: Use MoonUI CLI
|
|
189
|
+
|
|
190
|
+
The best way to use MoonUI is through our CLI tool, which gives you full control over the components:
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
# Install CLI globally
|
|
194
|
+
npm install -g @moontra/moonui-cli
|
|
195
|
+
|
|
196
|
+
# Initialize MoonUI in your project
|
|
197
|
+
moonui init
|
|
198
|
+
|
|
199
|
+
# Add components
|
|
200
|
+
moonui add button card badge
|
|
201
|
+
```
|
|
178
202
|
|
|
179
|
-
|
|
180
|
-
|
|
203
|
+
Then import from your project:
|
|
204
|
+
```tsx
|
|
205
|
+
import { Button } from '@/components/ui/button'
|
|
206
|
+
import { Card } from '@/components/ui/card'
|
|
207
|
+
import { Badge } from '@/components/ui/badge'
|
|
181
208
|
|
|
182
|
-
|
|
209
|
+
function App() {
|
|
183
210
|
return (
|
|
184
|
-
<
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
211
|
+
<Card>
|
|
212
|
+
<h2>Welcome to MoonUI</h2>
|
|
213
|
+
<p>Build beautiful interfaces with ease</p>
|
|
214
|
+
<Button variant="primary">Get Started</Button>
|
|
215
|
+
<Badge>New</Badge>
|
|
216
|
+
</Card>
|
|
217
|
+
)
|
|
188
218
|
}
|
|
189
219
|
```
|
|
190
220
|
|
|
191
|
-
|
|
221
|
+
### Alternative: Direct NPM Usage
|
|
222
|
+
|
|
223
|
+
You can also use components directly from NPM (limited customization):
|
|
224
|
+
|
|
225
|
+
```tsx
|
|
226
|
+
import { Button, Card, Badge } from '@moontra/moonui'
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
### Advanced Examples
|
|
230
|
+
|
|
231
|
+
#### Interactive Components
|
|
232
|
+
```tsx
|
|
233
|
+
import {
|
|
234
|
+
MagneticButton,
|
|
235
|
+
SpotlightCard,
|
|
236
|
+
GestureDrawer,
|
|
237
|
+
SwipeableCard
|
|
238
|
+
} from '@moontra/moonui'
|
|
192
239
|
|
|
193
|
-
|
|
240
|
+
function InteractiveDemo() {
|
|
241
|
+
return (
|
|
242
|
+
<div className="space-y-6">
|
|
243
|
+
{/* Magnetic Button with mouse following effect */}
|
|
244
|
+
<MagneticButton strength={0.3}>
|
|
245
|
+
Hover for magnetic effect
|
|
246
|
+
</MagneticButton>
|
|
247
|
+
|
|
248
|
+
{/* Card with spotlight effect */}
|
|
249
|
+
<SpotlightCard>
|
|
250
|
+
<h3>Interactive Card</h3>
|
|
251
|
+
<p>Move your mouse around to see the spotlight effect</p>
|
|
252
|
+
</SpotlightCard>
|
|
253
|
+
|
|
254
|
+
{/* Swipeable Card for mobile */}
|
|
255
|
+
<SwipeableCard onSwipeLeft={() => console.log('Swiped left')}>
|
|
256
|
+
<p>Swipe me on mobile devices</p>
|
|
257
|
+
</SwipeableCard>
|
|
258
|
+
</div>
|
|
259
|
+
)
|
|
260
|
+
}
|
|
261
|
+
```
|
|
194
262
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
263
|
+
#### Performance Components
|
|
264
|
+
```tsx
|
|
265
|
+
import {
|
|
266
|
+
VirtualList,
|
|
267
|
+
MemoryEfficientData,
|
|
268
|
+
LazyComponent,
|
|
269
|
+
OptimizedImage
|
|
270
|
+
} from '@moontra/moonui'
|
|
271
|
+
|
|
272
|
+
function PerformanceDemo() {
|
|
273
|
+
const largeDataset = Array.from({ length: 10000 }, (_, i) => ({
|
|
274
|
+
id: i,
|
|
275
|
+
name: `Item ${i}`
|
|
276
|
+
}))
|
|
277
|
+
|
|
278
|
+
return (
|
|
279
|
+
<div>
|
|
280
|
+
{/* Virtualized list for large datasets */}
|
|
281
|
+
<VirtualList
|
|
282
|
+
items={largeDataset}
|
|
283
|
+
itemHeight={50}
|
|
284
|
+
renderItem={({ item }) => <div key={item.id}>{item.name}</div>}
|
|
285
|
+
/>
|
|
286
|
+
|
|
287
|
+
{/* Memory efficient data handling */}
|
|
288
|
+
<MemoryEfficientData
|
|
289
|
+
data={largeDataset}
|
|
290
|
+
chunkSize={100}
|
|
291
|
+
renderChunk={(chunk) => (
|
|
292
|
+
<div>{chunk.map(item => <div key={item.id}>{item.name}</div>)}</div>
|
|
293
|
+
)}
|
|
294
|
+
/>
|
|
295
|
+
|
|
296
|
+
{/* Lazy loaded component */}
|
|
297
|
+
<LazyComponent>
|
|
298
|
+
<OptimizedImage
|
|
299
|
+
src="/large-image.jpg"
|
|
300
|
+
alt="Optimized image"
|
|
301
|
+
loading="lazy"
|
|
302
|
+
/>
|
|
303
|
+
</LazyComponent>
|
|
304
|
+
</div>
|
|
305
|
+
)
|
|
306
|
+
}
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
## Available Components (50+ Components)
|
|
310
|
+
|
|
311
|
+
### Core Components
|
|
312
|
+
- **Button** - Multiple variants with loading states
|
|
313
|
+
- **Card** - Flexible container with header/footer support
|
|
314
|
+
- **Badge** - Status indicators and labels
|
|
315
|
+
- **Input** - Text input with validation
|
|
316
|
+
- **Textarea** - Multi-line text input
|
|
317
|
+
- **Label** - Form labels with accessibility
|
|
318
|
+
- **Separator** - Visual dividers
|
|
319
|
+
|
|
320
|
+
### Form Components
|
|
321
|
+
- **Select** - Dropdown selection with search
|
|
322
|
+
- **Switch** - Toggle switches
|
|
323
|
+
- **Checkbox** - Single and group checkboxes
|
|
324
|
+
- **RadioGroup** - Radio button groups
|
|
325
|
+
- **Slider** - Range and single value sliders
|
|
326
|
+
- **Color Picker** - Color selection component
|
|
327
|
+
- **Date Picker** - Calendar-based date selection
|
|
328
|
+
|
|
329
|
+
### Layout Components
|
|
330
|
+
- **Dialog** - Modal dialogs and overlays
|
|
331
|
+
- **Sheet** - Slide-out panels
|
|
332
|
+
- **Tabs** - Tabbed content areas
|
|
333
|
+
- **Accordion** - Collapsible content sections
|
|
334
|
+
- **Collapsible** - Expandable content
|
|
335
|
+
- **Command** - Command palette interface
|
|
336
|
+
- **Aspect Ratio** - Responsive aspect ratio containers
|
|
337
|
+
|
|
338
|
+
### Data Display
|
|
339
|
+
- **Alert** - Notification and status messages
|
|
340
|
+
- **Avatar** - User profile images with fallbacks
|
|
341
|
+
- **Progress** - Progress bars and indicators
|
|
342
|
+
- **Skeleton** - Loading state placeholders
|
|
343
|
+
- **Table** - Data tables with sorting
|
|
344
|
+
- **Data Table** - Advanced data grid
|
|
345
|
+
- **Tooltip** - Contextual help text
|
|
346
|
+
- **Calendar** - Date display and navigation
|
|
347
|
+
|
|
348
|
+
### Navigation
|
|
349
|
+
- **Breadcrumb** - Navigation breadcrumbs
|
|
350
|
+
- **Dropdown Menu** - Context menus
|
|
351
|
+
- **Navigation Menu** - Main navigation
|
|
352
|
+
- **Pagination** - Page navigation controls
|
|
353
|
+
|
|
354
|
+
### Feedback & Overlays
|
|
355
|
+
- **Toast** - Temporary notifications
|
|
356
|
+
- **Popover** - Floating content containers
|
|
357
|
+
- **Hover Card** - Hover-triggered content
|
|
358
|
+
|
|
359
|
+
### Interactive Components
|
|
360
|
+
- **Animated Button** - Buttons with micro-interactions
|
|
361
|
+
- **Draggable List** - Drag and drop sortable lists
|
|
362
|
+
- **Floating Action Button** - FAB with expandable menu
|
|
363
|
+
- **Gesture Drawer** - Touch-gesture driven drawers
|
|
364
|
+
- **Hover Card 3D** - 3D hover effects
|
|
365
|
+
- **Magnetic Button** - Mouse-following magnetic effects
|
|
366
|
+
- **Spotlight Card** - Interactive spotlight effects
|
|
367
|
+
- **Swipeable Card** - Touch swipe interactions
|
|
368
|
+
- **Pinch Zoom** - Touch zoom functionality
|
|
369
|
+
|
|
370
|
+
### Performance & Utility
|
|
371
|
+
- **Error Boundary** - React error boundaries
|
|
372
|
+
- **File Upload** - File upload with progress
|
|
373
|
+
- **GitHub Stars** - GitHub repository stats
|
|
374
|
+
- **Health Check** - System health monitoring
|
|
375
|
+
- **Lazy Component** - Code splitting support
|
|
376
|
+
- **Locked Component** - Access control wrapper
|
|
377
|
+
- **Memory Efficient Data** - Optimized data handling
|
|
378
|
+
- **Optimized Image** - Performance-optimized images
|
|
379
|
+
- **Performance Debugger** - Performance analysis tools
|
|
380
|
+
- **Performance Monitor** - Real-time performance tracking
|
|
381
|
+
- **Simple Editor** - Basic text editor
|
|
382
|
+
- **Rich Text Editor** - Advanced WYSIWYG editor
|
|
383
|
+
- **Virtual List** - Virtualized large lists
|
|
384
|
+
- **Moon Logo** - MoonUI branding component
|
|
385
|
+
|
|
386
|
+
### Specialized
|
|
387
|
+
- **Toggle** - Toggle switches with states
|
|
388
|
+
|
|
389
|
+
## Pro Components
|
|
390
|
+
|
|
391
|
+
Looking for more advanced enterprise-grade components? Check out [MoonUI Pro](https://moonui.dev/pro) for:
|
|
392
|
+
|
|
393
|
+
- 📊 **Advanced Data Table** - Enterprise data grid with filtering, sorting, export
|
|
394
|
+
- 📈 **Advanced Charts** - Interactive charts with real-time data
|
|
395
|
+
- 📅 **Calendar Pro** - Full-featured calendar with events and scheduling
|
|
396
|
+
- 📝 **Rich Text Editor Pro** - WYSIWYG editor with AI assistance and collaboration
|
|
397
|
+
- 📤 **File Upload Pro** - Advanced file handling with cloud storage
|
|
398
|
+
- 🗂️ **Kanban Board** - Drag & drop project management
|
|
399
|
+
- 📍 **Timeline** - Interactive project timelines
|
|
400
|
+
- 🚀 **Memory Efficient Data** - Large dataset handling
|
|
401
|
+
- 📊 **Virtual List Pro** - Performance virtualization
|
|
402
|
+
- And many more enterprise features...
|
|
199
403
|
|
|
200
404
|
## Documentation
|
|
201
405
|
|
|
202
|
-
|
|
406
|
+
Visit [moonui.dev/docs](https://moonui.dev/docs) for full documentation.
|
|
203
407
|
|
|
204
|
-
##
|
|
408
|
+
## Customization
|
|
205
409
|
|
|
206
|
-
MoonUI
|
|
410
|
+
MoonUI components are built with customization in mind. You can easily customize them using:
|
|
207
411
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
412
|
+
### 1. CSS Variables
|
|
413
|
+
```css
|
|
414
|
+
:root {
|
|
415
|
+
--primary: 222.2 47.4% 11.2%;
|
|
416
|
+
--primary-foreground: 210 40% 98%;
|
|
417
|
+
}
|
|
418
|
+
```
|
|
419
|
+
|
|
420
|
+
### 2. Tailwind Classes
|
|
421
|
+
```tsx
|
|
422
|
+
<Button className="bg-blue-500 hover:bg-blue-600">
|
|
423
|
+
Custom Button
|
|
424
|
+
</Button>
|
|
425
|
+
```
|
|
426
|
+
|
|
427
|
+
### 3. Component Variants
|
|
428
|
+
```tsx
|
|
429
|
+
<Button variant="destructive" size="lg">
|
|
430
|
+
Delete
|
|
431
|
+
</Button>
|
|
211
432
|
```
|
|
212
433
|
|
|
434
|
+
## Theme Provider
|
|
435
|
+
|
|
436
|
+
Use the ThemeProvider to enable theme support:
|
|
437
|
+
|
|
438
|
+
```tsx
|
|
439
|
+
import { ThemeProvider } from '@moontra/moonui'
|
|
440
|
+
|
|
441
|
+
function App() {
|
|
442
|
+
return (
|
|
443
|
+
<ThemeProvider defaultTheme="dark">
|
|
444
|
+
{/* Your app */}
|
|
445
|
+
</ThemeProvider>
|
|
446
|
+
)
|
|
447
|
+
}
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
## Requirements
|
|
451
|
+
|
|
452
|
+
- React 18.0.0 or higher
|
|
453
|
+
- Tailwind CSS 3.0.0 or higher
|
|
454
|
+
|
|
213
455
|
## License
|
|
214
456
|
|
|
215
|
-
MIT
|
|
457
|
+
MIT License - see the [LICENSE](LICENSE) file for details.
|
|
458
|
+
|
|
459
|
+
## Support
|
|
460
|
+
|
|
461
|
+
- Documentation: [moonui.dev/docs](https://moonui.dev/docs)
|
|
462
|
+
- Discord: [Join our community](https://discord.gg/moonui)
|
|
463
|
+
- GitHub Issues: [Report bugs](https://github.com/moontra/moonui/issues)
|