@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,82 +1,78 @@
1
- var L = Object.defineProperty;
2
- var b = (i) => {
3
- throw TypeError(i);
1
+ var T = Object.defineProperty;
2
+ var g = (r) => {
3
+ throw TypeError(r);
4
4
  };
5
- var z = (i, t, e) => t in i ? L(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
6
- var l = (i, t, e) => z(i, typeof t != "symbol" ? t + "" : t, e), O = (i, t, e) => t.has(i) || b("Cannot " + e);
7
- var x = (i, t, e) => t.has(i) ? b("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(i) : t.set(i, e);
8
- var r = (i, t, e) => (O(i, t, "access private method"), e);
9
- let f = /* @__PURE__ */ new WeakMap();
10
- const P = new Event("scrollend"), I = /* @__PURE__ */ new Set();
11
- function h(i, t, e) {
12
- let n = i[t];
13
- i[t] = function() {
14
- let c = Array.prototype.slice.apply(arguments, [0]);
15
- n.apply(this, c), c.unshift(n), e.apply(this, c);
16
- };
17
- }
18
- function m(i, t) {
19
- if (t !== "scroll" && t !== "scrollend")
20
- return;
21
- let e = f.get(this);
22
- if (e === void 0) {
23
- let n = 0;
24
- e = {
25
- scrollListener: () => {
26
- clearTimeout(n), n = setTimeout(() => {
27
- I.size ? setTimeout(e.scrollListener, 100) : (this.dispatchEvent(P), n = 0);
5
+ var B = (r, t, e) => t in r ? T(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
6
+ var n = (r, t, e) => B(r, typeof t != "symbol" ? t + "" : t, e), L = (r, t, e) => t.has(r) || g("Cannot " + e);
7
+ var w = (r, t, e) => t.has(r) ? g("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(r) : t.set(r, e);
8
+ var l = (r, t, e) => (L(r, t, "access private method"), e);
9
+ if (typeof window < "u" && !("onscrollend" in window)) {
10
+ let e = function(o, i, p) {
11
+ let d = o[i];
12
+ o[i] = function() {
13
+ let a = Array.prototype.slice.apply(arguments, [0]);
14
+ d.apply(this, a), a.unshift(d), p.apply(this, a);
15
+ };
16
+ }, h = function(o, i, p, d) {
17
+ if (i != "scroll" && i != "scrollend") return;
18
+ let a = this, u = t.get(a);
19
+ if (u === void 0) {
20
+ let m = 0;
21
+ u = { scrollListener: (O) => {
22
+ clearTimeout(m), m = setTimeout(() => {
23
+ r.size ? setTimeout(u.scrollListener, 100) : (a && a.dispatchEvent(new Event("scrollend")), m = 0);
28
24
  }, 100);
29
- },
30
- listeners: 0
31
- // Count of number of listeners.
32
- }, i.apply(this, ["scroll", e.scrollListener]), f.set(this, e);
33
- }
34
- e.listeners++;
35
- }
36
- function p(i, t) {
37
- if (t !== "scroll" && t !== "scrollend") return;
38
- let e = f.get(this);
39
- e !== void 0 && (e[t]--, !(--e.listeners > 0) && (i.apply(this, ["scroll", e.scrollListener]), f.delete(this)));
25
+ }, listeners: 0 }, o.apply(a, ["scroll", u.scrollListener, { passive: !0 }]), t.set(a, u);
26
+ }
27
+ u.listeners++;
28
+ }, c = function(o, i, p) {
29
+ if (i != "scroll" && i != "scrollend") return;
30
+ let d = this, a = t.get(d);
31
+ a !== void 0 && (--a.listeners > 0 || (o.apply(d, ["scroll", a.scrollListener]), t.delete(d)));
32
+ };
33
+ const r = /* @__PURE__ */ new Set();
34
+ document.addEventListener("touchstart", (o) => {
35
+ for (let i of o.changedTouches) r.add(i.identifier);
36
+ }, { passive: !0 }), document.addEventListener("touchend", (o) => {
37
+ for (let i of o.changedTouches) r.delete(i.identifier);
38
+ }, { passive: !0 }), document.addEventListener("touchcancel", (o) => {
39
+ for (let i of o.changedTouches) r.delete(i.identifier);
40
+ }, { passive: !0 });
41
+ let t = /* @__PURE__ */ new WeakMap();
42
+ e(Element.prototype, "addEventListener", h), e(window, "addEventListener", h), e(document, "addEventListener", h), e(Element.prototype, "removeEventListener", c), e(window, "removeEventListener", c), e(document, "removeEventListener", c);
40
43
  }
41
- const G = "onscrollend" in window;
42
- var s, u, w, A, S, a, d, y, g, T;
43
- class M {
44
+ var s, E, b, x, y, f, v, S, I, A;
45
+ class C {
44
46
  constructor({
45
47
  carouselEl: t,
46
48
  scrollerEl: e,
47
- paginationEl: n,
49
+ paginationEl: h,
48
50
  cells: c,
49
- navBtnEls: B = {
51
+ navBtnEls: o = {
50
52
  next: {},
51
53
  previous: {}
52
54
  },
53
- options: o
55
+ options: i
54
56
  }) {
55
- x(this, s);
56
- l(this, "carouselEl");
57
- l(this, "scrollerEl");
58
- l(this, "paginationEl");
59
- l(this, "cells");
60
- l(this, "currentIndex");
61
- l(this, "slideEls");
62
- l(this, "navBtnEls");
63
- l(this, "currentIntersecting");
64
- l(this, "options");
65
- l(this, "timer");
66
- l(this, "timerInterval");
67
- l(this, "slideGutterSize");
68
- l(this, "showPagination");
69
- l(this, "isInitialScroll");
70
- l(this, "totalSlideEls");
71
- l(this, "totalSlides");
72
- l(this, "carouselObserver");
73
- G || (document.addEventListener("touchstart", (v) => {
74
- for (let E of v.changedTouches)
75
- I.add(E.identifier);
76
- }, { passive: !0 }), document.addEventListener("touchend", (v) => {
77
- for (let E of v.changedTouches)
78
- I.delete(E.identifier);
79
- }, { passive: !0 }), h(Element.prototype, "addEventListener", m), h(window, "addEventListener", m), h(document, "addEventListener", m), h(Element.prototype, "removeEventListener", p), h(window, "removeEventListener", p), h(document, "removeEventListener", p)), this.carouselEl = t, this.scrollerEl = e, this.paginationEl = n, this.currentIndex = 0, this.navBtnEls = B, this.currentIntersecting = {}, this.options = o, o.autoplay && (this.timer = null, this.timerInterval = (o == null ? void 0 : o.delay) ?? 3500, this.startTimer()), this.slideGutterSize = (o == null ? void 0 : o.slideGutterSize) ?? 25, this.showPagination = o == null ? void 0 : o.showPagination, this.isInitialScroll = !0, this.cells = c, this.slideEls = [...e.children], this.totalSlideEls = this.slideEls.length, this.totalSlides = Math.ceil(this.cells.length / (this.options.cellsPerSlide ?? 1)), r(this, s, w).call(this), r(this, s, S).call(this), r(this, s, A).call(this);
57
+ w(this, s);
58
+ n(this, "carouselEl");
59
+ n(this, "scrollerEl");
60
+ n(this, "paginationEl");
61
+ n(this, "cells");
62
+ n(this, "currentIndex");
63
+ n(this, "slideEls");
64
+ n(this, "navBtnEls");
65
+ n(this, "currentIntersecting");
66
+ n(this, "options");
67
+ n(this, "timer");
68
+ n(this, "timerInterval");
69
+ n(this, "slideGutterSize");
70
+ n(this, "showPagination");
71
+ n(this, "isInitialScroll");
72
+ n(this, "totalSlideEls");
73
+ n(this, "totalSlides");
74
+ n(this, "carouselObserver");
75
+ this.carouselEl = t, this.scrollerEl = e, this.paginationEl = h, this.currentIndex = 0, this.navBtnEls = o, this.currentIntersecting = null, this.options = i, this.timer = null, this.timerInterval = (i == null ? void 0 : i.delay) ?? 3500, i.autoplay && this.startTimer(), this.slideGutterSize = (i == null ? void 0 : i.slideGutterSize) ?? 25, this.showPagination = i == null ? void 0 : i.showPagination, this.isInitialScroll = !0, this.cells = c, this.slideEls = [...e.children], this.totalSlideEls = this.slideEls.length, this.totalSlides = Math.ceil(this.cells.length / (this.options.cellsPerSlide ?? 1)), this.options.wrapAround && this.totalSlideEls !== this.totalSlides + 2 && console.warn("CarouselUtils: expected two sentinel slides in wrapAround mode; wrap-around navigation may misbehave."), l(this, s, b).call(this), l(this, s, y).call(this), l(this, s, x).call(this);
80
76
  }
81
77
  /**
82
78
  * starts the autoplay timer
@@ -100,7 +96,7 @@ class M {
100
96
  * @param {number} dir - a number representing the direction of scroll 1 for forward, -1 for backward
101
97
  */
102
98
  determineScrollAction(t) {
103
- this.options.autoplay && this.timer !== null && this.clearTimer(), t === 1 ? this.currentIndex === this.totalSlides - 1 ? this.options.wrapAround && (this.scrollerEl.style.scrollBehavior = "auto", this.scrollerEl.scrollTo(0, 0), r(this, s, a).call(this, t), this.currentIndex = 0) : (r(this, s, a).call(this, t), this.currentIndex += 1) : t === -1 && (this.currentIndex === 0 ? this.options.wrapAround && (this.scrollerEl.style.scrollBehavior = "auto", this.scrollerEl.scrollTo(99999, 0), this.currentIndex = this.totalSlides - 1, r(this, s, a).call(this, t)) : (r(this, s, a).call(this, t), this.currentIndex -= 1)), this.options.autoplay && this.timer === null && this.startTimer();
99
+ this.options.autoplay && this.timer !== null && this.clearTimer(), t === 1 ? this.currentIndex === this.totalSlides - 1 ? this.options.wrapAround && (this.scrollerEl.style.scrollBehavior = "auto", this.scrollerEl.scrollTo(0, 0), l(this, s, f).call(this, t), this.currentIndex = 0) : (l(this, s, f).call(this, t), this.currentIndex += 1) : t === -1 && (this.currentIndex === 0 ? this.options.wrapAround && (this.scrollerEl.style.scrollBehavior = "auto", this.scrollerEl.scrollTo(this.scrollerEl.scrollWidth, 0), this.currentIndex = this.totalSlides - 1, l(this, s, f).call(this, t)) : (l(this, s, f).call(this, t), this.currentIndex -= 1)), this.options.autoplay && this.timer === null && this.startTimer();
104
100
  }
105
101
  /**
106
102
  * Navigates the carousel to a specific index
@@ -111,8 +107,8 @@ class M {
111
107
  navigateToIndex(t) {
112
108
  if (t === this.currentIndex) return;
113
109
  this.options.autoplay && this.clearTimer();
114
- let e = t > this.currentIndex ? t - this.currentIndex : this.currentIndex - t, n = t > this.currentIndex ? 1 : -1;
115
- this.currentIndex = t, r(this, s, a).call(this, n, e), this.options.autoplay && this.startTimer(), r(this, s, d).call(this);
110
+ let e = t > this.currentIndex ? t - this.currentIndex : this.currentIndex - t, h = t > this.currentIndex ? 1 : -1;
111
+ this.currentIndex = t, l(this, s, f).call(this, h, e), this.options.autoplay && this.startTimer(), l(this, s, v).call(this);
116
112
  }
117
113
  /**
118
114
  * Returns the current index of the carousel
@@ -127,29 +123,38 @@ class M {
127
123
  * @returns void
128
124
  */
129
125
  handleScrollEnd() {
130
- if (this.timer === null && this.options.autoplay && this.startTimer(), this.currentIntersecting.target) {
131
- const t = Number.parseInt(this.currentIntersecting.target.getAttribute("data-index") ?? "0", 10);
126
+ var t;
127
+ if (this.timer === null && this.options.autoplay && this.startTimer(), (t = this.currentIntersecting) != null && t.target) {
128
+ const e = Number.parseInt(this.currentIntersecting.target.getAttribute("data-index") ?? "0", 10);
132
129
  if (!this.options.wrapAround) {
133
- this.currentIndex = t, r(this, s, d).call(this);
130
+ this.currentIndex = e, l(this, s, v).call(this);
134
131
  return;
135
132
  }
136
- t === 0 ? (this.currentIndex = this.totalSlides - 1, r(this, s, u).call(this, { scrollport: this.scrollerEl, element: this.slideEls[this.totalSlides] })) : t === this.totalSlideEls - 1 ? (this.currentIndex = 0, r(this, s, u).call(this, { scrollport: this.scrollerEl, element: this.slideEls[1] })) : this.currentIndex = t - 1;
133
+ e === 0 ? (this.currentIndex = this.totalSlides - 1, l(this, s, E).call(this, { scrollport: this.scrollerEl, element: this.slideEls[this.slideEls.length - 2] })) : e === this.totalSlideEls - 1 ? (this.currentIndex = 0, l(this, s, E).call(this, { scrollport: this.scrollerEl, element: this.slideEls[1] })) : this.currentIndex = e - 1;
137
134
  }
138
- r(this, s, d).call(this);
135
+ l(this, s, v).call(this);
136
+ }
137
+ /**
138
+ * Cleans up the timer and disconnects the IntersectionObserver.
139
+ * Call this when the carousel is unmounted.
140
+ */
141
+ destroy() {
142
+ var t;
143
+ this.clearTimer(), (t = this.carouselObserver) == null || t.disconnect();
139
144
  }
140
145
  }
141
146
  s = new WeakSet(), /**
142
147
  * Scrolls the carousel to a specific child element
143
148
  * @param {*} param0 - an object containing the scrollport element and the child element to scroll to
144
149
  */
145
- u = function({ scrollport: t, element: e }) {
146
- const n = this.slideGutterSize * 2 / 100;
147
- t.style.scrollBehavior = "auto", t.scrollTo(Math.abs(t.offsetLeft - e.offsetLeft + e.clientWidth * n), 0);
150
+ E = function({ scrollport: t, element: e }) {
151
+ const h = this.slideGutterSize * 2 / 100;
152
+ t.style.scrollBehavior = "auto", t.scrollTo(Math.abs(t.offsetLeft - e.offsetLeft + e.clientWidth * h), 0);
148
153
  }, /**
149
154
  * adds an observer to the scroller element that we can use to
150
155
  * determine which slide is intersecting
151
156
  */
152
- w = function() {
157
+ b = function() {
153
158
  this.carouselObserver = new IntersectionObserver((t) => {
154
159
  for (let e of t)
155
160
  e.isIntersecting && (this.currentIntersecting = e);
@@ -160,56 +165,58 @@ w = function() {
160
165
  }, /**
161
166
  * sets listeners on the slide elements for the observer
162
167
  */
163
- A = function() {
168
+ x = function() {
164
169
  for (let t of this.slideEls)
165
170
  this.carouselObserver && this.carouselObserver.observe(t);
166
171
  }, /**
167
- * sets some intial settings for the carousel based on some of the options
172
+ * sets some initial settings for the carousel based on some of the options
168
173
  */
169
- S = function() {
174
+ y = function() {
170
175
  var t, e;
171
- this.options.wrapAround ? (this.scrollerEl.style.scrollBehavior = "auto", this.scrollerEl.scrollTo(-9999, 0), r(this, s, u).call(this, { scrollport: this.scrollerEl, element: this.scrollerEl.children[1] })) : this.options.showControls ? (this.navBtnEls && ((t = this.navBtnEls) != null && t.previous) && ((e = this.navBtnEls) == null || e.previous.setAttribute("disabled", "disabled")), r(this, s, d).call(this)) : r(this, s, g).call(this), this.totalSlides === 1 && this.slideEls[0].removeAttribute("inert");
176
+ this.options.wrapAround ? (this.scrollerEl.style.scrollBehavior = "auto", this.scrollerEl.scrollTo(0, 0), l(this, s, E).call(this, { scrollport: this.scrollerEl, element: this.scrollerEl.children[1] })) : this.options.showControls ? (this.navBtnEls && ((t = this.navBtnEls) != null && t.previous) && ((e = this.navBtnEls) == null || e.previous.setAttribute("disabled", "disabled")), l(this, s, v).call(this)) : l(this, s, I).call(this), this.totalSlideEls === 1 && this.slideEls[0].removeAttribute("inert");
172
177
  }, /**
173
178
  * Scrolls the carousel in a specified direction by a specified distance
174
179
  *
175
180
  * @param {number} dir - a number representing the direction of scroll 1 for forward, -1 for backward
176
181
  * @param {number} distance - a number representing the number of slides to scroll
177
182
  */
178
- a = function(t, e = 1) {
183
+ f = function(t, e = 1) {
184
+ var c;
185
+ const h = ((c = this.slideEls[0]) == null ? void 0 : c.getBoundingClientRect().width) ?? 0;
179
186
  this.scrollerEl.style.scrollBehavior = "smooth", this.scrollerEl.scrollBy({
180
- left: this.scrollerEl.clientWidth * ((100 - this.slideGutterSize * 2) / 100) * e * t,
187
+ left: h * e * t,
181
188
  top: 0,
182
189
  behavior: "smooth"
183
190
  });
184
191
  }, /**
185
- * Syncronizes various elements of the carousel
192
+ * Synchronizes various elements of the carousel
186
193
  *
187
194
  * add methods here to have them sync
188
195
  * when scroller is scrolled
189
196
  */
190
- d = function() {
191
- r(this, s, g).call(this), this.showPagination && r(this, s, T).call(this), this.options.wrapAround || r(this, s, y).call(this);
197
+ v = function() {
198
+ l(this, s, I).call(this), this.showPagination && l(this, s, A).call(this), this.options.wrapAround || l(this, s, S).call(this);
192
199
  }, /**
193
200
  * Sets the control arrow buttons to disabled if the carousel is at the start or end
194
201
  */
195
- y = function() {
196
- this.navBtnEls.previous && this.navBtnEls.next && (this.navBtnEls.previous.removeAttribute("disabled"), this.navBtnEls.next.removeAttribute("disabled"), this.currentIndex === 0 && this.navBtnEls.previous.toggleAttribute("disabled"), this.currentIndex === this.slideEls.length - 1 && this.navBtnEls.next.toggleAttribute("disabled"));
202
+ S = function() {
203
+ this.navBtnEls.previous && this.navBtnEls.next && (this.navBtnEls.previous.removeAttribute("disabled"), this.navBtnEls.next.removeAttribute("disabled"), this.currentIndex === 0 && this.navBtnEls.previous.toggleAttribute("disabled"), this.currentIndex === this.totalSlides - 1 && this.navBtnEls.next.toggleAttribute("disabled"));
197
204
  }, /**
198
205
  * Sets the inert attribute on all slides that are not the current slide
199
206
  */
200
- g = function() {
207
+ I = function() {
201
208
  const t = this.options.wrapAround ? this.currentIndex + 1 : this.currentIndex;
202
- this.slideEls.length === 1 ? this.slideEls[0].removeAttribute("inert") : this.slideEls.forEach((e, n) => {
203
- e.toggleAttribute("inert", n !== t);
209
+ this.slideEls.length === 1 ? this.slideEls[0].removeAttribute("inert") : this.slideEls.forEach((e, h) => {
210
+ e.toggleAttribute("inert", h !== t);
204
211
  });
205
212
  }, /**
206
213
  * Sets the pagination indicator to the current slide
207
214
  */
208
- T = function() {
215
+ A = function() {
209
216
  [...this.paginationEl.children].forEach((t, e) => {
210
- e === this.currentIndex ? t.setAttribute("data-current", "true") : t.setAttribute("data-current", "false");
217
+ t.toggleAttribute("data-current", e === this.currentIndex);
211
218
  });
212
219
  };
213
220
  export {
214
- M as default
221
+ C as default
215
222
  };
@@ -1,11 +1,11 @@
1
1
  import { jsx as e } from "react/jsx-runtime";
2
- import { c as r } from "../../../Carousel.module-BsPaZX5L.mjs";
2
+ import { c as r } from "../../../Carousel.module-Nwf_zL9b.mjs";
3
3
  function n({ slides: l, carouselId: s, ref: t }) {
4
4
  return /* @__PURE__ */ e("div", { className: `${r["carousel-nav"]} carousel-nav`, children: /* @__PURE__ */ e("ol", { className: r["carousel-nav__list"], ref: t, children: l.map((o, a) => /* @__PURE__ */ e(
5
5
  "li",
6
6
  {
7
7
  className: `${r["carousel-nav__item"]} carousel-nav__item`,
8
- "data-current": a === 0 ? "true" : "false",
8
+ "data-current": a === 0 ? "" : void 0,
9
9
  title: `Navigate to slide ${a + 1}`
10
10
  },
11
11
  `carousel${s}-nav-${a}`
@@ -1,65 +1,65 @@
1
- import { jsx as r } from "react/jsx-runtime";
1
+ import { jsx as o } from "react/jsx-runtime";
2
2
  import { createRef as m } from "react";
3
- import { d as c, i as l, r as o, s as a, g as t } from "../../../react.esm-S2Q_NbYC.mjs";
3
+ import { d as c, i as l, r, s as a, g as t } from "../../../react.esm-S2Q_NbYC.mjs";
4
4
  import "../../../index-BZQHStQa.mjs";
5
5
  import { Pagination as i } from "./Pagination.js";
6
6
  const n = Array.from({ length: 5 }), u = Array.from({ length: 1 });
7
7
  c("Pagination", () => {
8
8
  c("Rendering", () => {
9
9
  l("renders the correct number of list items", () => {
10
- o(/* @__PURE__ */ r(i, { carouselId: "test", slides: n }));
10
+ r(/* @__PURE__ */ o(i, { carouselId: "test", slides: n }));
11
11
  const e = a.getAllByRole("listitem");
12
12
  t(e).toHaveLength(5);
13
13
  }), l("renders nothing inside the list for empty slides", () => {
14
- const { container: e } = o(/* @__PURE__ */ r(i, { carouselId: "test", slides: [] })), s = e.querySelector("ol");
14
+ const { container: e } = r(/* @__PURE__ */ o(i, { carouselId: "test", slides: [] })), s = e.querySelector("ol");
15
15
  t(s).toBeInTheDocument(), t(s == null ? void 0 : s.children).toHaveLength(0);
16
16
  }), l("renders the outer nav div", () => {
17
- const { container: e } = o(/* @__PURE__ */ r(i, { carouselId: "test", slides: n })), s = e.querySelector(".carousel-nav");
17
+ const { container: e } = r(/* @__PURE__ */ o(i, { carouselId: "test", slides: n })), s = e.querySelector(".carousel-nav");
18
18
  t(s).toBeInTheDocument();
19
19
  }), l("renders an ordered list", () => {
20
- o(/* @__PURE__ */ r(i, { carouselId: "test", slides: n })), t(a.getByRole("list")).toBeInTheDocument();
21
- const { container: e } = o(/* @__PURE__ */ r(i, { carouselId: "test", slides: n }));
20
+ r(/* @__PURE__ */ o(i, { carouselId: "test", slides: n })), t(a.getByRole("list")).toBeInTheDocument();
21
+ const { container: e } = r(/* @__PURE__ */ o(i, { carouselId: "test", slides: n }));
22
22
  t(e.querySelector("ol")).toBeInTheDocument();
23
23
  }), l("renders the correct number of items for a single slide", () => {
24
- o(/* @__PURE__ */ r(i, { carouselId: "test", slides: u })), t(a.getAllByRole("listitem")).toHaveLength(1);
24
+ r(/* @__PURE__ */ o(i, { carouselId: "test", slides: u })), t(a.getAllByRole("listitem")).toHaveLength(1);
25
25
  }), l("renders the correct number of items for many slides", () => {
26
26
  const e = Array.from({ length: 12 });
27
- o(/* @__PURE__ */ r(i, { carouselId: "test", slides: e })), t(a.getAllByRole("listitem")).toHaveLength(12);
27
+ r(/* @__PURE__ */ o(i, { carouselId: "test", slides: e })), t(a.getAllByRole("listitem")).toHaveLength(12);
28
28
  });
29
29
  }), c("data-current attribute", () => {
30
- l('sets data-current="true" on the first item', () => {
31
- o(/* @__PURE__ */ r(i, { carouselId: "test", slides: n }));
30
+ l("sets data-current on the first item", () => {
31
+ r(/* @__PURE__ */ o(i, { carouselId: "test", slides: n }));
32
32
  const e = a.getAllByRole("listitem");
33
- t(e[0]).toHaveAttribute("data-current", "true");
34
- }), l('sets data-current="false" on all items after the first', () => {
35
- o(/* @__PURE__ */ r(i, { carouselId: "test", slides: n }));
33
+ t(e[0]).toHaveAttribute("data-current");
34
+ }), l("does not set data-current on items after the first", () => {
35
+ r(/* @__PURE__ */ o(i, { carouselId: "test", slides: n }));
36
36
  const e = a.getAllByRole("listitem");
37
37
  for (let s = 1; s < e.length; s++)
38
- t(e[s]).toHaveAttribute("data-current", "false");
39
- }), l('sets data-current="true" on the single item when there is one slide', () => {
40
- o(/* @__PURE__ */ r(i, { carouselId: "test", slides: u }));
38
+ t(e[s]).not.toHaveAttribute("data-current");
39
+ }), l("sets data-current on the single item when there is one slide", () => {
40
+ r(/* @__PURE__ */ o(i, { carouselId: "test", slides: u }));
41
41
  const e = a.getByRole("listitem");
42
- t(e).toHaveAttribute("data-current", "true");
42
+ t(e).toHaveAttribute("data-current");
43
43
  });
44
44
  }), c("title attribute", () => {
45
45
  l("sets the correct title on each item (1-indexed)", () => {
46
- o(/* @__PURE__ */ r(i, { carouselId: "test", slides: n })), a.getAllByRole("listitem").forEach((s, d) => {
46
+ r(/* @__PURE__ */ o(i, { carouselId: "test", slides: n })), a.getAllByRole("listitem").forEach((s, d) => {
47
47
  t(s).toHaveAttribute("title", `Navigate to slide ${d + 1}`);
48
48
  });
49
49
  }), l('sets title="Navigate to slide 1" on a single-slide pagination', () => {
50
- o(/* @__PURE__ */ r(i, { carouselId: "test", slides: u })), t(a.getByRole("listitem")).toHaveAttribute("title", "Navigate to slide 1");
50
+ r(/* @__PURE__ */ o(i, { carouselId: "test", slides: u })), t(a.getByRole("listitem")).toHaveAttribute("title", "Navigate to slide 1");
51
51
  });
52
52
  }), c("carouselId in keys", () => {
53
53
  l("uses carouselId in the rendered item titles to distinguish instances", () => {
54
- const { container: e } = o(/* @__PURE__ */ r(i, { carouselId: "alpha", slides: n })), { container: s } = o(/* @__PURE__ */ r(i, { carouselId: "beta", slides: n }));
54
+ const { container: e } = r(/* @__PURE__ */ o(i, { carouselId: "alpha", slides: n })), { container: s } = r(/* @__PURE__ */ o(i, { carouselId: "beta", slides: n }));
55
55
  t(e.querySelectorAll("li")).toHaveLength(5), t(s.querySelectorAll("li")).toHaveLength(5);
56
56
  });
57
57
  }), c("ref forwarding", () => {
58
58
  l("forwards the ref to the <ol> element", () => {
59
- const e = m(), { container: s } = o(/* @__PURE__ */ r(i, { carouselId: "test", ref: e, slides: n })), d = s.querySelector("ol");
59
+ const e = m(), { container: s } = r(/* @__PURE__ */ o(i, { carouselId: "test", ref: e, slides: n })), d = s.querySelector("ol");
60
60
  t(e.current).toBe(d);
61
61
  }), l("ref is null when no ref is provided", () => {
62
- const { container: e } = o(/* @__PURE__ */ r(i, { carouselId: "test", slides: n }));
62
+ const { container: e } = r(/* @__PURE__ */ o(i, { carouselId: "test", slides: n }));
63
63
  t(e.querySelector("ol")).toBeInTheDocument();
64
64
  });
65
65
  });