@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.
@@ -3370,9 +3370,11 @@ var LocationIcon = () => /* @__PURE__ */ jsxRuntime.jsxs("svg", { xmlns: "http:/
3370
3370
  /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z" }),
3371
3371
  /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "10", r: "3" })
3372
3372
  ] });
3373
+ var DEFAULT_VIEWS = ["list", "grid", "calendar"];
3373
3374
  function EventsWidget({
3374
3375
  events: propEvents,
3375
3376
  defaultView = "list",
3377
+ availableViews = DEFAULT_VIEWS,
3376
3378
  showViewToggle = true,
3377
3379
  title,
3378
3380
  subtitle,
@@ -3396,7 +3398,10 @@ function EventsWidget({
3396
3398
  eventCardClassName = "",
3397
3399
  modalClassName = ""
3398
3400
  }) {
3399
- const [viewMode, setViewMode] = React5.useState(defaultView);
3401
+ const views = availableViews.length > 0 ? availableViews : DEFAULT_VIEWS;
3402
+ const resolvedDefault = views.includes(defaultView) ? defaultView : views[0];
3403
+ const [viewMode, setViewMode] = React5.useState(resolvedDefault);
3404
+ const effectiveView = views.includes(viewMode) ? viewMode : views[0];
3400
3405
  const [events, setEvents] = React5.useState(propEvents || []);
3401
3406
  const [loading, setLoading] = React5.useState(!propEvents);
3402
3407
  const [error, setError] = React5.useState(null);
@@ -3516,7 +3521,7 @@ function EventsWidget({
3516
3521
  ] })
3517
3522
  ] });
3518
3523
  }
3519
- const displayEvents = viewMode === "list" || viewMode === "grid" ? events.slice(0, limit) : events;
3524
+ const displayEvents = effectiveView === "list" || effectiveView === "grid" ? events.slice(0, limit) : events;
3520
3525
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `site-kit-events-widget ${className}`, children: [
3521
3526
  (title || subtitle || showViewToggle) && /* @__PURE__ */ jsxRuntime.jsxs(
3522
3527
  "div",
@@ -3547,7 +3552,7 @@ function EventsWidget({
3547
3552
  borderRadius: "0.5rem"
3548
3553
  },
3549
3554
  children: [
3550
- /* @__PURE__ */ jsxRuntime.jsxs(
3555
+ views.includes("list") && /* @__PURE__ */ jsxRuntime.jsxs(
3551
3556
  "button",
3552
3557
  {
3553
3558
  onClick: () => setViewMode("list"),
@@ -3572,7 +3577,7 @@ function EventsWidget({
3572
3577
  ]
3573
3578
  }
3574
3579
  ),
3575
- /* @__PURE__ */ jsxRuntime.jsxs(
3580
+ views.includes("grid") && /* @__PURE__ */ jsxRuntime.jsxs(
3576
3581
  "button",
3577
3582
  {
3578
3583
  onClick: () => setViewMode("grid"),
@@ -3597,7 +3602,7 @@ function EventsWidget({
3597
3602
  ]
3598
3603
  }
3599
3604
  ),
3600
- /* @__PURE__ */ jsxRuntime.jsxs(
3605
+ views.includes("calendar") && /* @__PURE__ */ jsxRuntime.jsxs(
3601
3606
  "button",
3602
3607
  {
3603
3608
  onClick: () => setViewMode("calendar"),
@@ -3628,7 +3633,7 @@ function EventsWidget({
3628
3633
  ]
3629
3634
  }
3630
3635
  ),
3631
- viewMode === "list" ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `site-kit-events-list ${listClassName}`, children: [
3636
+ effectiveView === "list" ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `site-kit-events-list ${listClassName}`, children: [
3632
3637
  /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", flexDirection: "column", gap: "1rem" }, children: displayEvents.map((eventItem) => {
3633
3638
  const nextSchedule = eventItem.next_schedule || eventItem.schedules?.[0];
3634
3639
  const isFree = !eventItem.price || eventItem.price === 0;
@@ -3745,7 +3750,7 @@ function EventsWidget({
3745
3750
  children: viewAllText
3746
3751
  }
3747
3752
  ) })
3748
- ] }) : viewMode === "grid" ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `site-kit-events-grid ${listClassName}`, children: [
3753
+ ] }) : effectiveView === "grid" ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `site-kit-events-grid ${listClassName}`, children: [
3749
3754
  /* @__PURE__ */ jsxRuntime.jsx("div", { style: {
3750
3755
  display: "grid",
3751
3756
  gridTemplateColumns: "repeat(auto-fill, minmax(280px, 1fr))",
@@ -3915,5 +3920,5 @@ exports.getSpotsRemaining = getSpotsRemaining;
3915
3920
  exports.isEventSoldOut = isEventSoldOut;
3916
3921
  exports.registerForEvent = registerForEvent;
3917
3922
  exports.useEventModal = useEventModal;
3918
- //# sourceMappingURL=chunk-ZGT5ZYQ5.js.map
3919
- //# sourceMappingURL=chunk-ZGT5ZYQ5.js.map
3923
+ //# sourceMappingURL=chunk-WNCM4GNY.js.map
3924
+ //# sourceMappingURL=chunk-WNCM4GNY.js.map