@moontra/moonui-pro 2.17.1 → 2.17.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -7,7 +7,7 @@ import { ChevronDown, Info, AlertCircle, AlertTriangle, Check, X, MoreHorizontal
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
- import { startOfDay, endOfDay, addDays, startOfYear, endOfYear, startOfMonth, endOfMonth, startOfWeek, endOfWeek, isWithinInterval, isBefore, isAfter, subYears, addYears, subMonths, addMonths, subWeeks, addWeeks, subDays, addHours, differenceInMinutes, addMinutes, format, isSameDay, setHours, isToday, eachDayOfInterval, isSameMonth, eachMonthOfInterval, getDay, getDaysInMonth, formatDistanceToNow } from 'date-fns';
10
+ import { startOfDay, endOfDay, addDays, startOfYear, endOfYear, startOfMonth, endOfMonth, startOfWeek, endOfWeek, isWithinInterval, isBefore, isAfter, subYears, addYears, subMonths, addMonths, subWeeks, addWeeks, subDays, addHours, differenceInMinutes, addMinutes, format, isSameDay, setHours, setMinutes, isToday, eachDayOfInterval, isSameMonth, eachMonthOfInterval, getDay, getDaysInMonth, formatDistanceToNow } from 'date-fns';
11
11
  import { motion, AnimatePresence, useMotionValue, useSpring, useTransform, animate, LayoutGroup, Reorder, useDragControls } from 'framer-motion';
12
12
  import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
13
13
  import * as ReactDOM from 'react-dom';
@@ -11487,7 +11487,7 @@ var CalendarPro = t.forwardRef(({
11487
11487
  categories = defaultCategories,
11488
11488
  views = defaultViews,
11489
11489
  defaultView,
11490
- height = "100%",
11490
+ height = "100vh",
11491
11491
  className,
11492
11492
  sidebarCollapsed: controlledSidebarCollapsed,
11493
11493
  onSidebarToggle,
@@ -11756,40 +11756,64 @@ END:VCALENDAR`;
11756
11756
  ] }),
11757
11757
  /* @__PURE__ */ jsx("div", { className: "relative", children: hours.map((hour) => /* @__PURE__ */ jsxs("div", { className: "flex border-b", style: { height: "60px" }, children: [
11758
11758
  /* @__PURE__ */ jsx("div", { className: "w-16 p-2 text-xs text-muted-foreground text-right", children: format(setHours(/* @__PURE__ */ new Date(), hour), timeFormat === "12h" ? "h a" : "HH:00") }),
11759
- /* @__PURE__ */ jsx("div", { className: "flex-1 relative border-l", children: dayEvents.filter((event) => {
11760
- if (event.allDay)
11761
- return false;
11762
- const eventHour = new Date(event.start).getHours();
11763
- return eventHour === hour;
11764
- }).map((event) => {
11765
- const startMinutes = new Date(event.start).getMinutes();
11766
- const duration = differenceInMinutes(new Date(event.end), new Date(event.start));
11767
- const height2 = duration / 60 * 60;
11768
- const top = startMinutes / 60 * 60;
11769
- return /* @__PURE__ */ jsxs(
11770
- "div",
11771
- {
11772
- className: "absolute left-0 right-0 mx-1 p-1 rounded text-xs cursor-pointer hover:opacity-80 overflow-hidden",
11773
- style: {
11774
- top: `${top}px`,
11775
- height: `${height2}px`,
11776
- backgroundColor: event.color || eventColors[event.category || ""] || "#3b82f6",
11777
- color: "#ffffff",
11778
- zIndex: 10
11779
- },
11780
- onClick: (e) => handleEventClick(event, e),
11781
- children: [
11782
- /* @__PURE__ */ jsx("div", { className: "font-medium", children: event.title }),
11783
- /* @__PURE__ */ jsxs("div", { className: "text-xs opacity-80", children: [
11784
- format(new Date(event.start), "HH:mm"),
11785
- " - ",
11786
- format(new Date(event.end), "HH:mm")
11787
- ] })
11788
- ]
11759
+ /* @__PURE__ */ jsx(
11760
+ "div",
11761
+ {
11762
+ className: "flex-1 relative border-l cursor-pointer hover:bg-muted/20",
11763
+ onClick: () => {
11764
+ if (allowEventCreation) {
11765
+ const clickedTime = setHours(setMinutes(currentDate, 0), hour);
11766
+ setNewEventStart(clickedTime);
11767
+ setNewEventEnd(addHours(clickedTime, 1));
11768
+ setEditingEvent({
11769
+ title: "",
11770
+ start: clickedTime,
11771
+ end: addHours(clickedTime, 1),
11772
+ allDay: false
11773
+ });
11774
+ setIsCreating(true);
11775
+ setIsEventDialogOpen(true);
11776
+ }
11789
11777
  },
11790
- event.id
11791
- );
11792
- }) })
11778
+ children: dayEvents.filter((event) => {
11779
+ if (event.allDay)
11780
+ return false;
11781
+ const eventHour = new Date(event.start).getHours();
11782
+ return eventHour === hour;
11783
+ }).map((event) => {
11784
+ const startMinutes = new Date(event.start).getMinutes();
11785
+ const duration = differenceInMinutes(new Date(event.end), new Date(event.start));
11786
+ const height2 = duration / 60 * 60;
11787
+ const top = startMinutes / 60 * 60;
11788
+ return /* @__PURE__ */ jsxs(
11789
+ "div",
11790
+ {
11791
+ className: "absolute left-0 right-0 mx-1 p-1 rounded text-xs cursor-pointer hover:opacity-80 overflow-hidden",
11792
+ style: {
11793
+ top: `${top}px`,
11794
+ height: `${height2}px`,
11795
+ backgroundColor: event.color || eventColors[event.category || ""] || "#3b82f6",
11796
+ color: "#ffffff",
11797
+ zIndex: 10
11798
+ },
11799
+ onClick: (e) => {
11800
+ e.stopPropagation();
11801
+ handleEventClick(event, e);
11802
+ },
11803
+ children: [
11804
+ /* @__PURE__ */ jsx("div", { className: "font-medium", children: event.title }),
11805
+ /* @__PURE__ */ jsxs("div", { className: "text-xs opacity-80", children: [
11806
+ format(new Date(event.start), "HH:mm"),
11807
+ " - ",
11808
+ format(new Date(event.end), "HH:mm")
11809
+ ] })
11810
+ ]
11811
+ },
11812
+ event.id
11813
+ );
11814
+ })
11815
+ }
11816
+ )
11793
11817
  ] }, hour)) })
11794
11818
  ] }) }) });
11795
11819
  };
@@ -11828,9 +11852,24 @@ END:VCALENDAR`;
11828
11852
  "div",
11829
11853
  {
11830
11854
  className: cn(
11831
- "flex-1 relative border-l border-b",
11855
+ "flex-1 relative border-l border-b cursor-pointer hover:bg-muted/20",
11832
11856
  isToday(day) && "bg-primary/5"
11833
11857
  ),
11858
+ onClick: () => {
11859
+ if (allowEventCreation) {
11860
+ const clickedTime = setHours(setMinutes(day, 0), hour);
11861
+ setNewEventStart(clickedTime);
11862
+ setNewEventEnd(addHours(clickedTime, 1));
11863
+ setEditingEvent({
11864
+ title: "",
11865
+ start: clickedTime,
11866
+ end: addHours(clickedTime, 1),
11867
+ allDay: false
11868
+ });
11869
+ setIsCreating(true);
11870
+ setIsEventDialogOpen(true);
11871
+ }
11872
+ },
11834
11873
  children: dayEvents.filter((event) => {
11835
11874
  const eventHour = new Date(event.start).getHours();
11836
11875
  return eventHour === hour;
@@ -11850,7 +11889,10 @@ END:VCALENDAR`;
11850
11889
  color: "#ffffff",
11851
11890
  zIndex: 10
11852
11891
  },
11853
- onClick: (e) => handleEventClick(event, e),
11892
+ onClick: (e) => {
11893
+ e.stopPropagation();
11894
+ handleEventClick(event, e);
11895
+ },
11854
11896
  children: event.title
11855
11897
  },
11856
11898
  event.id
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moontra/moonui-pro",
3
- "version": "2.17.1",
3
+ "version": "2.17.3",
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",
@@ -410,7 +410,7 @@ export const CalendarPro = React.forwardRef<HTMLDivElement, CalendarProProps>(({
410
410
  categories = defaultCategories,
411
411
  views = defaultViews,
412
412
  defaultView,
413
- height = '100%',
413
+ height = '100vh',
414
414
  className,
415
415
  sidebarCollapsed: controlledSidebarCollapsed,
416
416
  onSidebarToggle,
@@ -749,7 +749,24 @@ END:VCALENDAR`
749
749
  <div className="w-16 p-2 text-xs text-muted-foreground text-right">
750
750
  {format(setHours(new Date(), hour), timeFormat === '12h' ? 'h a' : 'HH:00')}
751
751
  </div>
752
- <div className="flex-1 relative border-l">
752
+ <div
753
+ className="flex-1 relative border-l cursor-pointer hover:bg-muted/20"
754
+ onClick={() => {
755
+ if (allowEventCreation) {
756
+ const clickedTime = setHours(setMinutes(currentDate, 0), hour)
757
+ setNewEventStart(clickedTime)
758
+ setNewEventEnd(addHours(clickedTime, 1))
759
+ setEditingEvent({
760
+ title: '',
761
+ start: clickedTime,
762
+ end: addHours(clickedTime, 1),
763
+ allDay: false
764
+ })
765
+ setIsCreating(true)
766
+ setIsEventDialogOpen(true)
767
+ }
768
+ }}
769
+ >
753
770
  {/* Events in this hour */}
754
771
  {dayEvents
755
772
  .filter(event => {
@@ -774,7 +791,10 @@ END:VCALENDAR`
774
791
  color: '#ffffff',
775
792
  zIndex: 10
776
793
  }}
777
- onClick={(e) => handleEventClick(event, e)}
794
+ onClick={(e) => {
795
+ e.stopPropagation()
796
+ handleEventClick(event, e)
797
+ }}
778
798
  >
779
799
  <div className="font-medium">{event.title}</div>
780
800
  <div className="text-xs opacity-80">
@@ -845,9 +865,24 @@ END:VCALENDAR`
845
865
  <div
846
866
  key={day.toISOString()}
847
867
  className={cn(
848
- "flex-1 relative border-l border-b",
868
+ "flex-1 relative border-l border-b cursor-pointer hover:bg-muted/20",
849
869
  isToday(day) && "bg-primary/5"
850
870
  )}
871
+ onClick={() => {
872
+ if (allowEventCreation) {
873
+ const clickedTime = setHours(setMinutes(day, 0), hour)
874
+ setNewEventStart(clickedTime)
875
+ setNewEventEnd(addHours(clickedTime, 1))
876
+ setEditingEvent({
877
+ title: '',
878
+ start: clickedTime,
879
+ end: addHours(clickedTime, 1),
880
+ allDay: false
881
+ })
882
+ setIsCreating(true)
883
+ setIsEventDialogOpen(true)
884
+ }
885
+ }}
851
886
  >
852
887
  {dayEvents
853
888
  .filter(event => {
@@ -871,7 +906,10 @@ END:VCALENDAR`
871
906
  color: '#ffffff',
872
907
  zIndex: 10
873
908
  }}
874
- onClick={(e) => handleEventClick(event, e)}
909
+ onClick={(e) => {
910
+ e.stopPropagation()
911
+ handleEventClick(event, e)
912
+ }}
875
913
  >
876
914
  {event.title}
877
915
  </div>