@scrippsproduct/networks-ui-library 1.1.0-alpha.7 → 1.1.0-alpha.8
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/components/ScheduleLayout/ScheduleContext.d.ts +4 -2
- package/dist/components/ScheduleLayout/ScheduleContext.js +1919 -29
- package/dist/components/ScheduleLayout/ScheduleLayout.d.ts +3 -3
- package/dist/components/ScheduleLayout/ScheduleLayout.js +52 -52
- package/dist/components/ScheduleLayout/useScheduleContext.d.ts +1 -0
- package/dist/components/ScheduleList/ScheduleList.d.ts +1 -2
- package/dist/components/ScheduleList/ScheduleList.js +35 -36
- package/package.json +3 -2
|
@@ -7,11 +7,11 @@ type Day = {
|
|
|
7
7
|
fullDateStr: string;
|
|
8
8
|
};
|
|
9
9
|
type ScheduleLayoutProps = {
|
|
10
|
-
|
|
10
|
+
fetchSchedule: (date: Date) => Promise<ScheduleResponse>;
|
|
11
|
+
initialSchedule?: ScheduleResponse;
|
|
11
12
|
weeks?: Day[][];
|
|
12
13
|
handleScheduleClicks?: (details: HandleClicksDetails) => boolean | void;
|
|
13
14
|
handleDateChanged?: (date: Date) => boolean | void;
|
|
14
|
-
fetchError?: boolean;
|
|
15
15
|
};
|
|
16
|
-
export declare function ScheduleLayout({
|
|
16
|
+
export declare function ScheduleLayout({ fetchSchedule, initialSchedule, weeks, handleScheduleClicks, handleDateChanged, }: ScheduleLayoutProps): JSX.Element;
|
|
17
17
|
export default ScheduleLayout;
|
|
@@ -1,33 +1,32 @@
|
|
|
1
|
-
import { jsx as t, jsxs as
|
|
2
|
-
import { useRef as d, useCallback as
|
|
3
|
-
import { f as
|
|
4
|
-
import { l as
|
|
5
|
-
import { classes as
|
|
6
|
-
import { ScheduleProvider as
|
|
7
|
-
import { useScheduleContext as
|
|
8
|
-
import { DateNavigation as
|
|
9
|
-
import { ScheduleList as
|
|
10
|
-
|
|
11
|
-
import '../../assets/ScheduleLayout.css';function
|
|
12
|
-
handleScheduleClicks: f = () => !0
|
|
13
|
-
fetchError: p = !1
|
|
1
|
+
import { jsx as t, jsxs as b } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as d, useCallback as S, useEffect as y } from "react";
|
|
3
|
+
import { f as w } from "../../format-YhWt2D8M.mjs";
|
|
4
|
+
import { l as i } from "../../logger-C0N7U0YY.mjs";
|
|
5
|
+
import { classes as L } from "../../utils/helpers.js";
|
|
6
|
+
import { ScheduleProvider as E } from "./ScheduleContext.js";
|
|
7
|
+
import { useScheduleContext as T } from "./useScheduleContext.js";
|
|
8
|
+
import { DateNavigation as k } from "../DateNavigation/DateNavigation.js";
|
|
9
|
+
import { ScheduleList as q } from "../ScheduleList/ScheduleList.js";
|
|
10
|
+
i.setComponent("ScheduleLayout");
|
|
11
|
+
import '../../assets/ScheduleLayout.css';function x({
|
|
12
|
+
handleScheduleClicks: f = () => !0
|
|
14
13
|
}) {
|
|
15
|
-
const { currentDate: n } =
|
|
16
|
-
|
|
17
|
-
const
|
|
14
|
+
const { currentDate: n } = T(), r = d(null), p = d(0), o = d(null), s = d(null), l = d(null), a = S((u) => {
|
|
15
|
+
i.log("Determining pointer position for date: ", u);
|
|
16
|
+
const c = () => {
|
|
18
17
|
let e;
|
|
19
|
-
const
|
|
20
|
-
if (
|
|
21
|
-
const
|
|
22
|
-
|
|
18
|
+
const v = document.querySelector(`.date-navigation__day[aria-controls="${w(u, "yyyy-MM-dd")}"]`);
|
|
19
|
+
if (v && (e = v.parentElement), e && r.current) {
|
|
20
|
+
const g = e.offsetLeft + e.offsetWidth / 2;
|
|
21
|
+
p.current = g, r.current.style.setProperty(
|
|
23
22
|
"--pointer-position",
|
|
24
|
-
`${
|
|
23
|
+
`${g}px`
|
|
25
24
|
);
|
|
26
25
|
}
|
|
27
|
-
},
|
|
28
|
-
|
|
26
|
+
}, h = () => {
|
|
27
|
+
i.log("Scrolling schedule list to top"), i.log("Schedule list element: ", s.current), i.log("Sticky wrapper element: ", l.current);
|
|
29
28
|
const e = document.querySelector(".mobile-nav");
|
|
30
|
-
s.current && l.current && (
|
|
29
|
+
s.current && l.current && (i.log("Mobile nav element: ", e), window.scrollTo({
|
|
31
30
|
behavior: "auto",
|
|
32
31
|
top: e && window.getComputedStyle(e).display !== "none" ? s.current.offsetTop - l.current.offsetHeight - e.offsetHeight - 8 : s.current.offsetTop - l.current.offsetHeight - 16,
|
|
33
32
|
left: 0
|
|
@@ -35,68 +34,69 @@ import '../../assets/ScheduleLayout.css';function C({
|
|
|
35
34
|
};
|
|
36
35
|
if (!r.current) {
|
|
37
36
|
const e = setInterval(() => {
|
|
38
|
-
r.current = document.querySelector(".date-navigation__list"), r.current && (clearInterval(e), s.current = document.querySelector(".schedule-list"), l.current = document.querySelector("sticky-content-wrapper"),
|
|
37
|
+
r.current = document.querySelector(".date-navigation__list"), r.current && (clearInterval(e), s.current = document.querySelector(".schedule-list"), l.current = document.querySelector("sticky-content-wrapper"), c(), h());
|
|
39
38
|
}, 100);
|
|
40
39
|
setTimeout(() => {
|
|
41
40
|
clearInterval(e);
|
|
42
41
|
}, 3e3);
|
|
43
42
|
return;
|
|
44
43
|
}
|
|
45
|
-
|
|
46
|
-
}, []),
|
|
47
|
-
|
|
44
|
+
c(), h();
|
|
45
|
+
}, []), m = S(() => {
|
|
46
|
+
o.current && clearTimeout(o.current), o.current = window.setTimeout(() => {
|
|
48
47
|
a(n);
|
|
49
48
|
}, 250);
|
|
50
49
|
}, [n, a]);
|
|
51
|
-
return
|
|
52
|
-
window.removeEventListener("resize",
|
|
53
|
-
}), [a,
|
|
54
|
-
const u = document.querySelector(".header-divider"),
|
|
55
|
-
|
|
50
|
+
return y(() => (window.addEventListener("resize", m), () => {
|
|
51
|
+
window.removeEventListener("resize", m), o.current && clearTimeout(o.current);
|
|
52
|
+
}), [a, m]), y(() => {
|
|
53
|
+
const u = document.querySelector(".header-divider"), c = document.querySelector("sticky-content-wrapper");
|
|
54
|
+
c && u && new IntersectionObserver(
|
|
56
55
|
([e]) => {
|
|
57
|
-
e.intersectionRatio < 1 ?
|
|
56
|
+
e.intersectionRatio < 1 ? c.dataset.pinnedState = "pinned" : c.dataset.pinnedState = "unpinned";
|
|
58
57
|
},
|
|
59
58
|
{
|
|
60
59
|
threshold: [1],
|
|
61
60
|
rootMargin: "-37px"
|
|
62
61
|
}
|
|
63
62
|
).observe(u);
|
|
64
|
-
}, []),
|
|
63
|
+
}, []), y(() => {
|
|
65
64
|
a(n);
|
|
66
|
-
}, [n, a]), /* @__PURE__ */
|
|
65
|
+
}, [n, a]), /* @__PURE__ */ b("schedule-layout", { children: [
|
|
67
66
|
/* @__PURE__ */ t("sticky-content-wrapper", { "data-pinned-state": "unpinned", children: /* @__PURE__ */ t(
|
|
68
67
|
"content-constrainer",
|
|
69
68
|
{
|
|
70
|
-
class:
|
|
69
|
+
class: L([
|
|
71
70
|
"content-constrainer--no-padding",
|
|
72
71
|
"content-constrainer--no-border",
|
|
73
72
|
"content-constrainer--lead-container",
|
|
74
73
|
"schedule-date-nav-constrainer"
|
|
75
74
|
]),
|
|
76
|
-
children: /* @__PURE__ */ t(
|
|
75
|
+
children: /* @__PURE__ */ t(k, {})
|
|
77
76
|
}
|
|
78
77
|
) }),
|
|
79
|
-
/* @__PURE__ */ t("section", { className: "page-section", id: "schedule-section", children: /* @__PURE__ */ t("content-constrainer", { class: "content-constrainer--no-border schedule-content-constrainer", children: /* @__PURE__ */ t("div", { id:
|
|
78
|
+
/* @__PURE__ */ t("section", { className: "page-section", id: "schedule-section", children: /* @__PURE__ */ t("content-constrainer", { class: "content-constrainer--no-border schedule-content-constrainer", children: /* @__PURE__ */ t("div", { id: w(n, "yyyy-MM-dd"), role: "tabpanel", children: /* @__PURE__ */ t(q, { handleClicks: f }) }) }) })
|
|
80
79
|
] });
|
|
81
80
|
}
|
|
82
|
-
function
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
81
|
+
function N({
|
|
82
|
+
fetchSchedule: f,
|
|
83
|
+
initialSchedule: n = [],
|
|
84
|
+
weeks: r = [],
|
|
85
|
+
handleScheduleClicks: p = () => !0,
|
|
86
|
+
handleDateChanged: o = () => !0
|
|
88
87
|
}) {
|
|
89
88
|
return /* @__PURE__ */ t(
|
|
90
|
-
|
|
89
|
+
E,
|
|
91
90
|
{
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
91
|
+
fetchSchedule: f,
|
|
92
|
+
handleDateChanged: o,
|
|
93
|
+
initialSchedule: n,
|
|
94
|
+
weeks: r,
|
|
95
|
+
children: /* @__PURE__ */ t(x, { handleScheduleClicks: p })
|
|
96
96
|
}
|
|
97
97
|
);
|
|
98
98
|
}
|
|
99
99
|
export {
|
|
100
|
-
|
|
101
|
-
|
|
100
|
+
N as ScheduleLayout,
|
|
101
|
+
N as default
|
|
102
102
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { HandleClicksDetails } from '../../types.d.ts';
|
|
2
2
|
type ScheduleListProps = {
|
|
3
3
|
handleClicks?: (details: HandleClicksDetails) => boolean | void;
|
|
4
|
-
fetchError?: boolean;
|
|
5
4
|
};
|
|
6
|
-
export declare function ScheduleList({ handleClicks,
|
|
5
|
+
export declare function ScheduleList({ handleClicks, }: ScheduleListProps): JSX.Element;
|
|
7
6
|
export default ScheduleList;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { jsx as a, jsxs as
|
|
2
|
-
import { useReducer as R, useState as A, useRef as w, useCallback as L, useEffect as
|
|
1
|
+
import { jsx as a, jsxs as g } from "react/jsx-runtime";
|
|
2
|
+
import { useReducer as R, useState as A, useRef as w, useCallback as L, useEffect as E } from "react";
|
|
3
3
|
import { classes as T, getMinutesFromStr as u } from "../../utils/helpers.js";
|
|
4
4
|
import { useScheduleContext as b } from "../ScheduleLayout/useScheduleContext.js";
|
|
5
5
|
import { Loading as x } from "../Loading/Loading.js";
|
|
6
6
|
import { SportsItem as D } from "./schedule-list-items/SportsItem.js";
|
|
7
7
|
import { SeriesItem as M } from "./schedule-list-items/SeriesItem.js";
|
|
8
8
|
import { MovieItem as k } from "./schedule-list-items/MovieItem.js";
|
|
9
|
-
import '../../assets/ScheduleList.css';const
|
|
9
|
+
import '../../assets/ScheduleList.css';const l = {
|
|
10
10
|
"schedule-list__item": "_schedule-list__item_wmqq1_1",
|
|
11
11
|
"schedule-list__airdate": "_schedule-list__airdate_wmqq1_14",
|
|
12
12
|
"airdate-formatter__date": "_airdate-formatter__date_wmqq1_22",
|
|
@@ -24,8 +24,8 @@ import '../../assets/ScheduleList.css';const f = {
|
|
|
24
24
|
function S(r) {
|
|
25
25
|
return typeof r == "object" && !Array.isArray(r) && (r == null ? void 0 : r.queryStatus) && r.queryStatus === "no-results";
|
|
26
26
|
}
|
|
27
|
-
function C(r,
|
|
28
|
-
switch (
|
|
27
|
+
function C(r, t) {
|
|
28
|
+
switch (t.type) {
|
|
29
29
|
case "START_EXIT":
|
|
30
30
|
return "exiting";
|
|
31
31
|
case "EXIT_COMPLETE":
|
|
@@ -38,9 +38,9 @@ function C(r, p) {
|
|
|
38
38
|
return r;
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
const
|
|
42
|
-
var
|
|
43
|
-
return (
|
|
41
|
+
const v = (r) => {
|
|
42
|
+
var t, s, y, n, e, o, d, f, _, p, i;
|
|
43
|
+
return (t = r.video) != null && t.brightcove_id ? {
|
|
44
44
|
label: "Watch Preview",
|
|
45
45
|
type: "play-video",
|
|
46
46
|
href: "",
|
|
@@ -71,10 +71,10 @@ const E = (r) => {
|
|
|
71
71
|
//'film',
|
|
72
72
|
position: void 0
|
|
73
73
|
//'inline',
|
|
74
|
-
} : (((
|
|
74
|
+
} : (((s = r == null ? void 0 : r.content) == null ? void 0 : s.external_link) !== void 0 && ((y = r == null ? void 0 : r.content) == null ? void 0 : y.external_link) !== "" || ((n = r == null ? void 0 : r.content) == null ? void 0 : n.slug) !== void 0 && ((e = r == null ? void 0 : r.content) == null ? void 0 : e.slug) !== "") && !((o = r == null ? void 0 : r.content) != null && o.prevent_detail_page) ? {
|
|
75
75
|
label: (r == null ? void 0 : r.program_class) === "Episode" ? "View Series Details" : (r == null ? void 0 : r.program_class) === "Film" ? "View Movie Details" : "Learn More",
|
|
76
76
|
type: (d = r == null ? void 0 : r.content) != null && d.external_link ? "external-link" : "internal-link",
|
|
77
|
-
href: (
|
|
77
|
+
href: (f = r == null ? void 0 : r.content) != null && f.external_link ? (_ = r == null ? void 0 : r.content) == null ? void 0 : _.external_link : r.program_class === "Episode" ? `/show/${(p = r == null ? void 0 : r.content) == null ? void 0 : p.slug}` : `/movie/${(i = r == null ? void 0 : r.content) == null ? void 0 : i.slug}`,
|
|
78
78
|
position: "inline"
|
|
79
79
|
} : {
|
|
80
80
|
label: "",
|
|
@@ -84,24 +84,23 @@ const E = (r) => {
|
|
|
84
84
|
};
|
|
85
85
|
};
|
|
86
86
|
function H({
|
|
87
|
-
handleClicks: r = () => !0
|
|
88
|
-
fetchError: p = !1
|
|
87
|
+
handleClicks: r = () => !0
|
|
89
88
|
}) {
|
|
90
|
-
const { schedule: t, isLoading: s } = b(), [n, e] = R(C, "idle"), [o, d] = A(t),
|
|
89
|
+
const { schedule: t, isLoading: s, isError: y } = b(), [n, e] = R(C, "idle"), [o, d] = A(t), f = w(null), _ = w(null), p = L(() => {
|
|
91
90
|
_.current && (clearTimeout(_.current), _.current = null), n === "exiting" ? e({ type: "EXIT_COMPLETE" }) : n === "entering" && e({ type: "ENTER_COMPLETE" });
|
|
92
91
|
}, [n]);
|
|
93
|
-
return
|
|
94
|
-
const i =
|
|
92
|
+
return E(() => {
|
|
93
|
+
const i = f.current;
|
|
95
94
|
if (i)
|
|
96
|
-
return i.addEventListener("animationend",
|
|
97
|
-
i.removeEventListener("animationend",
|
|
95
|
+
return i.addEventListener("animationend", p), () => {
|
|
96
|
+
i.removeEventListener("animationend", p);
|
|
98
97
|
};
|
|
99
|
-
}, [
|
|
98
|
+
}, [p]), E(() => {
|
|
100
99
|
s && n === "idle" && e({ type: "START_EXIT" });
|
|
101
|
-
}, [s, n]),
|
|
100
|
+
}, [s, n]), E(() => {
|
|
102
101
|
const i = S(t) || Array.isArray(t) && t.length >= 0;
|
|
103
102
|
!s && n === "loading" && i && (d(t), e({ type: "SCHEDULE_LOADED" }));
|
|
104
|
-
}, [s, n, t]),
|
|
103
|
+
}, [s, n, t]), E(() => () => {
|
|
105
104
|
_.current && clearTimeout(_.current);
|
|
106
105
|
}, []), n === "loading" ? /* @__PURE__ */ a(
|
|
107
106
|
"div",
|
|
@@ -114,36 +113,36 @@ function H({
|
|
|
114
113
|
},
|
|
115
114
|
children: /* @__PURE__ */ a(x, {})
|
|
116
115
|
}
|
|
117
|
-
) :
|
|
116
|
+
) : y ? /* @__PURE__ */ g("div", { className: "schedule-list__no-schedule", children: [
|
|
118
117
|
/* @__PURE__ */ a("h2", { children: "There was an error loading the schedule for this day." }),
|
|
119
|
-
/* @__PURE__ */
|
|
118
|
+
/* @__PURE__ */ g("p", { children: [
|
|
120
119
|
"Please try again later. If this problem persists report it at ",
|
|
121
120
|
/* @__PURE__ */ a("a", { href: "https://support.iontelevision.com/support/home", children: "our support page" }),
|
|
122
121
|
"."
|
|
123
122
|
] })
|
|
124
|
-
] }) : S(o) ? /* @__PURE__ */
|
|
123
|
+
] }) : S(o) ? /* @__PURE__ */ g(
|
|
125
124
|
"div",
|
|
126
125
|
{
|
|
127
126
|
className: T([
|
|
128
|
-
|
|
127
|
+
l["schedule-list__no-schedule"],
|
|
129
128
|
"schedule-list__no-schedule"
|
|
130
129
|
]),
|
|
131
130
|
"data-state": n,
|
|
132
131
|
style: { animationDelay: "500ms" },
|
|
133
132
|
children: [
|
|
134
133
|
/* @__PURE__ */ a("h2", { children: "There are no shows scheduled for this day." }),
|
|
135
|
-
/* @__PURE__ */
|
|
134
|
+
/* @__PURE__ */ g("p", { children: [
|
|
136
135
|
"Please try again later. If this problem persists report it at ",
|
|
137
136
|
/* @__PURE__ */ a("a", { href: "https://support.iontelevision.com/support/home", children: "our support page" }),
|
|
138
137
|
"."
|
|
139
138
|
] })
|
|
140
139
|
]
|
|
141
140
|
}
|
|
142
|
-
) : Array.isArray(o) && o.length === 0 ? /* @__PURE__ */
|
|
141
|
+
) : Array.isArray(o) && o.length === 0 ? /* @__PURE__ */ g(
|
|
143
142
|
"div",
|
|
144
143
|
{
|
|
145
144
|
className: T([
|
|
146
|
-
|
|
145
|
+
l["schedule-list__no-schedule"],
|
|
147
146
|
"schedule-list__no-schedule"
|
|
148
147
|
]),
|
|
149
148
|
"data-state": n,
|
|
@@ -155,39 +154,39 @@ function H({
|
|
|
155
154
|
) : /* @__PURE__ */ a(
|
|
156
155
|
"ul",
|
|
157
156
|
{
|
|
158
|
-
className: `${
|
|
157
|
+
className: `${l["schedule-list"]} schedule-list`,
|
|
159
158
|
"data-state": n,
|
|
160
|
-
ref:
|
|
159
|
+
ref: f,
|
|
161
160
|
children: Array.isArray(o) && o.map((i) => {
|
|
162
|
-
const c = u(i.element_length), q =
|
|
161
|
+
const c = u(i.element_length), q = v(i).type === "" ? [c, i.rating] : [c, i.rating, " "];
|
|
163
162
|
return i.program_class === "Episode" ? /* @__PURE__ */ a(
|
|
164
163
|
M,
|
|
165
164
|
{
|
|
166
|
-
determineCTA:
|
|
165
|
+
determineCTA: v,
|
|
167
166
|
handleClicks: r,
|
|
168
167
|
scheduleItem: i,
|
|
169
168
|
strListArr: q,
|
|
170
|
-
styles:
|
|
169
|
+
styles: l
|
|
171
170
|
},
|
|
172
171
|
`schedule-list-${i.id}`
|
|
173
172
|
) : i.program_class === "Film" || i.program_class === "Movie" || i.program_class === "Special" ? /* @__PURE__ */ a(
|
|
174
173
|
k,
|
|
175
174
|
{
|
|
176
|
-
determineCTA:
|
|
175
|
+
determineCTA: v,
|
|
177
176
|
handleClicks: r,
|
|
178
177
|
scheduleItem: i,
|
|
179
178
|
strListArr: q,
|
|
180
|
-
styles:
|
|
179
|
+
styles: l
|
|
181
180
|
},
|
|
182
181
|
`schedule-list-${i.id}`
|
|
183
182
|
) : i.program_class === "Sports" ? /* @__PURE__ */ a(
|
|
184
183
|
D,
|
|
185
184
|
{
|
|
186
|
-
determineCTA:
|
|
185
|
+
determineCTA: v,
|
|
187
186
|
handleClicks: r,
|
|
188
187
|
scheduleItem: i,
|
|
189
188
|
strListArr: q,
|
|
190
|
-
styles:
|
|
189
|
+
styles: l
|
|
191
190
|
},
|
|
192
191
|
`schedule-list-${i.id}`
|
|
193
192
|
) : null;
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.1.0-alpha.
|
|
2
|
+
"version": "1.1.0-alpha.8",
|
|
3
3
|
"name": "@scrippsproduct/networks-ui-library",
|
|
4
4
|
"description": "React Component Library for use in Scripps Networks external applications",
|
|
5
5
|
"author": {
|
|
@@ -28,9 +28,10 @@
|
|
|
28
28
|
"create-component": "node scripts/componentFolderBuilder.js",
|
|
29
29
|
"reinstall-deps": "node ./reinstall-deps.js",
|
|
30
30
|
"login": "npm login",
|
|
31
|
-
"publish": "node scripts/publish-with-otp.mjs"
|
|
31
|
+
"custom-publish": "node scripts/publish-with-otp.mjs"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
+
"@tanstack/react-query": "^5.90.12",
|
|
34
35
|
"date-fns": "^3.6.0",
|
|
35
36
|
"date-fns-tz": "^3.1.3",
|
|
36
37
|
"html-react-parser": "^5.1.10",
|