@campphillip/widgets 4.0.9 → 4.0.10

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.
@@ -1,6 +1,6 @@
1
- import { j as t, r as o } from "./vendor.js";
2
- import { E as c, f as h, a as d } from "./EventContainer.js";
3
- const u = () => /* @__PURE__ */ t.jsxs(
1
+ import { j as e, r as o } from "./vendor.js";
2
+ import { E as c, f as x } from "./EventContainer.js";
3
+ const d = () => /* @__PURE__ */ e.jsxs(
4
4
  "svg",
5
5
  {
6
6
  xmlns: "http://www.w3.org/2000/svg",
@@ -14,48 +14,50 @@ const u = () => /* @__PURE__ */ t.jsxs(
14
14
  strokeLinejoin: "round",
15
15
  className: "feather feather-calendar",
16
16
  children: [
17
- /* @__PURE__ */ t.jsx("rect", { x: "3", y: "4", width: "18", height: "18", rx: "2", ry: "2" }),
18
- /* @__PURE__ */ t.jsx("line", { x1: "16", y1: "2", x2: "16", y2: "6" }),
19
- /* @__PURE__ */ t.jsx("line", { x1: "8", y1: "2", x2: "8", y2: "6" }),
20
- /* @__PURE__ */ t.jsx("line", { x1: "3", y1: "10", x2: "21", y2: "10" })
17
+ /* @__PURE__ */ e.jsx("rect", { x: "3", y: "4", width: "18", height: "18", rx: "2", ry: "2" }),
18
+ /* @__PURE__ */ e.jsx("line", { x1: "16", y1: "2", x2: "16", y2: "6" }),
19
+ /* @__PURE__ */ e.jsx("line", { x1: "8", y1: "2", x2: "8", y2: "6" }),
20
+ /* @__PURE__ */ e.jsx("line", { x1: "3", y1: "10", x2: "21", y2: "10" })
21
21
  ]
22
22
  }
23
- ), f = "_calendarButton_1m4jh_1", v = {
24
- calendarButton: f
25
- }, j = ({
26
- events: e,
23
+ ), h = "_calendarButton_1m4jh_1", u = {
24
+ calendarButton: h
25
+ }, v = ({
26
+ events: t,
27
27
  loading: n
28
28
  }) => {
29
- const s = /* @__PURE__ */ t.jsxs("a", { className: v.calendarButton, href: "/calendar", children: [
30
- /* @__PURE__ */ t.jsx(u, {}),
29
+ const s = /* @__PURE__ */ e.jsxs("a", { className: u.calendarButton, href: "/calendar", children: [
30
+ /* @__PURE__ */ e.jsx(d, {}),
31
31
  "Check out our calendar"
32
32
  ] });
33
- return /* @__PURE__ */ t.jsx(
33
+ return /* @__PURE__ */ e.jsx(
34
34
  c,
35
35
  {
36
- events: e,
36
+ events: t,
37
37
  loading: n,
38
38
  title: "What's going on at Camp?",
39
39
  headerActions: s
40
40
  }
41
41
  );
42
- }, E = ({
43
- events: e,
42
+ }, j = ({
43
+ events: t,
44
44
  loading: n
45
- }) => /* @__PURE__ */ t.jsx(
45
+ }) => /* @__PURE__ */ e.jsx(
46
46
  c,
47
47
  {
48
- events: e,
48
+ events: t,
49
49
  loading: n,
50
50
  title: "Upcoming Board Events"
51
51
  }
52
- ), g = ({ type: e }) => {
52
+ ), E = ({ type: t }) => {
53
53
  const [n, s] = o.useState([]), [a, i] = o.useState(!0);
54
54
  return o.useEffect(() => {
55
55
  async function l() {
56
- const x = e === "events" ? h : d;
57
56
  try {
58
- const r = await x();
57
+ const r = await x({
58
+ eventType: t === "events" ? "event" : "board-event",
59
+ limit: 3
60
+ });
59
61
  s(r);
60
62
  } catch (r) {
61
63
  console.error(r);
@@ -64,8 +66,8 @@ const u = () => /* @__PURE__ */ t.jsxs(
64
66
  }
65
67
  }
66
68
  l();
67
- }, [e]), e === "events" ? /* @__PURE__ */ t.jsx(j, { events: n, loading: a }) : /* @__PURE__ */ t.jsx(E, { events: n, loading: a });
69
+ }, [t]), t === "events" ? /* @__PURE__ */ e.jsx(v, { events: n, loading: a }) : /* @__PURE__ */ e.jsx(j, { events: n, loading: a });
68
70
  };
69
71
  export {
70
- g as E
72
+ E
71
73
  };
@@ -1,6 +1,7 @@
1
- import { s as j, u as N } from "./sanityClient.js";
2
- import { j as e, S as g, a as h, b as p, P as S, i as q, f as x, d as D, R as M, r as B } from "./vendor.js";
3
- const V = async () => await j.fetch(`*[_type == 'event'] | order(startDate asc)
1
+ import { s as N, u as y } from "./sanityClient.js";
2
+ import { j as e, S as M, a as f, b as x, P as S, i as g, f as C, d as q, R as D, r as B } from "./vendor.js";
3
+ const V = async (t) => {
4
+ const { eventType: a = "event", limit: n, includePassedEvents: r = !1 } = t || {}, v = r ? "" : "&& endDate >= now()", u = n ? `[0...${n}]` : "", l = `*[_type == '${a}' ${v}] | order(startDate asc) ${u}
4
5
  {
5
6
  name,
6
7
  image,
@@ -10,162 +11,153 @@ const V = async () => await j.fetch(`*[_type == 'event'] | order(startDate asc)
10
11
  shortDescription,
11
12
  buttons,
12
13
  isSummerCampEvent
13
- }`), X = async () => await j.fetch(`*[_type == 'board-event'] | order(startDate asc)
14
- {
15
- name,
16
- image,
17
- imageType,
18
- startDate,
19
- endDate,
20
- shortDescription,
21
- buttons,
22
- isSummerCampEvent
23
- }`), E = "_eventCard_17x4q_1", b = "_eventCardBody_17x4q_13", T = "_image_17x4q_27", W = "_square_17x4q_34", $ = "_eventCardTitle_17x4q_39", G = "_eventCardDate_17x4q_46", k = "_eventCardDescription_17x4q_51", H = "_eventButtons_17x4q_55", w = "_eventButton_17x4q_55", I = "_summerCamp_17x4q_140", n = {
14
+ }`;
15
+ return await N.fetch(l);
16
+ }, E = "_eventCard_17x4q_1", T = "_eventCardBody_17x4q_13", $ = "_image_17x4q_27", b = "_square_17x4q_34", W = "_eventCardTitle_17x4q_39", G = "_eventCardDate_17x4q_46", k = "_eventCardDescription_17x4q_51", H = "_eventButtons_17x4q_55", w = "_eventButton_17x4q_55", F = "_summerCamp_17x4q_140", m = {
24
17
  eventCard: E,
25
- eventCardBody: b,
26
- image: T,
27
- square: W,
28
- eventCardTitle: $,
18
+ eventCardBody: T,
19
+ image: $,
20
+ square: b,
21
+ eventCardTitle: W,
29
22
  eventCardDate: G,
30
23
  eventCardDescription: k,
31
24
  eventButtons: H,
32
25
  eventButton: w,
33
- summerCamp: I
34
- }, C = ({
26
+ summerCamp: F
27
+ }, _ = ({
35
28
  name: t,
36
29
  image: a,
37
- imageType: d,
38
- startDate: m,
39
- endDate: _,
40
- shortDescription: v,
41
- buttons: u,
42
- loading: f,
43
- containerStyle: i,
30
+ imageType: n,
31
+ startDate: r,
32
+ endDate: v,
33
+ shortDescription: u,
34
+ buttons: l,
35
+ loading: j,
36
+ containerStyle: c,
44
37
  isSummerCampEvent: o
45
38
  }) => {
46
- const l = L(m, _);
47
- return /* @__PURE__ */ e.jsx(g, { baseColor: "#dcdcdc", children: /* @__PURE__ */ e.jsxs(
39
+ const p = I(r, v);
40
+ return /* @__PURE__ */ e.jsx(M, { baseColor: "#dcdcdc", children: /* @__PURE__ */ e.jsxs(
48
41
  "div",
49
42
  {
50
- className: h(
51
- n.eventCard,
52
- o && n.summerCamp
43
+ className: f(
44
+ m.eventCard,
45
+ o && m.summerCamp
53
46
  ),
54
- style: { ...i },
47
+ style: { ...c },
55
48
  children: [
56
49
  a ? /* @__PURE__ */ e.jsx(
57
50
  "img",
58
51
  {
59
- src: N(a).height(400).url(),
60
- className: h(
61
- n.image,
62
- d === "square" && n.square
52
+ src: y(a).height(400).url(),
53
+ className: f(
54
+ m.image,
55
+ n === "square" && m.square
63
56
  ),
64
57
  crossOrigin: "anonymous",
65
58
  alt: ""
66
59
  }
67
- ) : /* @__PURE__ */ e.jsx("div", { className: n.image, children: /* @__PURE__ */ e.jsx(
68
- p,
60
+ ) : /* @__PURE__ */ e.jsx("div", { className: m.image, children: /* @__PURE__ */ e.jsx(
61
+ x,
69
62
  {
70
63
  height: 400,
71
64
  style: { lineHeight: "normal" }
72
65
  }
73
66
  ) }),
74
- /* @__PURE__ */ e.jsxs("div", { className: n.eventCardBody, children: [
67
+ /* @__PURE__ */ e.jsxs("div", { className: m.eventCardBody, children: [
75
68
  /* @__PURE__ */ e.jsxs("div", { children: [
76
- /* @__PURE__ */ e.jsx("h3", { className: n.eventCardTitle, children: t || /* @__PURE__ */ e.jsx(p, {}) }),
77
- /* @__PURE__ */ e.jsx("div", { className: n.eventCardDate, children: l || /* @__PURE__ */ e.jsx(p, {}) })
69
+ /* @__PURE__ */ e.jsx("h3", { className: m.eventCardTitle, children: t || /* @__PURE__ */ e.jsx(x, {}) }),
70
+ /* @__PURE__ */ e.jsx("div", { className: m.eventCardDate, children: p || /* @__PURE__ */ e.jsx(x, {}) })
78
71
  ] }),
79
- /* @__PURE__ */ e.jsx("div", { className: n.eventCardDescription, children: v ? /* @__PURE__ */ e.jsx(S, { value: v }) : /* @__PURE__ */ e.jsx(p, { count: 7 }) }),
80
- /* @__PURE__ */ e.jsx("div", { className: n.eventButtons, children: u ? u.map(({ url: s, text: r, _key: y }) => /* @__PURE__ */ e.jsx(
72
+ /* @__PURE__ */ e.jsx("div", { className: m.eventCardDescription, children: u ? /* @__PURE__ */ e.jsx(S, { value: u }) : /* @__PURE__ */ e.jsx(x, { count: 7 }) }),
73
+ /* @__PURE__ */ e.jsx("div", { className: m.eventButtons, children: l ? l.map(({ url: s, text: i, _key: h }) => /* @__PURE__ */ e.jsx(
81
74
  "a",
82
75
  {
83
76
  href: s,
84
- className: n.eventButton,
85
- children: /* @__PURE__ */ e.jsx("div", { children: r })
77
+ className: m.eventButton,
78
+ children: /* @__PURE__ */ e.jsx("div", { children: i })
86
79
  },
87
- y
88
- )) : f && /* @__PURE__ */ e.jsx(p, { className: n.eventButton }) })
80
+ h
81
+ )) : j && /* @__PURE__ */ e.jsx(x, { className: m.eventButton }) })
89
82
  ] })
90
83
  ]
91
84
  }
92
85
  ) });
93
86
  };
94
- function L(t, a) {
87
+ function I(t, a) {
95
88
  if (!t || !a) return null;
96
- const d = new Date(t), m = new Date(a);
97
- return q(d, m) ? x(d, "MMMM d") : D(d, m) ? x(d, "MMMM d") + " – " + x(m, "d") : x(d, "MMMM d") + " – " + x(m, "MMMM d");
89
+ const n = new Date(t), r = new Date(a);
90
+ return g(n, r) ? C(n, "MMMM d") : q(n, r) ? C(n, "MMMM d") + " – " + C(r, "d") : C(n, "MMMM d") + " – " + C(r, "MMMM d");
98
91
  }
99
- const F = "_eventsContainer_1fuij_1", R = "_eventsHeader_1fuij_11", P = "_eventsList_1fuij_28", O = "_eventWrapper_1fuij_34", z = "_summerCampGroup_1fuij_38", J = "_summerCampTitle_1fuij_50", K = "_empty_1fuij_60", c = {
100
- eventsContainer: F,
101
- eventsHeader: R,
102
- eventsList: P,
92
+ const L = "_eventsContainer_1fuij_1", P = "_eventsHeader_1fuij_11", R = "_eventsList_1fuij_28", O = "_eventWrapper_1fuij_34", z = "_summerCampGroup_1fuij_38", J = "_summerCampTitle_1fuij_50", K = "_empty_1fuij_60", d = {
93
+ eventsContainer: L,
94
+ eventsHeader: P,
95
+ eventsList: R,
103
96
  eventWrapper: O,
104
97
  summerCampGroup: z,
105
98
  summerCampTitle: J,
106
99
  empty: K
107
- }, Y = ({
100
+ }, X = ({
108
101
  events: t,
109
102
  loading: a,
110
- className: d,
111
- title: m = "What's going on at Camp?",
112
- headerActions: _,
113
- groupSummerCampEvents: v = !1
103
+ className: n,
104
+ title: r = "What's going on at Camp?",
105
+ headerActions: v,
106
+ groupSummerCampEvents: u = !1
114
107
  }) => {
115
- const u = M.useMemo(() => {
108
+ const l = D.useMemo(() => {
116
109
  if (!t) return [];
117
- if (!v)
118
- return t.map((s, r) => ({ isSummerCamp: !1, events: [s], startIndex: r }));
119
- const i = t.filter((s) => s.isSummerCampEvent), o = t.findIndex((s) => s.isSummerCampEvent);
120
- if (i.length === 0)
121
- return t.map((s, r) => ({ isSummerCamp: !1, events: [s], startIndex: r }));
122
- let l = !1;
123
- return t.flatMap((s, r) => s.isSummerCampEvent ? l ? [] : (l = !0, [{ isSummerCamp: !0, events: i, startIndex: o }]) : [{ isSummerCamp: !1, events: [s], startIndex: r }]);
124
- }, [t, v]), f = u.findIndex((i) => i.isSummerCamp);
125
- return /* @__PURE__ */ e.jsxs("div", { className: `${c.eventsContainer} ${d || ""}`, children: [
126
- (m || _) && /* @__PURE__ */ e.jsxs("div", { className: c.eventsHeader, children: [
127
- m && /* @__PURE__ */ e.jsx("h1", { children: m }),
128
- _
110
+ if (!u)
111
+ return t.map((s, i) => ({ isSummerCamp: !1, events: [s], startIndex: i }));
112
+ const c = t.filter((s) => s.isSummerCampEvent), o = t.findIndex((s) => s.isSummerCampEvent);
113
+ if (c.length === 0)
114
+ return t.map((s, i) => ({ isSummerCamp: !1, events: [s], startIndex: i }));
115
+ let p = !1;
116
+ return t.flatMap((s, i) => s.isSummerCampEvent ? p ? [] : (p = !0, [{ isSummerCamp: !0, events: c, startIndex: o }]) : [{ isSummerCamp: !1, events: [s], startIndex: i }]);
117
+ }, [t, u]), j = l.findIndex((c) => c.isSummerCamp);
118
+ return /* @__PURE__ */ e.jsxs("div", { className: `${d.eventsContainer} ${n || ""}`, children: [
119
+ (r || v) && /* @__PURE__ */ e.jsxs("div", { className: d.eventsHeader, children: [
120
+ r && /* @__PURE__ */ e.jsx("h1", { children: r }),
121
+ v
129
122
  ] }),
130
- /* @__PURE__ */ e.jsx("div", { className: c.eventsList, children: a ? /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
131
- /* @__PURE__ */ e.jsx("div", { className: c.eventWrapper, children: /* @__PURE__ */ e.jsx(C, { loading: a }, "loading-1") }),
132
- /* @__PURE__ */ e.jsx("div", { className: c.eventWrapper, children: /* @__PURE__ */ e.jsx(C, { loading: a }, "loading-2") }),
133
- /* @__PURE__ */ e.jsx("div", { className: c.eventWrapper, children: /* @__PURE__ */ e.jsx(C, { loading: a }, "loading-3") })
134
- ] }) : u.length > 0 ? u.map((i, o) => {
135
- const l = o === f;
136
- return i.isSummerCamp ? /* @__PURE__ */ e.jsxs(
123
+ /* @__PURE__ */ e.jsx("div", { className: d.eventsList, children: a ? /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
124
+ /* @__PURE__ */ e.jsx("div", { className: d.eventWrapper, children: /* @__PURE__ */ e.jsx(_, { loading: a }, "loading-1") }),
125
+ /* @__PURE__ */ e.jsx("div", { className: d.eventWrapper, children: /* @__PURE__ */ e.jsx(_, { loading: a }, "loading-2") }),
126
+ /* @__PURE__ */ e.jsx("div", { className: d.eventWrapper, children: /* @__PURE__ */ e.jsx(_, { loading: a }, "loading-3") })
127
+ ] }) : l.length > 0 ? l.map((c, o) => {
128
+ const p = o === j;
129
+ return c.isSummerCamp ? /* @__PURE__ */ e.jsxs(
137
130
  "div",
138
131
  {
139
- className: c.summerCampGroup,
140
- id: l ? "summer-camp" : void 0,
132
+ className: d.summerCampGroup,
133
+ id: p ? "summer-camp" : void 0,
141
134
  children: [
142
- /* @__PURE__ */ e.jsx("h2", { className: c.summerCampTitle, children: "🏕️ Summer Camp" }),
143
- i.events.map((s, r) => /* @__PURE__ */ B.createElement(
144
- C,
135
+ /* @__PURE__ */ e.jsx("h2", { className: d.summerCampTitle, children: "🏕️ Summer Camp" }),
136
+ c.events.map((s, i) => /* @__PURE__ */ B.createElement(
137
+ _,
145
138
  {
146
139
  ...s,
147
- key: `${o}-${r}`,
140
+ key: `${o}-${i}`,
148
141
  loading: a
149
142
  }
150
143
  ))
151
144
  ]
152
145
  },
153
146
  `group-${o}`
154
- ) : i.events.map((s, r) => /* @__PURE__ */ e.jsx("div", { className: c.eventWrapper, children: /* @__PURE__ */ e.jsx(
155
- C,
147
+ ) : c.events.map((s, i) => /* @__PURE__ */ e.jsx("div", { className: d.eventWrapper, children: /* @__PURE__ */ e.jsx(
148
+ _,
156
149
  {
157
150
  ...s,
158
151
  loading: a
159
152
  }
160
- ) }, `${o}-${r}`));
161
- }) : /* @__PURE__ */ e.jsxs("div", { className: c.empty, children: [
153
+ ) }, `${o}-${i}`));
154
+ }) : /* @__PURE__ */ e.jsxs("div", { className: d.empty, children: [
162
155
  /* @__PURE__ */ e.jsx("img", { src: "https://d2114hmso7dut1.cloudfront.net/customers/096355b6-1a03-11eb-a9c3-0614187498c1/sites/096f9d4e-1a03-11eb-b2dd-0614187498c1/files/67900ba0-5f83-11eb-9222-e3d4d8baf1a9/original/file.png?t=1611630366" }),
163
156
  "No upcoming events. Check back later!"
164
157
  ] }) })
165
158
  ] });
166
159
  };
167
160
  export {
168
- Y as E,
169
- X as a,
161
+ X as E,
170
162
  V as f
171
163
  };
@@ -1,7 +1,7 @@
1
- import { j as t, r as o, c as l, R as i } from "./vendor.js";
2
- import { E, f as d } from "./EventContainer.js";
3
- const p = "_summerEventsButton_qc18l_2", f = {
4
- summerEventsButton: p
1
+ import { j as t, r as o, c as u, R as i } from "./vendor.js";
2
+ import { E as l, f as E } from "./EventContainer.js";
3
+ const d = "_summerEventsButton_qc18l_2", p = {
4
+ summerEventsButton: d
5
5
  }, v = ({
6
6
  events: e,
7
7
  loading: s
@@ -9,7 +9,7 @@ const p = "_summerEventsButton_qc18l_2", f = {
9
9
  const n = e?.some((r) => r.isSummerCampEvent) ? /* @__PURE__ */ t.jsxs(
10
10
  "a",
11
11
  {
12
- className: f.summerEventsButton,
12
+ className: p.summerEventsButton,
13
13
  href: "#summer-camp",
14
14
  children: [
15
15
  /* @__PURE__ */ t.jsx("span", { children: "🏕️" }),
@@ -18,7 +18,7 @@ const p = "_summerEventsButton_qc18l_2", f = {
18
18
  }
19
19
  ) : null;
20
20
  return /* @__PURE__ */ t.jsx(
21
- E,
21
+ l,
22
22
  {
23
23
  events: e,
24
24
  loading: s,
@@ -27,28 +27,30 @@ const p = "_summerEventsButton_qc18l_2", f = {
27
27
  groupSummerCampEvents: !0
28
28
  }
29
29
  );
30
- }, h = ({ className: e }) => {
31
- const [s, c] = o.useState([]), [n, r] = o.useState(!0);
30
+ }, f = () => {
31
+ const [e, s] = o.useState([]), [c, n] = o.useState(!0);
32
32
  return o.useEffect(() => {
33
- async function u() {
33
+ async function r() {
34
34
  try {
35
- const a = await d();
36
- c(a);
35
+ const a = await E({
36
+ includePassedEvents: !0
37
+ });
38
+ s(a);
37
39
  } catch (a) {
38
40
  console.error(a);
39
41
  } finally {
40
- r(!1);
42
+ n(!1);
41
43
  }
42
44
  }
43
- u();
45
+ r();
44
46
  }, []), /* @__PURE__ */ t.jsx(
45
47
  v,
46
48
  {
47
- events: s,
48
- loading: n
49
+ events: e,
50
+ loading: c
49
51
  }
50
52
  );
51
53
  }, m = document.getElementById("camp-calendar");
52
- m && l.createRoot(m).render(
53
- /* @__PURE__ */ t.jsx(i.StrictMode, { children: /* @__PURE__ */ t.jsx(h, {}) })
54
+ m && u.createRoot(m).render(
55
+ /* @__PURE__ */ t.jsx(i.StrictMode, { children: /* @__PURE__ */ t.jsx(f, {}) })
54
56
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@campphillip/widgets",
3
- "version": "4.0.9",
3
+ "version": "4.0.10",
4
4
  "description": "",
5
5
  "sideEffects": false,
6
6
  "type": "module",