@scrippsproduct/networks-ui-library 1.1.2 → 1.1.4

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