@moontra/moonui-pro 2.24.4 → 2.24.7
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.d.ts +5 -0
- package/dist/index.global.js +107 -107
- package/dist/index.global.js.map +1 -1
- package/dist/index.mjs +156 -65
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -4,11 +4,11 @@ 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, CalendarIcon, DollarSign, Trophy, Grip, Unlock, Map as Map$1, GitFork, Package
|
|
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';
|
|
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';
|
|
11
|
-
import { format, addMonths, subMonths, startOfMonth, endOfMonth, eachDayOfInterval, getDay, startOfWeek, endOfWeek, isSameMonth, isToday, isSameDay, startOfDay, endOfDay, subDays
|
|
11
|
+
import { format, addMonths, subMonths, startOfMonth, endOfMonth, eachDayOfInterval, getDay, startOfWeek, endOfWeek, isSameMonth, isToday, isSameDay, formatDistanceToNow, startOfDay, endOfDay, subDays } from 'date-fns';
|
|
12
12
|
import { motion, AnimatePresence, useAnimation, useMotionValue, animate, useSpring, useTransform, Reorder, useDragControls } from 'framer-motion';
|
|
13
13
|
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
14
14
|
import * as ReactDOM2 from 'react-dom';
|
|
@@ -65043,6 +65043,11 @@ function DashboardInternal({
|
|
|
65043
65043
|
editable = true,
|
|
65044
65044
|
realtime = false,
|
|
65045
65045
|
glassmorphism = true,
|
|
65046
|
+
children,
|
|
65047
|
+
mode = "widgets",
|
|
65048
|
+
contentClassName,
|
|
65049
|
+
sidebarPosition = "none",
|
|
65050
|
+
sidebarContent,
|
|
65046
65051
|
notifications = [],
|
|
65047
65052
|
onNotificationClick,
|
|
65048
65053
|
onNotificationMarkAsRead,
|
|
@@ -65065,19 +65070,25 @@ function DashboardInternal({
|
|
|
65065
65070
|
brandName
|
|
65066
65071
|
}) {
|
|
65067
65072
|
const [editMode, setEditMode] = t__default.useState(false);
|
|
65068
|
-
const [widgets, setWidgets] = t__default.useState(initialWidgets);
|
|
65073
|
+
const [widgets, setWidgets] = t__default.useState(() => initialWidgets);
|
|
65069
65074
|
const [selectedTheme, setSelectedTheme] = t__default.useState("analytics");
|
|
65070
|
-
const [timeRange, setTimeRange] = t__default.useState(propTimeRange);
|
|
65075
|
+
const [timeRange, setTimeRange] = t__default.useState(() => propTimeRange);
|
|
65071
65076
|
const [searchQuery, setSearchQuery] = t__default.useState("");
|
|
65072
65077
|
const [showWidgetLibrary, setShowWidgetLibrary] = t__default.useState(false);
|
|
65073
65078
|
const [showTemplates, setShowTemplates] = t__default.useState(false);
|
|
65074
65079
|
const [refreshing, setRefreshing] = t__default.useState(false);
|
|
65075
65080
|
const [showNotifications, setShowNotifications] = t__default.useState(false);
|
|
65081
|
+
const prevInitialWidgetsRef = t__default.useRef(initialWidgets);
|
|
65082
|
+
const prevTimeRangeRef = t__default.useRef(propTimeRange);
|
|
65076
65083
|
t__default.useEffect(() => {
|
|
65077
|
-
|
|
65084
|
+
if (prevInitialWidgetsRef.current !== initialWidgets) {
|
|
65085
|
+
prevInitialWidgetsRef.current = initialWidgets;
|
|
65086
|
+
setWidgets(initialWidgets);
|
|
65087
|
+
}
|
|
65078
65088
|
}, [initialWidgets]);
|
|
65079
65089
|
t__default.useEffect(() => {
|
|
65080
|
-
if (propTimeRange) {
|
|
65090
|
+
if (propTimeRange && prevTimeRangeRef.current !== propTimeRange) {
|
|
65091
|
+
prevTimeRangeRef.current = propTimeRange;
|
|
65081
65092
|
setTimeRange(propTimeRange);
|
|
65082
65093
|
}
|
|
65083
65094
|
}, [propTimeRange]);
|
|
@@ -65582,66 +65593,146 @@ function DashboardInternal({
|
|
|
65582
65593
|
]
|
|
65583
65594
|
}
|
|
65584
65595
|
),
|
|
65585
|
-
|
|
65586
|
-
//
|
|
65587
|
-
/* @__PURE__ */ jsxs(
|
|
65588
|
-
|
|
65589
|
-
|
|
65590
|
-
|
|
65591
|
-
|
|
65592
|
-
|
|
65593
|
-
|
|
65594
|
-
|
|
65595
|
-
|
|
65596
|
-
|
|
65597
|
-
|
|
65598
|
-
|
|
65599
|
-
|
|
65600
|
-
|
|
65601
|
-
|
|
65602
|
-
|
|
65603
|
-
|
|
65604
|
-
|
|
65605
|
-
|
|
65606
|
-
|
|
65607
|
-
|
|
65608
|
-
|
|
65609
|
-
|
|
65610
|
-
|
|
65611
|
-
|
|
65612
|
-
|
|
65613
|
-
|
|
65614
|
-
|
|
65615
|
-
|
|
65616
|
-
|
|
65617
|
-
|
|
65618
|
-
widgets,
|
|
65619
|
-
onLayoutChange: (layout) => {
|
|
65620
|
-
const updatedWidgets = widgets.map((widget) => {
|
|
65621
|
-
const layoutItem = layout.find((l) => l.i === widget.id);
|
|
65622
|
-
if (layoutItem) {
|
|
65623
|
-
return {
|
|
65624
|
-
...widget,
|
|
65625
|
-
position: { x: layoutItem.x, y: layoutItem.y },
|
|
65626
|
-
size: { ...widget.size, w: layoutItem.w, h: layoutItem.h }
|
|
65627
|
-
};
|
|
65596
|
+
mode === "children" ? (
|
|
65597
|
+
// Children mode - use as layout wrapper
|
|
65598
|
+
/* @__PURE__ */ jsxs("div", { className: cn("flex-1", contentClassName), children: [
|
|
65599
|
+
sidebarPosition !== "none" && sidebarContent && /* @__PURE__ */ jsxs("div", { className: "flex", children: [
|
|
65600
|
+
sidebarPosition === "left" && /* @__PURE__ */ jsx("div", { className: cn(
|
|
65601
|
+
"w-64 border-r",
|
|
65602
|
+
glassmorphism ? "bg-background/60 backdrop-blur-md" : "bg-background"
|
|
65603
|
+
), children: /* @__PURE__ */ jsx("div", { className: "p-6", children: sidebarContent }) }),
|
|
65604
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1 p-6", children }),
|
|
65605
|
+
sidebarPosition === "right" && /* @__PURE__ */ jsx("div", { className: cn(
|
|
65606
|
+
"w-64 border-l",
|
|
65607
|
+
glassmorphism ? "bg-background/60 backdrop-blur-md" : "bg-background"
|
|
65608
|
+
), children: /* @__PURE__ */ jsx("div", { className: "p-6", children: sidebarContent }) })
|
|
65609
|
+
] }),
|
|
65610
|
+
sidebarPosition === "none" && /* @__PURE__ */ jsx("div", { className: "p-6", children })
|
|
65611
|
+
] })
|
|
65612
|
+
) : mode === "hybrid" ? (
|
|
65613
|
+
// Hybrid mode - both children and widgets
|
|
65614
|
+
/* @__PURE__ */ jsxs("div", { className: "flex", children: [
|
|
65615
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1 p-6", children }),
|
|
65616
|
+
/* @__PURE__ */ jsx("div", { className: cn(
|
|
65617
|
+
"w-80 border-l p-6",
|
|
65618
|
+
glassmorphism ? "bg-background/60 backdrop-blur-md" : "bg-background"
|
|
65619
|
+
), children: /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
65620
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between mb-4", children: [
|
|
65621
|
+
/* @__PURE__ */ jsx("h3", { className: "font-semibold", children: "Widgets" }),
|
|
65622
|
+
editable && /* @__PURE__ */ jsx(
|
|
65623
|
+
MoonUIButtonPro,
|
|
65624
|
+
{
|
|
65625
|
+
variant: "ghost",
|
|
65626
|
+
size: "sm",
|
|
65627
|
+
onClick: () => setShowWidgetLibrary(true),
|
|
65628
|
+
children: /* @__PURE__ */ jsx(Plus, { className: "h-4 w-4" })
|
|
65628
65629
|
}
|
|
65629
|
-
|
|
65630
|
-
|
|
65631
|
-
|
|
65632
|
-
|
|
65633
|
-
|
|
65634
|
-
|
|
65635
|
-
|
|
65636
|
-
|
|
65637
|
-
|
|
65638
|
-
|
|
65639
|
-
|
|
65640
|
-
|
|
65641
|
-
|
|
65642
|
-
|
|
65643
|
-
|
|
65644
|
-
|
|
65630
|
+
)
|
|
65631
|
+
] }),
|
|
65632
|
+
widgets.length === 0 ? /* @__PURE__ */ jsxs("div", { className: "text-center text-muted-foreground py-8", children: [
|
|
65633
|
+
/* @__PURE__ */ jsx(LayoutGrid, { className: "h-8 w-8 mx-auto mb-2 opacity-20" }),
|
|
65634
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm", children: "No widgets" }),
|
|
65635
|
+
editable && /* @__PURE__ */ jsx(
|
|
65636
|
+
MoonUIButtonPro,
|
|
65637
|
+
{
|
|
65638
|
+
variant: "ghost",
|
|
65639
|
+
size: "sm",
|
|
65640
|
+
className: "mt-2",
|
|
65641
|
+
onClick: () => setShowWidgetLibrary(true),
|
|
65642
|
+
children: "Add Widget"
|
|
65643
|
+
}
|
|
65644
|
+
)
|
|
65645
|
+
] }) : /* @__PURE__ */ jsx("div", { className: "space-y-4", children: widgets.map((widget) => /* @__PURE__ */ jsxs("div", { className: "border rounded-lg p-4", children: [
|
|
65646
|
+
widget.type === "metric" && widget.data && /* @__PURE__ */ jsx(
|
|
65647
|
+
MetricCard,
|
|
65648
|
+
{
|
|
65649
|
+
data: widget.data,
|
|
65650
|
+
glassmorphism
|
|
65651
|
+
}
|
|
65652
|
+
),
|
|
65653
|
+
widget.type === "chart" && widget.data && /* @__PURE__ */ jsx(
|
|
65654
|
+
ChartWidget,
|
|
65655
|
+
{
|
|
65656
|
+
id: widget.id,
|
|
65657
|
+
title: widget.title,
|
|
65658
|
+
data: widget.data,
|
|
65659
|
+
glassmorphism
|
|
65660
|
+
}
|
|
65661
|
+
),
|
|
65662
|
+
widget.type === "activity" && widget.data && /* @__PURE__ */ jsx(
|
|
65663
|
+
ActivityFeed,
|
|
65664
|
+
{
|
|
65665
|
+
items: widget.data.items || [],
|
|
65666
|
+
title: widget.title,
|
|
65667
|
+
glassmorphism
|
|
65668
|
+
}
|
|
65669
|
+
)
|
|
65670
|
+
] }, widget.id)) })
|
|
65671
|
+
] }) })
|
|
65672
|
+
] })
|
|
65673
|
+
) : (
|
|
65674
|
+
// Default widgets mode
|
|
65675
|
+
/* @__PURE__ */ jsx("div", { className: "p-6", children: widgets.length === 0 ? (
|
|
65676
|
+
// Empty state
|
|
65677
|
+
/* @__PURE__ */ jsxs(
|
|
65678
|
+
motion.div,
|
|
65679
|
+
{
|
|
65680
|
+
initial: { opacity: 0, scale: 0.9 },
|
|
65681
|
+
animate: { opacity: 1, scale: 1 },
|
|
65682
|
+
className: "flex flex-col items-center justify-center min-h-[400px] text-center",
|
|
65683
|
+
children: [
|
|
65684
|
+
/* @__PURE__ */ jsx("div", { className: cn(
|
|
65685
|
+
"p-4 rounded-full mb-4",
|
|
65686
|
+
glassmorphism ? "bg-background/60 backdrop-blur-sm" : "bg-muted"
|
|
65687
|
+
), children: /* @__PURE__ */ jsx(LayoutGrid, { className: "h-8 w-8 text-muted-foreground" }) }),
|
|
65688
|
+
/* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold mb-2", children: "No widgets added yet" }),
|
|
65689
|
+
/* @__PURE__ */ jsx("p", { className: "text-muted-foreground mb-4", children: "Start by adding widgets or choosing a template" }),
|
|
65690
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
|
|
65691
|
+
/* @__PURE__ */ jsxs(MoonUIButtonPro, { onClick: () => setShowWidgetLibrary(true), children: [
|
|
65692
|
+
/* @__PURE__ */ jsx(Plus, { className: "h-4 w-4 mr-2" }),
|
|
65693
|
+
"Add Widget"
|
|
65694
|
+
] }),
|
|
65695
|
+
/* @__PURE__ */ jsxs(MoonUIButtonPro, { variant: "outline", onClick: () => setShowTemplates(true), children: [
|
|
65696
|
+
/* @__PURE__ */ jsx(LayoutGrid, { className: "h-4 w-4 mr-2" }),
|
|
65697
|
+
"Browse Templates"
|
|
65698
|
+
] })
|
|
65699
|
+
] })
|
|
65700
|
+
]
|
|
65701
|
+
}
|
|
65702
|
+
)
|
|
65703
|
+
) : (
|
|
65704
|
+
// Dashboard grid
|
|
65705
|
+
/* @__PURE__ */ jsx(
|
|
65706
|
+
DashboardGrid,
|
|
65707
|
+
{
|
|
65708
|
+
widgets,
|
|
65709
|
+
onLayoutChange: (layout) => {
|
|
65710
|
+
const updatedWidgets = widgets.map((widget) => {
|
|
65711
|
+
const layoutItem = layout.find((l) => l.i === widget.id);
|
|
65712
|
+
if (layoutItem) {
|
|
65713
|
+
return {
|
|
65714
|
+
...widget,
|
|
65715
|
+
position: { x: layoutItem.x, y: layoutItem.y },
|
|
65716
|
+
size: { ...widget.size, w: layoutItem.w, h: layoutItem.h }
|
|
65717
|
+
};
|
|
65718
|
+
}
|
|
65719
|
+
return widget;
|
|
65720
|
+
});
|
|
65721
|
+
setWidgets(updatedWidgets);
|
|
65722
|
+
},
|
|
65723
|
+
onWidgetRemove: (widgetId) => {
|
|
65724
|
+
setWidgets((prev) => prev.filter((w) => w.id !== widgetId));
|
|
65725
|
+
onWidgetRemove?.(widgetId);
|
|
65726
|
+
},
|
|
65727
|
+
onWidgetAction: (widgetId, action, data) => {
|
|
65728
|
+
console.log("Widget action:", widgetId, action, data);
|
|
65729
|
+
},
|
|
65730
|
+
editMode,
|
|
65731
|
+
glassmorphism
|
|
65732
|
+
}
|
|
65733
|
+
)
|
|
65734
|
+
) })
|
|
65735
|
+
),
|
|
65645
65736
|
/* @__PURE__ */ jsx(WidgetLibrary, {}),
|
|
65646
65737
|
/* @__PURE__ */ jsx(TemplateGallery, {})
|
|
65647
65738
|
]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moontra/moonui-pro",
|
|
3
|
-
"version": "2.24.
|
|
3
|
+
"version": "2.24.7",
|
|
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",
|