@scrippsproduct/networks-ui-library 2.0.4 → 2.0.5

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.
Files changed (28) hide show
  1. package/dist/Carousel.module-Nwf_zL9b.mjs +14 -0
  2. package/dist/assets/Carousel.css +1 -1
  3. package/dist/assets/FindUs.css +1 -1
  4. package/dist/assets/LogoListItem.css +1 -1
  5. package/dist/components/AnchorTag/AnchorTag.js +12 -12
  6. package/dist/components/AnchorTag/AnchorTag.test.js +9 -19
  7. package/dist/components/BCVideoPlayer/BCVideoPlayer.js +58 -46
  8. package/dist/components/BCVideoPlayer/BCVideoPlayer.test.js +3 -3
  9. package/dist/components/Carousel/Carousel.js +37 -36
  10. package/dist/components/Carousel/Carousel.test.js +71 -68
  11. package/dist/components/Carousel/CarouselUtils.class.js +104 -97
  12. package/dist/components/Carousel/navigations/Pagination.js +2 -2
  13. package/dist/components/Carousel/navigations/Pagination.test.js +23 -23
  14. package/dist/components/CarouselSlide/CarouselSlide.test.js +58 -57
  15. package/dist/components/FindUs/FindUs.js +119 -90
  16. package/dist/components/GridList/GridList.js +6 -6
  17. package/dist/components/ImageCard/ImageCardCore.js +65 -69
  18. package/dist/components/ImageCard/ImageCardCore.test.js +2 -2
  19. package/dist/components/LogoListItem/LogoListItem.js +13 -13
  20. package/dist/components/PromotionsRowModule/PromotionsRowModule.js +42 -38
  21. package/dist/components/PromotionsRowModule/PromotionsRowModule.test.js +163 -149
  22. package/dist/hooks/useSourcepointPrivacyTrigger.js +4 -4
  23. package/dist/src/components/Carousel/CarouselUtils.class.d.ts +8 -3
  24. package/dist/src/components/Carousel/navigations/Pagination.d.ts +1 -1
  25. package/dist/src/components/PromotionsRowModule/PromotionsRowModule.d.ts +2 -1
  26. package/dist/src/hooks/useSourcepointPrivacyTrigger.d.ts +13 -2
  27. package/package.json +3 -2
  28. package/dist/Carousel.module-BsPaZX5L.mjs +0 -14
@@ -1,16 +1,16 @@
1
- import { jsx as s, jsxs as B } from "react/jsx-runtime";
2
- import { v as h, d as m, b as C, a as v, i as l, r as c, g as a, s as n, w as u } from "../../react.esm-S2Q_NbYC.mjs";
1
+ import { jsx as a, jsxs as B } from "react/jsx-runtime";
2
+ import { v as h, d as m, b as I, a as v, i as r, r as l, g as n, s as c, w as u } from "../../react.esm-S2Q_NbYC.mjs";
3
3
  import "../../index-BZQHStQa.mjs";
4
- import { PromotionsRowModule as r } from "./PromotionsRowModule.js";
4
+ import { PromotionsRowModule as s } from "./PromotionsRowModule.js";
5
5
  h.mock("../PromotionsRowBlock", () => ({
6
- default: ({ children: o, gap: e }) => /* @__PURE__ */ s("div", { "data-gap": e, "data-testid": "promotions-row-block", children: o })
6
+ default: ({ children: o, gap: e }) => /* @__PURE__ */ a("div", { "data-gap": e, "data-testid": "promotions-row-block", children: o })
7
7
  }));
8
8
  h.mock("../ImageCard", () => ({
9
- default: ({ image: o, title: e, content: i, cta: p, relatedResourceId: y, classname: T, overlayContent: I }) => /* @__PURE__ */ B(
9
+ default: ({ image: o, title: e, content: i, cta: p, relatedResourceId: y, classname: T, overlayContent: C }) => /* @__PURE__ */ B(
10
10
  "div",
11
11
  {
12
12
  "data-classname": T,
13
- "data-content": i,
13
+ "data-content": typeof i == "string" ? i : void 0,
14
14
  "data-cta-text": p == null ? void 0 : p.label,
15
15
  "data-image-url": o.url,
16
16
  "data-related-id": y,
@@ -19,7 +19,8 @@ h.mock("../ImageCard", () => ({
19
19
  children: [
20
20
  "ImageCard: ",
21
21
  e,
22
- I
22
+ i,
23
+ C
23
24
  ]
24
25
  }
25
26
  )
@@ -58,62 +59,62 @@ const g = {
58
59
  ...e
59
60
  });
60
61
  m("PromotionsRowModule", () => {
61
- C(() => {
62
+ I(() => {
62
63
  h.clearAllMocks();
63
64
  }), v(() => {
64
65
  h.clearAllMocks();
65
66
  }), m("Basic Rendering", () => {
66
- l("should render section with promotions-row class", () => {
67
- const o = [t("1")], { container: e } = c(/* @__PURE__ */ s(r, { promos: o })), i = e.querySelector("section.promotions-row");
68
- a(i).toBeInTheDocument();
69
- }), l("should render title when provided", () => {
67
+ r("should render section with promotions-row class", () => {
68
+ const o = [t("1")], { container: e } = l(/* @__PURE__ */ a(s, { promos: o })), i = e.querySelector("section.promotions-row");
69
+ n(i).toBeInTheDocument();
70
+ }), r("should render title when provided", () => {
70
71
  const o = [t("1")];
71
- c(/* @__PURE__ */ s(r, { promos: o, title: "Special Offers" })), a(n.getByRole("heading", { name: "Special Offers" })).toBeInTheDocument();
72
- }), l("should render title as h2 element", () => {
72
+ l(/* @__PURE__ */ a(s, { promos: o, title: "Special Offers" })), n(c.getByRole("heading", { name: "Special Offers" })).toBeInTheDocument();
73
+ }), r("should render title as h2 element", () => {
73
74
  const o = [t("1")];
74
- c(/* @__PURE__ */ s(r, { promos: o, title: "Special Offers" }));
75
- const e = n.getByRole("heading", { name: "Special Offers", level: 2 });
76
- a(e).toBeInTheDocument();
77
- }), l("should apply correct classes to title", () => {
75
+ l(/* @__PURE__ */ a(s, { promos: o, title: "Special Offers" }));
76
+ const e = c.getByRole("heading", { name: "Special Offers", level: 2 });
77
+ n(e).toBeInTheDocument();
78
+ }), r("should apply correct classes to title", () => {
78
79
  const o = [t("1")];
79
- c(/* @__PURE__ */ s(r, { promos: o, title: "Special Offers" }));
80
- const e = n.getByRole("heading", { name: "Special Offers" });
81
- a(e).toHaveClass("h2", "promotions-row__header");
82
- }), l("should render empty title when not provided", () => {
83
- const o = [t("1")], { container: e } = c(/* @__PURE__ */ s(r, { promos: o })), i = e.querySelector("h2");
84
- a(i).toHaveTextContent("");
80
+ l(/* @__PURE__ */ a(s, { promos: o, title: "Special Offers" }));
81
+ const e = c.getByRole("heading", { name: "Special Offers" });
82
+ n(e).toHaveClass("h2", "promotions-row__header");
83
+ }), r("should render empty title when not provided", () => {
84
+ const o = [t("1")], { container: e } = l(/* @__PURE__ */ a(s, { promos: o })), i = e.querySelector("h2");
85
+ n(i).toHaveTextContent("");
85
86
  });
86
87
  }), m("PromotionsRowBlock Rendering (≤4 promos)", () => {
87
- l("should render PromotionsRowBlock with single promo", () => {
88
+ r("should render PromotionsRowBlock with single promo", () => {
88
89
  const o = [t("1")];
89
- c(/* @__PURE__ */ s(r, { promos: o })), a(n.getByTestId("promotions-row-block")).toBeInTheDocument();
90
- }), l("should render PromotionsRowBlock with 2 promos", () => {
90
+ l(/* @__PURE__ */ a(s, { promos: o })), n(c.getByTestId("promotions-row-block")).toBeInTheDocument();
91
+ }), r("should render PromotionsRowBlock with 2 promos", () => {
91
92
  const o = [t("1"), t("2")];
92
- c(/* @__PURE__ */ s(r, { promos: o })), a(n.getByTestId("promotions-row-block")).toBeInTheDocument();
93
- }), l("should render PromotionsRowBlock with exactly 4 promos", () => {
93
+ l(/* @__PURE__ */ a(s, { promos: o })), n(c.getByTestId("promotions-row-block")).toBeInTheDocument();
94
+ }), r("should render PromotionsRowBlock with exactly 4 promos", () => {
94
95
  const o = [
95
96
  t("1"),
96
97
  t("2"),
97
98
  t("3"),
98
99
  t("4")
99
100
  ];
100
- c(/* @__PURE__ */ s(r, { promos: o })), a(n.getByTestId("promotions-row-block")).toBeInTheDocument();
101
- }), l("should apply 2rem gap to PromotionsRowBlock", () => {
101
+ l(/* @__PURE__ */ a(s, { promos: o })), n(c.getByTestId("promotions-row-block")).toBeInTheDocument();
102
+ }), r("should apply 2rem gap to PromotionsRowBlock", () => {
102
103
  const o = [t("1")];
103
- c(/* @__PURE__ */ s(r, { promos: o }));
104
- const e = n.getByTestId("promotions-row-block");
105
- a(e).toHaveAttribute("data-gap", "2rem");
106
- }), l("should not render Carousel when promos ≤ 4", () => {
104
+ l(/* @__PURE__ */ a(s, { promos: o }));
105
+ const e = c.getByTestId("promotions-row-block");
106
+ n(e).toHaveAttribute("data-gap", "2rem");
107
+ }), r("should not render Carousel when promos ≤ 4", () => {
107
108
  const o = [
108
109
  t("1"),
109
110
  t("2"),
110
111
  t("3"),
111
112
  t("4")
112
113
  ];
113
- c(/* @__PURE__ */ s(r, { promos: o })), a(n.queryByTestId("carousel")).not.toBeInTheDocument();
114
+ l(/* @__PURE__ */ a(s, { promos: o })), n(c.queryByTestId("carousel")).not.toBeInTheDocument();
114
115
  });
115
116
  }), m("Carousel Rendering (>4 promos)", () => {
116
- l("should render Carousel when promos > 4", async () => {
117
+ r("should render Carousel when promos > 4", async () => {
117
118
  const o = [
118
119
  t("1"),
119
120
  t("2"),
@@ -121,79 +122,92 @@ m("PromotionsRowModule", () => {
121
122
  t("4"),
122
123
  t("5")
123
124
  ];
124
- c(/* @__PURE__ */ s(r, { promos: o })), await u(() => {
125
- a(n.getByTestId("carousel")).toBeInTheDocument();
125
+ l(/* @__PURE__ */ a(s, { promos: o })), await u(() => {
126
+ n(c.getByTestId("carousel")).toBeInTheDocument();
126
127
  });
127
- }), l("should render h1 title for carousel view", async () => {
128
+ }), r("should render h1 title for carousel view", async () => {
128
129
  const o = Array.from({ length: 5 }, (e, i) => t(`${i + 1}`));
129
- c(/* @__PURE__ */ s(r, { promos: o, title: "Carousel Title" })), await u(() => {
130
- const e = n.getByRole("heading", { name: "Carousel Title", level: 1 });
131
- a(e).toBeInTheDocument();
130
+ l(/* @__PURE__ */ a(s, { promos: o, title: "Carousel Title" })), await u(() => {
131
+ const e = c.getByRole("heading", { name: "Carousel Title", level: 1 });
132
+ n(e).toBeInTheDocument();
132
133
  });
133
- }), l("should apply h3 class to carousel title", async () => {
134
+ }), r("should apply h3 class to carousel title", async () => {
134
135
  const o = Array.from({ length: 5 }, (e, i) => t(`${i + 1}`));
135
- c(/* @__PURE__ */ s(r, { promos: o, title: "Carousel Title" })), await u(() => {
136
- const e = n.getByRole("heading", { name: "Carousel Title" });
137
- a(e).toHaveClass("h3", "promotions-row__header");
136
+ l(/* @__PURE__ */ a(s, { promos: o, title: "Carousel Title" })), await u(() => {
137
+ const e = c.getByRole("heading", { name: "Carousel Title" });
138
+ n(e).toHaveClass("h3", "promotions-row__header");
138
139
  });
139
- }), l("should not render PromotionsRowBlock when carousel is shown", async () => {
140
+ }), r("should not render PromotionsRowBlock when carousel is shown", async () => {
140
141
  const o = Array.from({ length: 5 }, (e, i) => t(`${i + 1}`));
141
- c(/* @__PURE__ */ s(r, { promos: o })), await u(() => {
142
- a(n.getByTestId("carousel")).toBeInTheDocument();
143
- }), a(n.queryByTestId("promotions-row-block")).not.toBeInTheDocument();
144
- }), l("should pass correct number of cells to Carousel", async () => {
142
+ l(/* @__PURE__ */ a(s, { promos: o })), await u(() => {
143
+ n(c.getByTestId("carousel")).toBeInTheDocument();
144
+ }), n(c.queryByTestId("promotions-row-block")).not.toBeInTheDocument();
145
+ }), r("should pass correct number of cells to Carousel", async () => {
145
146
  const o = Array.from({ length: 6 }, (e, i) => t(`${i + 1}`));
146
- c(/* @__PURE__ */ s(r, { promos: o })), await u(() => {
147
- const e = n.getByTestId("carousel");
148
- a(e).toHaveAttribute("data-cells-count", "6");
147
+ l(/* @__PURE__ */ a(s, { promos: o })), await u(() => {
148
+ const e = c.getByTestId("carousel");
149
+ n(e).toHaveAttribute("data-cells-count", "6");
149
150
  });
150
151
  });
151
152
  }), m("ImageCard Rendering", () => {
152
- l("should render ImageCard for each promo", () => {
153
+ r("should render ImageCard for each promo", () => {
153
154
  const o = [
154
155
  t("1"),
155
156
  t("2"),
156
157
  t("3")
157
158
  ];
158
- c(/* @__PURE__ */ s(r, { promos: o }));
159
- const e = n.getAllByTestId("image-card");
160
- a(e).toHaveLength(3);
161
- }), l("should pass image prop to ImageCard", () => {
159
+ l(/* @__PURE__ */ a(s, { promos: o }));
160
+ const e = c.getAllByTestId("image-card");
161
+ n(e).toHaveLength(3);
162
+ }), r("should pass image prop to ImageCard", () => {
162
163
  const o = [t("1")];
163
- c(/* @__PURE__ */ s(r, { promos: o }));
164
- const e = n.getByTestId("image-card");
165
- a(e).toHaveAttribute("data-image-url", g.url);
166
- }), l("should pass title prop to ImageCard", () => {
164
+ l(/* @__PURE__ */ a(s, { promos: o }));
165
+ const e = c.getByTestId("image-card");
166
+ n(e).toHaveAttribute("data-image-url", g.url);
167
+ }), r("should pass title prop to ImageCard", () => {
167
168
  const o = [t("1", { title: "Special Promo" })];
168
- c(/* @__PURE__ */ s(r, { promos: o }));
169
- const e = n.getByTestId("image-card");
170
- a(e).toHaveAttribute("data-title", "Special Promo");
171
- }), l("should pass content prop to ImageCard", () => {
169
+ l(/* @__PURE__ */ a(s, { promos: o }));
170
+ const e = c.getByTestId("image-card");
171
+ n(e).toHaveAttribute("data-title", "Special Promo");
172
+ }), r("should pass content prop to ImageCard", () => {
172
173
  const o = [t("1", { content: "Special content" })];
173
- c(/* @__PURE__ */ s(r, { promos: o }));
174
- const e = n.getByTestId("image-card");
175
- a(e).toHaveAttribute("data-content", "Special content");
176
- }), l("should pass cta prop to ImageCard", () => {
174
+ l(/* @__PURE__ */ a(s, { promos: o, shouldClampContent: !1 }));
175
+ const e = c.getByTestId("image-card");
176
+ n(e).toHaveAttribute("data-content", "Special content");
177
+ }), r("should wrap content in a clamped-content div when shouldClampContent is true", () => {
178
+ const o = [t("1", { content: "Special content" })], { container: e } = l(
179
+ /* @__PURE__ */ a(s, { shouldClampContent: !0, promos: o })
180
+ ), i = e.querySelector(".promotions-row__clamped-content");
181
+ n(i).toBeInTheDocument(), n(i).toHaveTextContent("Special content");
182
+ }), r("should wrap content in a clamped-content div by default", () => {
183
+ const o = [t("1", { content: "Special content" })], { container: e } = l(/* @__PURE__ */ a(s, { promos: o })), i = e.querySelector(".promotions-row__clamped-content");
184
+ n(i).toBeInTheDocument(), n(i).toHaveTextContent("Special content");
185
+ }), r("should not wrap content when shouldClampContent is false", () => {
186
+ const o = [t("1", { content: "Special content" })], { container: e } = l(
187
+ /* @__PURE__ */ a(s, { promos: o, shouldClampContent: !1 })
188
+ ), i = e.querySelector(".promotions-row__clamped-content");
189
+ n(i).not.toBeInTheDocument();
190
+ }), r("should pass cta prop to ImageCard", () => {
177
191
  const o = [t("1")];
178
- c(/* @__PURE__ */ s(r, { promos: o }));
179
- const e = n.getByTestId("image-card");
180
- a(e).toHaveAttribute("data-cta-text", d.label);
181
- }), l("should pass relatedResourceId to ImageCard", () => {
192
+ l(/* @__PURE__ */ a(s, { promos: o }));
193
+ const e = c.getByTestId("image-card");
194
+ n(e).toHaveAttribute("data-cta-text", d.label);
195
+ }), r("should pass relatedResourceId to ImageCard", () => {
182
196
  const o = [t("test-id-123")];
183
- c(/* @__PURE__ */ s(r, { promos: o }));
184
- const e = n.getByTestId("image-card");
185
- a(e).toHaveAttribute("data-related-id", "test-id-123");
186
- }), l("should pass classname to ImageCard when provided", () => {
197
+ l(/* @__PURE__ */ a(s, { promos: o }));
198
+ const e = c.getByTestId("image-card");
199
+ n(e).toHaveAttribute("data-related-id", "test-id-123");
200
+ }), r("should pass classname to ImageCard when provided", () => {
187
201
  const o = [t("1", { classname: "custom-class" })];
188
- c(/* @__PURE__ */ s(r, { promos: o }));
189
- const e = n.getByTestId("image-card");
190
- a(e).toHaveAttribute("data-classname", "custom-class");
202
+ l(/* @__PURE__ */ a(s, { promos: o }));
203
+ const e = c.getByTestId("image-card");
204
+ n(e).toHaveAttribute("data-classname", "custom-class");
191
205
  });
192
206
  }), m("CtaBlock Overlay Content", () => {
193
- l("should not render CtaBlock when overlayContent is not provided", () => {
207
+ r("should not render CtaBlock when overlayContent is not provided", () => {
194
208
  const o = [t("1")];
195
- c(/* @__PURE__ */ s(r, { promos: o })), a(n.queryByTestId("cta-block")).not.toBeInTheDocument();
196
- }), l("should render CtaBlock when overlayContent is provided", () => {
209
+ l(/* @__PURE__ */ a(s, { promos: o })), n(c.queryByTestId("cta-block")).not.toBeInTheDocument();
210
+ }), r("should render CtaBlock when overlayContent is provided", () => {
197
211
  const o = [t("1", {
198
212
  overlayContent: {
199
213
  title: "Overlay Title",
@@ -201,69 +215,69 @@ m("PromotionsRowModule", () => {
201
215
  cta: d
202
216
  }
203
217
  })];
204
- c(/* @__PURE__ */ s(r, { promos: o })), a(n.getByTestId("cta-block")).toBeInTheDocument();
205
- }), l("should pass overlayContent title to CtaBlock", () => {
218
+ l(/* @__PURE__ */ a(s, { promos: o })), n(c.getByTestId("cta-block")).toBeInTheDocument();
219
+ }), r("should pass overlayContent title to CtaBlock", () => {
206
220
  const o = [t("1", {
207
221
  overlayContent: {
208
222
  title: "Overlay Title",
209
223
  cta: d
210
224
  }
211
225
  })];
212
- c(/* @__PURE__ */ s(r, { promos: o }));
213
- const e = n.getByTestId("cta-block");
214
- a(e).toHaveAttribute("data-title", "Overlay Title");
215
- }), l("should pass overlayContent cta to CtaBlock", () => {
226
+ l(/* @__PURE__ */ a(s, { promos: o }));
227
+ const e = c.getByTestId("cta-block");
228
+ n(e).toHaveAttribute("data-title", "Overlay Title");
229
+ }), r("should pass overlayContent cta to CtaBlock", () => {
216
230
  const o = [t("1", {
217
231
  overlayContent: {
218
232
  cta: d
219
233
  }
220
234
  })];
221
- c(/* @__PURE__ */ s(r, { promos: o }));
222
- const e = n.getByTestId("cta-block");
223
- a(e).toHaveAttribute("data-cta-text", d.label);
224
- }), l("should render multiple CtaBlocks for multiple promos with overlayContent", () => {
235
+ l(/* @__PURE__ */ a(s, { promos: o }));
236
+ const e = c.getByTestId("cta-block");
237
+ n(e).toHaveAttribute("data-cta-text", d.label);
238
+ }), r("should render multiple CtaBlocks for multiple promos with overlayContent", () => {
225
239
  const o = [
226
240
  t("1", { overlayContent: { title: "Overlay 1", cta: d } }),
227
241
  t("2", { overlayContent: { title: "Overlay 2", cta: d } }),
228
242
  t("3", { overlayContent: { title: "Overlay 3", cta: d } })
229
243
  ];
230
- c(/* @__PURE__ */ s(r, { promos: o }));
231
- const e = n.getAllByTestId("cta-block");
232
- a(e).toHaveLength(3);
244
+ l(/* @__PURE__ */ a(s, { promos: o }));
245
+ const e = c.getAllByTestId("cta-block");
246
+ n(e).toHaveLength(3);
233
247
  });
234
248
  }), m("HandleClicks Prop", () => {
235
- l("should use provided handleClicks function", () => {
249
+ r("should use provided handleClicks function", () => {
236
250
  const o = h.fn(), e = [t("1")];
237
- c(/* @__PURE__ */ s(r, { handleClicks: o, promos: e })), a(n.getByTestId("image-card")).toBeInTheDocument();
238
- }), l("should use default handleClicks when not provided", () => {
251
+ l(/* @__PURE__ */ a(s, { handleClicks: o, promos: e })), n(c.getByTestId("image-card")).toBeInTheDocument();
252
+ }), r("should use default handleClicks when not provided", () => {
239
253
  const o = [t("1")];
240
- c(/* @__PURE__ */ s(r, { promos: o })), a(n.getByTestId("image-card")).toBeInTheDocument();
241
- }), l("should use default handleClicks when null", () => {
254
+ l(/* @__PURE__ */ a(s, { promos: o })), n(c.getByTestId("image-card")).toBeInTheDocument();
255
+ }), r("should use default handleClicks when null", () => {
242
256
  const o = [t("1")];
243
- c(/* @__PURE__ */ s(r, { handleClicks: null, promos: o })), a(n.getByTestId("image-card")).toBeInTheDocument();
257
+ l(/* @__PURE__ */ a(s, { handleClicks: null, promos: o })), n(c.getByTestId("image-card")).toBeInTheDocument();
244
258
  });
245
259
  }), m("Edge Cases", () => {
246
- l("should handle empty promos array", () => {
247
- const { container: o } = c(/* @__PURE__ */ s(r, { promos: [] })), e = o.querySelector("section.promotions-row");
248
- a(e).toBeInTheDocument();
249
- }), l("should handle promos without optional fields", () => {
250
- c(/* @__PURE__ */ s(r, { promos: [{
260
+ r("should handle empty promos array", () => {
261
+ const { container: o } = l(/* @__PURE__ */ a(s, { promos: [] })), e = o.querySelector("section.promotions-row");
262
+ n(e).toBeInTheDocument();
263
+ }), r("should handle promos without optional fields", () => {
264
+ l(/* @__PURE__ */ a(s, { promos: [{
251
265
  id: "1",
252
266
  image: g
253
- }] })), a(n.getByTestId("image-card")).toBeInTheDocument();
254
- }), l("should handle very long title", () => {
255
- const o = "This is a very long title ".repeat(10).trim(), e = [t("1")], { container: i } = c(/* @__PURE__ */ s(r, { promos: e, title: o })), p = i.querySelector("h2");
256
- a(p).toHaveTextContent(o);
257
- }), l("should handle special characters in title", () => {
267
+ }] })), n(c.getByTestId("image-card")).toBeInTheDocument();
268
+ }), r("should handle very long title", () => {
269
+ const o = "This is a very long title ".repeat(10).trim(), e = [t("1")], { container: i } = l(/* @__PURE__ */ a(s, { promos: e, title: o })), p = i.querySelector("h2");
270
+ n(p).toHaveTextContent(o);
271
+ }), r("should handle special characters in title", () => {
258
272
  const o = 'Special & "Quoted" Title <test>', e = [t("1")];
259
- c(/* @__PURE__ */ s(r, { promos: e, title: o })), a(n.getByRole("heading", { name: o })).toBeInTheDocument();
260
- }), l("should handle many promos (>10)", async () => {
273
+ l(/* @__PURE__ */ a(s, { promos: e, title: o })), n(c.getByRole("heading", { name: o })).toBeInTheDocument();
274
+ }), r("should handle many promos (>10)", async () => {
261
275
  const o = Array.from({ length: 15 }, (e, i) => t(`${i + 1}`));
262
- c(/* @__PURE__ */ s(r, { promos: o })), await u(() => {
263
- const e = n.getByTestId("carousel");
264
- a(e).toHaveAttribute("data-cells-count", "15");
276
+ l(/* @__PURE__ */ a(s, { promos: o })), await u(() => {
277
+ const e = c.getByTestId("carousel");
278
+ n(e).toHaveAttribute("data-cells-count", "15");
265
279
  });
266
- }), l("should handle promos with undefined overlayContent properties", () => {
280
+ }), r("should handle promos with undefined overlayContent properties", () => {
267
281
  const o = [t("1", {
268
282
  overlayContent: {
269
283
  title: void 0,
@@ -271,29 +285,29 @@ m("PromotionsRowModule", () => {
271
285
  cta: void 0
272
286
  }
273
287
  })];
274
- c(/* @__PURE__ */ s(r, { promos: o })), a(n.getByTestId("cta-block")).toBeInTheDocument();
288
+ l(/* @__PURE__ */ a(s, { promos: o })), n(c.getByTestId("cta-block")).toBeInTheDocument();
275
289
  });
276
290
  }), m("Conditional Rendering Logic", () => {
277
- l("should switch from PromotionsRowBlock to Carousel when promos increase", async () => {
278
- const { rerender: o } = c(/* @__PURE__ */ s(r, { promos: [t("1")] }));
279
- a(n.getByTestId("promotions-row-block")).toBeInTheDocument();
291
+ r("should switch from PromotionsRowBlock to Carousel when promos increase", async () => {
292
+ const { rerender: o } = l(/* @__PURE__ */ a(s, { promos: [t("1")] }));
293
+ n(c.getByTestId("promotions-row-block")).toBeInTheDocument();
280
294
  const e = Array.from({ length: 5 }, (i, p) => t(`${p + 1}`));
281
- o(/* @__PURE__ */ s(r, { promos: e })), await u(() => {
282
- a(n.getByTestId("carousel")).toBeInTheDocument();
283
- }), a(n.queryByTestId("promotions-row-block")).not.toBeInTheDocument();
284
- }), l("should render section element for PromotionsRowBlock view", () => {
285
- const o = [t("1")], { container: e } = c(/* @__PURE__ */ s(r, { promos: o })), i = e.querySelector("section");
286
- a(i).toBeInTheDocument();
287
- }), l("should not render section element for Carousel view", async () => {
288
- const o = Array.from({ length: 5 }, (p, y) => t(`${y + 1}`)), { container: e } = c(/* @__PURE__ */ s(r, { promos: o }));
295
+ o(/* @__PURE__ */ a(s, { promos: e })), await u(() => {
296
+ n(c.getByTestId("carousel")).toBeInTheDocument();
297
+ }), n(c.queryByTestId("promotions-row-block")).not.toBeInTheDocument();
298
+ }), r("should render section element for PromotionsRowBlock view", () => {
299
+ const o = [t("1")], { container: e } = l(/* @__PURE__ */ a(s, { promos: o })), i = e.querySelector("section");
300
+ n(i).toBeInTheDocument();
301
+ }), r("should not render section element for Carousel view", async () => {
302
+ const o = Array.from({ length: 5 }, (p, y) => t(`${y + 1}`)), { container: e } = l(/* @__PURE__ */ a(s, { promos: o }));
289
303
  await u(() => {
290
- a(n.getByTestId("carousel")).toBeInTheDocument();
304
+ n(c.getByTestId("carousel")).toBeInTheDocument();
291
305
  });
292
306
  const i = e.querySelector("section");
293
- a(i).not.toBeInTheDocument();
307
+ n(i).not.toBeInTheDocument();
294
308
  });
295
309
  }), m("Integration", () => {
296
- l("should render complete module with all elements", () => {
310
+ r("should render complete module with all elements", () => {
297
311
  const o = [
298
312
  t("1", {
299
313
  title: "Promo 1",
@@ -305,28 +319,28 @@ m("PromotionsRowModule", () => {
305
319
  content: "Content 2"
306
320
  })
307
321
  ];
308
- c(/* @__PURE__ */ s(r, { promos: o, title: "Test Module" })), a(n.getByRole("heading", { name: "Test Module" })).toBeInTheDocument(), a(n.getByTestId("promotions-row-block")).toBeInTheDocument(), a(n.getAllByTestId("image-card")).toHaveLength(2), a(n.getByTestId("cta-block")).toBeInTheDocument();
309
- }), l("should render carousel with all promos when count > 4", async () => {
322
+ l(/* @__PURE__ */ a(s, { promos: o, title: "Test Module" })), n(c.getByRole("heading", { name: "Test Module" })).toBeInTheDocument(), n(c.getByTestId("promotions-row-block")).toBeInTheDocument(), n(c.getAllByTestId("image-card")).toHaveLength(2), n(c.getByTestId("cta-block")).toBeInTheDocument();
323
+ }), r("should render carousel with all promos when count > 4", async () => {
310
324
  const o = Array.from(
311
325
  { length: 8 },
312
326
  (e, i) => t(`${i + 1}`, { title: `Promo ${i + 1}` })
313
327
  );
314
- c(/* @__PURE__ */ s(r, { promos: o, title: "Carousel Module" })), await u(() => {
315
- a(n.getByRole("heading", { name: "Carousel Module", level: 1 })).toBeInTheDocument();
316
- const e = n.getByTestId("carousel");
317
- a(e).toHaveAttribute("data-cells-count", "8");
328
+ l(/* @__PURE__ */ a(s, { promos: o, title: "Carousel Module" })), await u(() => {
329
+ n(c.getByRole("heading", { name: "Carousel Module", level: 1 })).toBeInTheDocument();
330
+ const e = c.getByTestId("carousel");
331
+ n(e).toHaveAttribute("data-cells-count", "8");
318
332
  });
319
- }), l("should handle mix of promos with and without overlayContent", () => {
333
+ }), r("should handle mix of promos with and without overlayContent", () => {
320
334
  const o = [
321
335
  t("1", { overlayContent: { title: "Overlay 1", cta: d } }),
322
336
  t("2"),
323
337
  t("3", { overlayContent: { title: "Overlay 3", cta: d } })
324
338
  ];
325
- c(/* @__PURE__ */ s(r, { promos: o })), a(n.getAllByTestId("image-card")).toHaveLength(3), a(n.getAllByTestId("cta-block")).toHaveLength(2);
339
+ l(/* @__PURE__ */ a(s, { promos: o })), n(c.getAllByTestId("image-card")).toHaveLength(3), n(c.getAllByTestId("cta-block")).toHaveLength(2);
326
340
  });
327
341
  }), m("Type Safety", () => {
328
- l("should accept valid Promo array", () => {
329
- c(/* @__PURE__ */ s(r, { promos: [
342
+ r("should accept valid Promo array", () => {
343
+ l(/* @__PURE__ */ a(s, { promos: [
330
344
  {
331
345
  id: "1",
332
346
  title: "Promo 1",
@@ -338,12 +352,12 @@ m("PromotionsRowModule", () => {
338
352
  id: "2",
339
353
  image: g
340
354
  }
341
- ] })), a(n.getAllByTestId("image-card")).toHaveLength(2);
342
- }), l("should accept handleClicks function with correct signature", () => {
355
+ ] })), n(c.getAllByTestId("image-card")).toHaveLength(2);
356
+ }), r("should accept handleClicks function with correct signature", () => {
343
357
  const o = (i) => {
344
358
  console.warn(i);
345
359
  }, e = [t("1")];
346
- c(/* @__PURE__ */ s(r, { handleClicks: o, promos: e })), a(n.getByTestId("image-card")).toBeInTheDocument();
360
+ l(/* @__PURE__ */ a(s, { handleClicks: o, promos: e })), n(c.getByTestId("image-card")).toBeInTheDocument();
347
361
  });
348
362
  });
349
363
  });
@@ -1,16 +1,16 @@
1
1
  import { useRef as i, useEffect as o } from "react";
2
- const d = ({ messageId: c = 1192723 }) => {
2
+ const u = ({ messageId: c = 1192723 }) => {
3
3
  const s = i(c);
4
4
  return o(() => {
5
5
  const t = (e) => {
6
6
  var a;
7
- e.preventDefault(), (a = window._sp_) != null && a.usnat ? window._sp_.usnat.loadPrivacyManagerModal(s.current) : console.warn("Sourcepoint usnat not found.");
7
+ e instanceof MouseEvent && e.preventDefault(), (a = window._sp_) != null && a.usnat ? window._sp_.usnat.loadPrivacyManagerModal(s.current) : console.warn("Sourcepoint usnat not found.");
8
8
  };
9
9
  let n = 0;
10
10
  const r = setInterval(() => {
11
11
  n++;
12
12
  const e = document.querySelector(".privacy-preferences-trigger");
13
- e && !e.getAttribute("data-sp-listener-added") ? (e.addEventListener("click", t), e.setAttribute("data-sp-listener-added", !0), clearInterval(r)) : e && e.getAttribute("data-sp-listener-added") && clearInterval(r), n > 1e3 && (clearInterval(r), console.warn("Privacy preference button not found."));
13
+ e && !e.getAttribute("data-sp-listener-added") ? (e.addEventListener("click", t), e.setAttribute("data-sp-listener-added", "true"), clearInterval(r)) : e && e.getAttribute("data-sp-listener-added") && clearInterval(r), n > 1e3 && (clearInterval(r), console.warn("Privacy preference button not found."));
14
14
  }, 100);
15
15
  return () => {
16
16
  const e = document.querySelector(".privacy-preferences-trigger");
@@ -19,5 +19,5 @@ const d = ({ messageId: c = 1192723 }) => {
19
19
  }), null;
20
20
  };
21
21
  export {
22
- d as default
22
+ u as default
23
23
  };
@@ -8,10 +8,10 @@ export default class CarouselUtils {
8
8
  currentIndex: number;
9
9
  slideEls: HTMLElement[];
10
10
  navBtnEls: CarouselNavBtnEls;
11
- currentIntersecting: IntersectionObserverEntry | Record<string, never>;
11
+ currentIntersecting: IntersectionObserverEntry | null;
12
12
  options: CarouselOptions;
13
- timer: NodeJS.Timeout | null | undefined;
14
- timerInterval: number | undefined;
13
+ timer: ReturnType<typeof setInterval> | null;
14
+ timerInterval: number;
15
15
  slideGutterSize: number;
16
16
  showPagination: boolean | undefined;
17
17
  isInitialScroll: boolean;
@@ -53,4 +53,9 @@ export default class CarouselUtils {
53
53
  * @returns void
54
54
  */
55
55
  handleScrollEnd(): void;
56
+ /**
57
+ * Cleans up the timer and disconnects the IntersectionObserver.
58
+ * Call this when the carousel is unmounted.
59
+ */
60
+ destroy(): void;
56
61
  }
@@ -4,5 +4,5 @@ interface PaginationProps {
4
4
  carouselId: string;
5
5
  ref?: React.Ref<HTMLOListElement>;
6
6
  }
7
- export declare function Pagination({ slides, carouselId, ref }: PaginationProps): import("react/jsx-runtime").JSX.Element;
7
+ export declare function Pagination({ slides, carouselId, ref }: PaginationProps): JSX.Element;
8
8
  export default Pagination;
@@ -20,7 +20,8 @@ type Promo = {
20
20
  type PromotionsRowModuleProps = {
21
21
  title?: string;
22
22
  promos: Promo[];
23
+ shouldClampContent?: boolean;
23
24
  handleClicks?: ((eventDetails: HandleClicksDetails) => void) | null;
24
25
  };
25
- export declare function PromotionsRowModule({ title, promos, handleClicks, }: PromotionsRowModuleProps): JSX.Element;
26
+ export declare function PromotionsRowModule({ title, promos, shouldClampContent, handleClicks, }: PromotionsRowModuleProps): JSX.Element;
26
27
  export default PromotionsRowModule;
@@ -1,4 +1,12 @@
1
- export default useSourcePointPrivacyTrigger;
1
+ declare global {
2
+ interface Window {
3
+ _sp_?: {
4
+ usnat?: {
5
+ loadPrivacyManagerModal: (messageId: number) => void;
6
+ };
7
+ };
8
+ }
9
+ }
2
10
  /**
3
11
  * Custom hook to trigger the Sourcepoint privacy manager modal.
4
12
  * @param {*} param0 - Configuration object.
@@ -7,4 +15,7 @@ export default useSourcePointPrivacyTrigger;
7
15
  *
8
16
  * @returns void
9
17
  */
10
- declare function useSourcePointPrivacyTrigger({ messageId }: any): null;
18
+ declare const useSourcePointPrivacyTrigger: ({ messageId }: {
19
+ messageId?: number | undefined;
20
+ }) => null;
21
+ export default useSourcePointPrivacyTrigger;
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.0.4",
2
+ "version": "2.0.5",
3
3
  "name": "@scrippsproduct/networks-ui-library",
4
4
  "description": "React Component Library for use in Scripps Networks external applications",
5
5
  "author": {
@@ -38,7 +38,8 @@
38
38
  "react-datepicker": "^7.2.0",
39
39
  "react-feather": "^2.0.10",
40
40
  "react-ga4": "^2.1.0",
41
- "sass-embedded": "^1.80.7"
41
+ "sass-embedded": "^1.80.7",
42
+ "scrollyfills": "^1.0.4"
42
43
  },
43
44
  "peerDependencies": {
44
45
  "react": "^19.0.0",
@@ -1,14 +0,0 @@
1
- import './assets/Carousel.css';const _ = "_carousel_2eeiv_2", e = "_carousel__scroller_2eeiv_12", o = {
2
- carousel: _,
3
- carousel__scroller: e,
4
- "carousel-controls": "_carousel-controls_2eeiv_39",
5
- "carousel-controls__previous": "_carousel-controls__previous_2eeiv_43",
6
- "carousel-controls__next": "_carousel-controls__next_2eeiv_50",
7
- "carousel-controls__btn": "_carousel-controls__btn_2eeiv_57",
8
- "carousel-nav": "_carousel-nav_2eeiv_84",
9
- "carousel-nav__list": "_carousel-nav__list_2eeiv_88",
10
- "carousel-nav__item": "_carousel-nav__item_2eeiv_97"
11
- };
12
- export {
13
- o as c
14
- };