@moontra/moonui-pro 2.24.6 → 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.global.js +70 -70
- package/dist/index.global.js.map +1 -1
- package/dist/index.mjs +150 -132
- package/package.json +1 -1
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,
|
|
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';
|
|
@@ -65070,68 +65070,54 @@ function DashboardInternal({
|
|
|
65070
65070
|
brandName
|
|
65071
65071
|
}) {
|
|
65072
65072
|
const [editMode, setEditMode] = t__default.useState(false);
|
|
65073
|
-
const [widgets, setWidgets] = t__default.useState(initialWidgets);
|
|
65073
|
+
const [widgets, setWidgets] = t__default.useState(() => initialWidgets);
|
|
65074
65074
|
const [selectedTheme, setSelectedTheme] = t__default.useState("analytics");
|
|
65075
|
-
const [timeRange, setTimeRange] = t__default.useState(propTimeRange);
|
|
65075
|
+
const [timeRange, setTimeRange] = t__default.useState(() => propTimeRange);
|
|
65076
65076
|
const [searchQuery, setSearchQuery] = t__default.useState("");
|
|
65077
65077
|
const [showWidgetLibrary, setShowWidgetLibrary] = t__default.useState(false);
|
|
65078
65078
|
const [showTemplates, setShowTemplates] = t__default.useState(false);
|
|
65079
65079
|
const [refreshing, setRefreshing] = t__default.useState(false);
|
|
65080
65080
|
const [showNotifications, setShowNotifications] = t__default.useState(false);
|
|
65081
|
+
const prevInitialWidgetsRef = t__default.useRef(initialWidgets);
|
|
65082
|
+
const prevTimeRangeRef = t__default.useRef(propTimeRange);
|
|
65081
65083
|
t__default.useEffect(() => {
|
|
65082
|
-
|
|
65084
|
+
if (prevInitialWidgetsRef.current !== initialWidgets) {
|
|
65085
|
+
prevInitialWidgetsRef.current = initialWidgets;
|
|
65086
|
+
setWidgets(initialWidgets);
|
|
65087
|
+
}
|
|
65083
65088
|
}, [initialWidgets]);
|
|
65084
65089
|
t__default.useEffect(() => {
|
|
65085
|
-
if (propTimeRange) {
|
|
65090
|
+
if (propTimeRange && prevTimeRangeRef.current !== propTimeRange) {
|
|
65091
|
+
prevTimeRangeRef.current = propTimeRange;
|
|
65086
65092
|
setTimeRange(propTimeRange);
|
|
65087
65093
|
}
|
|
65088
65094
|
}, [propTimeRange]);
|
|
65089
65095
|
t__default.useEffect(() => {
|
|
65090
|
-
if (!realtime)
|
|
65096
|
+
if (!realtime || mode !== "widgets")
|
|
65091
65097
|
return;
|
|
65092
65098
|
const interval = setInterval(() => {
|
|
65093
|
-
setWidgets((prev) =>
|
|
65094
|
-
if (
|
|
65095
|
-
|
|
65096
|
-
|
|
65097
|
-
|
|
65098
|
-
data:
|
|
65099
|
-
|
|
65100
|
-
|
|
65101
|
-
|
|
65102
|
-
|
|
65103
|
-
|
|
65104
|
-
|
|
65105
|
-
|
|
65106
|
-
|
|
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
|
+
});
|
|
65107
65117
|
}, 5e3);
|
|
65108
65118
|
return () => clearInterval(interval);
|
|
65109
|
-
}, [realtime]);
|
|
65110
|
-
const
|
|
65111
|
-
const newWidget = {
|
|
65112
|
-
id: `widget-${Date.now()}`,
|
|
65113
|
-
type,
|
|
65114
|
-
title: `New ${type} Widget`,
|
|
65115
|
-
size: { w: 3, h: 3 },
|
|
65116
|
-
position: { x: 0, y: 0 },
|
|
65117
|
-
data: generateDefaultData(type)
|
|
65118
|
-
};
|
|
65119
|
-
setWidgets((prev) => [...prev, newWidget]);
|
|
65120
|
-
onWidgetAdd?.(newWidget);
|
|
65121
|
-
setShowWidgetLibrary(false);
|
|
65122
|
-
};
|
|
65123
|
-
const applyTemplate = (template) => {
|
|
65124
|
-
const newWidgets = template.widgets.map((w, index2) => ({
|
|
65125
|
-
...w,
|
|
65126
|
-
id: `widget-${Date.now()}-${index2}`,
|
|
65127
|
-
position: w.position || { x: index2 * 3 % 12, y: Math.floor(index2 * 3 / 12) * 3 },
|
|
65128
|
-
size: w.size || { w: 3, h: 3 }
|
|
65129
|
-
}));
|
|
65130
|
-
setWidgets(newWidgets);
|
|
65131
|
-
setSelectedTheme(template.theme);
|
|
65132
|
-
setShowTemplates(false);
|
|
65133
|
-
};
|
|
65134
|
-
const generateDefaultData = (type) => {
|
|
65119
|
+
}, [realtime, mode]);
|
|
65120
|
+
const generateDefaultData = t__default.useCallback((type) => {
|
|
65135
65121
|
switch (type) {
|
|
65136
65122
|
case "metric":
|
|
65137
65123
|
return {
|
|
@@ -65160,96 +65146,128 @@ function DashboardInternal({
|
|
|
65160
65146
|
default:
|
|
65161
65147
|
return {};
|
|
65162
65148
|
}
|
|
65163
|
-
};
|
|
65164
|
-
const
|
|
65165
|
-
|
|
65166
|
-
|
|
65167
|
-
|
|
65168
|
-
|
|
65169
|
-
|
|
65170
|
-
|
|
65171
|
-
|
|
65172
|
-
|
|
65173
|
-
|
|
65174
|
-
|
|
65175
|
-
|
|
65176
|
-
|
|
65177
|
-
|
|
65178
|
-
|
|
65179
|
-
|
|
65180
|
-
|
|
65181
|
-
|
|
65182
|
-
|
|
65183
|
-
|
|
65184
|
-
|
|
65185
|
-
|
|
65186
|
-
|
|
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" })
|
|
65187
65184
|
] }),
|
|
65188
|
-
/* @__PURE__ */
|
|
65189
|
-
|
|
65190
|
-
|
|
65191
|
-
|
|
65192
|
-
|
|
65193
|
-
children: /* @__PURE__ */ jsxs(
|
|
65194
|
-
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,
|
|
65195
65190
|
{
|
|
65196
|
-
|
|
65197
|
-
|
|
65198
|
-
|
|
65199
|
-
|
|
65200
|
-
|
|
65201
|
-
|
|
65202
|
-
|
|
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"
|
|
65203
65198
|
}
|
|
65204
65199
|
)
|
|
65205
|
-
},
|
|
65206
|
-
type
|
|
65207
|
-
|
|
65208
|
-
|
|
65209
|
-
|
|
65210
|
-
|
|
65211
|
-
|
|
65212
|
-
|
|
65213
|
-
|
|
65214
|
-
|
|
65215
|
-
|
|
65216
|
-
|
|
65217
|
-
|
|
65218
|
-
|
|
65219
|
-
|
|
65220
|
-
|
|
65221
|
-
|
|
65222
|
-
|
|
65223
|
-
|
|
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" })
|
|
65224
65234
|
] }),
|
|
65225
|
-
/* @__PURE__ */
|
|
65226
|
-
|
|
65227
|
-
|
|
65228
|
-
|
|
65229
|
-
|
|
65230
|
-
|
|
65231
|
-
|
|
65232
|
-
|
|
65233
|
-
|
|
65234
|
-
|
|
65235
|
-
|
|
65236
|
-
|
|
65237
|
-
|
|
65238
|
-
/* @__PURE__ */
|
|
65239
|
-
|
|
65240
|
-
|
|
65241
|
-
|
|
65242
|
-
|
|
65243
|
-
|
|
65244
|
-
/* @__PURE__ */ jsx("
|
|
65245
|
-
/* @__PURE__ */ jsx("
|
|
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
|
+
] })
|
|
65246
65264
|
] })
|
|
65247
|
-
|
|
65248
|
-
|
|
65249
|
-
|
|
65250
|
-
|
|
65251
|
-
] })
|
|
65252
|
-
|
|
65265
|
+
},
|
|
65266
|
+
template.id
|
|
65267
|
+
)) }) })
|
|
65268
|
+
] })
|
|
65269
|
+
] }) });
|
|
65270
|
+
}, [showTemplates, glassmorphism, templates, applyTemplate]);
|
|
65253
65271
|
return /* @__PURE__ */ jsxs(
|
|
65254
65272
|
motion.div,
|
|
65255
65273
|
{
|
|
@@ -65727,8 +65745,8 @@ function DashboardInternal({
|
|
|
65727
65745
|
)
|
|
65728
65746
|
) })
|
|
65729
65747
|
),
|
|
65730
|
-
/* @__PURE__ */ jsx(WidgetLibrary, {}),
|
|
65731
|
-
/* @__PURE__ */ jsx(TemplateGallery, {})
|
|
65748
|
+
showWidgetLibrary && /* @__PURE__ */ jsx(WidgetLibrary, {}),
|
|
65749
|
+
showTemplates && /* @__PURE__ */ jsx(TemplateGallery, {})
|
|
65732
65750
|
]
|
|
65733
65751
|
}
|
|
65734
65752
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moontra/moonui-pro",
|
|
3
|
-
"version": "2.24.
|
|
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",
|