@moontra/moonui-pro 2.24.7 → 2.24.8

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/dist/index.mjs CHANGED
@@ -4,7 +4,7 @@ import { twMerge } from 'tailwind-merge';
4
4
  import * as t from 'react';
5
5
  import t__default, { useState, useMemo, useCallback, useRef, useEffect, forwardRef, createContext, useContext, useLayoutEffect, useDebugValue, Component } from 'react';
6
6
  import * as AccordionPrimitive2 from '@radix-ui/react-accordion';
7
- import { Loader2, Play, ExternalLink, ChevronDown, Info, AlertCircle, AlertTriangle, Check, X, MoreHorizontal, Minus, Clock, ChevronUp, Search, Mic, MicOff, Settings, RefreshCw, Zap, ChevronRight, Crown, Circle, ChevronLeft, Plus, Lock, Sparkles, ZoomOut, ZoomIn, Pause, VolumeX, Volume2, Download, Maximize2, Filter, Image as Image$1, Video, RotateCw, Minimize2, Phone, Globe, Upload, Eye, CheckCircle2, RotateCcw, Copy, Share, Trash2, CreditCard, XCircle, HelpCircle, Bold as Bold$1, Italic as Italic$1, Underline as Underline$1, Strikethrough, AlignLeft, AlignCenter, AlignRight, AlignJustify, List, ListOrdered, Quote, Code as Code$1, Link as Link$1, Palette, Undo, Redo, Edit, GripVertical, Type, Heading1, Heading2, Heading3, CheckSquare, Highlighter, Link2, Table as Table$1, Wand2, Maximize, FileText, Briefcase, MessageSquare, Heart, GraduationCap, Languages, Lightbulb, BarChart3, Music, Archive, File, FileSpreadsheet, FileJson, FileDown, ArrowUp, ArrowDown, ArrowUpDown, ChevronsLeft, ChevronsRight, CheckCircle, Star, Shield, Award, Gem, Flame, Menu, Calendar as Calendar$1, Repeat, MapPin, Users, User, Move, EyeOff, Timer, Square, Cpu, Target, GitBranch, ArrowRight, MoreVertical, Trash, TrendingUp, MessageCircle, Paperclip, Printer, TrendingDown, Bell, CheckCheck, Settings2, LogOut, Edit3, LayoutGrid, Share2, Save, Github, Activity, Server, Monitor, MemoryStick, HardDrive, Network, Columns, Pin, Sun, Moon, Send, Tag, Flag, BellOff, CalendarIcon, DollarSign, Trophy, ArrowDownRight, ArrowUpRight, Grip, Unlock, Map as Map$1, GitFork, Package } from 'lucide-react';
7
+ import { Loader2, Play, ExternalLink, ChevronDown, Info, AlertCircle, AlertTriangle, Check, X, MoreHorizontal, Minus, Clock, ChevronUp, Search, Mic, MicOff, Settings, RefreshCw, Zap, ChevronRight, Crown, Circle, ChevronLeft, Plus, Lock, Sparkles, ZoomOut, ZoomIn, Pause, VolumeX, Volume2, Download, Maximize2, Filter, Image as Image$1, Video, RotateCw, Minimize2, Phone, Globe, Upload, Eye, CheckCircle2, RotateCcw, Copy, Share, Trash2, CreditCard, XCircle, HelpCircle, Bold as Bold$1, Italic as Italic$1, Underline as Underline$1, Strikethrough, AlignLeft, AlignCenter, AlignRight, AlignJustify, List, ListOrdered, Quote, Code as Code$1, Link as Link$1, Palette, Undo, Redo, Edit, GripVertical, Type, Heading1, Heading2, Heading3, CheckSquare, Highlighter, Link2, Table as Table$1, Wand2, Maximize, FileText, Briefcase, MessageSquare, Heart, GraduationCap, Languages, Lightbulb, BarChart3, Music, Archive, File, FileSpreadsheet, FileJson, FileDown, ArrowUp, ArrowDown, ArrowUpDown, ChevronsLeft, ChevronsRight, CheckCircle, Star, Shield, Award, Gem, Flame, Menu, Calendar as Calendar$1, Repeat, MapPin, Users, User, Move, EyeOff, Timer, Square, Cpu, Target, GitBranch, ArrowRight, MoreVertical, Trash, TrendingUp, MessageCircle, Paperclip, Printer, TrendingDown, Bell, CheckCheck, Settings2, LogOut, Edit3, LayoutGrid, Share2, Save, Github, Activity, Server, Monitor, MemoryStick, HardDrive, Network, Columns, Pin, Sun, Moon, Send, Tag, Flag, BellOff, CalendarIcon, DollarSign, Map as Map$1, Trophy, ArrowDownRight, ArrowUpRight, Grip, Unlock, GitFork, Package } from 'lucide-react';
8
8
  import { cva } from 'class-variance-authority';
9
9
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
10
10
  import * as AvatarPrimitive from '@radix-ui/react-avatar';
@@ -65093,51 +65093,31 @@ function DashboardInternal({
65093
65093
  }
65094
65094
  }, [propTimeRange]);
65095
65095
  t__default.useEffect(() => {
65096
- if (!realtime)
65096
+ if (!realtime || mode !== "widgets")
65097
65097
  return;
65098
65098
  const interval = setInterval(() => {
65099
- setWidgets((prev) => prev.map((widget) => {
65100
- if (widget.type === "metric" && widget.data) {
65101
- const newValue = typeof widget.data.value === "number" ? widget.data.value + Math.floor(Math.random() * 10 - 5) : widget.data.value;
65102
- return {
65103
- ...widget,
65104
- data: {
65105
- ...widget.data,
65106
- value: newValue,
65107
- lastUpdated: /* @__PURE__ */ new Date()
65108
- }
65109
- };
65110
- }
65111
- return widget;
65112
- }));
65099
+ setWidgets((prev) => {
65100
+ if (!prev || prev.length === 0)
65101
+ return prev;
65102
+ return prev.map((widget) => {
65103
+ if (widget.type === "metric" && widget.data) {
65104
+ const newValue = typeof widget.data.value === "number" ? widget.data.value + Math.floor(Math.random() * 10 - 5) : widget.data.value;
65105
+ return {
65106
+ ...widget,
65107
+ data: {
65108
+ ...widget.data,
65109
+ value: newValue,
65110
+ lastUpdated: /* @__PURE__ */ new Date()
65111
+ }
65112
+ };
65113
+ }
65114
+ return widget;
65115
+ });
65116
+ });
65113
65117
  }, 5e3);
65114
65118
  return () => clearInterval(interval);
65115
- }, [realtime]);
65116
- const handleAddWidget = (type) => {
65117
- const newWidget = {
65118
- id: `widget-${Date.now()}`,
65119
- type,
65120
- title: `New ${type} Widget`,
65121
- size: { w: 3, h: 3 },
65122
- position: { x: 0, y: 0 },
65123
- data: generateDefaultData(type)
65124
- };
65125
- setWidgets((prev) => [...prev, newWidget]);
65126
- onWidgetAdd?.(newWidget);
65127
- setShowWidgetLibrary(false);
65128
- };
65129
- const applyTemplate = (template) => {
65130
- const newWidgets = template.widgets.map((w, index2) => ({
65131
- ...w,
65132
- id: `widget-${Date.now()}-${index2}`,
65133
- position: w.position || { x: index2 * 3 % 12, y: Math.floor(index2 * 3 / 12) * 3 },
65134
- size: w.size || { w: 3, h: 3 }
65135
- }));
65136
- setWidgets(newWidgets);
65137
- setSelectedTheme(template.theme);
65138
- setShowTemplates(false);
65139
- };
65140
- const generateDefaultData = (type) => {
65119
+ }, [realtime, mode]);
65120
+ const generateDefaultData = t__default.useCallback((type) => {
65141
65121
  switch (type) {
65142
65122
  case "metric":
65143
65123
  return {
@@ -65166,96 +65146,128 @@ function DashboardInternal({
65166
65146
  default:
65167
65147
  return {};
65168
65148
  }
65169
- };
65170
- const WidgetLibrary = () => /* @__PURE__ */ jsx(Sheet, { open: showWidgetLibrary, onOpenChange: setShowWidgetLibrary, children: /* @__PURE__ */ jsxs(SheetContent, { className: cn(
65171
- "w-[400px] sm:w-[540px]",
65172
- glassmorphism && "bg-background/95 backdrop-blur-md"
65173
- ), children: [
65174
- /* @__PURE__ */ jsxs(SheetHeader, { children: [
65175
- /* @__PURE__ */ jsx(SheetTitle, { children: "Widget Library" }),
65176
- /* @__PURE__ */ jsx(SheetDescription, { children: "Add widgets to customize your dashboard" })
65177
- ] }),
65178
- /* @__PURE__ */ jsxs("div", { className: "mt-6 space-y-4", children: [
65179
- /* @__PURE__ */ jsxs("div", { className: "relative", children: [
65180
- /* @__PURE__ */ jsx(Search, { className: "absolute left-3 top-3 h-4 w-4 text-muted-foreground" }),
65181
- /* @__PURE__ */ jsx(
65182
- MoonUIInputPro,
65183
- {
65184
- placeholder: "Search widgets...",
65185
- value: searchQuery,
65186
- onChange: (e) => {
65187
- setSearchQuery(e.target.value);
65188
- onSearch?.(e.target.value);
65189
- },
65190
- className: "pl-10"
65191
- }
65192
- )
65149
+ }, []);
65150
+ const handleAddWidget = t__default.useCallback((type) => {
65151
+ const newWidget = {
65152
+ id: `widget-${Date.now()}`,
65153
+ type,
65154
+ title: `New ${type} Widget`,
65155
+ size: { w: 3, h: 3 },
65156
+ position: { x: 0, y: 0 },
65157
+ data: generateDefaultData(type)
65158
+ };
65159
+ setWidgets((prev) => [...prev, newWidget]);
65160
+ onWidgetAdd?.(newWidget);
65161
+ setShowWidgetLibrary(false);
65162
+ }, [onWidgetAdd, generateDefaultData]);
65163
+ const applyTemplate = t__default.useCallback((template) => {
65164
+ const newWidgets = template.widgets.map((w, index2) => ({
65165
+ ...w,
65166
+ id: `widget-${Date.now()}-${index2}`,
65167
+ position: w.position || { x: index2 * 3 % 12, y: Math.floor(index2 * 3 / 12) * 3 },
65168
+ size: w.size || { w: 3, h: 3 }
65169
+ }));
65170
+ setWidgets(newWidgets);
65171
+ setSelectedTheme(template.theme);
65172
+ setShowTemplates(false);
65173
+ }, []);
65174
+ const WidgetLibrary = t__default.useCallback(() => {
65175
+ if (!showWidgetLibrary)
65176
+ return null;
65177
+ return /* @__PURE__ */ jsx(Sheet, { open: showWidgetLibrary, onOpenChange: setShowWidgetLibrary, children: /* @__PURE__ */ jsxs(SheetContent, { className: cn(
65178
+ "w-[400px] sm:w-[540px]",
65179
+ glassmorphism && "bg-background/95 backdrop-blur-md"
65180
+ ), children: [
65181
+ /* @__PURE__ */ jsxs(SheetHeader, { children: [
65182
+ /* @__PURE__ */ jsx(SheetTitle, { children: "Widget Library" }),
65183
+ /* @__PURE__ */ jsx(SheetDescription, { children: "Add widgets to customize your dashboard" })
65193
65184
  ] }),
65194
- /* @__PURE__ */ jsx(ScrollArea, { className: "h-[calc(100vh-200px)]", children: /* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 gap-4", children: Object.entries(WIDGET_TYPE_ICONS).filter(([type]) => type.toLowerCase().includes(searchQuery.toLowerCase())).map(([type, icon]) => /* @__PURE__ */ jsx(
65195
- motion.div,
65196
- {
65197
- whileHover: { scale: 1.02 },
65198
- whileTap: { scale: 0.98 },
65199
- children: /* @__PURE__ */ jsxs(
65200
- MoonUIButtonPro,
65185
+ /* @__PURE__ */ jsxs("div", { className: "mt-6 space-y-4", children: [
65186
+ /* @__PURE__ */ jsxs("div", { className: "relative", children: [
65187
+ /* @__PURE__ */ jsx(Search, { className: "absolute left-3 top-3 h-4 w-4 text-muted-foreground" }),
65188
+ /* @__PURE__ */ jsx(
65189
+ MoonUIInputPro,
65201
65190
  {
65202
- variant: "outline",
65203
- className: "w-full h-24 flex-col gap-2",
65204
- onClick: () => handleAddWidget(type),
65205
- children: [
65206
- /* @__PURE__ */ jsx("div", { className: "p-2 rounded-lg bg-muted", children: icon }),
65207
- /* @__PURE__ */ jsx("span", { className: "capitalize text-sm", children: type })
65208
- ]
65191
+ placeholder: "Search widgets...",
65192
+ value: searchQuery,
65193
+ onChange: (e) => {
65194
+ setSearchQuery(e.target.value);
65195
+ onSearch?.(e.target.value);
65196
+ },
65197
+ className: "pl-10"
65209
65198
  }
65210
65199
  )
65211
- },
65212
- type
65213
- )) }) })
65214
- ] })
65215
- ] }) });
65216
- const TemplateGallery = () => /* @__PURE__ */ jsx(MoonUIDialogPro, { open: showTemplates, onOpenChange: setShowTemplates, children: /* @__PURE__ */ jsxs(MoonUIDialogContentPro, { className: cn(
65217
- "max-w-4xl",
65218
- glassmorphism && "bg-background/95 backdrop-blur-md"
65219
- ), children: [
65220
- /* @__PURE__ */ jsxs(MoonUIDialogHeaderPro, { children: [
65221
- /* @__PURE__ */ jsx(MoonUIDialogTitlePro, { children: "Dashboard Templates" }),
65222
- /* @__PURE__ */ jsx(MoonUIDialogDescriptionPro, { children: "Start with a pre-built template or create your own" })
65223
- ] }),
65224
- /* @__PURE__ */ jsxs(Tabs, { defaultValue: "all", className: "mt-4", children: [
65225
- /* @__PURE__ */ jsxs(TabsList, { children: [
65226
- /* @__PURE__ */ jsx(TabsTrigger, { value: "all", children: "All Templates" }),
65227
- /* @__PURE__ */ jsx(TabsTrigger, { value: "analytics", children: "Analytics" }),
65228
- /* @__PURE__ */ jsx(TabsTrigger, { value: "sales", children: "Sales" }),
65229
- /* @__PURE__ */ jsx(TabsTrigger, { value: "operations", children: "Operations" })
65200
+ ] }),
65201
+ /* @__PURE__ */ jsx(ScrollArea, { className: "h-[calc(100vh-200px)]", children: /* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 gap-4", children: Object.entries(WIDGET_TYPE_ICONS).filter(([type]) => type.toLowerCase().includes(searchQuery.toLowerCase())).map(([type, icon]) => /* @__PURE__ */ jsx(
65202
+ motion.div,
65203
+ {
65204
+ whileHover: { scale: 1.02 },
65205
+ whileTap: { scale: 0.98 },
65206
+ children: /* @__PURE__ */ jsxs(
65207
+ MoonUIButtonPro,
65208
+ {
65209
+ variant: "outline",
65210
+ className: "w-full h-24 flex-col gap-2",
65211
+ onClick: () => handleAddWidget(type),
65212
+ children: [
65213
+ /* @__PURE__ */ jsx("div", { className: "p-2 rounded-lg bg-muted", children: icon }),
65214
+ /* @__PURE__ */ jsx("span", { className: "capitalize text-sm", children: type })
65215
+ ]
65216
+ }
65217
+ )
65218
+ },
65219
+ type
65220
+ )) }) })
65221
+ ] })
65222
+ ] }) });
65223
+ }, [showWidgetLibrary, searchQuery, glassmorphism, onSearch, handleAddWidget]);
65224
+ const TemplateGallery = t__default.useCallback(() => {
65225
+ if (!showTemplates)
65226
+ return null;
65227
+ return /* @__PURE__ */ jsx(MoonUIDialogPro, { open: showTemplates, onOpenChange: setShowTemplates, children: /* @__PURE__ */ jsxs(MoonUIDialogContentPro, { className: cn(
65228
+ "max-w-4xl",
65229
+ glassmorphism && "bg-background/95 backdrop-blur-md"
65230
+ ), children: [
65231
+ /* @__PURE__ */ jsxs(MoonUIDialogHeaderPro, { children: [
65232
+ /* @__PURE__ */ jsx(MoonUIDialogTitlePro, { children: "Dashboard Templates" }),
65233
+ /* @__PURE__ */ jsx(MoonUIDialogDescriptionPro, { children: "Start with a pre-built template or create your own" })
65230
65234
  ] }),
65231
- /* @__PURE__ */ jsx(TabsContent, { value: "all", className: "mt-4", children: /* @__PURE__ */ jsx("div", { className: "grid grid-cols-3 gap-4", children: templates.map((template) => /* @__PURE__ */ jsx(
65232
- motion.div,
65233
- {
65234
- whileHover: { y: -4 },
65235
- className: "cursor-pointer",
65236
- onClick: () => applyTemplate(template),
65237
- children: /* @__PURE__ */ jsxs("div", { className: cn(
65238
- "relative overflow-hidden rounded-lg border p-4 hover:shadow-lg transition-all",
65239
- "bg-gradient-to-br",
65240
- THEME_COLORS[template.theme]
65241
- ), children: [
65242
- template.isPro && /* @__PURE__ */ jsx(MoonUIBadgePro, { className: "absolute top-2 right-2", variant: "secondary", children: "PRO" }),
65243
- /* @__PURE__ */ jsx("h3", { className: "font-semibold mb-1", children: template.name }),
65244
- /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: template.description }),
65245
- /* @__PURE__ */ jsxs("div", { className: "mt-3 flex items-center gap-2 text-xs text-muted-foreground", children: [
65246
- /* @__PURE__ */ jsxs("span", { children: [
65247
- template.widgets.length,
65248
- " widgets"
65249
- ] }),
65250
- /* @__PURE__ */ jsx("span", { children: "\u2022" }),
65251
- /* @__PURE__ */ jsx("span", { className: "capitalize", children: template.category })
65235
+ /* @__PURE__ */ jsxs(Tabs, { defaultValue: "all", className: "mt-4", children: [
65236
+ /* @__PURE__ */ jsxs(TabsList, { children: [
65237
+ /* @__PURE__ */ jsx(TabsTrigger, { value: "all", children: "All Templates" }),
65238
+ /* @__PURE__ */ jsx(TabsTrigger, { value: "analytics", children: "Analytics" }),
65239
+ /* @__PURE__ */ jsx(TabsTrigger, { value: "sales", children: "Sales" }),
65240
+ /* @__PURE__ */ jsx(TabsTrigger, { value: "operations", children: "Operations" })
65241
+ ] }),
65242
+ /* @__PURE__ */ jsx(TabsContent, { value: "all", className: "mt-4", children: /* @__PURE__ */ jsx("div", { className: "grid grid-cols-3 gap-4", children: templates.map((template) => /* @__PURE__ */ jsx(
65243
+ motion.div,
65244
+ {
65245
+ whileHover: { y: -4 },
65246
+ className: "cursor-pointer",
65247
+ onClick: () => applyTemplate(template),
65248
+ children: /* @__PURE__ */ jsxs("div", { className: cn(
65249
+ "relative overflow-hidden rounded-lg border p-4 hover:shadow-lg transition-all",
65250
+ "bg-gradient-to-br",
65251
+ THEME_COLORS[template.theme]
65252
+ ), children: [
65253
+ template.isPro && /* @__PURE__ */ jsx(MoonUIBadgePro, { className: "absolute top-2 right-2", variant: "secondary", children: "PRO" }),
65254
+ /* @__PURE__ */ jsx("h3", { className: "font-semibold mb-1", children: template.name }),
65255
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: template.description }),
65256
+ /* @__PURE__ */ jsxs("div", { className: "mt-3 flex items-center gap-2 text-xs text-muted-foreground", children: [
65257
+ /* @__PURE__ */ jsxs("span", { children: [
65258
+ template.widgets.length,
65259
+ " widgets"
65260
+ ] }),
65261
+ /* @__PURE__ */ jsx("span", { children: "\u2022" }),
65262
+ /* @__PURE__ */ jsx("span", { className: "capitalize", children: template.category })
65263
+ ] })
65252
65264
  ] })
65253
- ] })
65254
- },
65255
- template.id
65256
- )) }) })
65257
- ] })
65258
- ] }) });
65265
+ },
65266
+ template.id
65267
+ )) }) })
65268
+ ] })
65269
+ ] }) });
65270
+ }, [showTemplates, glassmorphism, templates, applyTemplate]);
65259
65271
  return /* @__PURE__ */ jsxs(
65260
65272
  motion.div,
65261
65273
  {
@@ -65733,8 +65745,8 @@ function DashboardInternal({
65733
65745
  )
65734
65746
  ) })
65735
65747
  ),
65736
- /* @__PURE__ */ jsx(WidgetLibrary, {}),
65737
- /* @__PURE__ */ jsx(TemplateGallery, {})
65748
+ showWidgetLibrary && /* @__PURE__ */ jsx(WidgetLibrary, {}),
65749
+ showTemplates && /* @__PURE__ */ jsx(TemplateGallery, {})
65738
65750
  ]
65739
65751
  }
65740
65752
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moontra/moonui-pro",
3
- "version": "2.24.7",
3
+ "version": "2.24.8",
4
4
  "description": "Premium React components for MoonUI - Advanced UI library with 50+ pro components including performance, interactive, and gesture components",
5
5
  "type": "module",
6
6
  "main": "dist/index.mjs",