@uptrademedia/site-kit 1.1.0 → 1.1.1

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.
@@ -2548,6 +2548,132 @@ var MONTHS = [
2548
2548
  "November",
2549
2549
  "December"
2550
2550
  ];
2551
+ function formatDateForTooltip(dateStr) {
2552
+ const d = new Date(dateStr);
2553
+ return d.toLocaleDateString("en-US", { weekday: "short", month: "short", day: "numeric", year: "numeric" });
2554
+ }
2555
+ function CalendarEventCell({
2556
+ item,
2557
+ eventDisplay,
2558
+ eventClassName,
2559
+ onEventClick,
2560
+ formatTime: formatTime2
2561
+ }) {
2562
+ const [hover, setHover] = React5__default.default.useState(false);
2563
+ const { event, schedule } = item;
2564
+ const imageUrl = event.featured_image_url;
2565
+ if (eventDisplay === "image") {
2566
+ return /* @__PURE__ */ jsxRuntime.jsxs(
2567
+ "div",
2568
+ {
2569
+ className: `site-kit-calendar-event-image-wrapper ${eventClassName}`,
2570
+ style: { position: "relative" },
2571
+ onMouseEnter: () => setHover(true),
2572
+ onMouseLeave: () => setHover(false),
2573
+ children: [
2574
+ /* @__PURE__ */ jsxRuntime.jsx(
2575
+ "button",
2576
+ {
2577
+ onClick: onEventClick,
2578
+ className: `site-kit-calendar-event site-kit-calendar-event-image ${eventClassName}`,
2579
+ style: {
2580
+ display: "block",
2581
+ width: "100%",
2582
+ height: "28px",
2583
+ padding: 0,
2584
+ border: "none",
2585
+ borderRadius: "4px",
2586
+ cursor: "pointer",
2587
+ overflow: "hidden",
2588
+ background: imageUrl ? "transparent" : "#dbeafe"
2589
+ },
2590
+ children: imageUrl ? /* @__PURE__ */ jsxRuntime.jsx(
2591
+ "img",
2592
+ {
2593
+ src: imageUrl,
2594
+ alt: event.name,
2595
+ style: {
2596
+ width: "100%",
2597
+ height: "100%",
2598
+ objectFit: "cover"
2599
+ }
2600
+ }
2601
+ ) : /* @__PURE__ */ jsxRuntime.jsx("span", { style: {
2602
+ fontSize: "0.65rem",
2603
+ color: "#1d4ed8",
2604
+ fontWeight: 500,
2605
+ padding: "2px 4px",
2606
+ display: "block",
2607
+ overflow: "hidden",
2608
+ textOverflow: "ellipsis",
2609
+ whiteSpace: "nowrap"
2610
+ }, children: event.name })
2611
+ }
2612
+ ),
2613
+ /* @__PURE__ */ jsxRuntime.jsxs(
2614
+ "div",
2615
+ {
2616
+ className: "site-kit-calendar-event-tooltip",
2617
+ style: {
2618
+ position: "absolute",
2619
+ bottom: "100%",
2620
+ left: "50%",
2621
+ transform: "translateX(-50%) translateY(-4px)",
2622
+ padding: "8px 12px",
2623
+ background: "#1f2937",
2624
+ color: "white",
2625
+ borderRadius: "8px",
2626
+ fontSize: "0.75rem",
2627
+ minWidth: "180px",
2628
+ maxWidth: "220px",
2629
+ boxShadow: "0 4px 12px rgba(0,0,0,0.2)",
2630
+ pointerEvents: "none",
2631
+ opacity: hover ? 1 : 0,
2632
+ visibility: hover ? "visible" : "hidden",
2633
+ transition: "opacity 0.15s, visibility 0.15s",
2634
+ zIndex: 50
2635
+ },
2636
+ children: [
2637
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontWeight: 600, marginBottom: "4px" }, children: event.name }),
2638
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { opacity: 0.9, fontSize: "0.7rem" }, children: [
2639
+ formatDateForTooltip(schedule.starts_at),
2640
+ " \u2022 ",
2641
+ formatTime2(schedule.starts_at)
2642
+ ] }),
2643
+ event.location && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { opacity: 0.8, fontSize: "0.65rem", marginTop: "2px" }, children: event.location })
2644
+ ]
2645
+ }
2646
+ )
2647
+ ]
2648
+ }
2649
+ );
2650
+ }
2651
+ return /* @__PURE__ */ jsxRuntime.jsx(
2652
+ "button",
2653
+ {
2654
+ onClick: onEventClick,
2655
+ className: `site-kit-calendar-event ${eventClassName}`,
2656
+ style: {
2657
+ display: "block",
2658
+ width: "100%",
2659
+ padding: "2px 4px",
2660
+ fontSize: "0.7rem",
2661
+ fontWeight: 500,
2662
+ textAlign: "left",
2663
+ border: "none",
2664
+ borderRadius: "3px",
2665
+ background: "#dbeafe",
2666
+ color: "#1d4ed8",
2667
+ cursor: "pointer",
2668
+ overflow: "hidden",
2669
+ whiteSpace: "nowrap",
2670
+ textOverflow: "ellipsis"
2671
+ },
2672
+ title: `${event.name} - ${formatTime2(schedule.starts_at)}`,
2673
+ children: event.name
2674
+ }
2675
+ );
2676
+ }
2551
2677
  function CalendarView({
2552
2678
  events: propEvents,
2553
2679
  initialDate,
@@ -2559,6 +2685,7 @@ function CalendarView({
2559
2685
  weekStartsOn = 0,
2560
2686
  minDate,
2561
2687
  maxDate,
2688
+ eventDisplay = "image",
2562
2689
  className = "",
2563
2690
  headerClassName = "",
2564
2691
  dayClassName = "",
@@ -2789,29 +2916,14 @@ function CalendarView({
2789
2916
  background: day.isToday ? "#2563eb" : "transparent"
2790
2917
  }, children: day.date.getDate() }) }),
2791
2918
  /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "2px" }, children: [
2792
- day.events.slice(0, 3).map((item, eventIndex) => /* @__PURE__ */ jsxRuntime.jsx(
2793
- "button",
2919
+ day.events.slice(0, 3).map((item) => /* @__PURE__ */ jsxRuntime.jsx(
2920
+ CalendarEventCell,
2794
2921
  {
2795
- onClick: (e) => handleEventClick(e, item.event, item.schedule),
2796
- className: `site-kit-calendar-event ${eventClassName}`,
2797
- style: {
2798
- display: "block",
2799
- width: "100%",
2800
- padding: "2px 4px",
2801
- fontSize: "0.7rem",
2802
- fontWeight: 500,
2803
- textAlign: "left",
2804
- border: "none",
2805
- borderRadius: "3px",
2806
- background: "#dbeafe",
2807
- color: "#1d4ed8",
2808
- cursor: "pointer",
2809
- overflow: "hidden",
2810
- whiteSpace: "nowrap",
2811
- textOverflow: "ellipsis"
2812
- },
2813
- title: `${item.event.name} - ${formatTime(item.schedule.starts_at)}`,
2814
- children: item.event.name
2922
+ item,
2923
+ eventDisplay,
2924
+ eventClassName,
2925
+ onEventClick: (e) => handleEventClick(e, item.event, item.schedule),
2926
+ formatTime
2815
2927
  },
2816
2928
  `${item.event.id}-${item.schedule.id}`
2817
2929
  )),
@@ -3770,10 +3882,11 @@ function EventsWidget({
3770
3882
  }
3771
3883
  ),
3772
3884
  effectiveView === "list" ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `site-kit-events-list ${listClassName}`, children: [
3773
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", flexDirection: "column", gap: "1rem" }, children: displayEvents.map((eventItem) => {
3885
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", flexDirection: "column", gap: "1rem" }, children: displayEvents.map((eventItem, index) => {
3774
3886
  const nextSchedule = eventItem.next_schedule || eventItem.schedules?.[0];
3775
3887
  const isFree = !eventItem.price || eventItem.price === 0;
3776
3888
  const imageUrl = eventItem.featured_image_url;
3889
+ const uniqueKey = nextSchedule ? `${eventItem.id}-${nextSchedule.id}` : `${eventItem.id}-${index}`;
3777
3890
  return /* @__PURE__ */ jsxRuntime.jsxs(
3778
3891
  "div",
3779
3892
  {
@@ -3883,7 +3996,7 @@ function EventsWidget({
3883
3996
  ] })
3884
3997
  ]
3885
3998
  },
3886
- eventItem.id
3999
+ uniqueKey
3887
4000
  );
3888
4001
  }) }),
3889
4002
  showViewAll && events.length > limit && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { textAlign: "center", marginTop: "1.5rem" }, children: /* @__PURE__ */ jsxRuntime.jsx(
@@ -3909,10 +4022,11 @@ function EventsWidget({
3909
4022
  display: "grid",
3910
4023
  gridTemplateColumns: "repeat(auto-fill, minmax(280px, 1fr))",
3911
4024
  gap: "1.25rem"
3912
- }, children: displayEvents.map((eventItem) => {
4025
+ }, children: displayEvents.map((eventItem, index) => {
3913
4026
  const nextSchedule = eventItem.next_schedule || eventItem.schedules?.[0];
3914
4027
  const isFree = !eventItem.price || eventItem.price === 0;
3915
4028
  const imageUrl = eventItem.featured_image_url;
4029
+ const uniqueKey = nextSchedule ? `${eventItem.id}-${nextSchedule.id}` : `${eventItem.id}-${index}`;
3916
4030
  return /* @__PURE__ */ jsxRuntime.jsxs(
3917
4031
  "div",
3918
4032
  {
@@ -3977,7 +4091,7 @@ function EventsWidget({
3977
4091
  ] })
3978
4092
  ]
3979
4093
  },
3980
- eventItem.id
4094
+ uniqueKey
3981
4095
  );
3982
4096
  }) }),
3983
4097
  showViewAll && events.length > limit && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { textAlign: "center", marginTop: "1.5rem" }, children: /* @__PURE__ */ jsxRuntime.jsx(
@@ -4075,5 +4189,5 @@ exports.getSpotsRemaining = getSpotsRemaining;
4075
4189
  exports.isEventSoldOut = isEventSoldOut;
4076
4190
  exports.registerForEvent = registerForEvent;
4077
4191
  exports.useEventModal = useEventModal;
4078
- //# sourceMappingURL=chunk-MVNUEXP3.js.map
4079
- //# sourceMappingURL=chunk-MVNUEXP3.js.map
4192
+ //# sourceMappingURL=chunk-YZRNC2Z6.js.map
4193
+ //# sourceMappingURL=chunk-YZRNC2Z6.js.map