@moontra/moonui-pro 2.15.2 → 2.16.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 +58 -2
- package/dist/index.mjs +367 -23
- package/package.json +1 -1
- package/src/components/calendar/index.tsx +575 -33
- package/src/components/timeline/index.tsx +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -993,7 +993,27 @@ interface CalendarEvent {
|
|
|
993
993
|
location?: string;
|
|
994
994
|
attendees?: string[];
|
|
995
995
|
color?: string;
|
|
996
|
-
type?: 'meeting' | 'task' | 'reminder' | 'event';
|
|
996
|
+
type?: 'meeting' | 'task' | 'reminder' | 'event' | 'birthday' | 'holiday' | 'conference';
|
|
997
|
+
recurring?: {
|
|
998
|
+
pattern: 'daily' | 'weekly' | 'monthly' | 'yearly';
|
|
999
|
+
interval: number;
|
|
1000
|
+
endDate?: Date;
|
|
1001
|
+
daysOfWeek?: number[];
|
|
1002
|
+
dayOfMonth?: number;
|
|
1003
|
+
};
|
|
1004
|
+
reminder?: {
|
|
1005
|
+
type: 'email' | 'notification' | 'sms';
|
|
1006
|
+
before: number;
|
|
1007
|
+
};
|
|
1008
|
+
priority?: 'low' | 'medium' | 'high';
|
|
1009
|
+
status?: 'confirmed' | 'tentative' | 'cancelled';
|
|
1010
|
+
attachments?: string[];
|
|
1011
|
+
tags?: string[];
|
|
1012
|
+
isAllDay?: boolean;
|
|
1013
|
+
isPrivate?: boolean;
|
|
1014
|
+
meetingLink?: string;
|
|
1015
|
+
phoneNumber?: string;
|
|
1016
|
+
timeZone?: string;
|
|
997
1017
|
}
|
|
998
1018
|
interface CalendarProps {
|
|
999
1019
|
events?: CalendarEvent[];
|
|
@@ -1005,6 +1025,9 @@ interface CalendarProps {
|
|
|
1005
1025
|
id: string;
|
|
1006
1026
|
}) => void;
|
|
1007
1027
|
onEventDelete?: (eventId: string) => void;
|
|
1028
|
+
onDateChange?: (date: Date) => void;
|
|
1029
|
+
onViewChange?: (view: 'month' | 'week' | 'day' | 'year' | 'agenda') => void;
|
|
1030
|
+
onEventDrop?: (event: CalendarEvent, newDate: Date) => void;
|
|
1008
1031
|
className?: string;
|
|
1009
1032
|
showWeekends?: boolean;
|
|
1010
1033
|
showEventDetails?: boolean;
|
|
@@ -1013,9 +1036,42 @@ interface CalendarProps {
|
|
|
1013
1036
|
maxDate?: Date;
|
|
1014
1037
|
highlightToday?: boolean;
|
|
1015
1038
|
height?: number;
|
|
1039
|
+
defaultView?: 'month' | 'week' | 'day' | 'year' | 'agenda';
|
|
1040
|
+
enableDragDrop?: boolean;
|
|
1041
|
+
enableSearch?: boolean;
|
|
1042
|
+
enableFilters?: boolean;
|
|
1043
|
+
enableExport?: boolean;
|
|
1044
|
+
enableImport?: boolean;
|
|
1045
|
+
enableRecurringEvents?: boolean;
|
|
1046
|
+
enableReminders?: boolean;
|
|
1047
|
+
eventCategories?: Array<{
|
|
1048
|
+
value: string;
|
|
1049
|
+
label: string;
|
|
1050
|
+
color: string;
|
|
1051
|
+
}>;
|
|
1052
|
+
workingHours?: {
|
|
1053
|
+
start: string;
|
|
1054
|
+
end: string;
|
|
1055
|
+
};
|
|
1056
|
+
holidays?: Array<{
|
|
1057
|
+
date: Date;
|
|
1058
|
+
name: string;
|
|
1059
|
+
}>;
|
|
1060
|
+
locale?: string;
|
|
1061
|
+
timeFormat?: '12h' | '24h';
|
|
1062
|
+
firstDayOfWeek?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
1063
|
+
theme?: 'light' | 'dark' | 'auto' | 'custom';
|
|
1064
|
+
customTheme?: {
|
|
1065
|
+
primary: string;
|
|
1066
|
+
secondary: string;
|
|
1067
|
+
accent: string;
|
|
1068
|
+
background: string;
|
|
1069
|
+
foreground: string;
|
|
1070
|
+
};
|
|
1071
|
+
compactMode?: boolean;
|
|
1016
1072
|
showProUpgrade?: boolean;
|
|
1017
1073
|
}
|
|
1018
|
-
declare function Calendar({ events, onEventClick, onEventAdd, onEventEdit, onEventDelete, className, showWeekends, showEventDetails, disabled, minDate, maxDate, highlightToday, height, showProUpgrade }: CalendarProps): react_jsx_runtime.JSX.Element;
|
|
1074
|
+
declare function Calendar({ events, onEventClick, onEventAdd, onEventEdit, onEventDelete, onDateChange, onViewChange, onEventDrop, className, showWeekends, showEventDetails, disabled, minDate, maxDate, highlightToday, height, defaultView, enableDragDrop, enableSearch, enableFilters, enableExport, enableImport, enableRecurringEvents, enableReminders, eventCategories, workingHours, holidays, locale, timeFormat, firstDayOfWeek, theme, customTheme, compactMode, showProUpgrade }: CalendarProps): react_jsx_runtime.JSX.Element;
|
|
1019
1075
|
|
|
1020
1076
|
interface KanbanAssignee {
|
|
1021
1077
|
id: string;
|
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@ 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, Target,
|
|
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, Repeat, Edit, MapPin, Users, 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, 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, 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';
|
|
@@ -10726,7 +10726,20 @@ var EVENT_COLORS = {
|
|
|
10726
10726
|
meeting: "bg-blue-500",
|
|
10727
10727
|
task: "bg-green-500",
|
|
10728
10728
|
reminder: "bg-yellow-500",
|
|
10729
|
-
event: "bg-purple-500"
|
|
10729
|
+
event: "bg-purple-500",
|
|
10730
|
+
birthday: "bg-pink-500",
|
|
10731
|
+
holiday: "bg-orange-500",
|
|
10732
|
+
conference: "bg-indigo-500"
|
|
10733
|
+
};
|
|
10734
|
+
var PRIORITY_COLORS = {
|
|
10735
|
+
low: "border-l-4 border-l-gray-400",
|
|
10736
|
+
medium: "border-l-4 border-l-yellow-500",
|
|
10737
|
+
high: "border-l-4 border-l-red-500"
|
|
10738
|
+
};
|
|
10739
|
+
var STATUS_STYLES = {
|
|
10740
|
+
confirmed: "",
|
|
10741
|
+
tentative: "opacity-70 border-dashed",
|
|
10742
|
+
cancelled: "opacity-50 line-through"
|
|
10730
10743
|
};
|
|
10731
10744
|
function Calendar3({
|
|
10732
10745
|
events = [],
|
|
@@ -10734,6 +10747,9 @@ function Calendar3({
|
|
|
10734
10747
|
onEventAdd,
|
|
10735
10748
|
onEventEdit,
|
|
10736
10749
|
onEventDelete,
|
|
10750
|
+
onDateChange,
|
|
10751
|
+
onViewChange,
|
|
10752
|
+
onEventDrop,
|
|
10737
10753
|
className,
|
|
10738
10754
|
showWeekends = true,
|
|
10739
10755
|
showEventDetails = true,
|
|
@@ -10742,6 +10758,23 @@ function Calendar3({
|
|
|
10742
10758
|
maxDate,
|
|
10743
10759
|
highlightToday = true,
|
|
10744
10760
|
height,
|
|
10761
|
+
defaultView = "month",
|
|
10762
|
+
enableDragDrop = true,
|
|
10763
|
+
enableSearch = true,
|
|
10764
|
+
enableFilters = true,
|
|
10765
|
+
enableExport = true,
|
|
10766
|
+
enableImport = false,
|
|
10767
|
+
enableRecurringEvents = true,
|
|
10768
|
+
enableReminders = true,
|
|
10769
|
+
eventCategories,
|
|
10770
|
+
workingHours = { start: "09:00", end: "18:00" },
|
|
10771
|
+
holidays = [],
|
|
10772
|
+
locale = "en-US",
|
|
10773
|
+
timeFormat = "12h",
|
|
10774
|
+
firstDayOfWeek = 0,
|
|
10775
|
+
theme = "auto",
|
|
10776
|
+
customTheme,
|
|
10777
|
+
compactMode = false,
|
|
10745
10778
|
showProUpgrade = false
|
|
10746
10779
|
}) {
|
|
10747
10780
|
if (showProUpgrade) {
|
|
@@ -10759,33 +10792,104 @@ function Calendar3({
|
|
|
10759
10792
|
}
|
|
10760
10793
|
const [currentDate, setCurrentDate] = t__default.useState(/* @__PURE__ */ new Date());
|
|
10761
10794
|
const [selectedDate, setSelectedDate] = t__default.useState(null);
|
|
10762
|
-
t__default.useState(
|
|
10795
|
+
const [view, setView] = t__default.useState(defaultView);
|
|
10763
10796
|
const [eventDialogOpen, setEventDialogOpen] = t__default.useState(false);
|
|
10764
10797
|
const [eventDialogMode, setEventDialogMode] = t__default.useState("create");
|
|
10765
10798
|
const [selectedEvent, setSelectedEvent] = t__default.useState(null);
|
|
10766
10799
|
const [draggedEvent, setDraggedEvent] = t__default.useState(null);
|
|
10767
10800
|
const [dragTargetDate, setDragTargetDate] = t__default.useState(null);
|
|
10801
|
+
const [searchQuery, setSearchQuery] = t__default.useState("");
|
|
10802
|
+
const [filterType, setFilterType] = t__default.useState("all");
|
|
10803
|
+
const [filterPriority, setFilterPriority] = t__default.useState("all");
|
|
10804
|
+
t__default.useState(false);
|
|
10805
|
+
const [selectedTags, setSelectedTags] = t__default.useState([]);
|
|
10806
|
+
t__default.useState(/* @__PURE__ */ new Date());
|
|
10768
10807
|
const today = /* @__PURE__ */ new Date();
|
|
10769
10808
|
const currentMonth = currentDate.getMonth();
|
|
10770
10809
|
const currentYear = currentDate.getFullYear();
|
|
10771
10810
|
const firstDayOfMonth = new Date(currentYear, currentMonth, 1);
|
|
10772
10811
|
const lastDayOfMonth = new Date(currentYear, currentMonth + 1, 0);
|
|
10773
10812
|
const startDate = new Date(firstDayOfMonth);
|
|
10774
|
-
|
|
10813
|
+
const daysToSubtract = (startDate.getDay() - firstDayOfWeek + 7) % 7;
|
|
10814
|
+
startDate.setDate(startDate.getDate() - daysToSubtract);
|
|
10775
10815
|
const endDate = new Date(lastDayOfMonth);
|
|
10776
|
-
|
|
10816
|
+
const daysToAdd = (6 - endDate.getDay() + firstDayOfWeek) % 7;
|
|
10817
|
+
endDate.setDate(endDate.getDate() + daysToAdd);
|
|
10777
10818
|
const calendarDays = [];
|
|
10778
10819
|
const currentDateIterator = new Date(startDate);
|
|
10779
10820
|
while (currentDateIterator <= endDate) {
|
|
10780
10821
|
calendarDays.push(new Date(currentDateIterator));
|
|
10781
10822
|
currentDateIterator.setDate(currentDateIterator.getDate() + 1);
|
|
10782
10823
|
}
|
|
10783
|
-
|
|
10824
|
+
t__default.useMemo(() => {
|
|
10825
|
+
const tags = /* @__PURE__ */ new Set();
|
|
10826
|
+
events.forEach((event) => {
|
|
10827
|
+
event.tags?.forEach((tag) => tags.add(tag));
|
|
10828
|
+
});
|
|
10829
|
+
return Array.from(tags);
|
|
10830
|
+
}, [events]);
|
|
10831
|
+
const filteredEvents = t__default.useMemo(() => {
|
|
10784
10832
|
return events.filter((event) => {
|
|
10833
|
+
if (searchQuery && !event.title.toLowerCase().includes(searchQuery.toLowerCase()) && !event.description?.toLowerCase().includes(searchQuery.toLowerCase())) {
|
|
10834
|
+
return false;
|
|
10835
|
+
}
|
|
10836
|
+
if (filterType !== "all" && event.type !== filterType) {
|
|
10837
|
+
return false;
|
|
10838
|
+
}
|
|
10839
|
+
if (filterPriority !== "all" && event.priority !== filterPriority) {
|
|
10840
|
+
return false;
|
|
10841
|
+
}
|
|
10842
|
+
if (selectedTags.length > 0 && (!event.tags || !event.tags.some((tag) => selectedTags.includes(tag)))) {
|
|
10843
|
+
return false;
|
|
10844
|
+
}
|
|
10845
|
+
return true;
|
|
10846
|
+
});
|
|
10847
|
+
}, [events, searchQuery, filterType, filterPriority, selectedTags]);
|
|
10848
|
+
const getEventsForDate = (date) => {
|
|
10849
|
+
return filteredEvents.filter((event) => {
|
|
10785
10850
|
const eventDate = new Date(event.date);
|
|
10851
|
+
if (event.recurring) {
|
|
10852
|
+
return isDateInRecurringPattern(date, event);
|
|
10853
|
+
}
|
|
10786
10854
|
return eventDate.toDateString() === date.toDateString();
|
|
10787
10855
|
});
|
|
10788
10856
|
};
|
|
10857
|
+
const isDateInRecurringPattern = (date, event) => {
|
|
10858
|
+
if (!event.recurring)
|
|
10859
|
+
return false;
|
|
10860
|
+
const eventDate = new Date(event.date);
|
|
10861
|
+
const daysDiff = Math.floor((date.getTime() - eventDate.getTime()) / (1e3 * 60 * 60 * 24));
|
|
10862
|
+
if (daysDiff < 0)
|
|
10863
|
+
return false;
|
|
10864
|
+
if (event.recurring.endDate && date > event.recurring.endDate)
|
|
10865
|
+
return false;
|
|
10866
|
+
switch (event.recurring.pattern) {
|
|
10867
|
+
case "daily":
|
|
10868
|
+
return daysDiff % event.recurring.interval === 0;
|
|
10869
|
+
case "weekly":
|
|
10870
|
+
if (daysDiff % (event.recurring.interval * 7) !== 0)
|
|
10871
|
+
return false;
|
|
10872
|
+
if (event.recurring.daysOfWeek) {
|
|
10873
|
+
return event.recurring.daysOfWeek.includes(date.getDay());
|
|
10874
|
+
}
|
|
10875
|
+
return date.getDay() === eventDate.getDay();
|
|
10876
|
+
case "monthly":
|
|
10877
|
+
const monthsDiff = (date.getFullYear() - eventDate.getFullYear()) * 12 + (date.getMonth() - eventDate.getMonth());
|
|
10878
|
+
if (monthsDiff % event.recurring.interval !== 0)
|
|
10879
|
+
return false;
|
|
10880
|
+
if (event.recurring.dayOfMonth) {
|
|
10881
|
+
return date.getDate() === event.recurring.dayOfMonth;
|
|
10882
|
+
}
|
|
10883
|
+
return date.getDate() === eventDate.getDate();
|
|
10884
|
+
case "yearly":
|
|
10885
|
+
const yearsDiff = date.getFullYear() - eventDate.getFullYear();
|
|
10886
|
+
if (yearsDiff % event.recurring.interval !== 0)
|
|
10887
|
+
return false;
|
|
10888
|
+
return date.getMonth() === eventDate.getMonth() && date.getDate() === eventDate.getDate();
|
|
10889
|
+
default:
|
|
10890
|
+
return false;
|
|
10891
|
+
}
|
|
10892
|
+
};
|
|
10789
10893
|
const isToday2 = (date) => {
|
|
10790
10894
|
return date.toDateString() === today.toDateString();
|
|
10791
10895
|
};
|
|
@@ -10812,6 +10916,7 @@ function Calendar3({
|
|
|
10812
10916
|
newDate.setMonth(currentMonth + 1);
|
|
10813
10917
|
}
|
|
10814
10918
|
setCurrentDate(newDate);
|
|
10919
|
+
onDateChange?.(newDate);
|
|
10815
10920
|
};
|
|
10816
10921
|
const handleDateClick = (date) => {
|
|
10817
10922
|
if (isDisabled(date))
|
|
@@ -10885,14 +10990,44 @@ function Calendar3({
|
|
|
10885
10990
|
onEventDelete?.(eventId);
|
|
10886
10991
|
};
|
|
10887
10992
|
const goToToday = () => {
|
|
10888
|
-
|
|
10889
|
-
|
|
10993
|
+
const today2 = /* @__PURE__ */ new Date();
|
|
10994
|
+
setCurrentDate(today2);
|
|
10995
|
+
setSelectedDate(today2);
|
|
10996
|
+
onDateChange?.(today2);
|
|
10997
|
+
};
|
|
10998
|
+
const isHoliday = (date) => {
|
|
10999
|
+
return holidays.some((holiday) => {
|
|
11000
|
+
const holidayDate = new Date(holiday.date);
|
|
11001
|
+
return holidayDate.toDateString() === date.toDateString();
|
|
11002
|
+
});
|
|
11003
|
+
};
|
|
11004
|
+
const getHolidayName = (date) => {
|
|
11005
|
+
const holiday = holidays.find((h2) => {
|
|
11006
|
+
const holidayDate = new Date(h2.date);
|
|
11007
|
+
return holidayDate.toDateString() === date.toDateString();
|
|
11008
|
+
});
|
|
11009
|
+
return holiday?.name;
|
|
11010
|
+
};
|
|
11011
|
+
const formatTime2 = (time) => {
|
|
11012
|
+
if (!time)
|
|
11013
|
+
return "";
|
|
11014
|
+
if (timeFormat === "24h")
|
|
11015
|
+
return time;
|
|
11016
|
+
const [hours, minutes] = time.split(":");
|
|
11017
|
+
const h2 = parseInt(hours);
|
|
11018
|
+
const period = h2 >= 12 ? "PM" : "AM";
|
|
11019
|
+
const displayHours = h2 === 0 ? 12 : h2 > 12 ? h2 - 12 : h2;
|
|
11020
|
+
return `${displayHours}:${minutes} ${period}`;
|
|
10890
11021
|
};
|
|
10891
11022
|
const filteredDays = showWeekends ? calendarDays : calendarDays.filter((day) => {
|
|
10892
11023
|
const dayOfWeek = day.getDay();
|
|
10893
11024
|
return dayOfWeek !== 0 && dayOfWeek !== 6;
|
|
10894
11025
|
});
|
|
10895
|
-
const
|
|
11026
|
+
const orderedDaysOfWeek = [...DAYS_OF_WEEK.slice(firstDayOfWeek), ...DAYS_OF_WEEK.slice(0, firstDayOfWeek)];
|
|
11027
|
+
const visibleDaysOfWeek = showWeekends ? orderedDaysOfWeek : orderedDaysOfWeek.filter((_, index2) => {
|
|
11028
|
+
const actualDay = (index2 + firstDayOfWeek) % 7;
|
|
11029
|
+
return actualDay !== 0 && actualDay !== 6;
|
|
11030
|
+
});
|
|
10896
11031
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
10897
11032
|
/* @__PURE__ */ jsxs(MoonUICardPro, { className: cn("w-full max-w-full overflow-hidden", className), style: { height: height ? `${height}px` : void 0 }, children: [
|
|
10898
11033
|
/* @__PURE__ */ jsx(MoonUICardHeaderPro, { children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
@@ -10932,7 +11067,7 @@ function Calendar3({
|
|
|
10932
11067
|
] })
|
|
10933
11068
|
] }) }),
|
|
10934
11069
|
/* @__PURE__ */ jsx(MoonUICardContentPro, { children: /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
10935
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-7 gap-1 w-full", children: [
|
|
11070
|
+
view === "month" && /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-7 gap-1 w-full", children: [
|
|
10936
11071
|
visibleDaysOfWeek.map((day) => /* @__PURE__ */ jsx("div", { className: "p-1 text-center text-xs font-medium text-muted-foreground", children: day }, day)),
|
|
10937
11072
|
filteredDays.map((date, index2) => {
|
|
10938
11073
|
const dayEvents = getEventsForDate(date);
|
|
@@ -10956,10 +11091,14 @@ function Calendar3({
|
|
|
10956
11091
|
onDrop: (e) => handleDateDrop(date, e),
|
|
10957
11092
|
children: [
|
|
10958
11093
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between mb-1", children: [
|
|
10959
|
-
/* @__PURE__ */
|
|
10960
|
-
|
|
10961
|
-
|
|
10962
|
-
|
|
11094
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
|
|
11095
|
+
/* @__PURE__ */ jsx("span", { className: cn(
|
|
11096
|
+
"text-sm font-medium",
|
|
11097
|
+
isTodayDate && "text-primary font-bold",
|
|
11098
|
+
isHoliday(date) && "text-orange-600 dark:text-orange-400"
|
|
11099
|
+
), children: date.getDate() }),
|
|
11100
|
+
isHoliday(date) && /* @__PURE__ */ jsx("span", { className: "text-[10px] text-orange-600 dark:text-orange-400 truncate", children: getHolidayName(date) })
|
|
11101
|
+
] }),
|
|
10963
11102
|
dayEvents.length > 0 && /* @__PURE__ */ jsx(MoonUIBadgePro, { variant: "secondary", className: "text-xs px-1", children: dayEvents.length })
|
|
10964
11103
|
] }),
|
|
10965
11104
|
/* @__PURE__ */ jsxs("div", { className: "flex-1 space-y-1 overflow-hidden", children: [
|
|
@@ -10968,9 +11107,11 @@ function Calendar3({
|
|
|
10968
11107
|
{
|
|
10969
11108
|
className: cn(
|
|
10970
11109
|
"text-xs p-1 mb-1 rounded text-white cursor-move group relative select-none block w-full truncate",
|
|
10971
|
-
event.color || EVENT_COLORS[event.type || "event"]
|
|
11110
|
+
event.color || EVENT_COLORS[event.type || "event"],
|
|
11111
|
+
event.priority && PRIORITY_COLORS[event.priority],
|
|
11112
|
+
event.status && STATUS_STYLES[event.status]
|
|
10972
11113
|
),
|
|
10973
|
-
draggable: !disabled,
|
|
11114
|
+
draggable: !disabled && enableDragDrop,
|
|
10974
11115
|
onClick: (e) => handleEventClick(event, e),
|
|
10975
11116
|
onDragStart: (e) => handleEventDragStart(event, e),
|
|
10976
11117
|
onDragEnd: handleEventDragEnd,
|
|
@@ -10979,7 +11120,11 @@ function Calendar3({
|
|
|
10979
11120
|
},
|
|
10980
11121
|
children: [
|
|
10981
11122
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
10982
|
-
/* @__PURE__ */
|
|
11123
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 flex-1 min-w-0", children: [
|
|
11124
|
+
event.isPrivate && /* @__PURE__ */ jsx(Lock, { className: "h-3 w-3 flex-shrink-0" }),
|
|
11125
|
+
event.recurring && /* @__PURE__ */ jsx(Repeat, { className: "h-3 w-3 flex-shrink-0" }),
|
|
11126
|
+
/* @__PURE__ */ jsx("span", { className: "truncate", children: event.title })
|
|
11127
|
+
] }),
|
|
10983
11128
|
showEventDetails && /* @__PURE__ */ jsxs("div", { className: "hidden group-hover:flex items-center gap-1 ml-1", children: [
|
|
10984
11129
|
/* @__PURE__ */ jsx(
|
|
10985
11130
|
MoonUIButtonPro,
|
|
@@ -11003,9 +11148,9 @@ function Calendar3({
|
|
|
11003
11148
|
)
|
|
11004
11149
|
] })
|
|
11005
11150
|
] }),
|
|
11006
|
-
event.startTime && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 mt-1", children: [
|
|
11151
|
+
event.startTime && !compactMode && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 mt-1", children: [
|
|
11007
11152
|
/* @__PURE__ */ jsx(Clock, { className: "h-3 w-3" }),
|
|
11008
|
-
/* @__PURE__ */ jsx("span", { children: event.startTime })
|
|
11153
|
+
/* @__PURE__ */ jsx("span", { className: "text-[10px]", children: formatTime2(event.startTime) })
|
|
11009
11154
|
] })
|
|
11010
11155
|
]
|
|
11011
11156
|
},
|
|
@@ -11023,7 +11168,206 @@ function Calendar3({
|
|
|
11023
11168
|
);
|
|
11024
11169
|
})
|
|
11025
11170
|
] }),
|
|
11026
|
-
|
|
11171
|
+
view === "week" && /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
11172
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-8 gap-2", children: [
|
|
11173
|
+
/* @__PURE__ */ jsx("div", { className: "text-xs font-medium text-muted-foreground", children: "Time" }),
|
|
11174
|
+
Array.from({ length: 7 }, (_, i) => {
|
|
11175
|
+
const date = new Date(currentDate);
|
|
11176
|
+
date.setDate(date.getDate() - date.getDay() + i);
|
|
11177
|
+
return /* @__PURE__ */ jsxs("div", { className: "text-center", children: [
|
|
11178
|
+
/* @__PURE__ */ jsx("div", { className: "text-xs font-medium text-muted-foreground", children: DAYS_OF_WEEK[i] }),
|
|
11179
|
+
/* @__PURE__ */ jsx("div", { className: cn(
|
|
11180
|
+
"text-sm font-medium",
|
|
11181
|
+
isToday2(date) && "text-primary"
|
|
11182
|
+
), children: date.getDate() })
|
|
11183
|
+
] }, i);
|
|
11184
|
+
})
|
|
11185
|
+
] }),
|
|
11186
|
+
/* @__PURE__ */ jsx("div", { className: "border rounded-lg overflow-hidden", children: /* @__PURE__ */ jsx("div", { className: "max-h-[500px] overflow-y-auto", children: Array.from({ length: 24 }, (_, hour) => /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-8 border-b last:border-b-0", children: [
|
|
11187
|
+
/* @__PURE__ */ jsx("div", { className: "p-2 text-xs text-muted-foreground border-r", children: formatTime2(`${hour.toString().padStart(2, "0")}:00`) }),
|
|
11188
|
+
Array.from({ length: 7 }, (_2, dayIndex) => {
|
|
11189
|
+
const date = new Date(currentDate);
|
|
11190
|
+
date.setDate(date.getDate() - date.getDay() + dayIndex);
|
|
11191
|
+
const hourEvents = getEventsForDate(date).filter((event) => {
|
|
11192
|
+
if (!event.startTime)
|
|
11193
|
+
return false;
|
|
11194
|
+
const eventHour = parseInt(event.startTime.split(":")[0]);
|
|
11195
|
+
return eventHour === hour;
|
|
11196
|
+
});
|
|
11197
|
+
return /* @__PURE__ */ jsx(
|
|
11198
|
+
"div",
|
|
11199
|
+
{
|
|
11200
|
+
className: cn(
|
|
11201
|
+
"p-1 min-h-[60px] border-r last:border-r-0 hover:bg-muted/50 transition-colors",
|
|
11202
|
+
isToday2(date) && "bg-primary/5"
|
|
11203
|
+
),
|
|
11204
|
+
onClick: () => handleDateClick(date),
|
|
11205
|
+
children: hourEvents.map((event) => /* @__PURE__ */ jsxs(
|
|
11206
|
+
"div",
|
|
11207
|
+
{
|
|
11208
|
+
className: cn(
|
|
11209
|
+
"text-xs p-1 rounded text-white mb-1 cursor-pointer",
|
|
11210
|
+
event.color || EVENT_COLORS[event.type || "event"]
|
|
11211
|
+
),
|
|
11212
|
+
onClick: (e) => handleEventClick(event, e),
|
|
11213
|
+
children: [
|
|
11214
|
+
/* @__PURE__ */ jsx("div", { className: "font-medium truncate", children: event.title }),
|
|
11215
|
+
event.location && /* @__PURE__ */ jsx("div", { className: "text-[10px] opacity-80 truncate", children: event.location })
|
|
11216
|
+
]
|
|
11217
|
+
},
|
|
11218
|
+
event.id
|
|
11219
|
+
))
|
|
11220
|
+
},
|
|
11221
|
+
dayIndex
|
|
11222
|
+
);
|
|
11223
|
+
})
|
|
11224
|
+
] }, hour)) }) })
|
|
11225
|
+
] }),
|
|
11226
|
+
view === "day" && /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
11227
|
+
/* @__PURE__ */ jsx("div", { className: "text-center", children: /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold", children: currentDate.toLocaleDateString(locale, {
|
|
11228
|
+
weekday: "long",
|
|
11229
|
+
year: "numeric",
|
|
11230
|
+
month: "long",
|
|
11231
|
+
day: "numeric"
|
|
11232
|
+
}) }) }),
|
|
11233
|
+
/* @__PURE__ */ jsx("div", { className: "border rounded-lg overflow-hidden", children: /* @__PURE__ */ jsx("div", { className: "max-h-[500px] overflow-y-auto", children: Array.from({ length: 24 }, (_, hour) => {
|
|
11234
|
+
const hourEvents = getEventsForDate(currentDate).filter((event) => {
|
|
11235
|
+
if (!event.startTime)
|
|
11236
|
+
return false;
|
|
11237
|
+
const eventHour = parseInt(event.startTime.split(":")[0]);
|
|
11238
|
+
return eventHour === hour;
|
|
11239
|
+
});
|
|
11240
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex border-b last:border-b-0", children: [
|
|
11241
|
+
/* @__PURE__ */ jsx("div", { className: "w-20 p-3 text-sm text-muted-foreground border-r", children: formatTime2(`${hour.toString().padStart(2, "0")}:00`) }),
|
|
11242
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1 p-2 min-h-[80px]", children: hourEvents.map((event) => /* @__PURE__ */ jsx(
|
|
11243
|
+
"div",
|
|
11244
|
+
{
|
|
11245
|
+
className: cn(
|
|
11246
|
+
"p-2 rounded text-white mb-2 cursor-pointer",
|
|
11247
|
+
event.color || EVENT_COLORS[event.type || "event"]
|
|
11248
|
+
),
|
|
11249
|
+
onClick: (e) => handleEventClick(event, e),
|
|
11250
|
+
children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
11251
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
11252
|
+
/* @__PURE__ */ jsx("div", { className: "font-medium", children: event.title }),
|
|
11253
|
+
event.description && /* @__PURE__ */ jsx("div", { className: "text-sm opacity-80", children: event.description }),
|
|
11254
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 text-xs mt-1", children: [
|
|
11255
|
+
event.startTime && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
|
|
11256
|
+
/* @__PURE__ */ jsx(Clock, { className: "h-3 w-3" }),
|
|
11257
|
+
formatTime2(event.startTime),
|
|
11258
|
+
" - ",
|
|
11259
|
+
formatTime2(event.endTime || event.startTime)
|
|
11260
|
+
] }),
|
|
11261
|
+
event.location && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
|
|
11262
|
+
/* @__PURE__ */ jsx(MapPin, { className: "h-3 w-3" }),
|
|
11263
|
+
event.location
|
|
11264
|
+
] })
|
|
11265
|
+
] })
|
|
11266
|
+
] }),
|
|
11267
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-1", children: [
|
|
11268
|
+
/* @__PURE__ */ jsx(
|
|
11269
|
+
MoonUIButtonPro,
|
|
11270
|
+
{
|
|
11271
|
+
variant: "ghost",
|
|
11272
|
+
size: "sm",
|
|
11273
|
+
className: "h-6 w-6 p-0 text-white/80 hover:text-white",
|
|
11274
|
+
onClick: (e) => handleEventEdit(event, e),
|
|
11275
|
+
children: /* @__PURE__ */ jsx(Edit, { className: "h-3 w-3" })
|
|
11276
|
+
}
|
|
11277
|
+
),
|
|
11278
|
+
/* @__PURE__ */ jsx(
|
|
11279
|
+
MoonUIButtonPro,
|
|
11280
|
+
{
|
|
11281
|
+
variant: "ghost",
|
|
11282
|
+
size: "sm",
|
|
11283
|
+
className: "h-6 w-6 p-0 text-white/80 hover:text-white",
|
|
11284
|
+
onClick: (e) => handleEventDelete(event, e),
|
|
11285
|
+
children: /* @__PURE__ */ jsx(Trash2, { className: "h-3 w-3" })
|
|
11286
|
+
}
|
|
11287
|
+
)
|
|
11288
|
+
] })
|
|
11289
|
+
] })
|
|
11290
|
+
},
|
|
11291
|
+
event.id
|
|
11292
|
+
)) })
|
|
11293
|
+
] }, hour);
|
|
11294
|
+
}) }) })
|
|
11295
|
+
] }),
|
|
11296
|
+
view === "agenda" && /* @__PURE__ */ jsx("div", { className: "space-y-4", children: /* @__PURE__ */ jsx("div", { className: "max-h-[500px] overflow-y-auto space-y-4", children: Array.from({ length: 30 }, (_, i) => {
|
|
11297
|
+
const date = new Date(currentDate);
|
|
11298
|
+
date.setDate(date.getDate() + i);
|
|
11299
|
+
const dayEvents = getEventsForDate(date);
|
|
11300
|
+
if (dayEvents.length === 0)
|
|
11301
|
+
return null;
|
|
11302
|
+
return /* @__PURE__ */ jsxs("div", { className: "border rounded-lg p-4", children: [
|
|
11303
|
+
/* @__PURE__ */ jsx("h4", { className: "font-medium mb-3", children: date.toLocaleDateString(locale, {
|
|
11304
|
+
weekday: "long",
|
|
11305
|
+
year: "numeric",
|
|
11306
|
+
month: "long",
|
|
11307
|
+
day: "numeric"
|
|
11308
|
+
}) }),
|
|
11309
|
+
/* @__PURE__ */ jsx("div", { className: "space-y-2", children: dayEvents.map((event) => /* @__PURE__ */ jsxs(
|
|
11310
|
+
"div",
|
|
11311
|
+
{
|
|
11312
|
+
className: "flex items-start gap-3 p-3 rounded-lg border hover:bg-muted/50 transition-colors cursor-pointer",
|
|
11313
|
+
onClick: () => onEventClick?.(event),
|
|
11314
|
+
children: [
|
|
11315
|
+
/* @__PURE__ */ jsx("div", { className: cn(
|
|
11316
|
+
"w-3 h-3 rounded-full mt-1 flex-shrink-0",
|
|
11317
|
+
event.color || EVENT_COLORS[event.type || "event"]
|
|
11318
|
+
) }),
|
|
11319
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1", children: [
|
|
11320
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
11321
|
+
/* @__PURE__ */ jsx("h5", { className: "font-medium", children: event.title }),
|
|
11322
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-1", children: [
|
|
11323
|
+
/* @__PURE__ */ jsx(
|
|
11324
|
+
MoonUIButtonPro,
|
|
11325
|
+
{
|
|
11326
|
+
variant: "ghost",
|
|
11327
|
+
size: "sm",
|
|
11328
|
+
className: "h-7 w-7 p-0",
|
|
11329
|
+
onClick: (e) => handleEventEdit(event, e),
|
|
11330
|
+
children: /* @__PURE__ */ jsx(Edit, { className: "h-3 w-3" })
|
|
11331
|
+
}
|
|
11332
|
+
),
|
|
11333
|
+
/* @__PURE__ */ jsx(
|
|
11334
|
+
MoonUIButtonPro,
|
|
11335
|
+
{
|
|
11336
|
+
variant: "ghost",
|
|
11337
|
+
size: "sm",
|
|
11338
|
+
className: "h-7 w-7 p-0",
|
|
11339
|
+
onClick: (e) => handleEventDelete(event, e),
|
|
11340
|
+
children: /* @__PURE__ */ jsx(Trash2, { className: "h-3 w-3" })
|
|
11341
|
+
}
|
|
11342
|
+
)
|
|
11343
|
+
] })
|
|
11344
|
+
] }),
|
|
11345
|
+
event.description && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground mt-1", children: event.description }),
|
|
11346
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4 text-xs text-muted-foreground mt-2", children: [
|
|
11347
|
+
event.startTime && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
|
|
11348
|
+
/* @__PURE__ */ jsx(Clock, { className: "h-3 w-3" }),
|
|
11349
|
+
formatTime2(event.startTime),
|
|
11350
|
+
" - ",
|
|
11351
|
+
formatTime2(event.endTime || event.startTime)
|
|
11352
|
+
] }),
|
|
11353
|
+
event.location && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
|
|
11354
|
+
/* @__PURE__ */ jsx(MapPin, { className: "h-3 w-3" }),
|
|
11355
|
+
event.location
|
|
11356
|
+
] }),
|
|
11357
|
+
event.attendees && event.attendees.length > 0 && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
|
|
11358
|
+
/* @__PURE__ */ jsx(Users, { className: "h-3 w-3" }),
|
|
11359
|
+
event.attendees.length,
|
|
11360
|
+
" attendees"
|
|
11361
|
+
] })
|
|
11362
|
+
] })
|
|
11363
|
+
] })
|
|
11364
|
+
]
|
|
11365
|
+
},
|
|
11366
|
+
event.id
|
|
11367
|
+
)) })
|
|
11368
|
+
] }, i);
|
|
11369
|
+
}).filter(Boolean) }) }),
|
|
11370
|
+
selectedDate && view === "month" && /* @__PURE__ */ jsxs("div", { className: "border rounded-lg p-4 bg-muted/50", children: [
|
|
11027
11371
|
/* @__PURE__ */ jsx("h4", { className: "font-medium mb-2", children: selectedDate.toLocaleDateString("en-US", {
|
|
11028
11372
|
weekday: "long",
|
|
11029
11373
|
year: "numeric",
|
|
@@ -30383,11 +30727,11 @@ var ReactNodeViewContext = createContext({
|
|
|
30383
30727
|
var useReactNodeView = () => useContext(ReactNodeViewContext);
|
|
30384
30728
|
t__default.forwardRef((props, ref) => {
|
|
30385
30729
|
const { onDragStart } = useReactNodeView();
|
|
30386
|
-
const
|
|
30730
|
+
const Tag5 = props.as || "div";
|
|
30387
30731
|
return (
|
|
30388
30732
|
// @ts-ignore
|
|
30389
30733
|
/* @__PURE__ */ jsx(
|
|
30390
|
-
|
|
30734
|
+
Tag5,
|
|
30391
30735
|
{
|
|
30392
30736
|
...props,
|
|
30393
30737
|
ref,
|
|
@@ -55523,7 +55867,7 @@ function Timeline({
|
|
|
55523
55867
|
] })
|
|
55524
55868
|
] }),
|
|
55525
55869
|
/* @__PURE__ */ jsx(MoonUICardContentPro, { className: cn(
|
|
55526
|
-
compactMode
|
|
55870
|
+
compactMode ? "pt-2" : "pt-6",
|
|
55527
55871
|
"relative"
|
|
55528
55872
|
), children: filteredAndSortedEvents.length > 0 ? renderTimeline() : /* @__PURE__ */ jsxs("div", { className: "text-center py-12", children: [
|
|
55529
55873
|
/* @__PURE__ */ jsx(Clock, { className: "h-12 w-12 mx-auto mb-4 text-muted-foreground" }),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moontra/moonui-pro",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.16.0",
|
|
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",
|