@moontra/moonui-pro 2.14.2 → 2.15.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/dist/index.d.ts +88 -23
- package/dist/index.mjs +685 -104
- package/package.json +1 -1
- package/src/components/timeline/index.tsx +967 -148
package/dist/index.mjs
CHANGED
|
@@ -3,12 +3,12 @@ import { twMerge } from 'tailwind-merge';
|
|
|
3
3
|
import * as t from 'react';
|
|
4
4
|
import t__default, { useState, useRef, useCallback, forwardRef, createContext, useEffect, useMemo, useContext, useLayoutEffect, useDebugValue, Component } from 'react';
|
|
5
5
|
import * as AccordionPrimitive from '@radix-ui/react-accordion';
|
|
6
|
-
import { ChevronDown, Info, AlertCircle, AlertTriangle, Check, X, MoreHorizontal, Loader2, Minus, Search, ChevronRight, Circle, ChevronUp, Lock, Sparkles, Plus, Upload, Play, Eye, CheckCircle2, Pause, RotateCcw, Download, Copy, Share, Trash2, CreditCard, Globe, XCircle, Clock, HelpCircle, ChevronLeft, Calendar as Calendar$1, Edit, MapPin, User, Filter, Move, Archive, EyeOff, Settings, Timer, Palette, ArrowUpDown, FileText, Star, Square, CheckSquare, Bold as Bold$1, Italic as Italic$1, Underline as Underline$1, Strikethrough, Code as Code$1, Type, Heading1, Heading2, Heading3, AlignLeft, AlignCenter, AlignRight, AlignJustify, List, ListOrdered, Quote, Highlighter, Link2, Image as Image$1, Table as Table$1, Undo, Redo, RefreshCw, Wand2, Maximize, Briefcase, MessageSquare, Heart, GraduationCap, Zap, Languages, Lightbulb, TrendingUp, TrendingDown, ZoomOut, ZoomIn, FileSpreadsheet, FileJson, Maximize2, Menu, Bell, CheckCheck, CheckCircle, Settings2, LogOut, Edit3, LayoutGrid, Share2, Save, Video, Music, File, FileDown, ArrowUp, ArrowDown, ChevronsLeft, ChevronsRight, Pin, Sun, Moon, Monitor, Activity, Send,
|
|
6
|
+
import { ChevronDown, Info, AlertCircle, AlertTriangle, Check, X, MoreHorizontal, Loader2, Minus, Search, ChevronRight, Circle, ChevronUp, Lock, Sparkles, Plus, Upload, Play, Eye, CheckCircle2, Pause, RotateCcw, Download, Copy, Share, Trash2, CreditCard, Globe, XCircle, Clock, HelpCircle, ChevronLeft, Calendar as Calendar$1, Edit, MapPin, User, Filter, Move, Archive, EyeOff, Settings, Timer, Palette, ArrowUpDown, FileText, Star, Square, CheckSquare, Bold as Bold$1, Italic as Italic$1, Underline as Underline$1, Strikethrough, Code as Code$1, Type, Heading1, Heading2, Heading3, AlignLeft, AlignCenter, AlignRight, AlignJustify, List, ListOrdered, Quote, Highlighter, Link2, Image as Image$1, Table as Table$1, Undo, Redo, RefreshCw, Wand2, Maximize, Briefcase, MessageSquare, Heart, GraduationCap, Zap, Languages, Lightbulb, Target, Repeat, GitBranch, ArrowRight, MoreVertical, Trash, ExternalLink, TrendingUp, MessageCircle, Paperclip, Printer, TrendingDown, ZoomOut, ZoomIn, FileSpreadsheet, FileJson, Maximize2, Menu, Bell, CheckCheck, CheckCircle, Settings2, LogOut, Edit3, LayoutGrid, Share2, Save, Video, Music, File, FileDown, ArrowUp, ArrowDown, ChevronsLeft, ChevronsRight, Pin, Sun, Moon, Monitor, Activity, Send, Tag, Flag, CalendarIcon, DollarSign, Users, Github, GitFork, Server, RotateCw, Cpu, MemoryStick, HardDrive, Network, BarChart3, Columns, Grip, Unlock, Minimize2, Map as Map$1, BellOff, ArrowDownRight, ArrowUpRight } from 'lucide-react';
|
|
7
7
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
8
8
|
import { cva } from 'class-variance-authority';
|
|
9
9
|
import * as AvatarPrimitive from '@radix-ui/react-avatar';
|
|
10
10
|
import { format, addMonths, subMonths, startOfMonth, endOfMonth, eachDayOfInterval, getDay, startOfWeek, endOfWeek, isSameMonth, isToday, isSameDay, startOfDay, endOfDay, subDays, formatDistanceToNow } from 'date-fns';
|
|
11
|
-
import { motion, AnimatePresence, useMotionValue, useSpring, useTransform, animate, useDragControls } from 'framer-motion';
|
|
11
|
+
import { motion, AnimatePresence, useMotionValue, useSpring, useTransform, animate, Reorder, useDragControls } from 'framer-motion';
|
|
12
12
|
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
13
13
|
import * as ReactDOM from 'react-dom';
|
|
14
14
|
import ReactDOM__default from 'react-dom';
|
|
@@ -54766,57 +54766,187 @@ var SwipeableCard = t__default.forwardRef(
|
|
|
54766
54766
|
}
|
|
54767
54767
|
);
|
|
54768
54768
|
SwipeableCard.displayName = "SwipeableCard";
|
|
54769
|
-
var
|
|
54769
|
+
var timelineVariants = cva("w-full", {
|
|
54770
|
+
variants: {
|
|
54771
|
+
theme: {
|
|
54772
|
+
default: "",
|
|
54773
|
+
minimal: "border-0 shadow-none",
|
|
54774
|
+
detailed: "border-2",
|
|
54775
|
+
compact: "p-0"
|
|
54776
|
+
}
|
|
54777
|
+
},
|
|
54778
|
+
defaultVariants: {
|
|
54779
|
+
theme: "default"
|
|
54780
|
+
}
|
|
54781
|
+
});
|
|
54782
|
+
var DEFAULT_COLORS = {
|
|
54770
54783
|
success: "bg-green-500 border-green-500",
|
|
54771
54784
|
warning: "bg-yellow-500 border-yellow-500",
|
|
54772
54785
|
error: "bg-red-500 border-red-500",
|
|
54773
54786
|
info: "bg-blue-500 border-blue-500",
|
|
54774
|
-
pending: "bg-gray-400 border-gray-400"
|
|
54787
|
+
pending: "bg-gray-400 border-gray-400",
|
|
54788
|
+
milestone: "bg-purple-500 border-purple-500",
|
|
54789
|
+
custom: "bg-slate-500 border-slate-500"
|
|
54775
54790
|
};
|
|
54776
|
-
var
|
|
54791
|
+
var DEFAULT_ICONS = {
|
|
54777
54792
|
success: /* @__PURE__ */ jsx(CheckCircle2, { className: "h-4 w-4 text-white" }),
|
|
54778
54793
|
warning: /* @__PURE__ */ jsx(AlertCircle, { className: "h-4 w-4 text-white" }),
|
|
54779
54794
|
error: /* @__PURE__ */ jsx(XCircle, { className: "h-4 w-4 text-white" }),
|
|
54780
54795
|
info: /* @__PURE__ */ jsx(Circle, { className: "h-4 w-4 text-white" }),
|
|
54781
|
-
pending: /* @__PURE__ */ jsx(Clock, { className: "h-4 w-4 text-white" })
|
|
54796
|
+
pending: /* @__PURE__ */ jsx(Clock, { className: "h-4 w-4 text-white" }),
|
|
54797
|
+
milestone: /* @__PURE__ */ jsx(Flag, { className: "h-4 w-4 text-white" }),
|
|
54798
|
+
custom: /* @__PURE__ */ jsx(Sparkles, { className: "h-4 w-4 text-white" })
|
|
54782
54799
|
};
|
|
54783
|
-
var
|
|
54784
|
-
success: "text-green-700",
|
|
54785
|
-
warning: "text-yellow-700",
|
|
54786
|
-
error: "text-red-700",
|
|
54787
|
-
info: "text-blue-700",
|
|
54788
|
-
pending: "text-gray-700"
|
|
54800
|
+
var TEXT_COLORS = {
|
|
54801
|
+
success: "text-green-700 dark:text-green-400",
|
|
54802
|
+
warning: "text-yellow-700 dark:text-yellow-400",
|
|
54803
|
+
error: "text-red-700 dark:text-red-400",
|
|
54804
|
+
info: "text-blue-700 dark:text-blue-400",
|
|
54805
|
+
pending: "text-gray-700 dark:text-gray-400",
|
|
54806
|
+
milestone: "text-purple-700 dark:text-purple-400",
|
|
54807
|
+
custom: "text-slate-700 dark:text-slate-400"
|
|
54808
|
+
};
|
|
54809
|
+
var animationVariants = {
|
|
54810
|
+
fade: {
|
|
54811
|
+
initial: { opacity: 0 },
|
|
54812
|
+
animate: { opacity: 1 },
|
|
54813
|
+
exit: { opacity: 0 }
|
|
54814
|
+
},
|
|
54815
|
+
slide: {
|
|
54816
|
+
initial: { opacity: 0, x: -20 },
|
|
54817
|
+
animate: { opacity: 1, x: 0 },
|
|
54818
|
+
exit: { opacity: 0, x: 20 }
|
|
54819
|
+
},
|
|
54820
|
+
scale: {
|
|
54821
|
+
initial: { opacity: 0, scale: 0.8 },
|
|
54822
|
+
animate: { opacity: 1, scale: 1 },
|
|
54823
|
+
exit: { opacity: 0, scale: 0.8 }
|
|
54824
|
+
}
|
|
54789
54825
|
};
|
|
54790
54826
|
function Timeline({
|
|
54791
|
-
events,
|
|
54827
|
+
events: initialEvents,
|
|
54792
54828
|
onEventClick,
|
|
54829
|
+
onEventEdit,
|
|
54830
|
+
onEventDelete,
|
|
54831
|
+
onEventsReorder,
|
|
54793
54832
|
className,
|
|
54833
|
+
layout = "vertical",
|
|
54834
|
+
theme = "default",
|
|
54835
|
+
animation = "fade",
|
|
54836
|
+
groupBy = "none",
|
|
54794
54837
|
showUserInfo = true,
|
|
54795
54838
|
showMetadata = true,
|
|
54796
54839
|
showRelativeTime = true,
|
|
54797
|
-
|
|
54798
|
-
|
|
54799
|
-
|
|
54800
|
-
|
|
54840
|
+
showSearch = true,
|
|
54841
|
+
showFilter = true,
|
|
54842
|
+
showExport = true,
|
|
54843
|
+
eventRenderer,
|
|
54844
|
+
connectorRenderer,
|
|
54845
|
+
iconRenderer,
|
|
54846
|
+
colorScheme = DEFAULT_COLORS,
|
|
54847
|
+
draggable = false,
|
|
54848
|
+
expandable = true,
|
|
54849
|
+
editable = false,
|
|
54850
|
+
selectable = false,
|
|
54851
|
+
virtualScroll = false,
|
|
54852
|
+
maxEventsPerGroup = 20,
|
|
54853
|
+
printMode = false,
|
|
54854
|
+
compactMode = false,
|
|
54855
|
+
parallaxEffect = false,
|
|
54856
|
+
gradientConnectors = false,
|
|
54857
|
+
animatedProgress = false,
|
|
54858
|
+
ariaLabel = "Timeline of events",
|
|
54859
|
+
keyboardNavigation = true,
|
|
54860
|
+
...props
|
|
54801
54861
|
}) {
|
|
54802
|
-
const
|
|
54803
|
-
const
|
|
54862
|
+
const [events, setEvents] = useState(initialEvents);
|
|
54863
|
+
const [searchQuery, setSearchQuery] = useState("");
|
|
54864
|
+
const [filterType, setFilterType] = useState("all");
|
|
54865
|
+
const [selectedEvents, setSelectedEvents] = useState(/* @__PURE__ */ new Set());
|
|
54866
|
+
const [expandedEvents, setExpandedEvents] = useState(/* @__PURE__ */ new Set());
|
|
54867
|
+
const [focusedEventId, setFocusedEventId] = useState(null);
|
|
54868
|
+
const timelineRef = useRef(null);
|
|
54869
|
+
const eventRefs = useRef(/* @__PURE__ */ new Map());
|
|
54870
|
+
useEffect(() => {
|
|
54871
|
+
setEvents(initialEvents);
|
|
54872
|
+
}, [initialEvents]);
|
|
54873
|
+
useEffect(() => {
|
|
54874
|
+
if (!keyboardNavigation)
|
|
54875
|
+
return;
|
|
54876
|
+
const handleKeyDown3 = (e) => {
|
|
54877
|
+
const currentIndex = events.findIndex((event) => event.id === focusedEventId);
|
|
54878
|
+
switch (e.key) {
|
|
54879
|
+
case "ArrowDown":
|
|
54880
|
+
case "ArrowRight":
|
|
54881
|
+
e.preventDefault();
|
|
54882
|
+
if (currentIndex < events.length - 1) {
|
|
54883
|
+
const nextEvent = events[currentIndex + 1];
|
|
54884
|
+
setFocusedEventId(nextEvent.id);
|
|
54885
|
+
eventRefs.current.get(nextEvent.id)?.focus();
|
|
54886
|
+
}
|
|
54887
|
+
break;
|
|
54888
|
+
case "ArrowUp":
|
|
54889
|
+
case "ArrowLeft":
|
|
54890
|
+
e.preventDefault();
|
|
54891
|
+
if (currentIndex > 0) {
|
|
54892
|
+
const prevEvent = events[currentIndex - 1];
|
|
54893
|
+
setFocusedEventId(prevEvent.id);
|
|
54894
|
+
eventRefs.current.get(prevEvent.id)?.focus();
|
|
54895
|
+
}
|
|
54896
|
+
break;
|
|
54897
|
+
case "Enter":
|
|
54898
|
+
case " ":
|
|
54899
|
+
e.preventDefault();
|
|
54900
|
+
if (focusedEventId) {
|
|
54901
|
+
const event = events.find((e2) => e2.id === focusedEventId);
|
|
54902
|
+
if (event && onEventClick) {
|
|
54903
|
+
onEventClick(event);
|
|
54904
|
+
}
|
|
54905
|
+
}
|
|
54906
|
+
break;
|
|
54907
|
+
case "Delete":
|
|
54908
|
+
if (editable && focusedEventId && onEventDelete) {
|
|
54909
|
+
const event = events.find((e2) => e2.id === focusedEventId);
|
|
54910
|
+
if (event) {
|
|
54911
|
+
onEventDelete(event);
|
|
54912
|
+
}
|
|
54913
|
+
}
|
|
54914
|
+
break;
|
|
54915
|
+
}
|
|
54916
|
+
};
|
|
54917
|
+
timelineRef.current?.addEventListener("keydown", handleKeyDown3);
|
|
54918
|
+
return () => timelineRef.current?.removeEventListener("keydown", handleKeyDown3);
|
|
54919
|
+
}, [keyboardNavigation, events, focusedEventId, onEventClick, onEventDelete, editable]);
|
|
54920
|
+
const formatDate2 = useCallback((date) => {
|
|
54804
54921
|
return date.toLocaleDateString("en-US", {
|
|
54805
54922
|
year: "numeric",
|
|
54806
54923
|
month: "long",
|
|
54807
54924
|
day: "numeric"
|
|
54808
54925
|
});
|
|
54809
|
-
};
|
|
54810
|
-
const formatTime2 = (date) => {
|
|
54926
|
+
}, []);
|
|
54927
|
+
const formatTime2 = useCallback((date) => {
|
|
54811
54928
|
return date.toLocaleTimeString("en-US", {
|
|
54812
54929
|
hour: "2-digit",
|
|
54813
54930
|
minute: "2-digit",
|
|
54814
54931
|
hour12: true
|
|
54815
54932
|
});
|
|
54816
|
-
};
|
|
54817
|
-
const getRelativeTime = (date) => {
|
|
54933
|
+
}, []);
|
|
54934
|
+
const getRelativeTime = useCallback((date) => {
|
|
54818
54935
|
const now = /* @__PURE__ */ new Date();
|
|
54819
54936
|
const diffInSeconds = Math.floor((now.getTime() - date.getTime()) / 1e3);
|
|
54937
|
+
if (diffInSeconds < 0) {
|
|
54938
|
+
const futureDiff = Math.abs(diffInSeconds);
|
|
54939
|
+
if (futureDiff < 3600) {
|
|
54940
|
+
const minutes = Math.floor(futureDiff / 60);
|
|
54941
|
+
return `In ${minutes} minute${minutes !== 1 ? "s" : ""}`;
|
|
54942
|
+
} else if (futureDiff < 86400) {
|
|
54943
|
+
const hours = Math.floor(futureDiff / 3600);
|
|
54944
|
+
return `In ${hours} hour${hours !== 1 ? "s" : ""}`;
|
|
54945
|
+
} else {
|
|
54946
|
+
const days = Math.floor(futureDiff / 86400);
|
|
54947
|
+
return `In ${days} day${days !== 1 ? "s" : ""}`;
|
|
54948
|
+
}
|
|
54949
|
+
}
|
|
54820
54950
|
if (diffInSeconds < 60) {
|
|
54821
54951
|
return "Just now";
|
|
54822
54952
|
} else if (diffInSeconds < 3600) {
|
|
@@ -54825,76 +54955,291 @@ function Timeline({
|
|
|
54825
54955
|
} else if (diffInSeconds < 86400) {
|
|
54826
54956
|
const hours = Math.floor(diffInSeconds / 3600);
|
|
54827
54957
|
return `${hours} hour${hours > 1 ? "s" : ""} ago`;
|
|
54828
|
-
} else if (diffInSeconds <
|
|
54958
|
+
} else if (diffInSeconds < 604800) {
|
|
54829
54959
|
const days = Math.floor(diffInSeconds / 86400);
|
|
54830
54960
|
return `${days} day${days > 1 ? "s" : ""} ago`;
|
|
54831
54961
|
} else {
|
|
54832
54962
|
return formatDate2(date);
|
|
54833
54963
|
}
|
|
54834
|
-
};
|
|
54835
|
-
const getInitials4 = (name) => {
|
|
54836
|
-
return name.split(" ").map((n) => n[0]).join("").toUpperCase();
|
|
54837
|
-
};
|
|
54838
|
-
const groupEventsByDate = (events2) => {
|
|
54964
|
+
}, [formatDate2]);
|
|
54965
|
+
const getInitials4 = useCallback((name) => {
|
|
54966
|
+
return name.split(" ").map((n) => n[0]).join("").toUpperCase().slice(0, 2);
|
|
54967
|
+
}, []);
|
|
54968
|
+
const groupEventsByDate = useCallback((events2) => {
|
|
54839
54969
|
const groups = {};
|
|
54840
54970
|
events2.forEach((event) => {
|
|
54841
|
-
|
|
54971
|
+
let dateKey;
|
|
54972
|
+
switch (groupBy) {
|
|
54973
|
+
case "week":
|
|
54974
|
+
const weekStart = new Date(event.date);
|
|
54975
|
+
weekStart.setDate(weekStart.getDate() - weekStart.getDay());
|
|
54976
|
+
dateKey = `Week of ${formatDate2(weekStart)}`;
|
|
54977
|
+
break;
|
|
54978
|
+
case "month":
|
|
54979
|
+
dateKey = event.date.toLocaleDateString("en-US", { year: "numeric", month: "long" });
|
|
54980
|
+
break;
|
|
54981
|
+
case "year":
|
|
54982
|
+
dateKey = event.date.getFullYear().toString();
|
|
54983
|
+
break;
|
|
54984
|
+
case "date":
|
|
54985
|
+
default:
|
|
54986
|
+
dateKey = formatDate2(event.date);
|
|
54987
|
+
}
|
|
54842
54988
|
if (!groups[dateKey]) {
|
|
54843
54989
|
groups[dateKey] = [];
|
|
54844
54990
|
}
|
|
54845
54991
|
groups[dateKey].push(event);
|
|
54846
54992
|
});
|
|
54847
54993
|
return groups;
|
|
54848
|
-
};
|
|
54849
|
-
const
|
|
54850
|
-
|
|
54851
|
-
|
|
54994
|
+
}, [groupBy, formatDate2]);
|
|
54995
|
+
const filteredAndSortedEvents = useMemo(() => {
|
|
54996
|
+
let filtered = [...events];
|
|
54997
|
+
if (searchQuery) {
|
|
54998
|
+
filtered = filtered.filter(
|
|
54999
|
+
(event) => event.title.toLowerCase().includes(searchQuery.toLowerCase()) || event.description?.toLowerCase().includes(searchQuery.toLowerCase()) || event.metadata?.tags?.some((tag) => tag.toLowerCase().includes(searchQuery.toLowerCase()))
|
|
55000
|
+
);
|
|
54852
55001
|
}
|
|
54853
|
-
|
|
54854
|
-
|
|
54855
|
-
|
|
54856
|
-
|
|
54857
|
-
|
|
54858
|
-
|
|
55002
|
+
if (filterType !== "all") {
|
|
55003
|
+
filtered = filtered.filter((event) => event.type === filterType);
|
|
55004
|
+
}
|
|
55005
|
+
return filtered.sort((a, b) => b.date.getTime() - a.date.getTime());
|
|
55006
|
+
}, [events, searchQuery, filterType]);
|
|
55007
|
+
const handleEventClick = useCallback((event) => {
|
|
55008
|
+
if (selectable) {
|
|
55009
|
+
setSelectedEvents((prev) => {
|
|
55010
|
+
const newSet = new Set(prev);
|
|
55011
|
+
if (newSet.has(event.id)) {
|
|
55012
|
+
newSet.delete(event.id);
|
|
55013
|
+
} else {
|
|
55014
|
+
newSet.add(event.id);
|
|
55015
|
+
}
|
|
55016
|
+
return newSet;
|
|
55017
|
+
});
|
|
55018
|
+
}
|
|
55019
|
+
if (expandable && "subEvents" in event) {
|
|
55020
|
+
setExpandedEvents((prev) => {
|
|
55021
|
+
const newSet = new Set(prev);
|
|
55022
|
+
if (newSet.has(event.id)) {
|
|
55023
|
+
newSet.delete(event.id);
|
|
55024
|
+
} else {
|
|
55025
|
+
newSet.add(event.id);
|
|
55026
|
+
}
|
|
55027
|
+
return newSet;
|
|
55028
|
+
});
|
|
55029
|
+
}
|
|
55030
|
+
onEventClick?.(event);
|
|
55031
|
+
}, [selectable, expandable, onEventClick]);
|
|
55032
|
+
const handleExport = useCallback(() => {
|
|
55033
|
+
const dataStr = JSON.stringify(filteredAndSortedEvents, null, 2);
|
|
55034
|
+
const dataUri = "data:application/json;charset=utf-8," + encodeURIComponent(dataStr);
|
|
55035
|
+
const exportFileDefaultName = `timeline-export-${( new Date()).toISOString()}.json`;
|
|
55036
|
+
const linkElement = document.createElement("a");
|
|
55037
|
+
linkElement.setAttribute("href", dataUri);
|
|
55038
|
+
linkElement.setAttribute("download", exportFileDefaultName);
|
|
55039
|
+
linkElement.click();
|
|
55040
|
+
}, [filteredAndSortedEvents]);
|
|
55041
|
+
const handlePrint = useCallback(() => {
|
|
55042
|
+
window.print();
|
|
55043
|
+
}, []);
|
|
55044
|
+
const renderEventIcon = useCallback((event) => {
|
|
55045
|
+
if (iconRenderer) {
|
|
55046
|
+
return iconRenderer(event);
|
|
55047
|
+
}
|
|
55048
|
+
if (event.icon) {
|
|
55049
|
+
return event.icon;
|
|
55050
|
+
}
|
|
55051
|
+
if ("milestone" in event) {
|
|
55052
|
+
return /* @__PURE__ */ jsx(Target, { className: "h-4 w-4 text-white" });
|
|
55053
|
+
}
|
|
55054
|
+
if ("recurrence" in event) {
|
|
55055
|
+
return /* @__PURE__ */ jsx(Repeat, { className: "h-4 w-4 text-white" });
|
|
55056
|
+
}
|
|
55057
|
+
if ("subEvents" in event) {
|
|
55058
|
+
return /* @__PURE__ */ jsx(GitBranch, { className: "h-4 w-4 text-white" });
|
|
55059
|
+
}
|
|
55060
|
+
return DEFAULT_ICONS[event.type] || DEFAULT_ICONS.custom;
|
|
55061
|
+
}, [iconRenderer]);
|
|
55062
|
+
const renderConnector = useCallback((fromEvent, toEvent, isLast) => {
|
|
55063
|
+
if (connectorRenderer) {
|
|
55064
|
+
return connectorRenderer(fromEvent, toEvent);
|
|
55065
|
+
}
|
|
55066
|
+
if (isLast)
|
|
55067
|
+
return null;
|
|
55068
|
+
const baseClasses = cn(
|
|
55069
|
+
"absolute",
|
|
55070
|
+
layout === "horizontal" ? "h-0.5 top-4" : "w-0.5 left-4 -ml-px",
|
|
55071
|
+
gradientConnectors && "bg-gradient-to-b from-border to-transparent"
|
|
55072
|
+
);
|
|
55073
|
+
if (layout === "horizontal") {
|
|
55074
|
+
return /* @__PURE__ */ jsx("div", { className: cn(baseClasses, "bg-border"), style: { width: "100px" } });
|
|
55075
|
+
}
|
|
55076
|
+
return /* @__PURE__ */ jsx(
|
|
55077
|
+
"div",
|
|
55078
|
+
{
|
|
55079
|
+
className: cn(
|
|
55080
|
+
baseClasses,
|
|
55081
|
+
"bg-border",
|
|
55082
|
+
layout === "alternating" && "hidden"
|
|
55083
|
+
),
|
|
55084
|
+
style: {
|
|
55085
|
+
height: "calc(100% + 2rem)",
|
|
55086
|
+
top: "2rem"
|
|
55087
|
+
}
|
|
55088
|
+
}
|
|
55089
|
+
);
|
|
55090
|
+
}, [connectorRenderer, layout, gradientConnectors]);
|
|
55091
|
+
const renderEvent = useCallback((event, index2, isLast = false) => {
|
|
55092
|
+
const eventColor = event.color || colorScheme[event.type] || DEFAULT_COLORS[event.type];
|
|
55093
|
+
TEXT_COLORS[event.type] || TEXT_COLORS.custom;
|
|
55094
|
+
const isSelected = selectedEvents.has(event.id);
|
|
55095
|
+
const isExpanded = expandedEvents.has(event.id);
|
|
55096
|
+
const isFocused = focusedEventId === event.id;
|
|
55097
|
+
if (eventRenderer) {
|
|
55098
|
+
return eventRenderer(event, index2);
|
|
55099
|
+
}
|
|
55100
|
+
const isRangeEvent = "endDate" in event;
|
|
55101
|
+
const isNestedEvent = "subEvents" in event;
|
|
55102
|
+
const isMilestoneEvent = "milestone" in event;
|
|
55103
|
+
const eventContent = /* @__PURE__ */ jsxs(
|
|
54859
55104
|
"div",
|
|
54860
55105
|
{
|
|
55106
|
+
ref: (el) => {
|
|
55107
|
+
if (el)
|
|
55108
|
+
eventRefs.current.set(event.id, el);
|
|
55109
|
+
},
|
|
55110
|
+
tabIndex: keyboardNavigation ? 0 : -1,
|
|
54861
55111
|
className: cn(
|
|
54862
55112
|
"relative flex gap-4",
|
|
54863
|
-
|
|
54864
|
-
|
|
55113
|
+
compactMode ? "pb-2" : "pb-8",
|
|
55114
|
+
layout === "alternating" && index2 % 2 === 0 && "flex-row-reverse",
|
|
55115
|
+
layout === "horizontal" && "flex-col items-center",
|
|
55116
|
+
"cursor-pointer rounded-lg p-3 -m-1 transition-all duration-200",
|
|
55117
|
+
"hover:bg-muted/50 focus:outline-none focus:ring-2 focus:ring-ring",
|
|
55118
|
+
isSelected && "bg-muted/70",
|
|
55119
|
+
isFocused && "ring-2 ring-ring",
|
|
55120
|
+
printMode && "print:break-inside-avoid"
|
|
54865
55121
|
),
|
|
54866
55122
|
onClick: () => handleEventClick(event),
|
|
55123
|
+
onFocus: () => setFocusedEventId(event.id),
|
|
55124
|
+
role: "button",
|
|
55125
|
+
"aria-label": `Event: ${event.title}`,
|
|
55126
|
+
"aria-expanded": isNestedEvent ? isExpanded : void 0,
|
|
54867
55127
|
children: [
|
|
54868
|
-
|
|
54869
|
-
|
|
54870
|
-
|
|
54871
|
-
|
|
54872
|
-
|
|
54873
|
-
|
|
55128
|
+
/* @__PURE__ */ jsxs("div", { className: cn(
|
|
55129
|
+
"flex flex-col items-center",
|
|
55130
|
+
layout === "horizontal" && "flex-row"
|
|
55131
|
+
), children: [
|
|
55132
|
+
/* @__PURE__ */ jsx(
|
|
55133
|
+
motion.div,
|
|
55134
|
+
{
|
|
55135
|
+
className: cn(
|
|
55136
|
+
"flex items-center justify-center rounded-full border-2 bg-background z-10",
|
|
55137
|
+
isMilestoneEvent ? "w-10 h-10" : "w-8 h-8",
|
|
55138
|
+
eventColor,
|
|
55139
|
+
isSelected && "ring-2 ring-ring ring-offset-2"
|
|
55140
|
+
),
|
|
55141
|
+
whileHover: { scale: 1.1 },
|
|
55142
|
+
whileTap: { scale: 0.95 },
|
|
55143
|
+
children: renderEventIcon(event)
|
|
55144
|
+
}
|
|
55145
|
+
),
|
|
55146
|
+
!isLast && renderConnector(event, events[index2 + 1], isLast)
|
|
54874
55147
|
] }),
|
|
54875
|
-
/* @__PURE__ */ jsxs("div", { className:
|
|
54876
|
-
|
|
55148
|
+
/* @__PURE__ */ jsxs("div", { className: cn(
|
|
55149
|
+
"flex-1 min-w-0",
|
|
55150
|
+
layout === "alternating" && index2 % 2 === 0 && "text-right"
|
|
55151
|
+
), children: [
|
|
55152
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-2 mb-2", children: [
|
|
54877
55153
|
/* @__PURE__ */ jsxs("div", { className: "flex-1", children: [
|
|
54878
|
-
/* @__PURE__ */
|
|
54879
|
-
"font-
|
|
54880
|
-
|
|
54881
|
-
|
|
54882
|
-
|
|
54883
|
-
|
|
54884
|
-
|
|
54885
|
-
|
|
55154
|
+
/* @__PURE__ */ jsxs("h4", { className: cn(
|
|
55155
|
+
"font-semibold",
|
|
55156
|
+
compactMode ? "text-sm" : "text-base",
|
|
55157
|
+
isMilestoneEvent && "text-lg"
|
|
55158
|
+
), children: [
|
|
55159
|
+
event.title,
|
|
55160
|
+
isMilestoneEvent && /* @__PURE__ */ jsx(MoonUIBadgePro, { variant: "secondary", className: "ml-2 bg-purple-500", children: "Milestone" })
|
|
55161
|
+
] }),
|
|
55162
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 mt-1 text-xs text-muted-foreground", children: [
|
|
55163
|
+
/* @__PURE__ */ jsx(Clock, { className: "h-3 w-3" }),
|
|
55164
|
+
showRelativeTime ? /* @__PURE__ */ jsx("span", { children: getRelativeTime(event.date) }) : /* @__PURE__ */ jsx("span", { children: formatTime2(event.date) }),
|
|
55165
|
+
isRangeEvent && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
55166
|
+
/* @__PURE__ */ jsx(ArrowRight, { className: "h-3 w-3" }),
|
|
55167
|
+
/* @__PURE__ */ jsx("span", { children: formatTime2(event.endDate) })
|
|
55168
|
+
] })
|
|
55169
|
+
] })
|
|
55170
|
+
] }),
|
|
55171
|
+
(editable || event.metadata?.externalLink) && /* @__PURE__ */ jsxs(MoonUIDropdownMenuPro, { children: [
|
|
55172
|
+
/* @__PURE__ */ jsx(MoonUIDropdownMenuTriggerPro, { asChild: true, children: /* @__PURE__ */ jsx(MoonUIButtonPro, { variant: "ghost", size: "sm", className: "h-8 w-8 p-0", children: /* @__PURE__ */ jsx(MoreVertical, { className: "h-4 w-4" }) }) }),
|
|
55173
|
+
/* @__PURE__ */ jsxs(MoonUIDropdownMenuContentPro, { align: "end", children: [
|
|
55174
|
+
editable && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
55175
|
+
/* @__PURE__ */ jsxs(MoonUIDropdownMenuItemPro, { onClick: () => onEventEdit?.(event), children: [
|
|
55176
|
+
/* @__PURE__ */ jsx(Edit, { className: "mr-2 h-4 w-4" }),
|
|
55177
|
+
"Edit"
|
|
55178
|
+
] }),
|
|
55179
|
+
/* @__PURE__ */ jsxs(MoonUIDropdownMenuItemPro, { onClick: () => onEventDelete?.(event), children: [
|
|
55180
|
+
/* @__PURE__ */ jsx(Trash, { className: "mr-2 h-4 w-4" }),
|
|
55181
|
+
"Delete"
|
|
55182
|
+
] }),
|
|
55183
|
+
/* @__PURE__ */ jsx(MoonUIDropdownMenuSeparatorPro, {})
|
|
55184
|
+
] }),
|
|
55185
|
+
/* @__PURE__ */ jsxs(MoonUIDropdownMenuItemPro, { onClick: () => navigator.clipboard.writeText(event.title), children: [
|
|
55186
|
+
/* @__PURE__ */ jsx(Copy, { className: "mr-2 h-4 w-4" }),
|
|
55187
|
+
"Copy"
|
|
55188
|
+
] }),
|
|
55189
|
+
/* @__PURE__ */ jsxs(MoonUIDropdownMenuItemPro, { children: [
|
|
55190
|
+
/* @__PURE__ */ jsx(Share, { className: "mr-2 h-4 w-4" }),
|
|
55191
|
+
"Share"
|
|
55192
|
+
] }),
|
|
55193
|
+
event.metadata?.externalLink && /* @__PURE__ */ jsxs(MoonUIDropdownMenuItemPro, { onClick: () => window.open(event.metadata?.externalLink, "_blank"), children: [
|
|
55194
|
+
/* @__PURE__ */ jsx(ExternalLink, { className: "mr-2 h-4 w-4" }),
|
|
55195
|
+
"View Details"
|
|
55196
|
+
] })
|
|
55197
|
+
] })
|
|
55198
|
+
] })
|
|
55199
|
+
] }),
|
|
55200
|
+
event.description && /* @__PURE__ */ jsx("p", { className: cn(
|
|
55201
|
+
"text-muted-foreground mb-2",
|
|
55202
|
+
compactMode ? "text-xs" : "text-sm"
|
|
55203
|
+
), children: event.description }),
|
|
55204
|
+
isMilestoneEvent && event.milestone && /* @__PURE__ */ jsxs("div", { className: "bg-purple-50 dark:bg-purple-950/20 rounded-md p-3 mb-2", children: [
|
|
55205
|
+
event.milestone.target && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm", children: [
|
|
55206
|
+
/* @__PURE__ */ jsx(Target, { className: "h-4 w-4 text-purple-600" }),
|
|
55207
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium", children: "Target:" }),
|
|
55208
|
+
/* @__PURE__ */ jsx("span", { children: event.milestone.target })
|
|
54886
55209
|
] }),
|
|
54887
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-
|
|
54888
|
-
|
|
54889
|
-
/* @__PURE__ */ jsx(
|
|
55210
|
+
event.milestone.achievement && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm mt-1", children: [
|
|
55211
|
+
/* @__PURE__ */ jsx(TrendingUp, { className: "h-4 w-4 text-purple-600" }),
|
|
55212
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium", children: "Achievement:" }),
|
|
55213
|
+
/* @__PURE__ */ jsx("span", { children: event.milestone.achievement })
|
|
54890
55214
|
] })
|
|
54891
55215
|
] }),
|
|
55216
|
+
event.metadata?.progress !== void 0 && /* @__PURE__ */ jsxs("div", { className: "mb-2", children: [
|
|
55217
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-between text-xs mb-1", children: [
|
|
55218
|
+
/* @__PURE__ */ jsx("span", { children: "Progress" }),
|
|
55219
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
55220
|
+
event.metadata.progress,
|
|
55221
|
+
"%"
|
|
55222
|
+
] })
|
|
55223
|
+
] }),
|
|
55224
|
+
/* @__PURE__ */ jsx("div", { className: "w-full bg-muted rounded-full h-2 overflow-hidden", children: /* @__PURE__ */ jsx(
|
|
55225
|
+
motion.div,
|
|
55226
|
+
{
|
|
55227
|
+
className: "h-full bg-primary",
|
|
55228
|
+
initial: { width: 0 },
|
|
55229
|
+
animate: { width: `${event.metadata.progress}%` },
|
|
55230
|
+
transition: { duration: 0.5, ease: "easeOut" }
|
|
55231
|
+
}
|
|
55232
|
+
) })
|
|
55233
|
+
] }),
|
|
54892
55234
|
showUserInfo && event.user && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 mb-2", children: [
|
|
54893
55235
|
/* @__PURE__ */ jsxs(MoonUIAvatarPro, { className: "h-6 w-6", children: [
|
|
54894
55236
|
/* @__PURE__ */ jsx(MoonUIAvatarImagePro, { src: event.user.avatar }),
|
|
54895
55237
|
/* @__PURE__ */ jsx(MoonUIAvatarFallbackPro, { className: "text-xs", children: getInitials4(event.user.name) })
|
|
54896
55238
|
] }),
|
|
54897
|
-
/* @__PURE__ */
|
|
55239
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
|
|
55240
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm font-medium", children: event.user.name }),
|
|
55241
|
+
event.user.role && /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: event.user.role })
|
|
55242
|
+
] })
|
|
54898
55243
|
] }),
|
|
54899
55244
|
showMetadata && event.metadata && /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-3 text-xs text-muted-foreground", children: [
|
|
54900
55245
|
event.metadata.duration && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
|
|
@@ -54905,56 +55250,292 @@ function Timeline({
|
|
|
54905
55250
|
/* @__PURE__ */ jsx(Calendar$1, { className: "h-3 w-3" }),
|
|
54906
55251
|
/* @__PURE__ */ jsx("span", { children: event.metadata.location })
|
|
54907
55252
|
] }),
|
|
54908
|
-
event.metadata.comments && event.metadata.comments > 0 && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
|
|
55253
|
+
event.metadata.comments !== void 0 && event.metadata.comments > 0 && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
|
|
54909
55254
|
/* @__PURE__ */ jsx(MessageCircle, { className: "h-3 w-3" }),
|
|
54910
55255
|
/* @__PURE__ */ jsx("span", { children: event.metadata.comments })
|
|
54911
55256
|
] }),
|
|
54912
|
-
event.metadata.attachments && event.metadata.attachments > 0 && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
|
|
55257
|
+
event.metadata.attachments !== void 0 && event.metadata.attachments > 0 && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
|
|
54913
55258
|
/* @__PURE__ */ jsx(Paperclip, { className: "h-3 w-3" }),
|
|
54914
55259
|
/* @__PURE__ */ jsx("span", { children: event.metadata.attachments })
|
|
54915
55260
|
] }),
|
|
54916
|
-
event.metadata.
|
|
54917
|
-
|
|
54918
|
-
|
|
54919
|
-
|
|
55261
|
+
event.metadata.priority && /* @__PURE__ */ jsx(
|
|
55262
|
+
MoonUIBadgePro,
|
|
55263
|
+
{
|
|
55264
|
+
variant: event.metadata.priority === "high" ? "destructive" : event.metadata.priority === "medium" ? "outline" : "secondary",
|
|
55265
|
+
className: "text-xs",
|
|
55266
|
+
children: event.metadata.priority
|
|
55267
|
+
}
|
|
55268
|
+
)
|
|
54920
55269
|
] }),
|
|
54921
|
-
event.metadata?.tags && event.metadata.tags.length > 0 && /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1 mt-2", children: event.metadata.tags.map((tag, tagIndex) => /* @__PURE__ */ jsx(MoonUIBadgePro, { variant: "
|
|
55270
|
+
event.metadata?.tags && event.metadata.tags.length > 0 && /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1 mt-2", children: event.metadata.tags.map((tag, tagIndex) => /* @__PURE__ */ jsx(MoonUIBadgePro, { variant: "outline", className: "text-xs", children: tag }, tagIndex)) }),
|
|
55271
|
+
isNestedEvent && isExpanded && event.subEvents && /* @__PURE__ */ jsx("div", { className: "mt-3 ml-4 pl-4 border-l-2 border-muted", children: event.subEvents.map((subEvent, subIndex) => /* @__PURE__ */ jsx("div", { className: "mb-2 last:mb-0", children: /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-2", children: [
|
|
55272
|
+
/* @__PURE__ */ jsx("div", { className: cn(
|
|
55273
|
+
"w-2 h-2 rounded-full mt-1.5",
|
|
55274
|
+
colorScheme[subEvent.type] || DEFAULT_COLORS[subEvent.type]
|
|
55275
|
+
) }),
|
|
55276
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1", children: [
|
|
55277
|
+
/* @__PURE__ */ jsx("h5", { className: "text-sm font-medium", children: subEvent.title }),
|
|
55278
|
+
subEvent.description && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: subEvent.description }),
|
|
55279
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: getRelativeTime(subEvent.date) })
|
|
55280
|
+
] })
|
|
55281
|
+
] }) }, subEvent.id)) }),
|
|
55282
|
+
isNestedEvent && event.subEvents && event.subEvents.length > 0 && /* @__PURE__ */ jsx(
|
|
55283
|
+
MoonUIButtonPro,
|
|
55284
|
+
{
|
|
55285
|
+
variant: "ghost",
|
|
55286
|
+
size: "sm",
|
|
55287
|
+
className: "mt-2 h-6 text-xs",
|
|
55288
|
+
onClick: (e) => {
|
|
55289
|
+
e.stopPropagation();
|
|
55290
|
+
setExpandedEvents((prev) => {
|
|
55291
|
+
const newSet = new Set(prev);
|
|
55292
|
+
if (newSet.has(event.id)) {
|
|
55293
|
+
newSet.delete(event.id);
|
|
55294
|
+
} else {
|
|
55295
|
+
newSet.add(event.id);
|
|
55296
|
+
}
|
|
55297
|
+
return newSet;
|
|
55298
|
+
});
|
|
55299
|
+
},
|
|
55300
|
+
children: isExpanded ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
55301
|
+
/* @__PURE__ */ jsx(ChevronDown, { className: "mr-1 h-3 w-3" }),
|
|
55302
|
+
"Hide ",
|
|
55303
|
+
event.subEvents.length,
|
|
55304
|
+
" sub-events"
|
|
55305
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
55306
|
+
/* @__PURE__ */ jsx(ChevronRight, { className: "mr-1 h-3 w-3" }),
|
|
55307
|
+
"Show ",
|
|
55308
|
+
event.subEvents.length,
|
|
55309
|
+
" sub-events"
|
|
55310
|
+
] })
|
|
55311
|
+
}
|
|
55312
|
+
)
|
|
54922
55313
|
] })
|
|
54923
55314
|
]
|
|
55315
|
+
}
|
|
55316
|
+
);
|
|
55317
|
+
if (draggable && onEventsReorder) {
|
|
55318
|
+
return /* @__PURE__ */ jsx(
|
|
55319
|
+
Reorder.Item,
|
|
55320
|
+
{
|
|
55321
|
+
value: event,
|
|
55322
|
+
dragListener: false,
|
|
55323
|
+
dragControls: void 0,
|
|
55324
|
+
children: eventContent
|
|
55325
|
+
},
|
|
55326
|
+
event.id
|
|
55327
|
+
);
|
|
55328
|
+
}
|
|
55329
|
+
const variants = animation !== "none" ? animationVariants[animation] : void 0;
|
|
55330
|
+
return /* @__PURE__ */ jsx(
|
|
55331
|
+
motion.div,
|
|
55332
|
+
{
|
|
55333
|
+
variants,
|
|
55334
|
+
initial: variants?.initial,
|
|
55335
|
+
animate: variants?.animate,
|
|
55336
|
+
exit: variants?.exit,
|
|
55337
|
+
transition: { duration: 0.3, delay: index2 * 0.05 },
|
|
55338
|
+
children: eventContent
|
|
54924
55339
|
},
|
|
54925
55340
|
event.id
|
|
54926
55341
|
);
|
|
54927
|
-
}
|
|
54928
|
-
|
|
54929
|
-
|
|
54930
|
-
|
|
54931
|
-
|
|
54932
|
-
|
|
54933
|
-
|
|
54934
|
-
|
|
54935
|
-
|
|
54936
|
-
|
|
54937
|
-
|
|
54938
|
-
|
|
54939
|
-
|
|
54940
|
-
|
|
54941
|
-
|
|
54942
|
-
|
|
54943
|
-
|
|
54944
|
-
|
|
54945
|
-
|
|
54946
|
-
|
|
54947
|
-
|
|
54948
|
-
|
|
55342
|
+
}, [
|
|
55343
|
+
eventRenderer,
|
|
55344
|
+
colorScheme,
|
|
55345
|
+
selectedEvents,
|
|
55346
|
+
expandedEvents,
|
|
55347
|
+
focusedEventId,
|
|
55348
|
+
keyboardNavigation,
|
|
55349
|
+
layout,
|
|
55350
|
+
compactMode,
|
|
55351
|
+
printMode,
|
|
55352
|
+
handleEventClick,
|
|
55353
|
+
renderEventIcon,
|
|
55354
|
+
renderConnector,
|
|
55355
|
+
events,
|
|
55356
|
+
showRelativeTime,
|
|
55357
|
+
getRelativeTime,
|
|
55358
|
+
formatTime2,
|
|
55359
|
+
editable,
|
|
55360
|
+
onEventEdit,
|
|
55361
|
+
onEventDelete,
|
|
55362
|
+
showUserInfo,
|
|
55363
|
+
getInitials4,
|
|
55364
|
+
showMetadata,
|
|
55365
|
+
draggable,
|
|
55366
|
+
onEventsReorder,
|
|
55367
|
+
animation
|
|
55368
|
+
]);
|
|
55369
|
+
const renderGroupedEvents = useCallback(() => {
|
|
55370
|
+
const groups = groupEventsByDate(filteredAndSortedEvents);
|
|
55371
|
+
return Object.entries(groups).map(([dateGroup, groupEvents], groupIndex) => {
|
|
55372
|
+
const displayEvents = maxEventsPerGroup ? groupEvents.slice(0, maxEventsPerGroup) : groupEvents;
|
|
55373
|
+
const remainingCount = groupEvents.length - displayEvents.length;
|
|
55374
|
+
return /* @__PURE__ */ jsxs("div", { className: "mb-8", children: [
|
|
55375
|
+
/* @__PURE__ */ jsx("div", { className: cn(
|
|
55376
|
+
"sticky top-0 z-20 bg-background/80 backdrop-blur-sm border-b p-3 mb-4 -mx-6 px-6",
|
|
55377
|
+
printMode && "print:relative print:bg-transparent"
|
|
55378
|
+
), children: /* @__PURE__ */ jsxs("h3", { className: "font-semibold text-sm text-muted-foreground flex items-center justify-between", children: [
|
|
55379
|
+
/* @__PURE__ */ jsx("span", { children: dateGroup }),
|
|
55380
|
+
/* @__PURE__ */ jsxs(MoonUIBadgePro, { variant: "secondary", className: "text-xs", children: [
|
|
55381
|
+
groupEvents.length,
|
|
55382
|
+
" event",
|
|
55383
|
+
groupEvents.length !== 1 ? "s" : ""
|
|
55384
|
+
] })
|
|
55385
|
+
] }) }),
|
|
55386
|
+
/* @__PURE__ */ jsx(AnimatePresence, { mode: "popLayout", children: displayEvents.map(
|
|
55387
|
+
(event, index2) => renderEvent(event, index2, index2 === displayEvents.length - 1)
|
|
55388
|
+
) }),
|
|
55389
|
+
remainingCount > 0 && /* @__PURE__ */ jsxs(
|
|
55390
|
+
MoonUIButtonPro,
|
|
55391
|
+
{
|
|
55392
|
+
variant: "ghost",
|
|
55393
|
+
size: "sm",
|
|
55394
|
+
className: "w-full mt-2",
|
|
55395
|
+
onClick: () => {
|
|
55396
|
+
console.log(`Show ${remainingCount} more events`);
|
|
55397
|
+
},
|
|
55398
|
+
children: [
|
|
55399
|
+
"Show ",
|
|
55400
|
+
remainingCount,
|
|
55401
|
+
" more event",
|
|
55402
|
+
remainingCount !== 1 ? "s" : ""
|
|
55403
|
+
]
|
|
55404
|
+
}
|
|
55405
|
+
)
|
|
55406
|
+
] }, dateGroup);
|
|
55407
|
+
});
|
|
55408
|
+
}, [groupEventsByDate, filteredAndSortedEvents, maxEventsPerGroup, printMode, renderEvent]);
|
|
55409
|
+
const renderTimeline = () => {
|
|
55410
|
+
const content = groupBy !== "none" ? renderGroupedEvents() : /* @__PURE__ */ jsx(AnimatePresence, { mode: "popLayout", children: draggable && onEventsReorder ? /* @__PURE__ */ jsx(
|
|
55411
|
+
Reorder.Group,
|
|
55412
|
+
{
|
|
55413
|
+
axis: layout === "horizontal" ? "x" : "y",
|
|
55414
|
+
values: filteredAndSortedEvents,
|
|
55415
|
+
onReorder: (newOrder) => {
|
|
55416
|
+
setEvents(newOrder);
|
|
55417
|
+
onEventsReorder(newOrder);
|
|
55418
|
+
},
|
|
55419
|
+
className: cn(
|
|
55420
|
+
"space-y-0",
|
|
55421
|
+
layout === "horizontal" && "flex overflow-x-auto gap-6 pb-4"
|
|
55422
|
+
),
|
|
55423
|
+
children: filteredAndSortedEvents.map(
|
|
55424
|
+
(event, index2) => renderEvent(event, index2, index2 === filteredAndSortedEvents.length - 1)
|
|
55425
|
+
)
|
|
55426
|
+
}
|
|
55427
|
+
) : /* @__PURE__ */ jsx("div", { className: cn(
|
|
54949
55428
|
"space-y-0",
|
|
54950
|
-
|
|
54951
|
-
|
|
54952
|
-
|
|
54953
|
-
|
|
54954
|
-
|
|
54955
|
-
|
|
54956
|
-
|
|
54957
|
-
|
|
55429
|
+
layout === "horizontal" && "flex overflow-x-auto gap-6 pb-4",
|
|
55430
|
+
layout === "alternating" && "relative"
|
|
55431
|
+
), children: filteredAndSortedEvents.map(
|
|
55432
|
+
(event, index2) => renderEvent(event, index2, index2 === filteredAndSortedEvents.length - 1)
|
|
55433
|
+
) }) });
|
|
55434
|
+
if (virtualScroll && filteredAndSortedEvents.length > 50) {
|
|
55435
|
+
return /* @__PURE__ */ jsx("div", { className: "h-[600px] overflow-y-auto", children: content });
|
|
55436
|
+
}
|
|
55437
|
+
return content;
|
|
55438
|
+
};
|
|
55439
|
+
return /* @__PURE__ */ jsxs(
|
|
55440
|
+
MoonUICardPro,
|
|
55441
|
+
{
|
|
55442
|
+
className: cn(
|
|
55443
|
+
timelineVariants({ theme }),
|
|
55444
|
+
"relative",
|
|
55445
|
+
printMode && "print:shadow-none print:border-0",
|
|
55446
|
+
className
|
|
55447
|
+
),
|
|
55448
|
+
ref: timelineRef,
|
|
55449
|
+
role: "region",
|
|
55450
|
+
"aria-label": ariaLabel,
|
|
55451
|
+
...props,
|
|
55452
|
+
children: [
|
|
55453
|
+
/* @__PURE__ */ jsxs(MoonUICardHeaderPro, { className: cn(
|
|
55454
|
+
compactMode && "pb-3",
|
|
55455
|
+
printMode && "print:pb-2"
|
|
55456
|
+
), children: [
|
|
55457
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
55458
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
55459
|
+
/* @__PURE__ */ jsxs(MoonUICardTitlePro, { className: "flex items-center gap-2", children: [
|
|
55460
|
+
/* @__PURE__ */ jsx(Clock, { className: "h-5 w-5" }),
|
|
55461
|
+
"Timeline",
|
|
55462
|
+
/* @__PURE__ */ jsxs(MoonUIBadgePro, { variant: "pro", className: "ml-2", children: [
|
|
55463
|
+
/* @__PURE__ */ jsx(Sparkles, { className: "mr-1 h-3 w-3" }),
|
|
55464
|
+
"Pro"
|
|
55465
|
+
] })
|
|
55466
|
+
] }),
|
|
55467
|
+
/* @__PURE__ */ jsxs(MoonUICardDescriptionPro, { children: [
|
|
55468
|
+
filteredAndSortedEvents.length,
|
|
55469
|
+
" event",
|
|
55470
|
+
filteredAndSortedEvents.length !== 1 ? "s" : "",
|
|
55471
|
+
searchQuery && ` matching "${searchQuery}"`,
|
|
55472
|
+
filterType !== "all" && ` of type ${filterType}`
|
|
55473
|
+
] })
|
|
55474
|
+
] }),
|
|
55475
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
55476
|
+
showExport && /* @__PURE__ */ jsx(
|
|
55477
|
+
MoonUIButtonPro,
|
|
55478
|
+
{
|
|
55479
|
+
variant: "ghost",
|
|
55480
|
+
size: "sm",
|
|
55481
|
+
onClick: handleExport,
|
|
55482
|
+
className: "print:hidden",
|
|
55483
|
+
children: /* @__PURE__ */ jsx(Download, { className: "h-4 w-4" })
|
|
55484
|
+
}
|
|
55485
|
+
),
|
|
55486
|
+
/* @__PURE__ */ jsx(
|
|
55487
|
+
MoonUIButtonPro,
|
|
55488
|
+
{
|
|
55489
|
+
variant: "ghost",
|
|
55490
|
+
size: "sm",
|
|
55491
|
+
onClick: handlePrint,
|
|
55492
|
+
className: "print:hidden",
|
|
55493
|
+
children: /* @__PURE__ */ jsx(Printer, { className: "h-4 w-4" })
|
|
55494
|
+
}
|
|
55495
|
+
)
|
|
55496
|
+
] })
|
|
55497
|
+
] }),
|
|
55498
|
+
(showSearch || showFilter) && /* @__PURE__ */ jsxs("div", { className: "flex gap-2 mt-4 print:hidden", children: [
|
|
55499
|
+
showSearch && /* @__PURE__ */ jsxs("div", { className: "relative flex-1", children: [
|
|
55500
|
+
/* @__PURE__ */ jsx(Search, { className: "absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground" }),
|
|
55501
|
+
/* @__PURE__ */ jsx(
|
|
55502
|
+
MoonUIInputPro,
|
|
55503
|
+
{
|
|
55504
|
+
type: "search",
|
|
55505
|
+
placeholder: "Search events...",
|
|
55506
|
+
value: searchQuery,
|
|
55507
|
+
onChange: (e) => setSearchQuery(e.target.value),
|
|
55508
|
+
className: "pl-9"
|
|
55509
|
+
}
|
|
55510
|
+
)
|
|
55511
|
+
] }),
|
|
55512
|
+
showFilter && /* @__PURE__ */ jsxs(MoonUISelectPro, { value: filterType, onValueChange: (value) => setFilterType(value), children: [
|
|
55513
|
+
/* @__PURE__ */ jsxs(MoonUISelectTriggerPro, { className: "w-[150px]", children: [
|
|
55514
|
+
/* @__PURE__ */ jsx(Filter, { className: "mr-2 h-4 w-4" }),
|
|
55515
|
+
/* @__PURE__ */ jsx(MoonUISelectValuePro, { placeholder: "Filter by type" })
|
|
55516
|
+
] }),
|
|
55517
|
+
/* @__PURE__ */ jsxs(MoonUISelectContentPro, { children: [
|
|
55518
|
+
/* @__PURE__ */ jsx(MoonUISelectItemPro, { value: "all", children: "All Types" }),
|
|
55519
|
+
/* @__PURE__ */ jsx(MoonUISelectItemPro, { value: "success", children: "Success" }),
|
|
55520
|
+
/* @__PURE__ */ jsx(MoonUISelectItemPro, { value: "warning", children: "Warning" }),
|
|
55521
|
+
/* @__PURE__ */ jsx(MoonUISelectItemPro, { value: "error", children: "Error" }),
|
|
55522
|
+
/* @__PURE__ */ jsx(MoonUISelectItemPro, { value: "info", children: "Info" }),
|
|
55523
|
+
/* @__PURE__ */ jsx(MoonUISelectItemPro, { value: "pending", children: "Pending" }),
|
|
55524
|
+
/* @__PURE__ */ jsx(MoonUISelectItemPro, { value: "milestone", children: "Milestone" })
|
|
55525
|
+
] })
|
|
55526
|
+
] })
|
|
55527
|
+
] })
|
|
55528
|
+
] }),
|
|
55529
|
+
/* @__PURE__ */ jsx(MoonUICardContentPro, { className: cn(
|
|
55530
|
+
compactMode && "pt-0",
|
|
55531
|
+
"relative"
|
|
55532
|
+
), children: filteredAndSortedEvents.length > 0 ? renderTimeline() : /* @__PURE__ */ jsxs("div", { className: "text-center py-12", children: [
|
|
55533
|
+
/* @__PURE__ */ jsx(Clock, { className: "h-12 w-12 mx-auto mb-4 text-muted-foreground" }),
|
|
55534
|
+
/* @__PURE__ */ jsx("p", { className: "text-muted-foreground", children: searchQuery || filterType !== "all" ? "No events match your filters" : "No events to display" })
|
|
55535
|
+
] }) })
|
|
55536
|
+
]
|
|
55537
|
+
}
|
|
55538
|
+
);
|
|
54958
55539
|
}
|
|
54959
55540
|
var COLOR_THEMES = {
|
|
54960
55541
|
default: [
|
|
@@ -55018,7 +55599,7 @@ var COLOR_THEMES = {
|
|
|
55018
55599
|
"#FFE400"
|
|
55019
55600
|
]
|
|
55020
55601
|
};
|
|
55021
|
-
var
|
|
55602
|
+
var DEFAULT_COLORS2 = COLOR_THEMES.default;
|
|
55022
55603
|
var CustomTooltip = ({ active, payload, label }) => {
|
|
55023
55604
|
if (!active || !payload || !payload.length)
|
|
55024
55605
|
return null;
|
|
@@ -55128,7 +55709,7 @@ function AdvancedChart({
|
|
|
55128
55709
|
showReference = false,
|
|
55129
55710
|
referenceLines = [],
|
|
55130
55711
|
referenceAreas = [],
|
|
55131
|
-
colors =
|
|
55712
|
+
colors = DEFAULT_COLORS2,
|
|
55132
55713
|
className,
|
|
55133
55714
|
onDataPointClick,
|
|
55134
55715
|
onExport,
|
|
@@ -55160,7 +55741,7 @@ function AdvancedChart({
|
|
|
55160
55741
|
const chartRef = t__default.useRef(null);
|
|
55161
55742
|
const containerRef = t__default.useRef(null);
|
|
55162
55743
|
const themeColors = t__default.useMemo(() => {
|
|
55163
|
-
return COLOR_THEMES[selectedTheme] ||
|
|
55744
|
+
return COLOR_THEMES[selectedTheme] || DEFAULT_COLORS2;
|
|
55164
55745
|
}, [selectedTheme]);
|
|
55165
55746
|
const gradientId = t__default.useId();
|
|
55166
55747
|
const trend = t__default.useMemo(() => {
|
|
@@ -66348,7 +66929,7 @@ var DialogProContent = t.forwardRef(({
|
|
|
66348
66929
|
overlayProps = {},
|
|
66349
66930
|
...props
|
|
66350
66931
|
}, ref) => {
|
|
66351
|
-
const
|
|
66932
|
+
const animationVariants2 = {
|
|
66352
66933
|
fade: {
|
|
66353
66934
|
initial: { opacity: 0 },
|
|
66354
66935
|
animate: { opacity: 1 },
|
|
@@ -66415,7 +66996,7 @@ var DialogProContent = t.forwardRef(({
|
|
|
66415
66996
|
children: /* @__PURE__ */ jsxs(
|
|
66416
66997
|
motion.div,
|
|
66417
66998
|
{
|
|
66418
|
-
variants:
|
|
66999
|
+
variants: animationVariants2[animation],
|
|
66419
67000
|
initial: "initial",
|
|
66420
67001
|
animate: "animate",
|
|
66421
67002
|
exit: "exit",
|