@scrippsproduct/networks-ui-library 1.0.17 → 1.0.18-dev.0

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.
@@ -0,0 +1,14 @@
1
+ import './assets/Carousel.css';const _ = "_carousel_60lzn_1", l = "_carousel__scroller_60lzn_11", o = {
2
+ carousel: _,
3
+ carousel__scroller: l,
4
+ "carousel-controls": "_carousel-controls_60lzn_38",
5
+ "carousel-controls__btn": "_carousel-controls__btn_60lzn_42",
6
+ "carousel-controls__previous": "_carousel-controls__previous_60lzn_67",
7
+ "carousel-controls__next": "_carousel-controls__next_60lzn_74",
8
+ "carousel-nav": "_carousel-nav_60lzn_86",
9
+ "carousel-nav__list": "_carousel-nav__list_60lzn_90",
10
+ "carousel-nav__item": "_carousel-nav__item_60lzn_99"
11
+ };
12
+ export {
13
+ o as c
14
+ };
@@ -1 +1 @@
1
- ._carousel_idy2d_1{--_carousel-scrollbar-gutter: 1.75rem;--_carousel-pagination-size: 1rem;--_slide-gap: 1.5rem;position:relative;display:grid;grid-template-columns:1fr;grid-template-rows:[carousel-scroller] 1fr [carousel-pagination]}._carousel__scroller_idy2d_11{display:flex;box-sizing:border-box;overflow-x:auto;scroll-behavior:smooth;overscroll-behavior-x:contain;scroll-snap-type:x mandatory;scroll-snap-align:center;scroll-padding-inline:var(--_carousel-gutters);padding-inline:var(--_carousel-gutters);scrollbar-width:none;list-style:none;margin:0}._carousel__scroller_idy2d_11[data-scrollbar=true]{scrollbar-width:auto;overflow-x:scroll}._carousel__scroller_idy2d_11:not([data-scrollbar=true])::-webkit-scrollbar{display:none}._carousel__scroller_idy2d_11::-webkit-scrollbar{display:auto}._carousel-controls_idy2d_39{display:contents}._carousel-controls__btn_idy2d_43{position:absolute;top:50%;transform:translateY(var(--_controls-transform));border-radius:50%;background-color:#fff6;color:#000;aspect-ratio:1;border:1px solid transparent;padding:0;overflow:hidden;z-index:1;cursor:pointer;transition:opacity .325s ease-out}._carousel-controls__btn_idy2d_43>i>svg{display:block;block-size:auto;max-inline-size:100%;stroke:currentColor}._carousel-controls__btn_idy2d_43[disabled]{opacity:0}._carousel-controls__previous_idy2d_68{inset-inline-start:var(--_control-btns-offset-x)}._carousel-controls__previous_idy2d_68 svg{transform:translate(-2px)}._carousel-controls__next_idy2d_75{inset-inline-end:var(--_control-btns-offset-x)}._carousel-controls__next_idy2d_75 svg{transform:translate(2px)}._carousel-controls__btn_idy2d_43[disabled]{cursor:not-allowed;transition-delay:0s}._carousel-nav_idy2d_87{margin-top:0}._carousel-nav__list_idy2d_91{display:flex;gap:1rem;justify-content:center;align-items:flex-start;list-style:none;padding:0}._carousel-nav__item_idy2d_100{flex-basis:1rem;min-width:1rem;max-width:1rem;height:1rem;background-color:transparent;border-radius:50%;border:1px solid rgba(65,65,65,.1)}._carousel-nav__item_idy2d_100[data-current=true]{background-color:#8080801a}
1
+ ._carousel_60lzn_1{--_carousel-scrollbar-gutter: 1.75rem;--_carousel-pagination-size: 1rem;--_slide-gap: 1.5rem;position:relative;display:grid;grid-template-columns:1fr;grid-template-rows:[carousel-scroller] 1fr [carousel-pagination]}._carousel__scroller_60lzn_11{display:flex;box-sizing:border-box;overflow-x:auto;scroll-behavior:smooth;overscroll-behavior-x:contain;scroll-snap-type:x mandatory;scroll-padding-inline:var(--_carousel-gutters);padding-inline:var(--_carousel-gutters);scrollbar-width:none;list-style:none;margin:0}._carousel__scroller_60lzn_11[data-scrollbar=true]{scrollbar-width:auto;overflow-x:scroll}._carousel__scroller_60lzn_11:not([data-scrollbar=true])::-webkit-scrollbar{display:none}._carousel__scroller_60lzn_11::-webkit-scrollbar{display:auto}._carousel-controls_60lzn_38{display:contents}._carousel-controls__btn_60lzn_42{position:absolute;top:50%;transform:translateY(var(--_controls-transform));border-radius:50%;background-color:#fff6;color:#000;aspect-ratio:1;border:1px solid transparent;padding:0;overflow:hidden;z-index:1;cursor:pointer;transition:opacity .325s ease-out}._carousel-controls__btn_60lzn_42>i>svg{display:block;block-size:auto;max-inline-size:100%;stroke:currentColor}._carousel-controls__btn_60lzn_42[disabled]{opacity:0}._carousel-controls__previous_60lzn_67{inset-inline-start:var(--_control-btns-offset-x)}._carousel-controls__previous_60lzn_67 svg{transform:translate(-2px)}._carousel-controls__next_60lzn_74{inset-inline-end:var(--_control-btns-offset-x)}._carousel-controls__next_60lzn_74 svg{transform:translate(2px)}._carousel-controls__btn_60lzn_42[disabled]{cursor:not-allowed;transition-delay:0s}._carousel-nav_60lzn_86{margin-top:0}._carousel-nav__list_60lzn_90{display:flex;gap:1rem;justify-content:center;align-items:flex-start;list-style:none;padding:0}._carousel-nav__item_60lzn_99{flex-basis:1rem;min-width:1rem;max-width:1rem;height:1rem;background-color:transparent;border-radius:50%;border:1px solid rgba(65,65,65,.1)}._carousel-nav__item_60lzn_99[data-current=true]{background-color:#8080801a}
@@ -19,7 +19,6 @@ export function Carousel({ id, slides, options }: {
19
19
  cellsPerSlide: number;
20
20
  cellAspectRatio: string;
21
21
  cellsPosition: string;
22
- groupSlides: boolean;
23
22
  wrapAround: boolean;
24
23
  } | undefined;
25
24
  }): import("react/jsx-runtime").JSX.Element;
@@ -1,16 +1,16 @@
1
- import { jsx as o, Fragment as W, jsxs as O } from "react/jsx-runtime";
2
- import { useRef as c, useState as A, useEffect as V, useCallback as u } from "react";
3
- import q from "./CarouselUtils.class.js";
4
- import { CarouselSlide as J } from "../CarouselSlide/CarouselSlide.js";
5
- import { chunkArray as Q, classes as z } from "../../utils/helpers.js";
6
- import { c as a } from "../../Carousel.module-CzL9vVtu.mjs";
7
- import { C as X } from "../../chevron-left-DmvQntvu.mjs";
8
- import { C as Y } from "../../chevron-right-CaAz6ISN.mjs";
9
- const Z = window.matchMedia("(max-width: 600px)"), ee = window.matchMedia("(max-width: 800px"), re = window.matchMedia("(max-width: 1024px"), te = window.matchMedia("(max-width: 1280px");
10
- function de({
11
- id: _,
12
- slides: b,
13
- options: x = {
1
+ import { jsx as s, Fragment as ee, jsxs as G } from "react/jsx-runtime";
2
+ import { useRef as c, useState as v, useEffect as H, useCallback as f } from "react";
3
+ import re from "./CarouselUtils.class.js";
4
+ import { CarouselSlide as te } from "../CarouselSlide/CarouselSlide.js";
5
+ import { chunkArray as ne, classes as E } from "../../utils/helpers.js";
6
+ import { c as i } from "../../Carousel.module-DOrBKQEQ.mjs";
7
+ import { C as le } from "../../chevron-left-DmvQntvu.mjs";
8
+ import { C as oe } from "../../chevron-right-CaAz6ISN.mjs";
9
+ const x = window.matchMedia("(width <= 600px)"), L = window.matchMedia("(width <= 800px"), R = window.matchMedia("(width <= 1024px"), I = window.matchMedia("(width <= 1280px");
10
+ function pe({
11
+ id: C,
12
+ slides: $,
13
+ options: P = {
14
14
  paginationType: "dots",
15
15
  showControls: !0,
16
16
  controlArrowSize: 48,
@@ -28,267 +28,277 @@ function de({
28
28
  cellsPerSlide: 1,
29
29
  cellAspectRatio: "4/2",
30
30
  cellsPosition: "center",
31
- groupSlides: !0,
32
31
  wrapAround: !0
33
32
  }
34
33
  }) {
35
- const m = c(`carousel-${_}`), R = c(null), i = c(null), I = c(null), w = c(b), E = c(null), g = c(null), t = c(null), e = c(x), $ = c(x.showPagination), T = c("-50%"), [N, j] = A([]), [r, d] = A(null), [k, B] = A([]);
36
- V(() => {
37
- (() => {
38
- Z.matches ? (d({
39
- ...e.current,
34
+ console.log(`Carousel component with id: ${C} initialized`);
35
+ const w = c(`carousel-${C}`), T = c(null), u = c(null), N = c(null), g = c($), M = c(null), y = c(null), r = c(null), e = c(P), o = c(P), U = c(P.showPagination), k = c("-50%"), [O, F] = v([]), [t, d] = v(null), [D, W] = v([]), [V, q] = v(0);
36
+ H(() => {
37
+ const n = () => {
38
+ x.matches ? (d({
39
+ ...o.current,
40
40
  showControls: !1,
41
41
  showPagination: !1,
42
42
  cellsPerSlide: 1,
43
- cellsPosition: e.current.wrapAround ? "center" : "flex-start",
43
+ cellsPosition: o.current.wrapAround ? "center" : "flex-start",
44
44
  gutterSize: 10
45
45
  }), e.current = {
46
- ...e.current,
46
+ ...o.current,
47
47
  showControls: !1,
48
48
  showPagination: !1,
49
49
  cellsPerSlide: 1,
50
- cellsPosition: e.current.wrapAround ? "center" : "flex-start",
50
+ cellsPosition: o.current.wrapAround ? "center" : "flex-start",
51
51
  gutterSize: 10
52
- }, $.current = !1) : ee.matches ? e.current.cellsPerSlide > 2 ? (d({
53
- ...e.current,
52
+ }) : L.matches ? o.current.cellsPerSlide !== 1 ? (d({
53
+ ...o.current,
54
54
  cellsPerSlide: 2,
55
55
  showControls: !1,
56
56
  gutterSize: 10
57
57
  }), e.current = {
58
- ...e.current,
58
+ ...o.current,
59
59
  cellsPerSlide: 2,
60
60
  showControls: !1,
61
61
  gutterSize: 10
62
62
  }) : (d({
63
- ...e.current,
63
+ ...o.current,
64
64
  showControls: !1,
65
65
  gutterSize: 10
66
66
  }), e.current = {
67
- ...e.current,
67
+ ...o.current,
68
68
  showControls: !1,
69
69
  gutterSize: 10
70
- }) : re.matches ? e.current.cellsPerSlide > 3 ? (d({
71
- ...e.current,
70
+ }) : R.matches ? o.current.cellsPerSlide !== 1 && o.current.cellsPerSlide !== 2 ? (d({
71
+ ...o.current,
72
72
  cellsPerSlide: 3,
73
73
  showControls: !1,
74
74
  gutterSize: 10
75
75
  }), e.current = {
76
- ...e.current,
76
+ ...o.current,
77
77
  cellsPerSlide: 3,
78
78
  showControls: !1,
79
79
  gutterSize: 10
80
80
  }) : (d({
81
- ...e.current,
81
+ ...o.current,
82
82
  showControls: !1,
83
83
  gutterSize: 10
84
84
  }), e.current = {
85
- ...e.current,
85
+ ...o.current,
86
86
  showControls: !1,
87
87
  gutterSize: 10
88
- }) : te.matches && e.current.showPagination ? (d({
89
- ...e.current,
88
+ }) : I.matches ? o.current.showPagination ? (d({
89
+ ...o.current,
90
90
  showControls: !1
91
91
  }), e.current = {
92
- ...e.current,
92
+ ...o.current,
93
93
  showControls: !1
94
- }) : d({
95
- ...e.current
94
+ }) : (d({
95
+ ...o.current
96
+ }), e.current = {
97
+ ...o.current
98
+ }) : (d({
99
+ ...o.current
100
+ }), e.current = {
101
+ ...o.current
96
102
  });
97
- })();
103
+ };
104
+ n();
105
+ const l = () => {
106
+ q((h) => h + 1), n();
107
+ };
108
+ return x.addEventListener("change", l), L.addEventListener("change", l), R.addEventListener("change", l), I.addEventListener("change", l), () => {
109
+ x.removeEventListener("change", l), L.removeEventListener("change", l), R.removeEventListener("change", l), I.removeEventListener("change", l);
110
+ };
98
111
  }, []);
99
- const L = u((l, n) => {
100
- const p = Q(n, l);
101
- B([...p]);
102
- let f = [];
103
- for (let s = 0; s <= p.length - 1; s++) {
104
- f[s] = {}, f[s].ariaLabel = `${s + 1} of ${p.length}`, f[s].layout = p[s][0].layout, f[s].cells = [];
105
- for (let S = 0; S <= p[s].length - 1; S++)
106
- f[s].cells[S] = {
107
- props: p[s][S].props
112
+ const j = f((n, l) => {
113
+ const h = ne(l, n);
114
+ W([...h]);
115
+ let p = [];
116
+ for (let a = 0; a <= h.length - 1; a++) {
117
+ p[a] = {}, p[a].ariaLabel = `${a + 1} of ${h.length}`, p[a].layout = h[a][0].layout, p[a].cells = [];
118
+ for (let S = 0; S <= h[a].length - 1; S++)
119
+ p[a].cells[S] = {
120
+ props: h[a][S].props
108
121
  };
109
122
  }
110
- const P = [...f], y = [...f], K = P.slice(-1), F = P.slice(0);
111
- return y.push(F[0]), y.unshift(K[0]), e.current.wrapAround && l.length > n ? y : P;
112
- }, []), h = u(() => {
113
- e.current.autoplay && t.current.clearTimer();
114
- }, []), G = u((l) => {
115
- h();
116
- const n = l.key;
117
- n === "ArrowLeft" ? (l.preventDefault(), t.current.determineScrollAction(-1)) : n === "ArrowRight" && (l.preventDefault(), t.current.determineScrollAction(1));
118
- }, [h]), H = u(() => {
119
- h(), i.current.addEventListener("scrollend", () => {
120
- t.current.handleScrollEnd();
123
+ const _ = [...p], b = [...p], Y = _.slice(-1), Z = _.slice(0);
124
+ return b.push(Z[0]), b.unshift(Y[0]), e.current.wrapAround && n.length > l ? b : _;
125
+ }, []), m = f(() => {
126
+ e.current.autoplay && r.current.clearTimer();
127
+ }, []), J = f((n) => {
128
+ m();
129
+ const l = n.key;
130
+ l === "ArrowLeft" ? (n.preventDefault(), r.current.determineScrollAction(-1)) : l === "ArrowRight" && (n.preventDefault(), r.current.determineScrollAction(1));
131
+ }, [m]), Q = f(() => {
132
+ m(), u.current.addEventListener("scrollend", () => {
133
+ r.current.handleScrollEnd();
121
134
  }, { once: !0 });
122
- }, [h]), v = u(() => {
123
- h(), i.current.addEventListener("scrollend", () => {
124
- t.current.handleScrollEnd(), i.current.addEventListener("scroll", v, { once: !0 });
135
+ }, [m]), A = f(() => {
136
+ m(), u.current.addEventListener("scrollend", () => {
137
+ r.current.handleScrollEnd(), u.current.addEventListener("scroll", A, { once: !0 });
125
138
  }, { once: !0 });
126
- }, [h]), U = () => {
127
- t.current && e.current.autoplay && t.current.clearTimer();
128
- }, C = u(() => {
139
+ }, [m]), X = () => {
140
+ r.current && e.current.autoplay && r.current.clearTimer();
141
+ }, z = f(() => {
129
142
  //! make sure class is only instantiated once because of reacts
130
143
  //! "strict" mode double do hocus pocus
131
- t.current === null && (t.current = new q({
132
- carouselEl: R.current,
133
- scrollerEl: i.current,
134
- paginationEl: I.current,
135
- slides: w.current,
144
+ var n, l;
145
+ r.current !== null && V > 0 && ((l = (n = r.current).clearTimer) == null || l.call(n), r.current = null), r.current = new re({
146
+ carouselEl: T.current,
147
+ scrollerEl: u.current,
148
+ paginationEl: N.current,
149
+ slides: g.current,
136
150
  navBtnEls: {
137
- next: E.current,
138
- previous: g.current
151
+ next: M.current,
152
+ previous: y.current
139
153
  },
140
- id: m.current,
154
+ id: w.current,
141
155
  options: {
142
156
  autoplay: e.current.autoplay,
143
- wrapAround: e.current.wrapAround && w.current.length > e.current.cellsPerSlide,
157
+ wrapAround: e.current.wrapAround && g.current.length > e.current.cellsPerSlide,
144
158
  showPagination: e.current.showPagination,
145
159
  delay: e.current.autoplayDelay,
146
160
  slideGutterSize: e.current.gutterSize,
147
161
  slideAspectRatio: e.current.slideAspectRatio,
148
- showControls: e.current.showControls && w.current.length > e.current.cellsPerSlide,
162
+ showControls: e.current.showControls && g.current.length > e.current.cellsPerSlide,
149
163
  cellsPerSlide: e.current.cellsPerSlide
150
164
  }
151
- }));
152
- }, []), M = u(() => {
153
- i.current.addEventListener("scroll", v, { once: !0 });
154
- }, [v]), D = u(() => {
155
- if (j(L(w.current, e.current.cellsPerSlide)), w.current.length > e.current.cellsPerSlide) {
156
- let l = setInterval(() => {
157
- i.current !== null && (g.current !== null && e.current.showControls || !e.current.showControls) && (clearInterval(l), M(), C());
165
+ });
166
+ }, [V]), K = f(() => {
167
+ u.current.addEventListener("scroll", A, { once: !0 });
168
+ }, [A]), B = f(() => {
169
+ if (F(j(g.current, e.current.cellsPerSlide)), g.current.length > e.current.cellsPerSlide) {
170
+ let n = setInterval(() => {
171
+ u.current !== null && (y.current !== null && e.current.showControls || !e.current.showControls) && (clearInterval(n), K(), z());
158
172
  }, 100);
159
173
  } else {
160
- let l = setInterval(() => {
161
- i.current !== null && (clearInterval(l), C());
174
+ let n = setInterval(() => {
175
+ u.current !== null && (clearInterval(n), z());
162
176
  }, 100);
163
177
  }
164
- }, [L, M, C]);
165
- return V(() => {
166
- if (r !== null) {
167
- if (r.showControls) {
168
- let l = 0;
169
- r.showPagination && (l = l + 25), r.showScrollbar && (l = l + 6), T.current = `calc(-50% - ${l}px)`;
178
+ }, [j, K, z]);
179
+ return H(() => {
180
+ if (t !== null) {
181
+ if (t.showControls) {
182
+ let n = 0;
183
+ t.showPagination && (n = n + 25), t.showScrollbar && (n = n + 6), k.current = `calc(-50% - ${n}px)`;
170
184
  }
171
- D();
185
+ B();
172
186
  }
173
187
  return () => {
174
- U();
188
+ X();
175
189
  };
176
- }, [D, r]), /* @__PURE__ */ o(W, { children: r !== null && /* @__PURE__ */ O(
190
+ }, [B, t]), /* @__PURE__ */ s(ee, { children: t !== null && /* @__PURE__ */ G(
177
191
  "div",
178
192
  {
179
- className: a.carousel,
180
- id: m.current,
181
- ref: R,
193
+ className: i.carousel,
194
+ id: w.current,
195
+ ref: T,
182
196
  tabIndex: -1,
183
197
  role: "region",
184
198
  "aria-roledescription": "carousel",
185
- "aria-label": r.title,
186
- onKeyDown: G,
199
+ "aria-label": t.title,
200
+ onKeyDown: J,
187
201
  style: {
188
- "--_carousel-gutters": r.wrapAround ? `${r.gutterSize <= 25 ? r.gutterSize : 25}%` : `0 ${r.gutterSize <= 25 ? r.gutterSize : 25}%`,
189
- "--_slide-aspect-ratio": r.slideAspectRatio,
190
- "--_cell-aspect-ratio": r.cellAspectRatio,
191
- "--_slide-cell-size": `${100 / r.cellsPerSlide}%`,
192
- "--_cells-position": r.cellsPosition,
193
- "--_control-btns-offset-x": `${r.controlButtonsOffset}rem`,
194
- "--_slide-gap": `${r.slideGap}rem`,
195
- "--_controls-transform": T.current
202
+ "--_carousel-gutters": t.wrapAround ? `${t.gutterSize <= 25 ? t.gutterSize : 25}%` : `0 ${t.gutterSize <= 25 ? t.gutterSize : 25}%`,
203
+ "--_slide-aspect-ratio": t.slideAspectRatio,
204
+ "--_cell-aspect-ratio": t.cellAspectRatio,
205
+ "--_slide-cell-size": `${100 / t.cellsPerSlide}%`,
206
+ "--_cells-position": t.cellsPosition,
207
+ "--_control-btns-offset-x": `${t.controlButtonsOffset}rem`,
208
+ "--_slide-gap": `${t.slideGap}rem`,
209
+ "--_controls-transform": k.current
196
210
  },
197
211
  children: [
198
- /* @__PURE__ */ o(
212
+ /* @__PURE__ */ s(
199
213
  "ol",
200
214
  {
201
- className: a.carousel__scroller,
202
- ref: i,
215
+ className: i.carousel__scroller,
216
+ ref: u,
203
217
  role: "group",
204
218
  "aria-label": "Items Scroller",
205
219
  "aria-live": "Polite",
206
220
  tabIndex: 0,
207
221
  onMouseEnter: () => {
208
- e.current.autoplay && t.current !== null && t.current.clearTimer();
222
+ e.current.autoplay && r.current !== null && r.current.clearTimer();
209
223
  },
210
224
  onMouseLeave: () => {
211
- e.current.autoplay && t.current !== null && t.current.startTimer();
225
+ e.current.autoplay && r.current !== null && r.current.startTimer();
212
226
  },
213
- onTouchStart: H,
214
- "data-scrollbar": r.showScrollbar,
215
- children: N.length > 0 && N.map((l, n) => /* @__PURE__ */ o(
216
- J,
227
+ onTouchStart: Q,
228
+ "data-scrollbar": t.showScrollbar,
229
+ children: O.length > 0 && O.map((n, l) => /* @__PURE__ */ s(
230
+ te,
217
231
  {
218
- slide: l,
219
- index: n,
220
- currentIndex: r.wrapAround ? 1 : 0,
221
- variableHeight: r.variableHeight
232
+ slide: n,
233
+ index: l,
234
+ currentIndex: t.wrapAround ? 1 : 0,
235
+ variableHeight: t.variableHeight
222
236
  },
223
- `carousel${_}-slide${n}`
237
+ `carousel${C}-slide${l}`
224
238
  ))
225
239
  }
226
240
  ),
227
- r.showControls && b.length > e.current.cellsPerSlide && /* @__PURE__ */ O("div", { className: a["carousel-controls"], children: [
228
- /* @__PURE__ */ o(
241
+ t.showControls && $.length > e.current.cellsPerSlide && /* @__PURE__ */ G("div", { className: i["carousel-controls"], children: [
242
+ /* @__PURE__ */ s(
229
243
  "button",
230
244
  {
231
245
  type: "button",
232
- ref: g,
246
+ ref: y,
233
247
  title: "Previous Item",
234
- className: z([
235
- a["carousel-controls__btn"],
236
- a["carousel-controls__previous"],
237
- "carousel-controls__previous"
238
- ]),
239
- "aria-controls": m.current,
248
+ className: E([i["carousel-controls__btn"], i["carousel-controls__previous"], "carousel-controls__previous"]),
249
+ "aria-controls": w.current,
240
250
  "aria-label": "Previous Item",
241
251
  onClick: () => {
242
- t.current.determineScrollAction(-1);
252
+ r.current.determineScrollAction(-1);
243
253
  },
244
254
  onMouseEnter: () => {
245
- e.current.autoplay && t.current !== null && t.current.clearTimer();
255
+ e.current.autoplay && r.current !== null && r.current.clearTimer();
246
256
  },
247
257
  onMouseLeave: () => {
248
- e.current.autoplay && t.current !== null && t.current.startTimer();
258
+ e.current.autoplay && r.current !== null && r.current.startTimer();
249
259
  },
250
- children: /* @__PURE__ */ o("i", { "aria-hidden": "true", children: /* @__PURE__ */ o(X, { width: r.controlArrowSize, height: r.controlArrowSize }) })
260
+ children: /* @__PURE__ */ s("i", { "aria-hidden": "true", children: /* @__PURE__ */ s(le, { width: t.controlArrowSize, height: t.controlArrowSize }) })
251
261
  }
252
262
  ),
253
- /* @__PURE__ */ o(
263
+ /* @__PURE__ */ s(
254
264
  "button",
255
265
  {
256
266
  type: "button",
257
- ref: E,
267
+ ref: M,
258
268
  title: "Next Item",
259
- className: z([a["carousel-controls__btn"], a["carousel-controls__next"], "carousel-controls__next"]),
260
- "aria-controls": m.current,
269
+ className: E([i["carousel-controls__btn"], i["carousel-controls__next"], "carousel-controls__next"]),
270
+ "aria-controls": w.current,
261
271
  "aria-label": "Next Item",
262
272
  onClick: () => {
263
- t.current.determineScrollAction(1);
273
+ r.current.determineScrollAction(1);
264
274
  },
265
275
  onMouseEnter: () => {
266
- e.current.autoplay && t.current !== null && t.current.clearTimer();
276
+ e.current.autoplay && r.current !== null && r.current.clearTimer();
267
277
  },
268
278
  onMouseLeave: () => {
269
- e.current.autoplay && t.current !== null && t.current.startTimer();
279
+ e.current.autoplay && r.current !== null && r.current.startTimer();
270
280
  },
271
- children: /* @__PURE__ */ o("i", { "aria-hidden": "true", children: /* @__PURE__ */ o(Y, { width: r.controlArrowSize, height: r.controlArrowSize }) })
281
+ children: /* @__PURE__ */ s("i", { "aria-hidden": "true", children: /* @__PURE__ */ s(oe, { width: t.controlArrowSize, height: t.controlArrowSize }) })
272
282
  }
273
283
  )
274
284
  ] }),
275
- $.current && k.length > 1 && /* @__PURE__ */ o("div", { className: [a["carousel-nav"], "carousel-nav"].join(" "), children: /* @__PURE__ */ o("ol", { className: a["carousel-nav__list"], ref: I, children: k.map((l, n) => /* @__PURE__ */ o(
285
+ U.current && D.length > 1 && /* @__PURE__ */ s("div", { className: [i["carousel-nav"], "carousel-nav"].join(" "), children: /* @__PURE__ */ s("ol", { className: i["carousel-nav__list"], ref: N, children: D.map((n, l) => /* @__PURE__ */ s(
276
286
  "li",
277
287
  {
278
- className: z([a["carousel-nav__item"], "carousel-nav__item"]),
279
- "data-current": n === 0 ? "true" : "false",
288
+ className: E([i["carousel-nav__item"], "carousel-nav__item"]),
289
+ "data-current": l === 0 ? "true" : "false",
280
290
  onClick: () => {
281
- t.current.navigateToIndex(n);
291
+ r.current.navigateToIndex(l);
282
292
  },
283
- title: `Navigate to slide ${n + 1}`
293
+ title: `Navigate to slide ${l + 1}`
284
294
  },
285
- `carousel${m}-nav-${n}`
295
+ `carousel${w}-nav-${l}`
286
296
  )) }) })
287
297
  ]
288
298
  }
289
299
  ) });
290
300
  }
291
301
  export {
292
- de as Carousel,
293
- de as default
302
+ pe as Carousel,
303
+ pe as default
294
304
  };
@@ -1,55 +1,54 @@
1
- var w = (o) => {
2
- throw TypeError(o);
1
+ var g = (r) => {
2
+ throw TypeError(r);
3
3
  };
4
- var G = (o, t, s) => t.has(o) || w("Cannot " + s);
5
- var y = (o, t, s) => t.has(o) ? w("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(o) : t.set(o, s);
6
- var i = (o, t, s) => (G(o, t, "access private method"), s);
7
- var e, T, S, L, p, f, v, B, A, z;
8
- class N {
9
- constructor({ carouselEl: t, scrollerEl: s, paginationEl: a, slides: O, navBtnEls: P = { next: {}, previous: {} }, options: n }) {
10
- y(this, e);
11
- if (!("onscrollend" in window)) {
12
- let d = function(h, r, b) {
13
- let c = h[r];
14
- h[r] = function() {
15
- let l = Array.prototype.slice.apply(arguments, [0]);
16
- c.apply(this, l), l.unshift(c), b.apply(this, l);
17
- };
18
- }, I = function(h, r, b, c) {
19
- if (r !== "scroll" && r !== "scrollend")
20
- return;
21
- let l = this, u = E.get(l);
22
- if (u === void 0) {
23
- let x = 0;
24
- u = {
25
- scrollListener: (W) => {
26
- clearTimeout(x), x = setTimeout(() => {
27
- m.size ? setTimeout(u.scrollListener, 100) : (l.dispatchEvent(C), x = 0);
28
- }, 100);
29
- },
30
- listeners: 0
31
- // Count of number of listeners.
32
- }, h.apply(l, ["scroll", u.scrollListener]), E.set(l, u);
33
- }
34
- u.listeners++;
35
- }, g = function(h, r, b) {
36
- if (r !== "scroll" && r !== "scrollend")
37
- return;
38
- let c = this, l = E.get(c);
39
- l !== void 0 && (l[r]--, !(--l.listeners > 0) && (h.apply(c, ["scroll", l.scrollListener]), E.delete(c)));
40
- };
41
- const C = new Event("scrollend"), m = /* @__PURE__ */ new Set();
42
- document.addEventListener("touchstart", (h) => {
43
- for (let r of h.changedTouches)
44
- m.add(r.identifier);
45
- }, { passive: !0 }), document.addEventListener("touchend", (h) => {
46
- for (let r of h.changedTouches)
47
- m.delete(r.identifier);
48
- }, { passive: !0 });
49
- let E = /* @__PURE__ */ new WeakMap();
50
- d(Element.prototype, "addEventListener", I), d(window, "addEventListener", I), d(document, "addEventListener", I), d(Element.prototype, "removeEventListener", g), d(window, "removeEventListener", g), d(document, "removeEventListener", g);
51
- }
52
- this.carouselEl = t, this.scrollerEl = s, this.paginationEl = a, this.slides = O, this.currentIndex = 0, this.slideEls = [...s.children], this.navBtnEls = P, this.currentIntersecting = {}, this.options = n, n.autoplay && (this.timer = null, this.timerInterval = (n == null ? void 0 : n.delay) ?? 3500, this.startTimer()), this.slideGutterSize = (n == null ? void 0 : n.slideGutterSize) ?? 25, this.showPagination = n == null ? void 0 : n.showPagination, this.isInitialScroll = !0, this.totalSlideEls = this.slideEls.length, this.totalSlides = Math.ceil(this.slides.length / this.options.cellsPerSlide), i(this, e, T).call(this), i(this, e, L).call(this), i(this, e, S).call(this);
4
+ var L = (r, t, e) => t.has(r) || g("Cannot " + e);
5
+ var b = (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);
6
+ var i = (r, t, e) => (L(r, t, "access private method"), e);
7
+ let u = /* @__PURE__ */ new WeakMap();
8
+ const B = new Event("scrollend"), p = /* @__PURE__ */ new Set();
9
+ function o(r, t, e) {
10
+ let l = r[t];
11
+ r[t] = function() {
12
+ let a = Array.prototype.slice.apply(arguments, [0]);
13
+ l.apply(this, a), a.unshift(l), e.apply(this, a);
14
+ };
15
+ }
16
+ function E(r, t) {
17
+ if (t !== "scroll" && t !== "scrollend")
18
+ return;
19
+ let e = u.get(this);
20
+ if (e === void 0) {
21
+ let l = 0;
22
+ e = {
23
+ scrollListener: () => {
24
+ clearTimeout(l), l = setTimeout(() => {
25
+ p.size ? setTimeout(e.scrollListener, 100) : (this.dispatchEvent(B), l = 0);
26
+ }, 100);
27
+ },
28
+ listeners: 0
29
+ // Count of number of listeners.
30
+ }, r.apply(this, ["scroll", e.scrollListener]), u.set(this, e);
31
+ }
32
+ e.listeners++;
33
+ }
34
+ function m(r, t) {
35
+ if (t !== "scroll" && t !== "scrollend")
36
+ return;
37
+ let e = u.get(this);
38
+ e !== void 0 && (e[t]--, !(--e.listeners > 0) && (r.apply(this, ["scroll", e.scrollListener]), u.delete(this)));
39
+ }
40
+ const z = "onscrollend" in window;
41
+ var s, x, A, w, d, h, c, y, I, T;
42
+ class P {
43
+ constructor({ carouselEl: t, scrollerEl: e, paginationEl: l, slides: a, navBtnEls: S = { next: {}, previous: {} }, options: n }) {
44
+ b(this, s);
45
+ z || (document.addEventListener("touchstart", (f) => {
46
+ for (let v of f.changedTouches)
47
+ p.add(v.identifier);
48
+ }, { passive: !0 }), document.addEventListener("touchend", (f) => {
49
+ for (let v of f.changedTouches)
50
+ p.delete(v.identifier);
51
+ }, { passive: !0 }), o(Element.prototype, "addEventListener", E), o(window, "addEventListener", E), o(document, "addEventListener", E), o(Element.prototype, "removeEventListener", m), o(window, "removeEventListener", m), o(document, "removeEventListener", m)), this.carouselEl = t, this.scrollerEl = e, this.paginationEl = l, this.slides = a, this.currentIndex = 0, this.slideEls = [...e.children], this.navBtnEls = S, this.currentIntersecting = {}, this.options = n, n.autoplay && (this.timer = null, this.timerInterval = (n == null ? void 0 : n.delay) ?? 3500, this.startTimer()), this.slideGutterSize = (n == null ? void 0 : n.slideGutterSize) ?? 25, this.showPagination = n == null ? void 0 : n.showPagination, this.isInitialScroll = !0, this.totalSlideEls = this.slideEls.length, this.totalSlides = Math.ceil(this.slides.length / this.options.cellsPerSlide), i(this, s, x).call(this), i(this, s, w).call(this), i(this, s, A).call(this);
53
52
  }
54
53
  /**
55
54
  * starts the autoplay timer
@@ -73,7 +72,7 @@ class N {
73
72
  * @param {number} dir - a number representing the direction of scroll 1 for forward, -1 for backward
74
73
  */
75
74
  determineScrollAction(t) {
76
- 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), i(this, e, f).call(this, t), this.currentIndex = 0) : (i(this, e, f).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, i(this, e, f).call(this, t)) : (i(this, e, f).call(this, t), this.currentIndex -= 1)), this.options.autoplay && this.timer === null && this.startTimer();
75
+ 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), i(this, s, h).call(this, t), this.currentIndex = 0) : (i(this, s, h).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, i(this, s, h).call(this, t)) : (i(this, s, h).call(this, t), this.currentIndex -= 1)), this.options.autoplay && this.timer === null && this.startTimer();
77
76
  }
78
77
  /**
79
78
  * Navigates the carousel to a specific index
@@ -84,8 +83,8 @@ class N {
84
83
  navigateToIndex(t) {
85
84
  if (t === this.currentIndex) return;
86
85
  this.options.autoplay && this.clearTimer();
87
- let s = t > this.currentIndex ? t - this.currentIndex : this.currentIndex - t, a = t > this.currentIndex ? 1 : -1;
88
- this.currentIndex = t, i(this, e, f).call(this, a, s), this.options.autoplay && this.startTimer(), i(this, e, v).call(this);
86
+ let e = t > this.currentIndex ? t - this.currentIndex : this.currentIndex - t, l = t > this.currentIndex ? 1 : -1;
87
+ this.currentIndex = t, i(this, s, h).call(this, l, e), this.options.autoplay && this.startTimer(), i(this, s, c).call(this);
89
88
  }
90
89
  /**
91
90
  * Returns the current index of the carousel
@@ -103,22 +102,22 @@ class N {
103
102
  if (this.timer === null && this.options.autoplay && this.startTimer(), this.currentIntersecting.target) {
104
103
  const t = Number.parseInt(this.currentIntersecting.target.getAttribute("data-index"), 10);
105
104
  if (!this.options.wrapAround) {
106
- this.currentIndex = t, i(this, e, v).call(this);
105
+ this.currentIndex = t, i(this, s, c).call(this);
107
106
  return;
108
107
  }
109
- t === 0 ? (this.currentIndex = this.slides.length - 1, i(this, e, p).call(this, { scrollport: this.scrollerEl, element: this.slideEls[this.totalSlides] })) : t === this.totalSlideEls - 1 ? (this.currentIndex = 0, i(this, e, p).call(this, { scrollport: this.scrollerEl, element: this.slideEls[1] })) : this.currentIndex = t - 1;
108
+ t === 0 ? (this.currentIndex = this.slides.length - 1, i(this, s, d).call(this, { scrollport: this.scrollerEl, element: this.slideEls[this.totalSlides] })) : t === this.totalSlideEls - 1 ? (this.currentIndex = 0, i(this, s, d).call(this, { scrollport: this.scrollerEl, element: this.slideEls[1] })) : this.currentIndex = t - 1;
110
109
  }
111
- i(this, e, v).call(this);
110
+ i(this, s, c).call(this);
112
111
  }
113
112
  }
114
- e = new WeakSet(), /**
113
+ s = new WeakSet(), /**
115
114
  * adds an observer to the scroller element that we can use to
116
115
  * determine which slide is intersecting
117
116
  */
118
- T = function() {
117
+ x = function() {
119
118
  this.carouselObserver = new IntersectionObserver((t) => {
120
- for (let s of t)
121
- s.isIntersecting && (this.currentIntersecting = s);
119
+ for (let e of t)
120
+ e.isIntersecting && (this.currentIntersecting = e);
122
121
  }, {
123
122
  root: this.scrollerEl,
124
123
  threshold: 0.8
@@ -126,30 +125,30 @@ T = function() {
126
125
  }, /**
127
126
  * sets listeners on the slide elements for the observer
128
127
  */
129
- S = function() {
128
+ A = function() {
130
129
  for (let t of this.slideEls)
131
130
  this.carouselObserver.observe(t);
132
131
  }, /**
133
132
  * sets some intial settings for the carousel based on some of the options
134
133
  */
135
- L = function() {
136
- this.options.wrapAround ? (this.scrollerEl.style.scrollBehavior = "auto", this.scrollerEl.scrollTo(-9999, 0), i(this, e, p).call(this, { scrollport: this.scrollerEl, element: this.scrollerEl.children[1] })) : this.options.showControls ? (this.navBtnEls.previous.setAttribute("disabled", !0), i(this, e, v).call(this)) : i(this, e, A).call(this), this.totalSlides === 1 && this.slideEls[0].removeAttribute("inert");
134
+ w = function() {
135
+ this.options.wrapAround ? (this.scrollerEl.style.scrollBehavior = "auto", this.scrollerEl.scrollTo(-9999, 0), i(this, s, d).call(this, { scrollport: this.scrollerEl, element: this.scrollerEl.children[1] })) : this.options.showControls ? (this.navBtnEls.previous.setAttribute("disabled", !0), i(this, s, c).call(this)) : i(this, s, I).call(this), this.totalSlides === 1 && this.slideEls[0].removeAttribute("inert");
137
136
  }, /**
138
137
  * Scrolls the carousel to a specific child element
139
138
  * @param {*} param0 - an object containing the scrollport element and the child element to scroll to
140
139
  */
141
- p = function({ scrollport: t, element: s }) {
142
- const a = this.slideGutterSize * 2 / 100;
143
- t.style.scrollBehavior = "auto", t.scrollTo(Math.abs(t.offsetLeft - s.offsetLeft + s.clientWidth * a), 0);
140
+ d = function({ scrollport: t, element: e }) {
141
+ const l = this.slideGutterSize * 2 / 100;
142
+ t.style.scrollBehavior = "auto", t.scrollTo(Math.abs(t.offsetLeft - e.offsetLeft + e.clientWidth * l), 0);
144
143
  }, /**
145
144
  * Scrolls the carousel in a specified direction by a specified distance
146
145
  *
147
146
  * @param {number} dir - a number representing the direction of scroll 1 for forward, -1 for backward
148
147
  * @param {number} distance - a number representing the number of slides to scroll
149
148
  */
150
- f = function(t, s = 1) {
149
+ h = function(t, e = 1) {
151
150
  this.scrollerEl.style.scrollBehavior = "smooth", this.scrollerEl.scrollBy({
152
- left: this.scrollerEl.clientWidth * ((100 - this.slideGutterSize * 2) / 100) * s * t,
151
+ left: this.scrollerEl.clientWidth * ((100 - this.slideGutterSize * 2) / 100) * e * t,
153
152
  top: 0,
154
153
  behavior: "smooth"
155
154
  });
@@ -159,29 +158,29 @@ f = function(t, s = 1) {
159
158
  * add methods here to have them sync
160
159
  * when scroller is scrolled
161
160
  */
162
- v = function() {
163
- i(this, e, A).call(this), this.showPagination && i(this, e, z).call(this), this.options.wrapAround || i(this, e, B).call(this);
161
+ c = function() {
162
+ i(this, s, I).call(this), this.showPagination && i(this, s, T).call(this), this.options.wrapAround || i(this, s, y).call(this);
164
163
  }, /**
165
164
  * Sets the control arrow buttons to disabled if the carousel is at the start or end
166
165
  */
167
- B = function() {
166
+ y = function() {
168
167
  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"));
169
168
  }, /**
170
169
  * Sets the inert attribute on all slides that are not the current slide
171
170
  */
172
- A = function() {
171
+ I = function() {
173
172
  const t = this.options.wrapAround ? this.currentIndex + 1 : this.currentIndex;
174
- this.slideEls.length === 1 ? this.slideEls[0].removeAttribute("inert") : this.slideEls.forEach((s, a) => {
175
- s.toggleAttribute("inert", a !== t);
173
+ this.slideEls.length === 1 ? this.slideEls[0].removeAttribute("inert") : this.slideEls.forEach((e, l) => {
174
+ e.toggleAttribute("inert", l !== t);
176
175
  });
177
176
  }, /**
178
177
  * Sets the pagination indicator to the current slide
179
178
  */
180
- z = function() {
181
- [...this.paginationEl.children].forEach((t, s) => {
182
- s === this.currentIndex ? t.setAttribute("data-current", "true") : t.setAttribute("data-current", "false");
179
+ T = function() {
180
+ [...this.paginationEl.children].forEach((t, e) => {
181
+ e === this.currentIndex ? t.setAttribute("data-current", "true") : t.setAttribute("data-current", "false");
183
182
  });
184
183
  };
185
184
  export {
186
- N as default
185
+ P as default
187
186
  };
@@ -1,6 +1,6 @@
1
1
  import { jsx as e } from "react/jsx-runtime";
2
2
  import o from "react";
3
- import { c as r } from "../../../Carousel.module-CzL9vVtu.mjs";
3
+ import { c as r } from "../../../Carousel.module-DOrBKQEQ.mjs";
4
4
  const n = o.forwardRef(({ slides: t, carouselId: l }, s) => /* @__PURE__ */ e("div", { className: `${r["carousel-nav"]} carousel-nav`, children: /* @__PURE__ */ e("ol", { className: r["carousel-nav__list"], ref: s, children: t.map((c, a) => /* @__PURE__ */ e(
5
5
  "li",
6
6
  {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.0.17",
2
+ "version": "1.0.18-dev.0",
3
3
  "name": "@scrippsproduct/networks-ui-library",
4
4
  "description": "React Component Library for use in Scripps Networks external applications",
5
5
  "author": {
@@ -1,14 +0,0 @@
1
- import './assets/Carousel.css';const _ = "_carousel_idy2d_1", o = "_carousel__scroller_idy2d_11", s = {
2
- carousel: _,
3
- carousel__scroller: o,
4
- "carousel-controls": "_carousel-controls_idy2d_39",
5
- "carousel-controls__btn": "_carousel-controls__btn_idy2d_43",
6
- "carousel-controls__previous": "_carousel-controls__previous_idy2d_68",
7
- "carousel-controls__next": "_carousel-controls__next_idy2d_75",
8
- "carousel-nav": "_carousel-nav_idy2d_87",
9
- "carousel-nav__list": "_carousel-nav__list_idy2d_91",
10
- "carousel-nav__item": "_carousel-nav__item_idy2d_100"
11
- };
12
- export {
13
- s as c
14
- };