@scrippsproduct/networks-ui-library 1.1.1 → 1.1.3
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,72 +1,80 @@
|
|
|
1
1
|
import { jsx as t, jsxs as b } from "react/jsx-runtime";
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { f as
|
|
4
|
-
import { l } from "../../logger-C0N7U0YY.mjs";
|
|
5
|
-
import { classes as
|
|
2
|
+
import { useRef as l, useCallback as w, useEffect as y } from "react";
|
|
3
|
+
import { f as S } from "../../format-YhWt2D8M.mjs";
|
|
4
|
+
import { l as L } from "../../logger-C0N7U0YY.mjs";
|
|
5
|
+
import { classes as g } from "../../utils/helpers.js";
|
|
6
6
|
import { ScheduleProvider as E } from "./ScheduleContext.js";
|
|
7
|
-
import { useScheduleContext as
|
|
7
|
+
import { useScheduleContext as q } from "./useScheduleContext.js";
|
|
8
8
|
import { DateNavigation as k } from "../DateNavigation/DateNavigation.js";
|
|
9
|
-
import { ScheduleList as
|
|
10
|
-
|
|
11
|
-
import '../../assets/ScheduleLayout.css';function
|
|
12
|
-
handleScheduleClicks:
|
|
9
|
+
import { ScheduleList as T } from "../ScheduleList/ScheduleList.js";
|
|
10
|
+
L.setComponent("ScheduleLayout");
|
|
11
|
+
import '../../assets/ScheduleLayout.css';function C({
|
|
12
|
+
handleScheduleClicks: d = () => !0
|
|
13
13
|
}) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const
|
|
14
|
+
console.warn("ScheduleLayoutContent rendered");
|
|
15
|
+
const { currentDate: n } = q(), r = l(null), f = l(0), o = l(null), s = l(null), m = l(!0), a = w((c) => {
|
|
16
|
+
const i = () => {
|
|
17
17
|
let e;
|
|
18
|
-
const
|
|
19
|
-
if (
|
|
20
|
-
const
|
|
21
|
-
|
|
18
|
+
const u = document.querySelector(`.date-navigation__day[aria-controls="${S(c, "yyyy-MM-dd")}"]`);
|
|
19
|
+
if (u && (e = u.parentElement), e && r.current) {
|
|
20
|
+
const v = e.offsetLeft + e.offsetWidth / 2;
|
|
21
|
+
f.current = v, r.current.style.setProperty(
|
|
22
22
|
"--pointer-position",
|
|
23
|
-
`${
|
|
23
|
+
`${v}px`
|
|
24
24
|
);
|
|
25
25
|
}
|
|
26
|
-
},
|
|
27
|
-
|
|
26
|
+
}, h = () => {
|
|
27
|
+
s.current || (s.current = document.querySelector("sticky-content-wrapper"));
|
|
28
28
|
const e = document.querySelector(".mobile-nav");
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
if (s.current) {
|
|
30
|
+
const u = e && window.getComputedStyle(e).display !== "none" ? e.offsetHeight + 8 : 16;
|
|
31
|
+
window.scrollTo({
|
|
32
|
+
behavior: "smooth",
|
|
33
|
+
top: s.current.offsetTop - u,
|
|
34
|
+
left: 0
|
|
35
|
+
});
|
|
36
|
+
}
|
|
34
37
|
};
|
|
35
|
-
if (!
|
|
38
|
+
if (!r.current) {
|
|
36
39
|
const e = setInterval(() => {
|
|
37
|
-
|
|
40
|
+
r.current = document.querySelector(".date-navigation__list"), r.current && (clearInterval(e), s.current = document.querySelector("sticky-content-wrapper"), i());
|
|
38
41
|
}, 100);
|
|
39
42
|
setTimeout(() => {
|
|
40
43
|
clearInterval(e);
|
|
41
44
|
}, 3e3);
|
|
42
45
|
return;
|
|
43
46
|
}
|
|
44
|
-
|
|
45
|
-
}, []),
|
|
47
|
+
i(), m.current || h();
|
|
48
|
+
}, []), p = w(() => {
|
|
46
49
|
o.current && clearTimeout(o.current), o.current = window.setTimeout(() => {
|
|
47
|
-
|
|
50
|
+
a(n);
|
|
48
51
|
}, 250);
|
|
49
|
-
}, [
|
|
50
|
-
return
|
|
51
|
-
window.removeEventListener("resize",
|
|
52
|
-
}), [
|
|
53
|
-
const
|
|
54
|
-
|
|
52
|
+
}, [n, a]);
|
|
53
|
+
return y(() => (window.addEventListener("resize", p), () => {
|
|
54
|
+
window.removeEventListener("resize", p), o.current && clearTimeout(o.current);
|
|
55
|
+
}), [a, p]), y(() => {
|
|
56
|
+
const c = document.querySelector(".header-divider"), i = document.querySelector("sticky-content-wrapper");
|
|
57
|
+
i && c && new IntersectionObserver(
|
|
55
58
|
([e]) => {
|
|
56
|
-
e.intersectionRatio < 1 ?
|
|
59
|
+
e.intersectionRatio < 1 ? i.dataset.pinnedState = "pinned" : i.dataset.pinnedState = "unpinned";
|
|
57
60
|
},
|
|
58
61
|
{
|
|
59
62
|
threshold: [1],
|
|
60
63
|
rootMargin: "-37px"
|
|
61
64
|
}
|
|
62
|
-
).observe(
|
|
63
|
-
}, []),
|
|
64
|
-
|
|
65
|
-
|
|
65
|
+
).observe(c);
|
|
66
|
+
}, []), y(() => {
|
|
67
|
+
const c = requestAnimationFrame(() => {
|
|
68
|
+
requestAnimationFrame(() => {
|
|
69
|
+
a(n), m.current && (m.current = !1);
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
return () => cancelAnimationFrame(c);
|
|
73
|
+
}, [n, a]), /* @__PURE__ */ b("schedule-layout", { children: [
|
|
66
74
|
/* @__PURE__ */ t("sticky-content-wrapper", { "data-pinned-state": "unpinned", children: /* @__PURE__ */ t(
|
|
67
75
|
"content-constrainer",
|
|
68
76
|
{
|
|
69
|
-
class:
|
|
77
|
+
class: g([
|
|
70
78
|
"content-constrainer--no-padding",
|
|
71
79
|
"content-constrainer--no-border",
|
|
72
80
|
"content-constrainer--lead-container",
|
|
@@ -75,28 +83,28 @@ import '../../assets/ScheduleLayout.css';function x({
|
|
|
75
83
|
children: /* @__PURE__ */ t(k, {})
|
|
76
84
|
}
|
|
77
85
|
) }),
|
|
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:
|
|
86
|
+
/* @__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: S(n, "yyyy-MM-dd"), role: "tabpanel", children: /* @__PURE__ */ t(T, { handleClicks: d }) }) }) })
|
|
79
87
|
] });
|
|
80
88
|
}
|
|
81
|
-
function
|
|
82
|
-
fetchSchedule:
|
|
83
|
-
initialSchedule:
|
|
84
|
-
weeks:
|
|
85
|
-
handleScheduleClicks:
|
|
89
|
+
function _({
|
|
90
|
+
fetchSchedule: d,
|
|
91
|
+
initialSchedule: n = [],
|
|
92
|
+
weeks: r = [],
|
|
93
|
+
handleScheduleClicks: f = () => !0,
|
|
86
94
|
handleDateChanged: o = () => !0
|
|
87
95
|
}) {
|
|
88
96
|
return /* @__PURE__ */ t(
|
|
89
97
|
E,
|
|
90
98
|
{
|
|
91
|
-
fetchSchedule:
|
|
99
|
+
fetchSchedule: d,
|
|
92
100
|
handleDateChanged: o,
|
|
93
|
-
initialSchedule:
|
|
94
|
-
weeks:
|
|
95
|
-
children: /* @__PURE__ */ t(
|
|
101
|
+
initialSchedule: n,
|
|
102
|
+
weeks: r,
|
|
103
|
+
children: /* @__PURE__ */ t(C, { handleScheduleClicks: f })
|
|
96
104
|
}
|
|
97
105
|
);
|
|
98
106
|
}
|
|
99
107
|
export {
|
|
100
|
-
|
|
101
|
-
|
|
108
|
+
_ as ScheduleLayout,
|
|
109
|
+
_ as default
|
|
102
110
|
};
|
package/package.json
CHANGED