@graupl/graupl 1.0.0-beta.45 → 1.0.0-beta.47

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 (51) hide show
  1. package/dist/css/component/carousel.css +1 -1
  2. package/dist/css/component/carousel.css.map +1 -1
  3. package/dist/css/component.css +1 -1
  4. package/dist/css/component.css.map +1 -1
  5. package/dist/css/graupl.css +1 -1
  6. package/dist/css/graupl.css.map +1 -1
  7. package/dist/js/breadcrumb.js +30 -30
  8. package/dist/js/breadcrumb.js.map +1 -1
  9. package/dist/js/carousel.js +266 -145
  10. package/dist/js/carousel.js.map +1 -1
  11. package/dist/js/component/breadcrumb.cjs.js +22 -22
  12. package/dist/js/component/breadcrumb.cjs.js.map +1 -1
  13. package/dist/js/component/breadcrumb.es.js +22 -22
  14. package/dist/js/component/breadcrumb.es.js.map +1 -1
  15. package/dist/js/component/breadcrumb.iife.js +24 -24
  16. package/dist/js/component/breadcrumb.iife.js.map +1 -1
  17. package/dist/js/component/carousel.cjs.js +246 -125
  18. package/dist/js/component/carousel.cjs.js.map +1 -1
  19. package/dist/js/component/carousel.es.js +246 -125
  20. package/dist/js/component/carousel.es.js.map +1 -1
  21. package/dist/js/component/carousel.iife.js +243 -122
  22. package/dist/js/component/carousel.iife.js.map +1 -1
  23. package/dist/js/component/disclosure.cjs.js +1 -1
  24. package/dist/js/component/disclosure.cjs.js.map +1 -1
  25. package/dist/js/component/disclosure.es.js +1 -1
  26. package/dist/js/component/disclosure.es.js.map +1 -1
  27. package/dist/js/component/disclosure.iife.js +1 -1
  28. package/dist/js/component/disclosure.iife.js.map +1 -1
  29. package/dist/js/disclosure.js +12 -12
  30. package/dist/js/disclosure.js.map +1 -1
  31. package/dist/js/generator/breadcrumb.cjs.js +24 -24
  32. package/dist/js/generator/breadcrumb.cjs.js.map +1 -1
  33. package/dist/js/generator/breadcrumb.es.js +40 -40
  34. package/dist/js/generator/breadcrumb.es.js.map +1 -1
  35. package/dist/js/generator/breadcrumb.iife.js +46 -46
  36. package/dist/js/generator/breadcrumb.iife.js.map +1 -1
  37. package/dist/js/generator/carousel.cjs.js +262 -141
  38. package/dist/js/generator/carousel.cjs.js.map +1 -1
  39. package/dist/js/generator/carousel.es.js +262 -141
  40. package/dist/js/generator/carousel.es.js.map +1 -1
  41. package/dist/js/generator/carousel.iife.js +263 -142
  42. package/dist/js/generator/carousel.iife.js.map +1 -1
  43. package/dist/js/generator/disclosure.cjs.js +13 -13
  44. package/dist/js/generator/disclosure.cjs.js.map +1 -1
  45. package/dist/js/generator/disclosure.es.js +13 -13
  46. package/dist/js/generator/disclosure.es.js.map +1 -1
  47. package/dist/js/generator/disclosure.iife.js +12 -12
  48. package/dist/js/generator/disclosure.iife.js.map +1 -1
  49. package/dist/js/graupl.js +565 -444
  50. package/dist/js/graupl.js.map +1 -1
  51. package/package.json +1 -1
@@ -1,11 +1,11 @@
1
1
  var CarouselGenerator = (function() {
2
- function h(t, e) {
2
+ function c(t, e) {
3
3
  t === "" || t.length === 0 || (typeof t == "string" ? e.classList.add(t) : e.classList.add(...t));
4
4
  }
5
- function l(t, e) {
5
+ function m(t, e) {
6
6
  t === "" || t.length === 0 || (typeof t == "string" ? e.classList.remove(t) : e.classList.remove(...t));
7
7
  }
8
- function d(t) {
8
+ function u(t) {
9
9
  try {
10
10
  const e = t.key || t.keyCode, r = {
11
11
  Enter: e === "Enter" || e === 13,
@@ -26,10 +26,10 @@ var CarouselGenerator = (function() {
26
26
  return "";
27
27
  }
28
28
  }
29
- function _(t) {
29
+ function l(t) {
30
30
  t.preventDefault(), t.stopPropagation();
31
31
  }
32
- function u(t, e, { shouldThrow: r = !0 } = {}) {
32
+ function h(t, e, { shouldThrow: r = !0 } = {}) {
33
33
  const s = {
34
34
  status: !0,
35
35
  errors: []
@@ -69,7 +69,7 @@ var CarouselGenerator = (function() {
69
69
  if (r && !s.status) throw s.errors[0];
70
70
  return s;
71
71
  }
72
- function b(t, { shouldThrow: e = !0 } = {}) {
72
+ function I(t, { shouldThrow: e = !0 } = {}) {
73
73
  const r = {
74
74
  status: !0,
75
75
  errors: []
@@ -92,7 +92,7 @@ var CarouselGenerator = (function() {
92
92
  if (e && !r.status) throw r.errors[0];
93
93
  return r;
94
94
  }
95
- function c(t, { shouldThrow: e = !0 } = {}) {
95
+ function d(t, { shouldThrow: e = !0 } = {}) {
96
96
  const r = {
97
97
  status: !0,
98
98
  errors: []
@@ -107,7 +107,7 @@ var CarouselGenerator = (function() {
107
107
  else throw new TypeError(`${s} must be a string or an array of strings. "${i}" given.`);
108
108
  else {
109
109
  const o = {};
110
- o[s] = t[s], b(o);
110
+ o[s] = t[s], I(o);
111
111
  }
112
112
  } catch (i) {
113
113
  r.status = !1, r.errors.push(i);
@@ -118,7 +118,7 @@ var CarouselGenerator = (function() {
118
118
  if (e && !r.status) throw r.errors[0];
119
119
  return r;
120
120
  }
121
- function D(t, { shouldThrow: e = !0 } = {}) {
121
+ function x(t, { shouldThrow: e = !0 } = {}) {
122
122
  const r = {
123
123
  status: !0,
124
124
  errors: []
@@ -141,7 +141,7 @@ var CarouselGenerator = (function() {
141
141
  if (e && !r.status) throw r.errors[0];
142
142
  return r;
143
143
  }
144
- function O(t, { shouldThrow: e = !0 } = {}) {
144
+ function D(t, { shouldThrow: e = !0 } = {}) {
145
145
  const r = {
146
146
  status: !0,
147
147
  errors: []
@@ -165,13 +165,13 @@ var CarouselGenerator = (function() {
165
165
  if (e && !r.status) throw r.errors[0];
166
166
  return r;
167
167
  }
168
- function T(t, e, { shouldThrow: r = !0 } = {}) {
168
+ function S(t, e, { shouldThrow: r = !0 } = {}) {
169
169
  const s = {
170
170
  status: !0,
171
171
  errors: []
172
172
  };
173
173
  try {
174
- if (a("string", { tagName: t }, { shouldThrow: !0 }).status && u(HTMLElement, e, { shouldThrow: !0 }).status) {
174
+ if (a("string", { tagName: t }, { shouldThrow: !0 }).status && h(HTMLElement, e, { shouldThrow: !0 }).status) {
175
175
  const i = t.toLowerCase();
176
176
  for (const o in e) try {
177
177
  if (e[o].tagName.toLowerCase() !== i) throw new TypeError(`${o} must be a <${i}> element. <${e[o].tagName.toLowerCase()}> given.`);
@@ -185,7 +185,7 @@ var CarouselGenerator = (function() {
185
185
  if (r && !s.status) throw s.errors[0];
186
186
  return s;
187
187
  }
188
- function M(t, e, { shouldThrow: r = !0 } = {}) {
188
+ function L(t, e, { shouldThrow: r = !0 } = {}) {
189
189
  const s = {
190
190
  status: !0,
191
191
  errors: []
@@ -198,7 +198,7 @@ var CarouselGenerator = (function() {
198
198
  if (r && !s.status) throw s.errors[0];
199
199
  return s;
200
200
  }
201
- function x(t, { shouldThrow: e = !0 } = {}) {
201
+ function z(t, { shouldThrow: e = !0 } = {}) {
202
202
  const r = {
203
203
  status: !0,
204
204
  errors: []
@@ -211,7 +211,7 @@ var CarouselGenerator = (function() {
211
211
  if (e && !r.status) throw r.errors[0];
212
212
  return r;
213
213
  }
214
- var g = class A {
214
+ var g = class O {
215
215
  _scope;
216
216
  _type = "_default";
217
217
  _storage = {};
@@ -221,7 +221,7 @@ var CarouselGenerator = (function() {
221
221
  }
222
222
  initialize() {
223
223
  try {
224
- !this._crush && typeof window[this.scope] < "u" && (u(A, { storage: window[this.scope] }, { shouldThrow: !1 }).status || typeof window[this.scope].storage < "u" && typeof window[this.scope].scope < "u" && typeof window[this.scope].type < "u") && (this._storage = window[this.scope].storage);
224
+ !this._crush && typeof window[this.scope] < "u" && (h(O, { storage: window[this.scope] }, { shouldThrow: !1 }).status || typeof window[this.scope].storage < "u" && typeof window[this.scope].scope < "u" && typeof window[this.scope].type < "u") && (this._storage = window[this.scope].storage);
225
225
  } catch {} finally {
226
226
  window[this.scope] = this;
227
227
  }
@@ -271,7 +271,7 @@ var CarouselGenerator = (function() {
271
271
  dispose() {
272
272
  delete this._storage, delete this;
273
273
  }
274
- }, S = class {
274
+ }, C = class {
275
275
  _dom = {};
276
276
  _rootDOMElement = "";
277
277
  _protectedDOMElements = [];
@@ -316,7 +316,7 @@ var CarouselGenerator = (function() {
316
316
  if (!this._validate()) throw new Error(`Graupl ${this.name}: Cannot initialize component. The following errors have been found:
317
317
  - ${this.errors.map((t) => t.message).join(`
318
318
  - `)}`);
319
- h(this.initializeClass, this.rootDOMElement), this._dispatchEvent("preinitialize", this.rootDOMElement), this._generateKey(), this._setDOMElements(), this._setIds(), this._setAriaAttributes(), this._setCustomProps(), this._createChildElements(), this._handleMediaMatch(), this._handleFocus(), this._handleHover(), this._handleClick(), this._handleKeydown(), this._handleKeyup(), this._dispatchEvent("initialize", this.rootDOMElement), this._store(), l(this.initializeClass, this.rootDOMElement), this._initialized = !0, this._dispatchEvent("postinitialize", this.rootDOMElement);
319
+ c(this.initializeClass, this.rootDOMElement), this._dispatchEvent("preinitialize", this.rootDOMElement), this._generateKey(), this._setDOMElements(), this._setIds(), this._setAriaAttributes(), this._setCustomProps(), this._createChildElements(), this._handleMediaMatch(), this._handleFocus(), this._handleHover(), this._handleClick(), this._handleKeydown(), this._handleKeyup(), this._dispatchEvent("initialize", this.rootDOMElement), this._store(), m(this.initializeClass, this.rootDOMElement), this._initialized = !0, this._dispatchEvent("postinitialize", this.rootDOMElement);
320
320
  } catch (t) {
321
321
  console.error(t);
322
322
  }
@@ -361,19 +361,19 @@ var CarouselGenerator = (function() {
361
361
  return this._classes.initialize;
362
362
  }
363
363
  set initializeClass(t) {
364
- c({ initializeClass: t }), this._classes.initialize !== t && (this._classes.initialize = t);
364
+ d({ initializeClass: t }), this._classes.initialize !== t && (this._classes.initialize = t);
365
365
  }
366
366
  get focusState() {
367
367
  return this._focusState;
368
368
  }
369
369
  set focusState(t) {
370
- D({ focusState: t }), this._focusState !== t && (this._focusState = t);
370
+ x({ focusState: t }), this._focusState !== t && (this._focusState = t);
371
371
  }
372
372
  get currentEvent() {
373
373
  return this._currentEvent;
374
374
  }
375
375
  set currentEvent(t) {
376
- O({ currentEvent: t }), this._currentEvent !== t && (this._currentEvent = t);
376
+ D({ currentEvent: t }), this._currentEvent !== t && (this._currentEvent = t);
377
377
  }
378
378
  get shouldFocus() {
379
379
  let t = !1;
@@ -414,25 +414,25 @@ var CarouselGenerator = (function() {
414
414
  }
415
415
  _validate() {
416
416
  this._dispatchEvent("prevalidate", this.rootDOMElement);
417
- const t = x(this, { shouldThrow: !1 });
417
+ const t = z(this, { shouldThrow: !1 });
418
418
  if (t.status || (this._errors = [...this._errors, ...t.errors], this._valid = !1), Object.keys(this._dom).length > 0) {
419
419
  const s = {};
420
- for (const o of Object.keys(this._dom)) Array.isArray(this._dom[o]) ? this._dom[o].forEach((n, C) => {
421
- s[`${o}Element[${C}]`] = n;
420
+ for (const o of Object.keys(this._dom)) Array.isArray(this._dom[o]) ? this._dom[o].forEach((n, f) => {
421
+ s[`${o}Element[${f}]`] = n;
422
422
  }) : this._dom[o] !== null && (s[`${o}Element`] = this._dom[o]);
423
- const i = u(HTMLElement, s, { shouldThrow: !1 });
423
+ const i = h(HTMLElement, s, { shouldThrow: !1 });
424
424
  i.status || (this._errors = [...this._errors, ...i.errors], this._valid = !1);
425
425
  }
426
426
  if (Object.keys(this._selectors).length > 0) {
427
427
  const s = {};
428
428
  for (const o of Object.keys(this._selectors)) s[`${o}Selector`] = this._selectors[o];
429
- const i = b(s, { shouldThrow: !1 });
429
+ const i = I(s, { shouldThrow: !1 });
430
430
  i.status || (this._errors = [...this._errors, ...i.errors], this._valid = !1);
431
431
  }
432
432
  if (Object.keys(this._classes).length > 0) {
433
433
  const s = {};
434
434
  for (const o of Object.keys(this._classes)) this._classes[o] !== "" && (s[`${o}Class`] = this._classes[o]);
435
- const i = c(s, { shouldThrow: !1 });
435
+ const i = d(s, { shouldThrow: !1 });
436
436
  i.status || (this._errors = [...this._errors, ...i.errors], this._valid = !1);
437
437
  }
438
438
  if (Object.keys(this._durations).length > 0) {
@@ -469,7 +469,7 @@ var CarouselGenerator = (function() {
469
469
  _setDOMElementType(t, { context: e, overwrite: r = !0, strict: s = !1 } = {}) {
470
470
  if (typeof this.selectors[t] != "string") throw new Error(`Graupl ${this.name}: "${t}" is not a valid element type.`);
471
471
  if (this._rootDOMElement === t || this._protectedDOMElements.includes(t)) throw new Error(`Graupl ${this.name}: "${t}" element cannot be set through _setDOMElementType because it is a protected element.`);
472
- u(HTMLElement, { context: e });
472
+ h(HTMLElement, { context: e });
473
473
  const i = Array.from(e.querySelectorAll(this.selectors[t])).filter((o) => s ? o.parentElement === e : !0);
474
474
  Array.isArray(this._dom[t]) ? r ? this._dom[t] = i : this._dom[t] = [...this._dom[t], ...i] : this._dom[t] = i[0] || null;
475
475
  }
@@ -489,14 +489,14 @@ var CarouselGenerator = (function() {
489
489
  _handleKeydown() {}
490
490
  _handleKeyup() {}
491
491
  _store() {
492
- this._shouldStore && (u(g, { storage: window.GrauplStorage }, { shouldThrow: !1 }).status || new g({ scope: "GrauplStorage" }), window.GrauplStorage.set({
492
+ this._shouldStore && (h(g, { storage: window.GrauplStorage }, { shouldThrow: !1 }).status || new g({ scope: "GrauplStorage" }), window.GrauplStorage.set({
493
493
  key: this.id !== "" ? this.id : this.key,
494
494
  type: this._storageKey,
495
495
  data: this
496
496
  }));
497
497
  }
498
498
  _unstore() {
499
- this._shouldStore && u(g, { storage: window.GrauplStorage }, { shouldThrow: !1 }).status && window.GrauplStorage.clear({
499
+ this._shouldStore && h(g, { storage: window.GrauplStorage }, { shouldThrow: !1 }).status && window.GrauplStorage.clear({
500
500
  key: this.id !== "" ? this.id : this.key,
501
501
  type: this._storageKey
502
502
  });
@@ -531,7 +531,7 @@ var CarouselGenerator = (function() {
531
531
  });
532
532
  }
533
533
  _dispatchEvent(t, e) {
534
- M(t, this), u(HTMLElement, { element: e }), e.dispatchEvent(this.events[t]);
534
+ L(t, this), h(HTMLElement, { element: e }), e.dispatchEvent(this.events[t]);
535
535
  }
536
536
  _addEventListener(t, e, r, s = {}) {
537
537
  e.addEventListener(t, r, s), this._listeners.push({
@@ -562,77 +562,96 @@ var CarouselGenerator = (function() {
562
562
  dispose() {
563
563
  this._clearIntervals(), this._clearTimeouts(), this._removeEventListeners(), this._unstore(), delete this;
564
564
  }
565
- }, L = class extends S {
565
+ }, E = class extends C {
566
+ _rootDOMElement = "carouselItem";
567
+ _shouldStore = !1;
568
+ _storageKey = "carouselItems";
569
+ _name = "CarouselItem";
570
+ _busy = !1;
571
+ constructor({ carouselItemElement: t, tabElement: e = null, clone: r = null, parent: s, prefix: i = "graupl-", key: o = null, initializeClass: n = "initializing", initialize: f = !1 }) {
572
+ super({
573
+ prefix: i,
574
+ key: o,
575
+ initializeClass: n
576
+ }), this._dom.carouselItem = t, this._dom.tab = e, this._elements.clone = r ?? null, this._elements.parent = s, f && this.initialize();
577
+ }
578
+ activate({ scroll: t = !0, scrollOptions: e = {} } = {}) {
579
+ requestAnimationFrame(() => {
580
+ c(this.elements.parent.activeClass, this.dom.carouselItem), this.dom.carouselItem.removeAttribute("inert"), t && this.elements.parent.dom.carouselItemContainer.scrollTo({
581
+ left: this.dom.carouselItem.offsetLeft,
582
+ top: this.dom.carouselItem.offsetTop,
583
+ behavior: "smooth",
584
+ ...e
585
+ }), this.dom.tab && requestAnimationFrame(() => {
586
+ c(this.elements.parent.activeClass, this.dom.tab), this.dom.tab.setAttribute("aria-selected", !0);
587
+ });
588
+ });
589
+ }
590
+ deactivate() {
591
+ requestAnimationFrame(() => {
592
+ m(this.elements.parent.activeClass, this.dom.carouselItem), this.dom.carouselItem.setAttribute("inert", !0), requestAnimationFrame(() => {
593
+ this.dom.tab && (m(this.elements.parent.activeClass, this.dom.tab), this.dom.tab.setAttribute("aria-selected", !1));
594
+ });
595
+ });
596
+ }
597
+ }, P = class extends C {
566
598
  _rootDOMElement = "carousel";
567
599
  _currentItem = 0;
568
600
  _autoplay = !0;
569
601
  _playText = "Play";
570
602
  _pauseText = "Pause";
571
- _currentAction = "next";
572
603
  _storageKey = "carousels";
573
604
  _name = "Carousel";
574
- constructor({ carouselElement: t, carouselItemsSelector: e = ".carousel-item", carouselItemContainerSelector: r = ".carousel-item-container", carouselControlsSelector: s = ".carousel-control", carouselControlContainerSelector: i = ".carousel-control-container", carouselTabsSelector: o = ".carousel-tab", carouselTabContainerSelector: n = ".carousel-tab-container", autoplaySelector: C = ".autoplay", nextSelector: Q = ".next", previousSelector: V = ".previous", activeClass: P = "active", previousClass: K = "previous", nextClass: F = "next", playClass: G = "play", pauseClass: q = "pause", autoplay: N = !0, transitionDelay: H = 1e4, transitionDuration: R = 500, playText: U = "Play", pauseText: J = "Pause", prefix: Z = "graupl-", key: B = null, initializeClass: W = "initializing", initialize: X = !1 }) {
605
+ _itemsPerPage = 1;
606
+ _loop = !0;
607
+ constructor({ carouselElement: t, carouselItemsSelector: e = ".carousel-item", carouselItemContainerSelector: r = ".carousel-item-container", carouselControlsSelector: s = ".carousel-control", carouselControlContainerSelector: i = ".carousel-control-container", carouselTabsSelector: o = ".carousel-tab", carouselTabContainerSelector: n = ".carousel-tab-container", autoplaySelector: f = ".autoplay", nextSelector: V = ".next", previousSelector: K = ".previous", activeClass: F = "active", playClass: N = "play", pauseClass: q = "pause", autoplay: G = !0, transitionDelay: H = 1e4, playText: R = "Play", pauseText: U = "Pause", itemsPerPage: J = 1, loop: B = !0, prefix: Z = "graupl-", key: W = null, initializeClass: X = "initializing", initialize: Y = !1 }) {
575
608
  super({
576
609
  prefix: Z,
577
- key: B,
578
- initializeClass: W
579
- }), this._dom.carousel = t, this._dom.carouselItems = [], this._dom.carouselItemContainer = null, this._dom.carouselControls = [], this._dom.carouselControlContainer = null, this._dom.carouselTabs = [], this._dom.carouselTabContainer = null, this._dom.autoplay = null, this._dom.next = null, this._dom.previous = null, this._selectors.carouselItems = e, this._selectors.carouselItemContainer = r, this._selectors.carouselControls = s, this._selectors.carouselControlContainer = i, this._selectors.carouselTabs = o, this._selectors.carouselTabContainer = n, this._selectors.autoplay = C, this._selectors.next = Q, this._selectors.previous = V, this._classes.active = P || "", this._classes.previous = K || "", this._classes.next = F || "", this._classes.play = G || "", this._classes.pause = q || "", this._autoplay = N, this._delays.transition = H, this._durations.transition = R, this._playText = U || "", this._pauseText = J || "", this._addEventListener("grauplComponentInitialize", this.rootDOMElement, () => {
580
- this._handleAutoplay(), this.dom.carouselItems.forEach((y) => {
581
- y.setAttribute("inert", "true");
582
- }), this.activateFirstItem();
610
+ key: W,
611
+ initializeClass: X
612
+ }), this._dom.carousel = t, this._dom.carouselItems = [], this._dom.carouselItemContainer = null, this._dom.carouselControls = [], this._dom.carouselControlContainer = null, this._dom.carouselTabs = [], this._dom.carouselTabContainer = null, this._dom.autoplay = null, this._dom.next = null, this._dom.previous = null, this._selectors.carouselItems = e, this._selectors.carouselItemContainer = r, this._selectors.carouselControls = s, this._selectors.carouselControlContainer = i, this._selectors.carouselTabs = o, this._selectors.carouselTabContainer = n, this._selectors.autoplay = f, this._selectors.next = V, this._selectors.previous = K, this._elements.carouselItems = [], this._classes.active = F || "", this._classes.play = N || "", this._classes.pause = q || "", this._autoplay = G, this._itemsPerPage = J, this._loop = B, this._delays.transition = H, this._playText = R || "", this._pauseText = U || "", this._addEventListener("grauplComponentInitialize", this.rootDOMElement, () => {
613
+ this._handleAutoplay(), this.loop && this._handleLoop(), this._handleIntersection(), this.activateFirstItem({ scrollOptions: { behavior: "instant" } });
583
614
  }), this._addEventListener("grauplComponentValidate", this.rootDOMElement, () => {
584
- const y = a("boolean", { autoplay: this._autoplay }, { shouldThrow: !1 });
585
- y.status || (this._errors = [...this._errors, ...y.errors], this._valid = !1);
586
- const $ = a("string", {
615
+ const $ = a("boolean", {
616
+ autoplay: this._autoplay,
617
+ loop: this._loop
618
+ }, { shouldThrow: !1 });
619
+ $.status || (this._errors = [...this._errors, ...$.errors], this._valid = !1);
620
+ const A = a("string", {
587
621
  playText: this._playText,
588
622
  pauseText: this._pauseText
589
623
  }, { shouldThrow: !1 });
590
- $.status || (this._errors = [...this._errors, ...$.errors], this._valid = !1);
591
- }), X && this.initialize();
624
+ A.status || (this._errors = [...this._errors, ...A.errors], this._valid = !1);
625
+ const M = a("number", { itemsPerPage: this._itemsPerPage }, { shouldThrow: !1 });
626
+ M.status || (this._errors = [...this._errors, ...M.errors], this._valid = !1);
627
+ }), Y && this.initialize();
592
628
  }
593
629
  get activeClass() {
594
630
  return this._classes.active;
595
631
  }
596
632
  set activeClass(t) {
597
- c({ activeClass: t }), this._classes.active !== t && (this._classes.active = t);
598
- }
599
- get previousClass() {
600
- return this._classes.previous;
601
- }
602
- set previousClass(t) {
603
- c({ previousClass: t }), this._classes.previous !== t && (this._classes.previous = t);
604
- }
605
- get nextClass() {
606
- return this._classes.next;
607
- }
608
- set nextClass(t) {
609
- c({ nextClass: t }), this._classes.next !== t && (this._classes.next = t);
633
+ d({ activeClass: t }), this._classes.active !== t && (this._classes.active = t);
610
634
  }
611
635
  get playClass() {
612
636
  return this._classes.play;
613
637
  }
614
638
  set playClass(t) {
615
- c({ playClass: t }), this._classes.play !== t && (this._classes.play = t);
639
+ d({ playClass: t }), this._classes.play !== t && (this._classes.play = t);
616
640
  }
617
641
  get pauseClass() {
618
642
  return this._classes.pause;
619
643
  }
620
644
  set pauseClass(t) {
621
- c({ pauseClass: t }), this._classes.pause !== t && (this._classes.pause = t);
645
+ d({ pauseClass: t }), this._classes.pause !== t && (this._classes.pause = t);
622
646
  }
623
647
  get currentItem() {
624
648
  return this._currentItem;
625
649
  }
626
650
  set currentItem(t) {
627
- a("number", { currentItem: t }), t !== this.currentItem && (t < 0 ? this._currentItem = 0 : t >= this.dom.carouselItems.length ? this._currentItem = this.dom.carouselItems.length - 1 : this._currentItem = t, this._dom.carousel.querySelectorAll(this.selectors.carouselTab) && this.dom.carouselItems.forEach((e, r) => {
628
- e.setAttribute("aria-selected", r === this._currentItem);
629
- }));
651
+ a("number", { currentItem: t }), t !== this.currentItem && (t < 0 ? this._currentItem = 0 : t >= this.dom.carouselItems.length ? this._currentItem = this.dom.carouselItems.length - 1 : this._currentItem = t);
630
652
  }
631
653
  get currentCarouselItem() {
632
- return this.dom.carouselItems[this.currentItem];
633
- }
634
- get currentCarouselTab() {
635
- return this.dom.carouselTabs[this.currentItem];
654
+ return this.elements.carouselItems[this.currentItem];
636
655
  }
637
656
  get autoplay() {
638
657
  return this._autoplay;
@@ -640,18 +659,18 @@ var CarouselGenerator = (function() {
640
659
  set autoplay(t) {
641
660
  a("boolean", { autoplay: t }), this._autoplay !== t && (this._autoplay = t);
642
661
  }
662
+ get itemsPerPage() {
663
+ return this._itemsPerPage;
664
+ }
665
+ get loop() {
666
+ return this._loop;
667
+ }
643
668
  get transitionDelay() {
644
669
  return this._delays.transition;
645
670
  }
646
671
  set transitionDelay(t) {
647
672
  a("number", { transitionDelay: t }), t !== this.transitionDelay && t >= 0 && (this._delays.transition = t);
648
673
  }
649
- get transitionDuration() {
650
- return this._durations.transition;
651
- }
652
- set transitionDuration(t) {
653
- a("number", { transitionDuration: t }), this._durations.transition !== t && t >= 0 && (this._durations.transition = t, this._setTransitionDuration());
654
- }
655
674
  get playText() {
656
675
  return this._playText;
657
676
  }
@@ -664,12 +683,22 @@ var CarouselGenerator = (function() {
664
683
  set pauseText(t) {
665
684
  a("string", { pauseText: t }), this._pauseText !== t && (this._pauseText = t);
666
685
  }
667
- get currentAction() {
668
- return this._currentAction;
669
- }
670
686
  _setDOMElements() {
671
687
  this._setDOMElementType("carouselItemContainer", { context: this.dom.carousel }), this._setDOMElementType("carouselControlContainer", { context: this.dom.carousel }), this._setDOMElementType("carouselTabContainer", { context: this.dom.carousel }), this.dom.carouselItemContainer && this._setDOMElementType("carouselItems", { context: this.dom.carouselItemContainer }), this.dom.carouselControlContainer && (this._setDOMElementType("carouselControls", { context: this.dom.carouselControlContainer }), this._setDOMElementType("autoplay", { context: this.dom.carouselControlContainer }), this._setDOMElementType("next", { context: this.dom.carouselControlContainer }), this._setDOMElementType("previous", { context: this.dom.carouselControlContainer })), this._dom.carouselTabContainer && this._setDOMElementType("carouselTabs", { context: this.dom.carouselTabContainer });
672
688
  }
689
+ _createChildElements() {
690
+ this.dom.carouselItems.forEach((t, e) => {
691
+ const r = new E({
692
+ carouselItemElement: t,
693
+ tabElement: this.dom.carouselTabs ? this.dom.carouselTabs[e] : null,
694
+ parent: this,
695
+ prefix: this.prefix,
696
+ initializeClass: this.classes.initialize,
697
+ initialize: !0
698
+ });
699
+ this._elements.carouselItems.push(r);
700
+ });
701
+ }
673
702
  _setIds() {
674
703
  this.dom.carousel.id = this.dom.carousel.id || `carousel-${this.key}`, this.dom.carouselItems.forEach((t, e) => {
675
704
  t.id = t.id || `carousel-item-${this.key}-${e}`;
@@ -678,15 +707,36 @@ var CarouselGenerator = (function() {
678
707
  }), this._id = this.dom.carousel.id;
679
708
  }
680
709
  _setAriaAttributes() {
681
- !T("section", { carousel: this.dom.carousel }, { shouldThrow: !1 }).status && !this.dom.carousel.getAttribute("role") !== "region" && this.dom.carousel.setAttribute("role", "group"), this._dom.carousel.setAttribute("aria-roledescription", "carousel"), this.dom.carouselTabContainer && this.dom.carouselTabContainer.setAttribute("role", "tablist"), this.dom.carouselTabs.forEach((t, e) => {
682
- T("button", { tab: t }, { shouldThrow: !1 }).status || t.setAttribute("role", "button"), t.setAttribute("aria-selected", e === 0), t.setAttribute("aria-controls", this.dom.carouselItems[e].id);
710
+ !S("section", { carousel: this.dom.carousel }, { shouldThrow: !1 }).status && !this.dom.carousel.getAttribute("role") !== "region" && this.dom.carousel.setAttribute("role", "group"), this.dom.carouselItems.forEach((t) => {
711
+ t.setAttribute("inert", "true");
712
+ }), this.dom.carouselItemContainer && this.dom.carouselItemContainer.setAttribute("tabindex", "-1"), this._dom.carousel.setAttribute("aria-roledescription", "carousel"), this.dom.carouselTabContainer && this.dom.carouselTabContainer.setAttribute("role", "tablist"), this.dom.carouselTabs.forEach((t, e) => {
713
+ t.setAttribute("role", "tab"), t.setAttribute("aria-selected", e === 0), t.setAttribute("aria-controls", this.dom.carouselItems[e].id);
683
714
  });
684
715
  }
685
- _setCustomProps() {
686
- this.dom.carousel.style.setProperty(`--${this.prefix}carousel-transition-duration`, `${this.transitionDuration}ms`);
687
- }
688
716
  _handleAutoplay() {
689
- this.autoplay ? (h(this.pauseClass, this.dom.autoplay), l(this.playClass, this.dom.autoplay), this.dom.autoplay.setAttribute("aria-label", this.pauseText), this.dom.carousel.setAttribute("aria-live", "off"), this._setInterval(() => this.activateNextItem(), this.transitionDelay)) : (h(this.playClass, this.dom.autoplay), l(this.pauseClass, this.dom.autoplay), this.dom.autoplay.setAttribute("aria-label", this.playText), this.dom.carousel.setAttribute("aria-live", "polite"), this._clearInterval());
717
+ this.autoplay ? (c(this.pauseClass, this.dom.autoplay), m(this.playClass, this.dom.autoplay), this.dom.autoplay.setAttribute("aria-label", this.pauseText), this.dom.carousel.setAttribute("aria-live", "off"), this._setInterval(() => this.activateNextItem(), this.transitionDelay)) : (c(this.playClass, this.dom.autoplay), m(this.pauseClass, this.dom.autoplay), this.dom.autoplay.setAttribute("aria-label", this.playText), this.dom.carousel.setAttribute("aria-live", "polite"), this._clearInterval());
718
+ }
719
+ _handleIntersection() {
720
+ const t = {
721
+ root: this.dom.carouselItemContainer,
722
+ rootMargin: "1px",
723
+ scrollMargin: "1px",
724
+ threshold: 1
725
+ }, e = new IntersectionObserver((r) => {
726
+ this.isInitialized && r.forEach((s) => {
727
+ if (!s.isIntersecting) return;
728
+ const i = this.dom.carouselItems.indexOf(s.target);
729
+ let o = i;
730
+ this.elements.carouselItems[i].elements.clone !== null && (o = this.dom.carouselItems.indexOf(this.elements.carouselItems[i].elements.clone.dom.carouselItem), (i === 0 || i === this.dom.carouselItems.length - 1) && this.dom.carouselItemContainer.scrollTo({
731
+ left: this.elements.carouselItems[i].elements.clone.dom.carouselItem.offsetLeft,
732
+ top: this.elements.carouselItems[i].elements.clone.dom.carouselItem.offsetTop,
733
+ behavior: "instant"
734
+ })), this.currentItem !== o && this.activateItem(o, { scroll: !1 });
735
+ });
736
+ }, t);
737
+ this.dom.carouselItems.forEach((r) => {
738
+ e.observe(r);
739
+ });
690
740
  }
691
741
  _handleFocus() {
692
742
  this._addEventListener("focusin", this.dom.carousel, () => {
@@ -696,15 +746,15 @@ var CarouselGenerator = (function() {
696
746
  });
697
747
  }
698
748
  _handleClick() {
699
- this._addEventListener("click", this.dom.next, () => {
700
- this.activateNextItem();
701
- }), this._addEventListener("click", this.dom.previous, () => {
702
- this.activatePreviousItem();
703
- }), this._addEventListener("click", this.dom.autoplay, () => {
704
- this.toggleAutoplay();
705
- }), this.dom.carouselTabs.forEach((t, e) => {
706
- this._addEventListener("click", t, () => {
707
- this.currentItem > e ? this._currentAction = "previous" : this._currentAction = "next", this.activateItem(e);
749
+ this._addEventListener("click", this.dom.next, (t) => {
750
+ t.button === 0 && (l(t), this.currentEvent = "mouse", this.activateNextItem());
751
+ }), this._addEventListener("click", this.dom.previous, (t) => {
752
+ t.button === 0 && (l(t), this.currentEvent = "mouse", this.activatePreviousItem());
753
+ }), this._addEventListener("click", this.dom.autoplay, (t) => {
754
+ t.button === 0 && (l(t), this.currentEvent = "mouse", this.toggleAutoplay());
755
+ }), this.elements.carouselItems.forEach((t) => {
756
+ t.dom.tab && this._addEventListener("click", t.dom.tab, (e) => {
757
+ e.button === 0 && (l(e), this.currentEvent = "mouse", this.activateItem(this.dom.carouselItems.indexOf(t.dom.carouselItem)));
708
758
  });
709
759
  });
710
760
  }
@@ -718,19 +768,19 @@ var CarouselGenerator = (function() {
718
768
  _handleKeydown() {
719
769
  this.dom.carouselControls.forEach((t) => {
720
770
  this._addEventListener("keydown", t, (e) => {
721
- switch (d(e)) {
771
+ switch (u(e)) {
722
772
  case "Space":
723
773
  case "Enter":
724
- _(e);
774
+ l(e);
725
775
  break;
726
776
  }
727
777
  });
728
- }), this.dom.carouselTabs.forEach((t) => {
729
- this._addEventListener("keydown", t, (e) => {
730
- switch (d(e)) {
778
+ }), this.elements.carouselItems.forEach((t) => {
779
+ t.dom.tab && this._addEventListener("keydown", t.dom.tab, (e) => {
780
+ switch (u(e)) {
731
781
  case "Space":
732
782
  case "Enter":
733
- _(e);
783
+ l(e);
734
784
  break;
735
785
  }
736
786
  });
@@ -738,83 +788,154 @@ var CarouselGenerator = (function() {
738
788
  }
739
789
  _handleKeyup() {
740
790
  this._addEventListener("keyup", this.dom.next, (t) => {
741
- switch (d(t)) {
791
+ switch (u(t)) {
742
792
  case "Space":
743
793
  case "Enter":
744
- this.activateNextItem(), _(t);
794
+ this.activateNextItem(), l(t);
745
795
  break;
746
796
  }
747
797
  }), this._addEventListener("keyup", this.dom.previous, (t) => {
748
- switch (d(t)) {
798
+ switch (u(t)) {
749
799
  case "Space":
750
800
  case "Enter":
751
- this.activatePreviousItem(), _(t);
801
+ this.activatePreviousItem(), l(t);
752
802
  break;
753
803
  }
754
804
  }), this._addEventListener("keyup", this.dom.autoplay, (t) => {
755
- switch (d(t)) {
805
+ switch (u(t)) {
756
806
  case "Space":
757
807
  case "Enter":
758
- this.toggleAutoplay(), _(t);
808
+ this.toggleAutoplay(), l(t);
759
809
  break;
760
810
  }
761
- }), this.dom.carouselTabs.forEach((t, e) => {
762
- this._addEventListener("keyup", t, (r) => {
763
- switch (d(r)) {
811
+ }), this.elements.carouselItems.forEach((t) => {
812
+ t.dom.tab && this._addEventListener("keyup", t.dom.tab, (e) => {
813
+ switch (u(e)) {
764
814
  case "Space":
765
815
  case "Enter":
766
- this.activateItem(e), _(r);
816
+ this.activateItem(this.dom.carouselItems.indexOf(t.dom.carouselItem)), l(e);
767
817
  break;
768
818
  }
769
819
  });
770
820
  });
771
821
  }
772
- activateCurrentItem() {
773
- h(this.activeClass, this.currentCarouselItem), this.currentCarouselItem.removeAttribute("inert"), this.currentCarouselTab && (this.currentCarouselTab.setAttribute("aria-selected", !0), h(this.activeClass, this.currentCarouselTab));
822
+ _handleLoop() {
823
+ const t = /* @__PURE__ */ new Map(), e = /* @__PURE__ */ new Map(), r = this.dom.carouselItemContainer;
824
+ for (let s = 0; s < this.itemsPerPage; s++) t.set(this.dom.carouselItems[s], this.dom.carouselItems.indexOf(this.dom.carouselItems[s]));
825
+ for (let s = this.dom.carouselItems.length - this.itemsPerPage; s < this.dom.carouselItems.length; s++) e.set(this.dom.carouselItems[s], this.dom.carouselItems.indexOf(this.dom.carouselItems[s]));
826
+ t.forEach((s, i) => {
827
+ const o = i.cloneNode(!0);
828
+ o.setAttribute("aria-hidden", "true"), o.setAttribute("inert", "true"), o.setAttribute("id", `${i.id}-clone`), r.appendChild(o);
829
+ const n = new E({
830
+ carouselItemElement: o,
831
+ clone: this._elements.carouselItems[s],
832
+ parent: this,
833
+ prefix: this.prefix,
834
+ initializeClass: this.classes.initialize,
835
+ initialize: !0
836
+ });
837
+ this.dom.carouselItems.push(o), this._elements.carouselItems.push(n);
838
+ }), e.forEach((s, i) => {
839
+ const o = i.cloneNode(!0);
840
+ o.setAttribute("aria-hidden", "true"), o.setAttribute("inert", "true"), o.setAttribute("id", `${i.id}-clone`), r.insertBefore(o, r.firstChild);
841
+ const n = new E({
842
+ carouselItemElement: o,
843
+ clone: this._elements.carouselItems[s],
844
+ parent: this,
845
+ prefix: this.prefix,
846
+ initializeClass: this.classes.initialize,
847
+ initialize: !0
848
+ });
849
+ this.dom.carouselItems.unshift(o), this._elements.carouselItems.unshift(n);
850
+ });
851
+ }
852
+ activateCurrentItem({ scroll: t = !0, scrollOptions: e = {} } = {}) {
853
+ this.currentCarouselItem.activate({
854
+ scroll: t,
855
+ scrollOptions: e
856
+ });
774
857
  }
775
- deactivateCurrentItem() {
776
- l(this.activeClass, this.currentCarouselItem), this.currentCarouselItem.setAttribute("inert", !0), this.currentCarouselTab && (this.currentCarouselTab.setAttribute("aria-selected", !1), l(this.activeClass, this.currentCarouselTab));
858
+ deactivateCurrentItem({ scroll: t = !0, scrollOptions: e = {} } = {}) {
859
+ this.currentCarouselItem.deactivate({
860
+ scroll: t,
861
+ scrollOptions: e
862
+ });
777
863
  }
778
- activateItem(t) {
779
- const e = this.currentItem;
780
- this.dom.carousel.dataset.grauplAction = this._currentAction, this.autoplay && this._clearInterval(), h(this.previousClass, this.currentCarouselItem), h(this.nextClass, this.dom.carouselItems[t]), requestAnimationFrame(() => {
781
- this.deactivateCurrentItem(), this.currentItem = t, this.activateCurrentItem(), requestAnimationFrame(() => {
782
- setTimeout(() => {
783
- l(this.previousClass, this.dom.carouselItems[e]), l(this.nextClass, this.currentCarouselItem);
784
- }, this.transitionDuration);
785
- });
864
+ activateItem(t, { scroll: e = !0, scrollOptions: r = {} } = {}) {
865
+ this.autoplay && this._clearInterval(), this.deactivateCurrentItem({
866
+ scroll: e,
867
+ scrollOptions: r
868
+ }), this.currentItem = t, this.activateCurrentItem({
869
+ scroll: e,
870
+ scrollOptions: r
786
871
  }), this.autoplay && this._setInterval(() => this.activateNextItem(), this.transitionDelay);
787
872
  }
788
- activateFirstItem() {
789
- this.activateItem(0);
873
+ activateFirstItem({ scroll: t = !0, scrollOptions: e = {} } = {}) {
874
+ this.loop ? this.currentItem === this.dom.carouselItems.length - this.itemsPerPage - 1 ? this.activateNextItem({
875
+ scroll: t,
876
+ scrollOptions: e
877
+ }) : this.activateItem(this.itemsPerPage, {
878
+ scroll: t,
879
+ scrollOptions: e
880
+ }) : this.activateItem(0, {
881
+ scroll: t,
882
+ scrollOptions: e
883
+ });
790
884
  }
791
- activateLastItem() {
792
- this.activateItem(this.dom.carouselItems.length - 1);
885
+ activateLastItem({ scroll: t = !0, scrollOptions: e = {} } = {}) {
886
+ this.loop ? this.currentItem === this.itemsPerPage ? this.activatePreviousItem({
887
+ scroll: t,
888
+ scrollOptions: e
889
+ }) : this.activateItem(this.dom.carouselItems.length - this.itemsPerPage - 1, {
890
+ scroll: t,
891
+ scrollOptions: e
892
+ }) : this.activateItem(this.dom.carouselItems.length - 1, {
893
+ scroll: t,
894
+ scrollOptions: e
895
+ });
793
896
  }
794
- activateNextItem() {
795
- this._currentAction = "next", this.currentItem + 1 >= this.dom.carouselItems.length ? this.activateFirstItem() : this.activateItem(this.currentItem + 1);
897
+ activateNextItem({ scroll: t = !0, scrollOptions: e = {} } = {}) {
898
+ this.loop ? this.activateItem(this.currentItem + 1, {
899
+ scroll: t,
900
+ scrollOptions: e
901
+ }) : this.currentItem + 1 >= this.dom.carouselItems.length ? this.activateFirstItem({
902
+ scroll: t,
903
+ scrollOptions: e
904
+ }) : this.activateItem(this.currentItem + 1, {
905
+ scroll: t,
906
+ scrollOptions: e
907
+ });
796
908
  }
797
- activatePreviousItem() {
798
- this._currentAction = "previous", this.currentItem - 1 < 0 ? this.activateLastItem() : this.activateItem(this.currentItem - 1);
909
+ activatePreviousItem({ scroll: t = !0, scrollOptions: e = {} } = {}) {
910
+ this.loop ? this.activateItem(this.currentItem - 1, {
911
+ scroll: t,
912
+ scrollOptions: e
913
+ }) : this.currentItem - 1 < 0 || this.loop && this.currentItem - 1 < this.itemsPerPage ? this.activateLastItem({
914
+ scroll: t,
915
+ scrollOptions: e
916
+ }) : this.activateItem(this.currentItem - 1, {
917
+ scroll: t,
918
+ scrollOptions: e
919
+ });
799
920
  }
800
921
  toggleAutoplay() {
801
922
  this.autoplay = !this.autoplay, this._handleAutoplay();
802
923
  }
803
924
  };
804
- const I = /[\11\12\14\15\40]+/, E = "data-once", j = document;
925
+ const T = /[\11\12\14\15\40]+/, v = "data-once", j = document;
805
926
  function w(t, e, r) {
806
- return t[`${e}Attribute`](E, r);
927
+ return t[`${e}Attribute`](v, r);
807
928
  }
808
- function m(t) {
929
+ function _(t) {
809
930
  if (typeof t != "string") throw new TypeError("once ID must be a string");
810
- if (t === "" || I.test(t)) throw new RangeError("once ID must not be empty or contain spaces");
811
- return `[${E}~="${t}"]`;
931
+ if (t === "" || T.test(t)) throw new RangeError("once ID must not be empty or contain spaces");
932
+ return `[${v}~="${t}"]`;
812
933
  }
813
- function z(t) {
934
+ function Q(t) {
814
935
  if (!(t instanceof Element)) throw new TypeError("The element must be an instance of Element");
815
936
  return !0;
816
937
  }
817
- function f(t, e = j) {
938
+ function p(t, e = j) {
818
939
  let r = t;
819
940
  if (t === null) r = [];
820
941
  else if (t) if (e instanceof Document || e instanceof DocumentFragment || e instanceof Element) typeof t == "string" ? r = e.querySelectorAll(t) : t instanceof Element && (r = [t]);
@@ -822,27 +943,27 @@ var CarouselGenerator = (function() {
822
943
  else throw new TypeError("Selector must not be empty");
823
944
  return Array.prototype.slice.call(r);
824
945
  }
825
- function v(t, e, r) {
946
+ function b(t, e, r) {
826
947
  return e.filter((s) => {
827
- const i = z(s) && s.matches(t);
948
+ const i = Q(s) && s.matches(t);
828
949
  return i && r && r(s), i;
829
950
  });
830
951
  }
831
952
  function k(t, { add: e, remove: r }) {
832
953
  const s = [];
833
- w(t, "has") && w(t, "get").trim().split(I).forEach((o) => {
954
+ w(t, "has") && w(t, "get").trim().split(T).forEach((o) => {
834
955
  s.indexOf(o) < 0 && o !== r && s.push(o);
835
956
  }), e && s.push(e);
836
957
  const i = s.join(" ");
837
958
  w(t, i === "" ? "remove" : "set", i);
838
959
  }
839
- function p(t, e, r) {
840
- return v(`:not(${m(t)})`, f(e, r), (s) => k(s, { add: t }));
960
+ function y(t, e, r) {
961
+ return b(`:not(${_(t)})`, p(e, r), (s) => k(s, { add: t }));
841
962
  }
842
- return p.remove = (t, e, r) => v(m(t), f(e, r), (s) => k(s, { remove: t })), p.filter = (t, e, r) => v(m(t), f(e, r)), p.find = (t, e) => f(t ? m(t) : `[${E}]`, e), (t = {}, e = document, r = ".carousel") => {
843
- p("graupl-carousel-generator", r, e).forEach((s) => {
963
+ return y.remove = (t, e, r) => b(_(t), p(e, r), (s) => k(s, { remove: t })), y.filter = (t, e, r) => b(_(t), p(e, r)), y.find = (t, e) => p(t ? _(t) : `[${v}]`, e), (t = {}, e = document, r = ".carousel") => {
964
+ y("graupl-carousel-generator", r, e).forEach((s) => {
844
965
  const i = s.dataset.grauplCarouselOptions ? JSON.parse(s.dataset.grauplCarouselOptions.replace(/'/g, "\"")) || {} : {};
845
- new L({
966
+ new P({
846
967
  carouselElement: s,
847
968
  initialize: !0,
848
969
  ...t,