@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 d, useCallback as g, useEffect as h } from "react";
3
- import { f as w } from "../../format-YhWt2D8M.mjs";
4
- import { l } from "../../logger-C0N7U0YY.mjs";
5
- import { classes as L } from "../../utils/helpers.js";
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 T } from "./useScheduleContext.js";
7
+ import { useScheduleContext as q } from "./useScheduleContext.js";
8
8
  import { DateNavigation as k } from "../DateNavigation/DateNavigation.js";
9
- import { ScheduleList as q } from "../ScheduleList/ScheduleList.js";
10
- l.setComponent("ScheduleLayout");
11
- import '../../assets/ScheduleLayout.css';function x({
12
- handleScheduleClicks: f = () => !0
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
- const { currentDate: r } = T(), n = d(null), p = d(0), o = d(null), c = d(null), i = d(null), u = g((a) => {
15
- l.log("Determining pointer position for date: ", a);
16
- const s = () => {
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 v = document.querySelector(`.date-navigation__day[aria-controls="${w(a, "yyyy-MM-dd")}"]`);
19
- if (v && (e = v.parentElement), e && n.current) {
20
- const S = e.offsetLeft + e.offsetWidth / 2;
21
- p.current = S, n.current.style.setProperty(
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
- `${S}px`
23
+ `${v}px`
24
24
  );
25
25
  }
26
- }, y = () => {
27
- l.log("Scrolling schedule list to top"), c.current || (c.current = document.querySelector(".schedule-list")), i.current || (i.current = document.querySelector("sticky-content-wrapper")), l.log("Schedule list element: ", c.current), l.log("Sticky wrapper element: ", i.current);
26
+ }, h = () => {
27
+ s.current || (s.current = document.querySelector("sticky-content-wrapper"));
28
28
  const e = document.querySelector(".mobile-nav");
29
- c.current && i.current && (l.log("Mobile nav element: ", e), window.scrollTo({
30
- behavior: "auto",
31
- top: e && window.getComputedStyle(e).display !== "none" ? c.current.offsetTop - i.current.offsetHeight - e.offsetHeight - 8 : c.current.offsetTop - i.current.offsetHeight - 16,
32
- left: 0
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 (!n.current) {
38
+ if (!r.current) {
36
39
  const e = setInterval(() => {
37
- n.current = document.querySelector(".date-navigation__list"), n.current && (clearInterval(e), c.current = document.querySelector(".schedule-list"), i.current = document.querySelector("sticky-content-wrapper"), s(), y());
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
- s(), y();
45
- }, []), m = g(() => {
47
+ i(), m.current || h();
48
+ }, []), p = w(() => {
46
49
  o.current && clearTimeout(o.current), o.current = window.setTimeout(() => {
47
- u(r);
50
+ a(n);
48
51
  }, 250);
49
- }, [r, u]);
50
- return h(() => (window.addEventListener("resize", m), () => {
51
- window.removeEventListener("resize", m), o.current && clearTimeout(o.current);
52
- }), [u, m]), h(() => {
53
- const a = document.querySelector(".header-divider"), s = document.querySelector("sticky-content-wrapper");
54
- s && a && new IntersectionObserver(
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 ? s.dataset.pinnedState = "pinned" : s.dataset.pinnedState = "unpinned";
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(a);
63
- }, []), h(() => {
64
- u(r);
65
- }, [r, u]), /* @__PURE__ */ b("schedule-layout", { children: [
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: L([
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: w(r, "yyyy-MM-dd"), role: "tabpanel", children: /* @__PURE__ */ t(q, { handleClicks: f }) }) }) })
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 N({
82
- fetchSchedule: f,
83
- initialSchedule: r = [],
84
- weeks: n = [],
85
- handleScheduleClicks: p = () => !0,
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: f,
99
+ fetchSchedule: d,
92
100
  handleDateChanged: o,
93
- initialSchedule: r,
94
- weeks: n,
95
- children: /* @__PURE__ */ t(x, { handleScheduleClicks: p })
101
+ initialSchedule: n,
102
+ weeks: r,
103
+ children: /* @__PURE__ */ t(C, { handleScheduleClicks: f })
96
104
  }
97
105
  );
98
106
  }
99
107
  export {
100
- N as ScheduleLayout,
101
- N as default
108
+ _ as ScheduleLayout,
109
+ _ as default
102
110
  };
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.1.1",
2
+ "version": "1.1.3",
3
3
  "name": "@scrippsproduct/networks-ui-library",
4
4
  "description": "React Component Library for use in Scripps Networks external applications",
5
5
  "author": {