@moontra/moonui 6.16.0 → 6.18.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 CHANGED
@@ -33,8 +33,8 @@ A premium React component library built for modern web applications. MoonUI prov
33
33
 
34
34
  - **TypeScript** - Full type safety and IntelliSense
35
35
  - **Tree Shaking** - Import only what you use
36
- - **Zero Config** - Works out of the box
37
- - **CLI Tool** - Easy installation with `moonui` CLI
36
+ - **Tailwind Preset** - One line in your config wires up every design token
37
+ - **CLI Tool** - Easy installation with the `@moontra/moonui-cli` CLI
38
38
  - **Storybook** - Interactive component documentation
39
39
 
40
40
  ### 📱 **Responsive & Performance**
@@ -52,70 +52,84 @@ A premium React component library built for modern web applications. MoonUI prov
52
52
  # Install the package
53
53
  npm install @moontra/moonui
54
54
 
55
- # Or use the CLI (recommended)
56
- npx @moontra/moonui-cli@latest init
55
+ # Tailwind is a peer dependency; the components also use the animate plugin
56
+ npm install -D tailwindcss tailwindcss-animate
57
57
  ```
58
58
 
59
- ### CDN Usage (Browser/Artifacts)
60
-
61
- For quick prototyping or artifact environments:
62
-
63
- ```html
64
- <!-- Dependencies -->
65
- <script
66
- crossorigin
67
- src="https://unpkg.com/react@18/umd/react.production.min.js"
68
- ></script>
69
- <script
70
- crossorigin
71
- src="https://unpkg.com/react-dom@18/umd/react-dom.production.min.js"
72
- ></script>
73
-
74
- <!-- MoonUI -->
75
- <script src="https://cdn.jsdelivr.net/npm/@moontra/moonui@2.3.2/dist/index.global.js"></script>
76
-
77
- <script>
78
- const { Button, Card } = window.MoonUI;
79
-
80
- function App() {
81
- return React.createElement(
82
- Card,
83
- null,
84
- React.createElement(Button, { variant: "default" }, "Hello MoonUI!")
85
- );
86
- }
59
+ Optionally scaffold the project files (`moonui.config.js`, `src/lib/utils.ts`,
60
+ `src/components/ui/`) with the CLI. It does **not** edit your Tailwind config or
61
+ global CSS steps 1 and 2 below are still yours to add:
87
62
 
88
- ReactDOM.render(React.createElement(App), document.getElementById("root"));
89
- </script>
63
+ ```bash
64
+ npx @moontra/moonui-cli init
90
65
  ```
91
66
 
92
67
  ### Setup
93
68
 
94
- 1. **Configure Tailwind CSS** (required)
69
+ Steps 1 and 2 are both required. Skip either one and the components render
70
+ unstyled — the utility classes they rely on are simply never generated.
71
+
72
+ 1. **Add the Tailwind preset** (required)
73
+
74
+ The preset maps Tailwind's color, radius and animation scales onto MoonUI's CSS
75
+ variables. Without it, classes such as `bg-primary`, `border-border` and
76
+ `animate-accordion-down` are never produced. The `content` entry for
77
+ `dist/**` matters just as much: Tailwind only generates classes it can *see*, and
78
+ the component classes live inside the package bundle.
95
79
 
96
80
  ```javascript
97
- // tailwind.config.js
81
+ // tailwind.config.js (Tailwind v3 config format)
98
82
  module.exports = {
83
+ presets: [require("@moontra/moonui/tailwind-preset")],
99
84
  content: [
100
- "./src/**/*.{js,ts,jsx,tsx}",
101
- "./node_modules/@moontra/moonui/**/*.{js,mjs}",
85
+ "./src/**/*.{js,ts,jsx,tsx,mdx}",
86
+ "./node_modules/@moontra/moonui/dist/**/*.{js,mjs}",
102
87
  ],
103
- theme: {
104
- extend: {},
105
- },
106
- plugins: [],
88
+ // Radix-driven components use animate-in / fade-in-0 / slide-in-from-*
89
+ plugins: [require("tailwindcss-animate")],
107
90
  };
108
91
  ```
109
92
 
110
- 2. **Import styles** (in your main CSS file)
93
+ Everything the preset sets is still yours to override — add your own
94
+ `theme.extend` block and it wins.
95
+
96
+ 2. **Import the design tokens** (required)
97
+
98
+ The preset only *maps* the variables; this file *defines* them (light and dark).
111
99
 
112
100
  ```css
113
- @import "@moontra/moonui/styles";
101
+ /* globals.css */
102
+ @import "@moontra/moonui/src/styles/tokens.css";
103
+
114
104
  @tailwind base;
115
105
  @tailwind components;
116
106
  @tailwind utilities;
117
107
  ```
118
108
 
109
+ > **Why the `src/styles/…` path and not `@moontra/moonui/tokens.css`?** Because the
110
+ > two are resolved by different machinery. `postcss-import` — what handles CSS
111
+ > `@import` in the usual Tailwind v3 + PostCSS setup — does not read a package's
112
+ > `exports` map, so in CSS it needs the physical path (it ships in the tarball via
113
+ > the package `files` field). Bundler/Node resolution is the mirror image: it *is*
114
+ > `exports`-aware, so from JavaScript use the subpath instead:
115
+ >
116
+ > ```jsx
117
+ > // app/layout.tsx
118
+ > import "@moontra/moonui/tokens.css";
119
+ > ```
120
+ >
121
+ > Either route loads the same file — pick one, not both.
122
+
123
+ Recommended: also add the semantic layer. It defines extra tokens (elevation,
124
+ duration, easing) and the handful of utilities that have no Tailwind equivalent —
125
+ `shadow-xs`, `animate-fade-in`, `duration-fast`, `ease-bounce`. Every token the
126
+ preset reads already lives in `tokens.css`, so components still render correctly
127
+ without it; you only lose those extras (for example the `Skeleton` fade-in).
128
+
129
+ ```css
130
+ @import "@moontra/moonui/src/styles/design-system.css";
131
+ ```
132
+
119
133
  3. **Start using components**
120
134
 
121
135
  ```jsx
@@ -127,7 +141,7 @@ function App() {
127
141
  <h1 className="text-2xl font-bold mb-4">Welcome to MoonUI</h1>
128
142
  <div className="space-y-4">
129
143
  <Input placeholder="Enter your name" />
130
- <Button variant="default" size="lg">
144
+ <Button variant="primary" size="lg">
131
145
  Get Started
132
146
  </Button>
133
147
  </div>
@@ -138,104 +152,160 @@ function App() {
138
152
 
139
153
  ## 📚 Components
140
154
 
155
+ A selection of what ships in the package — every name below is a real export of
156
+ `@moontra/moonui`. The full, always-current list lives at
157
+ **[moonui.dev/docs/components](https://moonui.dev/docs/components)**.
158
+
141
159
  ### Layout & Structure
142
160
 
143
161
  - **Card** - Flexible content containers
144
162
  - **Separator** - Visual content dividers
145
163
  - **AspectRatio** - Responsive aspect ratio containers
146
164
  - **ScrollArea** - Custom scrollable areas
165
+ - **Collapsible** - Expandable content
147
166
 
148
167
  ### Navigation
149
168
 
150
169
  - **Breadcrumb** - Hierarchical navigation
151
170
  - **Pagination** - Page navigation controls
152
171
  - **Tabs** - Tabbed interfaces
153
- - **Navigation Menu** - Complex navigation structures
172
+ - **DropdownMenu** - Context menus
173
+ - **Command** - Command palette interface
154
174
 
155
175
  ### Form Controls
156
176
 
157
- - **Button** - Interactive buttons with variants
158
- - **Input** - Text input fields
159
- - **Textarea** - Multi-line text input
177
+ - **Button**, **ButtonGroup** - Interactive buttons with variants
178
+ - **Input**, **Textarea** - Text input fields
160
179
  - **Select** - Dropdown selections
161
- - **Checkbox** - Boolean selections
180
+ - **Checkbox**, **CheckboxGroup** - Boolean selections
162
181
  - **RadioGroup** - Single choice selections
163
- - **Switch** - Toggle controls
182
+ - **Switch**, **Toggle**, **ToggleGroup** - Toggle controls
164
183
  - **Slider** - Range inputs
165
184
  - **Label** - Form field labels
185
+ - **InputOTP** - One-time-code input
186
+ - **PhoneInput**, **TagsInput** - Specialized inputs
187
+ - **CardNumberInput**, **CardExpiryInput**, **CardCVCInput**, **CardZipInput** - Payment fields
188
+ - **Rating** - Star ratings
189
+ - **FileUpload** - File upload interface
166
190
 
167
191
  ### Feedback & Overlays
168
192
 
169
- - **Dialog** - Modal dialogs
170
- - **AlertDialog** - Confirmation dialogs
171
- - **Toast** - Notification messages
193
+ - **Dialog**, **DialogForm** - Modal dialogs
194
+ - **Toast** / **Toaster** - Notification messages
172
195
  - **Alert** - Inline notifications
173
- - **Tooltip** - Contextual information
196
+ - **Tooltip**, **SimpleTooltip** - Contextual information
174
197
  - **Popover** - Floating content panels
175
- - **HoverCard** - Hover-triggered content
198
+ - **Spinner** - Inline loading indicator
176
199
 
177
200
  ### Data Display
178
201
 
179
- - **Avatar** - User profile images
202
+ - **Avatar**, **AvatarGroup** - User profile images
180
203
  - **Badge** - Status indicators
204
+ - **Kbd** - Keyboard shortcut hints
181
205
  - **Progress** - Loading indicators
182
- - **Skeleton** - Loading placeholders
206
+ - **Skeleton** (+ **SkeletonText**, **SkeletonCard**, **SkeletonAvatar**) - Loading placeholders
183
207
  - **Table** - Structured data display
184
- - **DataTable** - Advanced data tables
208
+ - **MoonUIDataTableBasic** - Basic TanStack-powered data table
185
209
  - **Accordion** - Collapsible content
210
+ - **Carousel** - Slideshows
186
211
 
187
- ### Media & Graphics
212
+ ### Dates & Color
188
213
 
189
- - **Calendar** - Date selection
190
- - **DatePicker** - Date input controls
191
- - **ColorPicker** - Color selection
192
- - **FileUpload** - File upload interface
214
+ - **MoonUICalendar** - Date selection
215
+ - **DatePicker**, **DateRangePicker**, **DateTimePicker**, **MonthPicker** - Date input controls
216
+ - **ColorPicker**, **SimpleColorPicker**, **GradientPicker** - Color selection
193
217
 
194
- ### Advanced
218
+ ### Interaction & Motion
195
219
 
196
- - **Command** - Command palette interface
197
- - **Collapsible** - Expandable content
198
- - **DropdownMenu** - Context menus
199
- - **Menubar** - Application menu bars
220
+ - **DraggableList** - Sortable lists
221
+ - **SwipeableCard** - Touch-friendly cards
222
+ - **GestureDrawer** - Gesture-driven drawer
223
+ - **ScrollReveal** (+ **ScrollRevealContainer**, **ScrollRevealItem**) - Scroll-driven reveals
224
+
225
+ ### Editors
226
+
227
+ - **RichTextEditor** - WYSIWYG editor
228
+ - **SimpleEditor** - Lightweight text editor
229
+
230
+ > Components are also exported under a `MoonUI`-prefixed alias (for example
231
+ > `MoonUIButton`, `MoonUICard`) if you need to avoid name collisions. Two of them
232
+ > — `Calendar` and `DataTableBasic` — are available **only** under their prefixed
233
+ > names: `MoonUICalendar` and `MoonUIDataTableBasic`.
200
234
 
201
235
  ## 🎨 Theming
202
236
 
203
237
  ### CSS Variables
204
238
 
205
- MoonUI uses CSS variables for easy theming:
239
+ MoonUI uses CSS variables for theming. These are the values `tokens.css` ships
240
+ with — components read them as `hsl(var(--primary))` and friends:
206
241
 
207
242
  ```css
208
243
  :root {
209
244
  --background: 0 0% 100%;
210
245
  --foreground: 222.2 84% 4.9%;
211
- --primary: 222.2 47.4% 11.2%;
246
+ --primary: 217.2 91.2% 51%;
212
247
  --primary-foreground: 210 40% 98%;
248
+ --border: 214.3 31.8% 91.4%;
249
+ --ring: 217.2 91.2% 51%;
250
+ --radius: 0.5rem;
213
251
  /* ... more variables */
214
252
  }
215
253
 
216
254
  .dark {
217
- --background: 222.2 84% 4.9%;
218
- --foreground: 210 40% 98%;
255
+ --background: 224 71% 4%;
256
+ --foreground: 213 31% 91%;
257
+ --primary: 210 40% 98%;
258
+ --primary-foreground: 222.2 47.4% 1.2%;
219
259
  /* ... dark theme variables */
220
260
  }
221
261
  ```
222
262
 
263
+ ### Dark Mode
264
+
265
+ Dark mode is **class-based**: `tokens.css` defines a `.dark` block and the preset
266
+ sets `darkMode: "class"`. Put the `dark` class on your root element — yourself, or
267
+ with a library such as `next-themes` — and every component follows:
268
+
269
+ ```jsx
270
+ <html className="dark">
271
+ <body>{children}</body>
272
+ </html>
273
+ ```
274
+
223
275
  ### Theme Provider
224
276
 
277
+ `ThemeProvider` is **optional** and does something different from dark mode: it
278
+ swaps whole colour *presets* at runtime. The default preset is the static
279
+ `tokens.css`, so mounting the provider changes nothing until you pick another one.
280
+
225
281
  ```jsx
226
282
  import { ThemeProvider } from "@moontra/moonui/theme";
227
283
 
228
284
  function App() {
229
285
  return (
230
- <ThemeProvider attribute="class" defaultTheme="system">
286
+ <ThemeProvider defaultPreset="ocean" persist>
231
287
  <YourApp />
232
288
  </ThemeProvider>
233
289
  );
234
290
  }
235
291
  ```
236
292
 
293
+ | Prop | Type | Default | Description |
294
+ | --------------- | --------------------------------- | ----------- | ---------------------------------------- |
295
+ | `defaultPreset` | `ThemePresetName` | `"default"` | Preset used on first render |
296
+ | `preset` | `ThemePresetName` | — | Controlled preset (overrides internal state) |
297
+ | `overrides` | `Partial<ThemeTokens>` | — | Per-token overrides |
298
+ | `persist` | `boolean` | `false` | Persist the selection to `localStorage` |
299
+ | `storageKey` | `string` | — | Key used when `persist` is on |
300
+
301
+ Available presets: `default`, `brand`, `corporate`, `creative`, `nature`,
302
+ `minimal`, `ocean`. Read the active one with `useTheme()` (it must be called
303
+ inside a `ThemeProvider`).
304
+
237
305
  ### Custom Colors
238
306
 
307
+ Redeclare any token in your own `:root` block **after** the import and it wins:
308
+
239
309
  ```css
240
310
  :root {
241
311
  --primary: 142 76% 36%; /* Custom green */
@@ -249,16 +319,22 @@ The MoonUI CLI helps you add components easily:
249
319
 
250
320
  ```bash
251
321
  # Initialize MoonUI in your project
252
- npx @moontra/moonui-cli@latest init
322
+ npx @moontra/moonui-cli init
253
323
 
254
324
  # Add specific components
255
- npx @moontra/moonui-cli@latest add button
256
- npx @moontra/moonui-cli@latest add card input
325
+ npx @moontra/moonui-cli add button
326
+ npx @moontra/moonui-cli add card input
257
327
 
258
328
  # Add multiple components
259
- npx @moontra/moonui-cli@latest add button card input dialog
329
+ npx @moontra/moonui-cli add button card input dialog
330
+
331
+ # Browse what is available
332
+ npx @moontra/moonui-cli list
260
333
  ```
261
334
 
335
+ Other commands: `theme`, `templates`, `license`, `login`, `logout`, `whoami`.
336
+ Run `npx @moontra/moonui-cli --help` for the full list.
337
+
262
338
  ## 📖 Documentation
263
339
 
264
340
  - **🌐 Website**: [moonui.dev](https://moonui.dev)
@@ -271,17 +347,19 @@ npx @moontra/moonui-cli@latest add button card input dialog
271
347
  MoonUI includes MCP (Model Context Protocol) support for AI assistants:
272
348
 
273
349
  ```bash
274
- # Install MCP Server
275
350
  npm install -g @moontra/moonui-mcp-server
351
+ ```
352
+
353
+ Then register it with your MCP client (Claude Desktop shown here):
276
354
 
277
- # Configure in Claude Desktop
355
+ ```json
278
356
  {
279
- "mcpServers": {
280
- "moonui": {
281
- "command": "npx",
282
- "args": ["@moontra/moonui-mcp-server"]
357
+ "mcpServers": {
358
+ "moonui": {
359
+ "command": "npx",
360
+ "args": ["@moontra/moonui-mcp-server"]
361
+ }
283
362
  }
284
- }
285
363
  }
286
364
  ```
287
365
 
@@ -291,22 +369,21 @@ AI assistants can then help you:
291
369
  - 🔧 Generate component code automatically
292
370
  - 🐛 Fix import issues
293
371
  - 🎨 Configure theming and customization
294
- - 📱 Detect environment (CDN vs NPM) automatically
295
372
 
296
373
  ## 💼 Pro Version
297
374
 
298
375
  Upgrade to MoonUI Pro for advanced components:
299
376
 
300
- - **DataTable** - Advanced data grids with sorting, filtering, pagination
301
- - **Charts** - Beautiful data visualizations
377
+ - **DataTable** - Advanced data grids with sorting, filtering, export, bulk actions
378
+ - **AdvancedChart**, **ChartWidget** - Data visualization built on Recharts
302
379
  - **RichTextEditor** - WYSIWYG editor
303
- - **FormWizard** - Multi-step forms
304
- - **Calendar** - Advanced date/time pickers
305
- - **DragDropList** - Sortable lists
306
- - **TreeView** - Hierarchical data display
380
+ - **FormWizard** - Multi-step forms with validation
381
+ - **AdvancedCalendar** - Event calendars and advanced date/time pickers
382
+ - **DraggableList** - Sortable lists
383
+ - **FileTree** - Hierarchical data display
307
384
  - **Timeline** - Event timelines
308
- - **VideoPlayer** - Custom video controls
309
- - **CodeEditor** - Syntax-highlighted code input
385
+ - **Kanban** - Drag-and-drop board layouts
386
+ - **BentoGrid**, **Spotlight**, **VirtualList** - Layout, search and virtualization
310
387
 
311
388
  [Learn more about Pro →](https://moonui.dev/pricing)
312
389
 
@@ -314,16 +391,18 @@ Upgrade to MoonUI Pro for advanced components:
314
391
 
315
392
  ### Requirements
316
393
 
317
- - Node.js 18+
318
- - React 18+
319
- - TypeScript 5+
320
- - Tailwind CSS 3+
394
+ Declared peer dependencies:
395
+
396
+ - React 18 or 19 (`react`, `react-dom`)
397
+ - Tailwind CSS 3 or 4
398
+
399
+ Recommended for development: Node.js 18+ and TypeScript 5+.
321
400
 
322
401
  ### Local Development
323
402
 
324
403
  ```bash
325
- git clone https://github.com/moontra/moonui
326
- cd moonui/packages/moonui
404
+ git clone https://github.com/oguzhanayyldz/moonuikit
405
+ cd moonuikit/packages/moonui
327
406
  npm install
328
407
  npm run dev
329
408
  ```
@@ -339,7 +418,7 @@ npm run test # Run tests
339
418
 
340
419
  ## 🤝 Contributing
341
420
 
342
- We welcome contributions! See our [Contributing Guide](CONTRIBUTING.md) for details.
421
+ We welcome contributions! See our [Contributing Guide](https://github.com/oguzhanayyldz/moonuikit/blob/main/CONTRIBUTING.md) for details.
343
422
 
344
423
  ### Development Workflow
345
424
 
@@ -359,11 +438,13 @@ We welcome contributions! See our [Contributing Guide](CONTRIBUTING.md) for deta
359
438
 
360
439
  ## 📦 Package Details
361
440
 
362
- - **Bundle Size**: ~460KB (ESM), ~485KB (CJS)
363
- - **CDN Bundle**: ~742KB (includes all dependencies)
364
- - **Type Definitions**: Full TypeScript support
365
- - **Tree Shaking**: Import individual components
366
- - **Side Effects**: false (webpack optimization)
441
+ - **Bundle Size** (v6.17.0, unminified): ~311 KB `dist/index.mjs`, ~335 KB `dist/index.js`
442
+ - **Formats**: ESM + CJS, both marked `"use client"` for the Next.js App Router
443
+ - **Type Definitions**: Full TypeScript support (`dist/index.d.ts`)
444
+ - **Tree Shaking**: Enabled `sideEffects` is limited to `**/*.css`, so unused
445
+ components are dropped by the bundler
446
+ - **Subpath exports**: `.`, `./theme`, `./hooks`, `./tokens.css`,
447
+ `./design-system.css`, `./tailwind-preset`
367
448
 
368
449
  ## 🔗 Ecosystem
369
450
 
@@ -373,7 +454,7 @@ We welcome contributions! See our [Contributing Guide](CONTRIBUTING.md) for deta
373
454
 
374
455
  ## 📄 License
375
456
 
376
- Licensed under the [MIT License](LICENSE).
457
+ Licensed under the [MIT License](https://github.com/oguzhanayyldz/moonuikit/blob/main/LICENSE).
377
458
 
378
459
  ## 🙏 Acknowledgments
379
460
 
@@ -389,7 +470,7 @@ Built with:
389
470
 
390
471
  <div align="center">
391
472
 
392
- **[Website](https://moonui.dev) • [Documentation](https://moonui.dev/docs) • [Components](https://moonui.dev/docs/components) • [GitHub](https://github.com/moontra/moonui)**
473
+ **[Website](https://moonui.dev) • [Documentation](https://moonui.dev/docs) • [Components](https://moonui.dev/docs/components) • [GitHub](https://github.com/oguzhanayyldz/moonuikit)**
393
474
 
394
475
  Made with ❤️ by the MoonUI team
395
476