@uptrademedia/site-kit 1.0.29 → 1.0.30

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.
@@ -3364,9 +3364,11 @@ var LocationIcon = () => /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org
3364
3364
  /* @__PURE__ */ jsx("path", { d: "M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z" }),
3365
3365
  /* @__PURE__ */ jsx("circle", { cx: "12", cy: "10", r: "3" })
3366
3366
  ] });
3367
+ var DEFAULT_VIEWS = ["list", "grid", "calendar"];
3367
3368
  function EventsWidget({
3368
3369
  events: propEvents,
3369
3370
  defaultView = "list",
3371
+ availableViews = DEFAULT_VIEWS,
3370
3372
  showViewToggle = true,
3371
3373
  title,
3372
3374
  subtitle,
@@ -3390,7 +3392,10 @@ function EventsWidget({
3390
3392
  eventCardClassName = "",
3391
3393
  modalClassName = ""
3392
3394
  }) {
3393
- const [viewMode, setViewMode] = useState(defaultView);
3395
+ const views = availableViews.length > 0 ? availableViews : DEFAULT_VIEWS;
3396
+ const resolvedDefault = views.includes(defaultView) ? defaultView : views[0];
3397
+ const [viewMode, setViewMode] = useState(resolvedDefault);
3398
+ const effectiveView = views.includes(viewMode) ? viewMode : views[0];
3394
3399
  const [events, setEvents] = useState(propEvents || []);
3395
3400
  const [loading, setLoading] = useState(!propEvents);
3396
3401
  const [error, setError] = useState(null);
@@ -3510,7 +3515,7 @@ function EventsWidget({
3510
3515
  ] })
3511
3516
  ] });
3512
3517
  }
3513
- const displayEvents = viewMode === "list" || viewMode === "grid" ? events.slice(0, limit) : events;
3518
+ const displayEvents = effectiveView === "list" || effectiveView === "grid" ? events.slice(0, limit) : events;
3514
3519
  return /* @__PURE__ */ jsxs("div", { className: `site-kit-events-widget ${className}`, children: [
3515
3520
  (title || subtitle || showViewToggle) && /* @__PURE__ */ jsxs(
3516
3521
  "div",
@@ -3541,7 +3546,7 @@ function EventsWidget({
3541
3546
  borderRadius: "0.5rem"
3542
3547
  },
3543
3548
  children: [
3544
- /* @__PURE__ */ jsxs(
3549
+ views.includes("list") && /* @__PURE__ */ jsxs(
3545
3550
  "button",
3546
3551
  {
3547
3552
  onClick: () => setViewMode("list"),
@@ -3566,7 +3571,7 @@ function EventsWidget({
3566
3571
  ]
3567
3572
  }
3568
3573
  ),
3569
- /* @__PURE__ */ jsxs(
3574
+ views.includes("grid") && /* @__PURE__ */ jsxs(
3570
3575
  "button",
3571
3576
  {
3572
3577
  onClick: () => setViewMode("grid"),
@@ -3591,7 +3596,7 @@ function EventsWidget({
3591
3596
  ]
3592
3597
  }
3593
3598
  ),
3594
- /* @__PURE__ */ jsxs(
3599
+ views.includes("calendar") && /* @__PURE__ */ jsxs(
3595
3600
  "button",
3596
3601
  {
3597
3602
  onClick: () => setViewMode("calendar"),
@@ -3622,7 +3627,7 @@ function EventsWidget({
3622
3627
  ]
3623
3628
  }
3624
3629
  ),
3625
- viewMode === "list" ? /* @__PURE__ */ jsxs("div", { className: `site-kit-events-list ${listClassName}`, children: [
3630
+ effectiveView === "list" ? /* @__PURE__ */ jsxs("div", { className: `site-kit-events-list ${listClassName}`, children: [
3626
3631
  /* @__PURE__ */ jsx("div", { style: { display: "flex", flexDirection: "column", gap: "1rem" }, children: displayEvents.map((eventItem) => {
3627
3632
  const nextSchedule = eventItem.next_schedule || eventItem.schedules?.[0];
3628
3633
  const isFree = !eventItem.price || eventItem.price === 0;
@@ -3739,7 +3744,7 @@ function EventsWidget({
3739
3744
  children: viewAllText
3740
3745
  }
3741
3746
  ) })
3742
- ] }) : viewMode === "grid" ? /* @__PURE__ */ jsxs("div", { className: `site-kit-events-grid ${listClassName}`, children: [
3747
+ ] }) : effectiveView === "grid" ? /* @__PURE__ */ jsxs("div", { className: `site-kit-events-grid ${listClassName}`, children: [
3743
3748
  /* @__PURE__ */ jsx("div", { style: {
3744
3749
  display: "grid",
3745
3750
  gridTemplateColumns: "repeat(auto-fill, minmax(280px, 1fr))",
@@ -3872,5 +3877,5 @@ function getApiKey() {
3872
3877
  }
3873
3878
 
3874
3879
  export { CalendarView, CheckoutForm, EventCalendar, EventEmbed, EventModal, EventTile, EventsWidget, OfferingCard, OfferingList, ProductDetail, ProductEmbed, ProductGrid, ProductPage, RegistrationForm, UpcomingEvents, createCheckoutSession, fetchActiveProcessor, fetchCategories, fetchLatestOffering, fetchNextEvent, fetchOffering, fetchOfferings, fetchProductBySlug, fetchProducts, fetchProductsPublic, fetchServices, fetchUpcomingEvents, formatDate, formatDateRange, formatDateTime, formatPrice, formatTime, getOfferingUrl, getRelativeTimeUntil, getSpotsRemaining, isEventSoldOut, registerForEvent, useEventModal };
3875
- //# sourceMappingURL=chunk-QY7CDW6P.mjs.map
3876
- //# sourceMappingURL=chunk-QY7CDW6P.mjs.map
3880
+ //# sourceMappingURL=chunk-L474IOHD.mjs.map
3881
+ //# sourceMappingURL=chunk-L474IOHD.mjs.map