@aurodesignsystem-dev/auro-slideshow 0.0.0-pr18.0 → 0.0.0-pr19.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.
@@ -1,2225 +1,4 @@
1
- import { x, e as elementChildren, c as createElement, m as makeElementsArray, a as elementParents, b as elementOuterSize, d as elementIndex, g as getDocument, T, E, i as i$2, s as styleCss, f as i$3, h as colorCss, t as tokensCss, j as tokensCss$1, k as styleCss$1, l as colorCss$1, n as styleCss$2, o as tokensCss$2, p as colorCss$2, q as styleCss$3, S as Swiper } from './api.min.js';
2
-
3
- /**
4
- * @license
5
- * Copyright 2020 Google LLC
6
- * SPDX-License-Identifier: BSD-3-Clause
7
- */
8
- const a=Symbol.for(""),o$1=t=>{if(t?.r===a)return t?._$litStatic$},s=t=>({_$litStatic$:t,r:a}),i$1=(t,...r)=>({_$litStatic$:r.reduce(((r,e,a)=>r+(t=>{if(void 0!==t._$litStatic$)return t._$litStatic$;throw Error(`Value passed to 'literal' function must be a 'literal' result: ${t}. Use 'unsafeStatic' to pass non-literal values, but\n take care to ensure page security.`)})(e)+t[a+1]),t[0]),r:a}),l=new Map,n=t=>(r,...e)=>{const a=e.length;let s,i;const n=[],u=[];let c,$=0,f=false;for(;$<a;){for(c=r[$];$<a&&void 0!==(i=e[$],s=o$1(i));)c+=s+r[++$],f=true;$!==a&&u.push(i),n.push(c),$++;}if($===a&&n.push(r[a]),f){const t=n.join("$$lit$$");void 0===(r=l.get(t))&&(n.raw=n,l.set(t,r=n)),e=u;}return t(r,...e)},u=n(x);
9
-
10
- function createElementIfNotDefined(swiper, originalParams, params, checkProps) {
11
- if (swiper.params.createElements) {
12
- Object.keys(checkProps).forEach(key => {
13
- if (!params[key] && params.auto === true) {
14
- let element = elementChildren(swiper.el, `.${checkProps[key]}`)[0];
15
- if (!element) {
16
- element = createElement('div', checkProps[key]);
17
- element.className = checkProps[key];
18
- swiper.el.append(element);
19
- }
20
- params[key] = element;
21
- originalParams[key] = element;
22
- }
23
- });
24
- }
25
- return params;
26
- }
27
-
28
- function Navigation(_ref) {
29
- let {
30
- swiper,
31
- extendParams,
32
- on,
33
- emit
34
- } = _ref;
35
- extendParams({
36
- navigation: {
37
- nextEl: null,
38
- prevEl: null,
39
- hideOnClick: false,
40
- disabledClass: 'swiper-button-disabled',
41
- hiddenClass: 'swiper-button-hidden',
42
- lockClass: 'swiper-button-lock',
43
- navigationDisabledClass: 'swiper-navigation-disabled'
44
- }
45
- });
46
- swiper.navigation = {
47
- nextEl: null,
48
- prevEl: null
49
- };
50
- function getEl(el) {
51
- let res;
52
- if (el && typeof el === 'string' && swiper.isElement) {
53
- res = swiper.el.querySelector(el) || swiper.hostEl.querySelector(el);
54
- if (res) return res;
55
- }
56
- if (el) {
57
- if (typeof el === 'string') res = [...document.querySelectorAll(el)];
58
- if (swiper.params.uniqueNavElements && typeof el === 'string' && res && res.length > 1 && swiper.el.querySelectorAll(el).length === 1) {
59
- res = swiper.el.querySelector(el);
60
- } else if (res && res.length === 1) {
61
- res = res[0];
62
- }
63
- }
64
- if (el && !res) return el;
65
- // if (Array.isArray(res) && res.length === 1) res = res[0];
66
- return res;
67
- }
68
- function toggleEl(el, disabled) {
69
- const params = swiper.params.navigation;
70
- el = makeElementsArray(el);
71
- el.forEach(subEl => {
72
- if (subEl) {
73
- subEl.classList[disabled ? 'add' : 'remove'](...params.disabledClass.split(' '));
74
- if (subEl.tagName === 'BUTTON') subEl.disabled = disabled;
75
- if (swiper.params.watchOverflow && swiper.enabled) {
76
- subEl.classList[swiper.isLocked ? 'add' : 'remove'](params.lockClass);
77
- }
78
- }
79
- });
80
- }
81
- function update() {
82
- // Update Navigation Buttons
83
- const {
84
- nextEl,
85
- prevEl
86
- } = swiper.navigation;
87
- if (swiper.params.loop) {
88
- toggleEl(prevEl, false);
89
- toggleEl(nextEl, false);
90
- return;
91
- }
92
- toggleEl(prevEl, swiper.isBeginning && !swiper.params.rewind);
93
- toggleEl(nextEl, swiper.isEnd && !swiper.params.rewind);
94
- }
95
- function onPrevClick(e) {
96
- e.preventDefault();
97
- if (swiper.isBeginning && !swiper.params.loop && !swiper.params.rewind) return;
98
- swiper.slidePrev();
99
- emit('navigationPrev');
100
- }
101
- function onNextClick(e) {
102
- e.preventDefault();
103
- if (swiper.isEnd && !swiper.params.loop && !swiper.params.rewind) return;
104
- swiper.slideNext();
105
- emit('navigationNext');
106
- }
107
- function init() {
108
- const params = swiper.params.navigation;
109
- swiper.params.navigation = createElementIfNotDefined(swiper, swiper.originalParams.navigation, swiper.params.navigation, {
110
- nextEl: 'swiper-button-next',
111
- prevEl: 'swiper-button-prev'
112
- });
113
- if (!(params.nextEl || params.prevEl)) return;
114
- let nextEl = getEl(params.nextEl);
115
- let prevEl = getEl(params.prevEl);
116
- Object.assign(swiper.navigation, {
117
- nextEl,
118
- prevEl
119
- });
120
- nextEl = makeElementsArray(nextEl);
121
- prevEl = makeElementsArray(prevEl);
122
- const initButton = (el, dir) => {
123
- if (el) {
124
- el.addEventListener('click', dir === 'next' ? onNextClick : onPrevClick);
125
- }
126
- if (!swiper.enabled && el) {
127
- el.classList.add(...params.lockClass.split(' '));
128
- }
129
- };
130
- nextEl.forEach(el => initButton(el, 'next'));
131
- prevEl.forEach(el => initButton(el, 'prev'));
132
- }
133
- function destroy() {
134
- let {
135
- nextEl,
136
- prevEl
137
- } = swiper.navigation;
138
- nextEl = makeElementsArray(nextEl);
139
- prevEl = makeElementsArray(prevEl);
140
- const destroyButton = (el, dir) => {
141
- el.removeEventListener('click', dir === 'next' ? onNextClick : onPrevClick);
142
- el.classList.remove(...swiper.params.navigation.disabledClass.split(' '));
143
- };
144
- nextEl.forEach(el => destroyButton(el, 'next'));
145
- prevEl.forEach(el => destroyButton(el, 'prev'));
146
- }
147
- on('init', () => {
148
- if (swiper.params.navigation.enabled === false) {
149
- // eslint-disable-next-line
150
- disable();
151
- } else {
152
- init();
153
- update();
154
- }
155
- });
156
- on('toEdge fromEdge lock unlock', () => {
157
- update();
158
- });
159
- on('destroy', () => {
160
- destroy();
161
- });
162
- on('enable disable', () => {
163
- let {
164
- nextEl,
165
- prevEl
166
- } = swiper.navigation;
167
- nextEl = makeElementsArray(nextEl);
168
- prevEl = makeElementsArray(prevEl);
169
- if (swiper.enabled) {
170
- update();
171
- return;
172
- }
173
- [...nextEl, ...prevEl].filter(el => !!el).forEach(el => el.classList.add(swiper.params.navigation.lockClass));
174
- });
175
- on('click', (_s, e) => {
176
- let {
177
- nextEl,
178
- prevEl
179
- } = swiper.navigation;
180
- nextEl = makeElementsArray(nextEl);
181
- prevEl = makeElementsArray(prevEl);
182
- const targetEl = e.target;
183
- let targetIsButton = prevEl.includes(targetEl) || nextEl.includes(targetEl);
184
- if (swiper.isElement && !targetIsButton) {
185
- const path = e.path || e.composedPath && e.composedPath();
186
- if (path) {
187
- targetIsButton = path.find(pathEl => nextEl.includes(pathEl) || prevEl.includes(pathEl));
188
- }
189
- }
190
- if (swiper.params.navigation.hideOnClick && !targetIsButton) {
191
- if (swiper.pagination && swiper.params.pagination && swiper.params.pagination.clickable && (swiper.pagination.el === targetEl || swiper.pagination.el.contains(targetEl))) return;
192
- let isHidden;
193
- if (nextEl.length) {
194
- isHidden = nextEl[0].classList.contains(swiper.params.navigation.hiddenClass);
195
- } else if (prevEl.length) {
196
- isHidden = prevEl[0].classList.contains(swiper.params.navigation.hiddenClass);
197
- }
198
- if (isHidden === true) {
199
- emit('navigationShow');
200
- } else {
201
- emit('navigationHide');
202
- }
203
- [...nextEl, ...prevEl].filter(el => !!el).forEach(el => el.classList.toggle(swiper.params.navigation.hiddenClass));
204
- }
205
- });
206
- const enable = () => {
207
- swiper.el.classList.remove(...swiper.params.navigation.navigationDisabledClass.split(' '));
208
- init();
209
- update();
210
- };
211
- const disable = () => {
212
- swiper.el.classList.add(...swiper.params.navigation.navigationDisabledClass.split(' '));
213
- destroy();
214
- };
215
- Object.assign(swiper.navigation, {
216
- enable,
217
- disable,
218
- update,
219
- init,
220
- destroy
221
- });
222
- }
223
-
224
- function classesToSelector(classes) {
225
- if (classes === void 0) {
226
- classes = '';
227
- }
228
- return `.${classes.trim().replace(/([\.:!+\/])/g, '\\$1') // eslint-disable-line
229
- .replace(/ /g, '.')}`;
230
- }
231
-
232
- function Pagination(_ref) {
233
- let {
234
- swiper,
235
- extendParams,
236
- on,
237
- emit
238
- } = _ref;
239
- const pfx = 'swiper-pagination';
240
- extendParams({
241
- pagination: {
242
- el: null,
243
- bulletElement: 'span',
244
- clickable: false,
245
- hideOnClick: false,
246
- renderBullet: null,
247
- renderProgressbar: null,
248
- renderFraction: null,
249
- renderCustom: null,
250
- progressbarOpposite: false,
251
- type: 'bullets',
252
- // 'bullets' or 'progressbar' or 'fraction' or 'custom'
253
- dynamicBullets: false,
254
- dynamicMainBullets: 1,
255
- formatFractionCurrent: number => number,
256
- formatFractionTotal: number => number,
257
- bulletClass: `${pfx}-bullet`,
258
- bulletActiveClass: `${pfx}-bullet-active`,
259
- modifierClass: `${pfx}-`,
260
- currentClass: `${pfx}-current`,
261
- totalClass: `${pfx}-total`,
262
- hiddenClass: `${pfx}-hidden`,
263
- progressbarFillClass: `${pfx}-progressbar-fill`,
264
- progressbarOppositeClass: `${pfx}-progressbar-opposite`,
265
- clickableClass: `${pfx}-clickable`,
266
- lockClass: `${pfx}-lock`,
267
- horizontalClass: `${pfx}-horizontal`,
268
- verticalClass: `${pfx}-vertical`,
269
- paginationDisabledClass: `${pfx}-disabled`
270
- }
271
- });
272
- swiper.pagination = {
273
- el: null,
274
- bullets: []
275
- };
276
- let bulletSize;
277
- let dynamicBulletIndex = 0;
278
- function isPaginationDisabled() {
279
- return !swiper.params.pagination.el || !swiper.pagination.el || Array.isArray(swiper.pagination.el) && swiper.pagination.el.length === 0;
280
- }
281
- function setSideBullets(bulletEl, position) {
282
- const {
283
- bulletActiveClass
284
- } = swiper.params.pagination;
285
- if (!bulletEl) return;
286
- bulletEl = bulletEl[`${position === 'prev' ? 'previous' : 'next'}ElementSibling`];
287
- if (bulletEl) {
288
- bulletEl.classList.add(`${bulletActiveClass}-${position}`);
289
- bulletEl = bulletEl[`${position === 'prev' ? 'previous' : 'next'}ElementSibling`];
290
- if (bulletEl) {
291
- bulletEl.classList.add(`${bulletActiveClass}-${position}-${position}`);
292
- }
293
- }
294
- }
295
- function getMoveDirection(prevIndex, nextIndex, length) {
296
- prevIndex = prevIndex % length;
297
- nextIndex = nextIndex % length;
298
- if (nextIndex === prevIndex + 1) {
299
- return 'next';
300
- } else if (nextIndex === prevIndex - 1) {
301
- return 'previous';
302
- }
303
- return;
304
- }
305
- function onBulletClick(e) {
306
- const bulletEl = e.target.closest(classesToSelector(swiper.params.pagination.bulletClass));
307
- if (!bulletEl) {
308
- return;
309
- }
310
- e.preventDefault();
311
- const index = elementIndex(bulletEl) * swiper.params.slidesPerGroup;
312
- if (swiper.params.loop) {
313
- if (swiper.realIndex === index) return;
314
- const moveDirection = getMoveDirection(swiper.realIndex, index, swiper.slides.length);
315
- if (moveDirection === 'next') {
316
- swiper.slideNext();
317
- } else if (moveDirection === 'previous') {
318
- swiper.slidePrev();
319
- } else {
320
- swiper.slideToLoop(index);
321
- }
322
- } else {
323
- swiper.slideTo(index);
324
- }
325
- }
326
- function update() {
327
- // Render || Update Pagination bullets/items
328
- const rtl = swiper.rtl;
329
- const params = swiper.params.pagination;
330
- if (isPaginationDisabled()) return;
331
- let el = swiper.pagination.el;
332
- el = makeElementsArray(el);
333
- // Current/Total
334
- let current;
335
- let previousIndex;
336
- const slidesLength = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.slides.length : swiper.slides.length;
337
- const total = swiper.params.loop ? Math.ceil(slidesLength / swiper.params.slidesPerGroup) : swiper.snapGrid.length;
338
- if (swiper.params.loop) {
339
- previousIndex = swiper.previousRealIndex || 0;
340
- current = swiper.params.slidesPerGroup > 1 ? Math.floor(swiper.realIndex / swiper.params.slidesPerGroup) : swiper.realIndex;
341
- } else if (typeof swiper.snapIndex !== 'undefined') {
342
- current = swiper.snapIndex;
343
- previousIndex = swiper.previousSnapIndex;
344
- } else {
345
- previousIndex = swiper.previousIndex || 0;
346
- current = swiper.activeIndex || 0;
347
- }
348
- // Types
349
- if (params.type === 'bullets' && swiper.pagination.bullets && swiper.pagination.bullets.length > 0) {
350
- const bullets = swiper.pagination.bullets;
351
- let firstIndex;
352
- let lastIndex;
353
- let midIndex;
354
- if (params.dynamicBullets) {
355
- bulletSize = elementOuterSize(bullets[0], swiper.isHorizontal() ? 'width' : 'height');
356
- el.forEach(subEl => {
357
- subEl.style[swiper.isHorizontal() ? 'width' : 'height'] = `${bulletSize * (params.dynamicMainBullets + 4)}px`;
358
- });
359
- if (params.dynamicMainBullets > 1 && previousIndex !== undefined) {
360
- dynamicBulletIndex += current - (previousIndex || 0);
361
- if (dynamicBulletIndex > params.dynamicMainBullets - 1) {
362
- dynamicBulletIndex = params.dynamicMainBullets - 1;
363
- } else if (dynamicBulletIndex < 0) {
364
- dynamicBulletIndex = 0;
365
- }
366
- }
367
- firstIndex = Math.max(current - dynamicBulletIndex, 0);
368
- lastIndex = firstIndex + (Math.min(bullets.length, params.dynamicMainBullets) - 1);
369
- midIndex = (lastIndex + firstIndex) / 2;
370
- }
371
- bullets.forEach(bulletEl => {
372
- const classesToRemove = [...['', '-next', '-next-next', '-prev', '-prev-prev', '-main'].map(suffix => `${params.bulletActiveClass}${suffix}`)].map(s => typeof s === 'string' && s.includes(' ') ? s.split(' ') : s).flat();
373
- bulletEl.classList.remove(...classesToRemove);
374
- });
375
- if (el.length > 1) {
376
- bullets.forEach(bullet => {
377
- const bulletIndex = elementIndex(bullet);
378
- if (bulletIndex === current) {
379
- bullet.classList.add(...params.bulletActiveClass.split(' '));
380
- } else if (swiper.isElement) {
381
- bullet.setAttribute('part', 'bullet');
382
- }
383
- if (params.dynamicBullets) {
384
- if (bulletIndex >= firstIndex && bulletIndex <= lastIndex) {
385
- bullet.classList.add(...`${params.bulletActiveClass}-main`.split(' '));
386
- }
387
- if (bulletIndex === firstIndex) {
388
- setSideBullets(bullet, 'prev');
389
- }
390
- if (bulletIndex === lastIndex) {
391
- setSideBullets(bullet, 'next');
392
- }
393
- }
394
- });
395
- } else {
396
- const bullet = bullets[current];
397
- if (bullet) {
398
- bullet.classList.add(...params.bulletActiveClass.split(' '));
399
- }
400
- if (swiper.isElement) {
401
- bullets.forEach((bulletEl, bulletIndex) => {
402
- bulletEl.setAttribute('part', bulletIndex === current ? 'bullet-active' : 'bullet');
403
- });
404
- }
405
- if (params.dynamicBullets) {
406
- const firstDisplayedBullet = bullets[firstIndex];
407
- const lastDisplayedBullet = bullets[lastIndex];
408
- for (let i = firstIndex; i <= lastIndex; i += 1) {
409
- if (bullets[i]) {
410
- bullets[i].classList.add(...`${params.bulletActiveClass}-main`.split(' '));
411
- }
412
- }
413
- setSideBullets(firstDisplayedBullet, 'prev');
414
- setSideBullets(lastDisplayedBullet, 'next');
415
- }
416
- }
417
- if (params.dynamicBullets) {
418
- const dynamicBulletsLength = Math.min(bullets.length, params.dynamicMainBullets + 4);
419
- const bulletsOffset = (bulletSize * dynamicBulletsLength - bulletSize) / 2 - midIndex * bulletSize;
420
- const offsetProp = rtl ? 'right' : 'left';
421
- bullets.forEach(bullet => {
422
- bullet.style[swiper.isHorizontal() ? offsetProp : 'top'] = `${bulletsOffset}px`;
423
- });
424
- }
425
- }
426
- el.forEach((subEl, subElIndex) => {
427
- if (params.type === 'fraction') {
428
- subEl.querySelectorAll(classesToSelector(params.currentClass)).forEach(fractionEl => {
429
- fractionEl.textContent = params.formatFractionCurrent(current + 1);
430
- });
431
- subEl.querySelectorAll(classesToSelector(params.totalClass)).forEach(totalEl => {
432
- totalEl.textContent = params.formatFractionTotal(total);
433
- });
434
- }
435
- if (params.type === 'progressbar') {
436
- let progressbarDirection;
437
- if (params.progressbarOpposite) {
438
- progressbarDirection = swiper.isHorizontal() ? 'vertical' : 'horizontal';
439
- } else {
440
- progressbarDirection = swiper.isHorizontal() ? 'horizontal' : 'vertical';
441
- }
442
- const scale = (current + 1) / total;
443
- let scaleX = 1;
444
- let scaleY = 1;
445
- if (progressbarDirection === 'horizontal') {
446
- scaleX = scale;
447
- } else {
448
- scaleY = scale;
449
- }
450
- subEl.querySelectorAll(classesToSelector(params.progressbarFillClass)).forEach(progressEl => {
451
- progressEl.style.transform = `translate3d(0,0,0) scaleX(${scaleX}) scaleY(${scaleY})`;
452
- progressEl.style.transitionDuration = `${swiper.params.speed}ms`;
453
- });
454
- }
455
- if (params.type === 'custom' && params.renderCustom) {
456
- subEl.innerHTML = params.renderCustom(swiper, current + 1, total);
457
- if (subElIndex === 0) emit('paginationRender', subEl);
458
- } else {
459
- if (subElIndex === 0) emit('paginationRender', subEl);
460
- emit('paginationUpdate', subEl);
461
- }
462
- if (swiper.params.watchOverflow && swiper.enabled) {
463
- subEl.classList[swiper.isLocked ? 'add' : 'remove'](params.lockClass);
464
- }
465
- });
466
- }
467
- function render() {
468
- // Render Container
469
- const params = swiper.params.pagination;
470
- if (isPaginationDisabled()) return;
471
- const slidesLength = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.slides.length : swiper.grid && swiper.params.grid.rows > 1 ? swiper.slides.length / Math.ceil(swiper.params.grid.rows) : swiper.slides.length;
472
- let el = swiper.pagination.el;
473
- el = makeElementsArray(el);
474
- let paginationHTML = '';
475
- if (params.type === 'bullets') {
476
- let numberOfBullets = swiper.params.loop ? Math.ceil(slidesLength / swiper.params.slidesPerGroup) : swiper.snapGrid.length;
477
- if (swiper.params.freeMode && swiper.params.freeMode.enabled && numberOfBullets > slidesLength) {
478
- numberOfBullets = slidesLength;
479
- }
480
- for (let i = 0; i < numberOfBullets; i += 1) {
481
- if (params.renderBullet) {
482
- paginationHTML += params.renderBullet.call(swiper, i, params.bulletClass);
483
- } else {
484
- // prettier-ignore
485
- paginationHTML += `<${params.bulletElement} ${swiper.isElement ? 'part="bullet"' : ''} class="${params.bulletClass}"></${params.bulletElement}>`;
486
- }
487
- }
488
- }
489
- if (params.type === 'fraction') {
490
- if (params.renderFraction) {
491
- paginationHTML = params.renderFraction.call(swiper, params.currentClass, params.totalClass);
492
- } else {
493
- paginationHTML = `<span class="${params.currentClass}"></span>` + ' / ' + `<span class="${params.totalClass}"></span>`;
494
- }
495
- }
496
- if (params.type === 'progressbar') {
497
- if (params.renderProgressbar) {
498
- paginationHTML = params.renderProgressbar.call(swiper, params.progressbarFillClass);
499
- } else {
500
- paginationHTML = `<span class="${params.progressbarFillClass}"></span>`;
501
- }
502
- }
503
- swiper.pagination.bullets = [];
504
- el.forEach(subEl => {
505
- if (params.type !== 'custom') {
506
- subEl.innerHTML = paginationHTML || '';
507
- }
508
- if (params.type === 'bullets') {
509
- swiper.pagination.bullets.push(...subEl.querySelectorAll(classesToSelector(params.bulletClass)));
510
- }
511
- });
512
- if (params.type !== 'custom') {
513
- emit('paginationRender', el[0]);
514
- }
515
- }
516
- function init() {
517
- swiper.params.pagination = createElementIfNotDefined(swiper, swiper.originalParams.pagination, swiper.params.pagination, {
518
- el: 'swiper-pagination'
519
- });
520
- const params = swiper.params.pagination;
521
- if (!params.el) return;
522
- let el;
523
- if (typeof params.el === 'string' && swiper.isElement) {
524
- el = swiper.el.querySelector(params.el);
525
- }
526
- if (!el && typeof params.el === 'string') {
527
- el = [...document.querySelectorAll(params.el)];
528
- }
529
- if (!el) {
530
- el = params.el;
531
- }
532
- if (!el || el.length === 0) return;
533
- if (swiper.params.uniqueNavElements && typeof params.el === 'string' && Array.isArray(el) && el.length > 1) {
534
- el = [...swiper.el.querySelectorAll(params.el)];
535
- // check if it belongs to another nested Swiper
536
- if (el.length > 1) {
537
- el = el.find(subEl => {
538
- if (elementParents(subEl, '.swiper')[0] !== swiper.el) return false;
539
- return true;
540
- });
541
- }
542
- }
543
- if (Array.isArray(el) && el.length === 1) el = el[0];
544
- Object.assign(swiper.pagination, {
545
- el
546
- });
547
- el = makeElementsArray(el);
548
- el.forEach(subEl => {
549
- if (params.type === 'bullets' && params.clickable) {
550
- subEl.classList.add(...(params.clickableClass || '').split(' '));
551
- }
552
- subEl.classList.add(params.modifierClass + params.type);
553
- subEl.classList.add(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass);
554
- if (params.type === 'bullets' && params.dynamicBullets) {
555
- subEl.classList.add(`${params.modifierClass}${params.type}-dynamic`);
556
- dynamicBulletIndex = 0;
557
- if (params.dynamicMainBullets < 1) {
558
- params.dynamicMainBullets = 1;
559
- }
560
- }
561
- if (params.type === 'progressbar' && params.progressbarOpposite) {
562
- subEl.classList.add(params.progressbarOppositeClass);
563
- }
564
- if (params.clickable) {
565
- subEl.addEventListener('click', onBulletClick);
566
- }
567
- if (!swiper.enabled) {
568
- subEl.classList.add(params.lockClass);
569
- }
570
- });
571
- }
572
- function destroy() {
573
- const params = swiper.params.pagination;
574
- if (isPaginationDisabled()) return;
575
- let el = swiper.pagination.el;
576
- if (el) {
577
- el = makeElementsArray(el);
578
- el.forEach(subEl => {
579
- subEl.classList.remove(params.hiddenClass);
580
- subEl.classList.remove(params.modifierClass + params.type);
581
- subEl.classList.remove(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass);
582
- if (params.clickable) {
583
- subEl.classList.remove(...(params.clickableClass || '').split(' '));
584
- subEl.removeEventListener('click', onBulletClick);
585
- }
586
- });
587
- }
588
- if (swiper.pagination.bullets) swiper.pagination.bullets.forEach(subEl => subEl.classList.remove(...params.bulletActiveClass.split(' ')));
589
- }
590
- on('changeDirection', () => {
591
- if (!swiper.pagination || !swiper.pagination.el) return;
592
- const params = swiper.params.pagination;
593
- let {
594
- el
595
- } = swiper.pagination;
596
- el = makeElementsArray(el);
597
- el.forEach(subEl => {
598
- subEl.classList.remove(params.horizontalClass, params.verticalClass);
599
- subEl.classList.add(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass);
600
- });
601
- });
602
- on('init', () => {
603
- if (swiper.params.pagination.enabled === false) {
604
- // eslint-disable-next-line
605
- disable();
606
- } else {
607
- init();
608
- render();
609
- update();
610
- }
611
- });
612
- on('activeIndexChange', () => {
613
- if (typeof swiper.snapIndex === 'undefined') {
614
- update();
615
- }
616
- });
617
- on('snapIndexChange', () => {
618
- update();
619
- });
620
- on('snapGridLengthChange', () => {
621
- render();
622
- update();
623
- });
624
- on('destroy', () => {
625
- destroy();
626
- });
627
- on('enable disable', () => {
628
- let {
629
- el
630
- } = swiper.pagination;
631
- if (el) {
632
- el = makeElementsArray(el);
633
- el.forEach(subEl => subEl.classList[swiper.enabled ? 'remove' : 'add'](swiper.params.pagination.lockClass));
634
- }
635
- });
636
- on('lock unlock', () => {
637
- update();
638
- });
639
- on('click', (_s, e) => {
640
- const targetEl = e.target;
641
- const el = makeElementsArray(swiper.pagination.el);
642
- if (swiper.params.pagination.el && swiper.params.pagination.hideOnClick && el && el.length > 0 && !targetEl.classList.contains(swiper.params.pagination.bulletClass)) {
643
- if (swiper.navigation && (swiper.navigation.nextEl && targetEl === swiper.navigation.nextEl || swiper.navigation.prevEl && targetEl === swiper.navigation.prevEl)) return;
644
- const isHidden = el[0].classList.contains(swiper.params.pagination.hiddenClass);
645
- if (isHidden === true) {
646
- emit('paginationShow');
647
- } else {
648
- emit('paginationHide');
649
- }
650
- el.forEach(subEl => subEl.classList.toggle(swiper.params.pagination.hiddenClass));
651
- }
652
- });
653
- const enable = () => {
654
- swiper.el.classList.remove(swiper.params.pagination.paginationDisabledClass);
655
- let {
656
- el
657
- } = swiper.pagination;
658
- if (el) {
659
- el = makeElementsArray(el);
660
- el.forEach(subEl => subEl.classList.remove(swiper.params.pagination.paginationDisabledClass));
661
- }
662
- init();
663
- render();
664
- update();
665
- };
666
- const disable = () => {
667
- swiper.el.classList.add(swiper.params.pagination.paginationDisabledClass);
668
- let {
669
- el
670
- } = swiper.pagination;
671
- if (el) {
672
- el = makeElementsArray(el);
673
- el.forEach(subEl => subEl.classList.add(swiper.params.pagination.paginationDisabledClass));
674
- }
675
- destroy();
676
- };
677
- Object.assign(swiper.pagination, {
678
- enable,
679
- disable,
680
- render,
681
- update,
682
- init,
683
- destroy
684
- });
685
- }
686
-
687
- /* eslint no-underscore-dangle: "off" */
688
- /* eslint no-use-before-define: "off" */
689
- function Autoplay(_ref) {
690
- let {
691
- swiper,
692
- extendParams,
693
- on,
694
- emit,
695
- params
696
- } = _ref;
697
- swiper.autoplay = {
698
- running: false,
699
- paused: false,
700
- timeLeft: 0
701
- };
702
- extendParams({
703
- autoplay: {
704
- enabled: false,
705
- delay: 3000,
706
- waitForTransition: true,
707
- disableOnInteraction: false,
708
- stopOnLastSlide: false,
709
- reverseDirection: false,
710
- pauseOnMouseEnter: false
711
- }
712
- });
713
- let timeout;
714
- let raf;
715
- let autoplayDelayTotal = params && params.autoplay ? params.autoplay.delay : 3000;
716
- let autoplayDelayCurrent = params && params.autoplay ? params.autoplay.delay : 3000;
717
- let autoplayTimeLeft;
718
- let autoplayStartTime = new Date().getTime();
719
- let wasPaused;
720
- let isTouched;
721
- let pausedByTouch;
722
- let touchStartTimeout;
723
- let slideChanged;
724
- let pausedByInteraction;
725
- let pausedByPointerEnter;
726
- function onTransitionEnd(e) {
727
- if (!swiper || swiper.destroyed || !swiper.wrapperEl) return;
728
- if (e.target !== swiper.wrapperEl) return;
729
- swiper.wrapperEl.removeEventListener('transitionend', onTransitionEnd);
730
- if (pausedByPointerEnter || e.detail && e.detail.bySwiperTouchMove) {
731
- return;
732
- }
733
- resume();
734
- }
735
- const calcTimeLeft = () => {
736
- if (swiper.destroyed || !swiper.autoplay.running) return;
737
- if (swiper.autoplay.paused) {
738
- wasPaused = true;
739
- } else if (wasPaused) {
740
- autoplayDelayCurrent = autoplayTimeLeft;
741
- wasPaused = false;
742
- }
743
- const timeLeft = swiper.autoplay.paused ? autoplayTimeLeft : autoplayStartTime + autoplayDelayCurrent - new Date().getTime();
744
- swiper.autoplay.timeLeft = timeLeft;
745
- emit('autoplayTimeLeft', timeLeft, timeLeft / autoplayDelayTotal);
746
- raf = requestAnimationFrame(() => {
747
- calcTimeLeft();
748
- });
749
- };
750
- const getSlideDelay = () => {
751
- let activeSlideEl;
752
- if (swiper.virtual && swiper.params.virtual.enabled) {
753
- activeSlideEl = swiper.slides.find(slideEl => slideEl.classList.contains('swiper-slide-active'));
754
- } else {
755
- activeSlideEl = swiper.slides[swiper.activeIndex];
756
- }
757
- if (!activeSlideEl) return undefined;
758
- const currentSlideDelay = parseInt(activeSlideEl.getAttribute('data-swiper-autoplay'), 10);
759
- return currentSlideDelay;
760
- };
761
- const run = delayForce => {
762
- if (swiper.destroyed || !swiper.autoplay.running) return;
763
- cancelAnimationFrame(raf);
764
- calcTimeLeft();
765
- let delay = typeof delayForce === 'undefined' ? swiper.params.autoplay.delay : delayForce;
766
- autoplayDelayTotal = swiper.params.autoplay.delay;
767
- autoplayDelayCurrent = swiper.params.autoplay.delay;
768
- const currentSlideDelay = getSlideDelay();
769
- if (!Number.isNaN(currentSlideDelay) && currentSlideDelay > 0 && typeof delayForce === 'undefined') {
770
- delay = currentSlideDelay;
771
- autoplayDelayTotal = currentSlideDelay;
772
- autoplayDelayCurrent = currentSlideDelay;
773
- }
774
- autoplayTimeLeft = delay;
775
- const speed = swiper.params.speed;
776
- const proceed = () => {
777
- if (!swiper || swiper.destroyed) return;
778
- if (swiper.params.autoplay.reverseDirection) {
779
- if (!swiper.isBeginning || swiper.params.loop || swiper.params.rewind) {
780
- swiper.slidePrev(speed, true, true);
781
- emit('autoplay');
782
- } else if (!swiper.params.autoplay.stopOnLastSlide) {
783
- swiper.slideTo(swiper.slides.length - 1, speed, true, true);
784
- emit('autoplay');
785
- }
786
- } else {
787
- if (!swiper.isEnd || swiper.params.loop || swiper.params.rewind) {
788
- swiper.slideNext(speed, true, true);
789
- emit('autoplay');
790
- } else if (!swiper.params.autoplay.stopOnLastSlide) {
791
- swiper.slideTo(0, speed, true, true);
792
- emit('autoplay');
793
- }
794
- }
795
- if (swiper.params.cssMode) {
796
- autoplayStartTime = new Date().getTime();
797
- requestAnimationFrame(() => {
798
- run();
799
- });
800
- }
801
- };
802
- if (delay > 0) {
803
- clearTimeout(timeout);
804
- timeout = setTimeout(() => {
805
- proceed();
806
- }, delay);
807
- } else {
808
- requestAnimationFrame(() => {
809
- proceed();
810
- });
811
- }
812
-
813
- // eslint-disable-next-line
814
- return delay;
815
- };
816
- const start = () => {
817
- autoplayStartTime = new Date().getTime();
818
- swiper.autoplay.running = true;
819
- run();
820
- emit('autoplayStart');
821
- };
822
- const stop = () => {
823
- swiper.autoplay.running = false;
824
- clearTimeout(timeout);
825
- cancelAnimationFrame(raf);
826
- emit('autoplayStop');
827
- };
828
- const pause = (internal, reset) => {
829
- if (swiper.destroyed || !swiper.autoplay.running) return;
830
- clearTimeout(timeout);
831
- if (!internal) {
832
- pausedByInteraction = true;
833
- }
834
- const proceed = () => {
835
- emit('autoplayPause');
836
- if (swiper.params.autoplay.waitForTransition) {
837
- swiper.wrapperEl.addEventListener('transitionend', onTransitionEnd);
838
- } else {
839
- resume();
840
- }
841
- };
842
- swiper.autoplay.paused = true;
843
- if (reset) {
844
- if (slideChanged) {
845
- autoplayTimeLeft = swiper.params.autoplay.delay;
846
- }
847
- slideChanged = false;
848
- proceed();
849
- return;
850
- }
851
- const delay = autoplayTimeLeft || swiper.params.autoplay.delay;
852
- autoplayTimeLeft = delay - (new Date().getTime() - autoplayStartTime);
853
- if (swiper.isEnd && autoplayTimeLeft < 0 && !swiper.params.loop) return;
854
- if (autoplayTimeLeft < 0) autoplayTimeLeft = 0;
855
- proceed();
856
- };
857
- const resume = () => {
858
- if (swiper.isEnd && autoplayTimeLeft < 0 && !swiper.params.loop || swiper.destroyed || !swiper.autoplay.running) return;
859
- autoplayStartTime = new Date().getTime();
860
- if (pausedByInteraction) {
861
- pausedByInteraction = false;
862
- run(autoplayTimeLeft);
863
- } else {
864
- run();
865
- }
866
- swiper.autoplay.paused = false;
867
- emit('autoplayResume');
868
- };
869
- const onVisibilityChange = () => {
870
- if (swiper.destroyed || !swiper.autoplay.running) return;
871
- const document = getDocument();
872
- if (document.visibilityState === 'hidden') {
873
- pausedByInteraction = true;
874
- pause(true);
875
- }
876
- if (document.visibilityState === 'visible') {
877
- resume();
878
- }
879
- };
880
- const onPointerEnter = e => {
881
- if (e.pointerType !== 'mouse') return;
882
- pausedByInteraction = true;
883
- pausedByPointerEnter = true;
884
- if (swiper.animating || swiper.autoplay.paused) return;
885
- pause(true);
886
- };
887
- const onPointerLeave = e => {
888
- if (e.pointerType !== 'mouse') return;
889
- pausedByPointerEnter = false;
890
- if (swiper.autoplay.paused) {
891
- resume();
892
- }
893
- };
894
- const attachMouseEvents = () => {
895
- if (swiper.params.autoplay.pauseOnMouseEnter) {
896
- swiper.el.addEventListener('pointerenter', onPointerEnter);
897
- swiper.el.addEventListener('pointerleave', onPointerLeave);
898
- }
899
- };
900
- const detachMouseEvents = () => {
901
- if (swiper.el && typeof swiper.el !== 'string') {
902
- swiper.el.removeEventListener('pointerenter', onPointerEnter);
903
- swiper.el.removeEventListener('pointerleave', onPointerLeave);
904
- }
905
- };
906
- const attachDocumentEvents = () => {
907
- const document = getDocument();
908
- document.addEventListener('visibilitychange', onVisibilityChange);
909
- };
910
- const detachDocumentEvents = () => {
911
- const document = getDocument();
912
- document.removeEventListener('visibilitychange', onVisibilityChange);
913
- };
914
- on('init', () => {
915
- if (swiper.params.autoplay.enabled) {
916
- attachMouseEvents();
917
- attachDocumentEvents();
918
- start();
919
- }
920
- });
921
- on('destroy', () => {
922
- detachMouseEvents();
923
- detachDocumentEvents();
924
- if (swiper.autoplay.running) {
925
- stop();
926
- }
927
- });
928
- on('_freeModeStaticRelease', () => {
929
- if (pausedByTouch || pausedByInteraction) {
930
- resume();
931
- }
932
- });
933
- on('_freeModeNoMomentumRelease', () => {
934
- if (!swiper.params.autoplay.disableOnInteraction) {
935
- pause(true, true);
936
- } else {
937
- stop();
938
- }
939
- });
940
- on('beforeTransitionStart', (_s, speed, internal) => {
941
- if (swiper.destroyed || !swiper.autoplay.running) return;
942
- if (internal || !swiper.params.autoplay.disableOnInteraction) {
943
- pause(true, true);
944
- } else {
945
- stop();
946
- }
947
- });
948
- on('sliderFirstMove', () => {
949
- if (swiper.destroyed || !swiper.autoplay.running) return;
950
- if (swiper.params.autoplay.disableOnInteraction) {
951
- stop();
952
- return;
953
- }
954
- isTouched = true;
955
- pausedByTouch = false;
956
- pausedByInteraction = false;
957
- touchStartTimeout = setTimeout(() => {
958
- pausedByInteraction = true;
959
- pausedByTouch = true;
960
- pause(true);
961
- }, 200);
962
- });
963
- on('touchEnd', () => {
964
- if (swiper.destroyed || !swiper.autoplay.running || !isTouched) return;
965
- clearTimeout(touchStartTimeout);
966
- clearTimeout(timeout);
967
- if (swiper.params.autoplay.disableOnInteraction) {
968
- pausedByTouch = false;
969
- isTouched = false;
970
- return;
971
- }
972
- if (pausedByTouch && swiper.params.cssMode) resume();
973
- pausedByTouch = false;
974
- isTouched = false;
975
- });
976
- on('slideChange', () => {
977
- if (swiper.destroyed || !swiper.autoplay.running) return;
978
- slideChanged = true;
979
- });
980
- Object.assign(swiper.autoplay, {
981
- start,
982
- stop,
983
- pause,
984
- resume
985
- });
986
- }
987
-
988
- // Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
989
- // See LICENSE in the project root for license information.
990
-
991
-
992
- class AuroDependencyVersioning {
993
-
994
- /**
995
- * Generates a unique string to be used for child auro element naming.
996
- * @private
997
- * @param {string} baseName - Defines the first part of the unique element name.
998
- * @param {string} version - Version of the component that will be appended to the baseName.
999
- * @returns {string} - Unique string to be used for naming.
1000
- */
1001
- generateElementName(baseName, version) {
1002
- let result = baseName;
1003
-
1004
- result += '-';
1005
- result += version.replace(/[.]/g, '_');
1006
-
1007
- return result;
1008
- }
1009
-
1010
- /**
1011
- * Generates a unique string to be used for child auro element naming.
1012
- * @param {string} baseName - Defines the first part of the unique element name.
1013
- * @param {string} version - Version of the component that will be appended to the baseName.
1014
- * @returns {string} - Unique string to be used for naming.
1015
- */
1016
- generateTag(baseName, version, tagClass) {
1017
- const elementName = this.generateElementName(baseName, version);
1018
- const tag = i$1`${s(elementName)}`;
1019
-
1020
- if (!customElements.get(elementName)) {
1021
- customElements.define(elementName, class extends tagClass {});
1022
- }
1023
-
1024
- return tag;
1025
- }
1026
- }
1027
-
1028
- // Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
1029
- // See LICENSE in the project root for license information.
1030
-
1031
- // ---------------------------------------------------------------------
1032
-
1033
- /* eslint-disable line-comment-position, no-inline-comments, no-confusing-arrow, no-nested-ternary, implicit-arrow-linebreak */
1034
-
1035
- class AuroLibraryRuntimeUtils {
1036
-
1037
- /* eslint-disable jsdoc/require-param */
1038
-
1039
- /**
1040
- * This will register a new custom element with the browser.
1041
- * @param {String} name - The name of the custom element.
1042
- * @param {Object} componentClass - The class to register as a custom element.
1043
- * @returns {void}
1044
- */
1045
- registerComponent(name, componentClass) {
1046
- if (!customElements.get(name)) {
1047
- customElements.define(name, class extends componentClass {});
1048
- }
1049
- }
1050
-
1051
- /**
1052
- * Finds and returns the closest HTML Element based on a selector.
1053
- * @returns {void}
1054
- */
1055
- closestElement(
1056
- selector, // selector like in .closest()
1057
- base = this, // extra functionality to skip a parent
1058
- __Closest = (el, found = el && el.closest(selector)) =>
1059
- !el || el === document || el === window
1060
- ? null // standard .closest() returns null for non-found selectors also
1061
- : found
1062
- ? found // found a selector INside this element
1063
- : __Closest(el.getRootNode().host) // recursion!! break out to parent DOM
1064
- ) {
1065
- return __Closest(base);
1066
- }
1067
- /* eslint-enable jsdoc/require-param */
1068
-
1069
- /**
1070
- * If the element passed is registered with a different tag name than what is passed in, the tag name is added as an attribute to the element.
1071
- * @param {Object} elem - The element to check.
1072
- * @param {String} tagName - The name of the Auro component to check for or add as an attribute.
1073
- * @returns {void}
1074
- */
1075
- handleComponentTagRename(elem, tagName) {
1076
- const tag = tagName.toLowerCase();
1077
- const elemTag = elem.tagName.toLowerCase();
1078
-
1079
- if (elemTag !== tag) {
1080
- elem.setAttribute(tag, true);
1081
- }
1082
- }
1083
-
1084
- /**
1085
- * Validates if an element is a specific Auro component.
1086
- * @param {Object} elem - The element to validate.
1087
- * @param {String} tagName - The name of the Auro component to check against.
1088
- * @returns {Boolean} - Returns true if the element is the specified Auro component.
1089
- */
1090
- elementMatch(elem, tagName) {
1091
- const tag = tagName.toLowerCase();
1092
- const elemTag = elem.tagName.toLowerCase();
1093
-
1094
- return elemTag === tag || elem.hasAttribute(tag);
1095
- }
1096
- }
1097
-
1098
- /**
1099
- * @license
1100
- * Copyright 2017 Google LLC
1101
- * SPDX-License-Identifier: BSD-3-Clause
1102
- */
1103
- const t={ATTRIBUTE:1},e$1=t=>(...e)=>({_$litDirective$:t,values:e});class i{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i;}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}
1104
-
1105
- /**
1106
- * @license
1107
- * Copyright 2018 Google LLC
1108
- * SPDX-License-Identifier: BSD-3-Clause
1109
- */const e=e$1(class extends i{constructor(t$1){if(super(t$1),t$1.type!==t.ATTRIBUTE||"class"!==t$1.name||t$1.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(t){return " "+Object.keys(t).filter((s=>t[s])).join(" ")+" "}update(s,[i]){if(void 0===this.st){this.st=new Set,void 0!==s.strings&&(this.nt=new Set(s.strings.join(" ").split(/\s/).filter((t=>""!==t))));for(const t in i)i[t]&&!this.nt?.has(t)&&this.st.add(t);return this.render(i)}const r=s.element.classList;for(const t of this.st)t in i||(r.remove(t),this.st.delete(t));for(const t in i){const s=!!i[t];s===this.st.has(t)||this.nt?.has(t)||(s?(r.add(t),this.st.add(t)):(r.remove(t),this.st.delete(t)));}return T}});
1110
-
1111
- /**
1112
- * @license
1113
- * Copyright 2018 Google LLC
1114
- * SPDX-License-Identifier: BSD-3-Clause
1115
- */const o=o=>o??E;
1116
-
1117
- // Copyright (c) 2020 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
1118
- // See LICENSE in the project root for license information.
1119
-
1120
-
1121
- class AuroLoader extends i$2 {
1122
- constructor() {
1123
- super();
1124
-
1125
- /**
1126
- * @private
1127
- */
1128
- this.keys = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
1129
-
1130
- /**
1131
- * @private
1132
- */
1133
- this.mdCount = 3;
1134
-
1135
- /**
1136
- * @private
1137
- */
1138
- this.smCount = 2;
1139
-
1140
- /**
1141
- * @private
1142
- */
1143
- this.runtimeUtils = new AuroLibraryRuntimeUtils();
1144
-
1145
- this.orbit = false;
1146
- this.ringworm = false;
1147
- this.laser = false;
1148
- this.pulse = false;
1149
- }
1150
-
1151
- // function to define props used within the scope of this component
1152
- static get properties() {
1153
- return {
1154
-
1155
- /**
1156
- * Sets loader to laser type.
1157
- */
1158
- laser: {
1159
- type: Boolean,
1160
- reflect: true
1161
- },
1162
-
1163
- /**
1164
- * Sets loader to orbit type.
1165
- */
1166
- orbit: {
1167
- type: Boolean,
1168
- reflect: true
1169
- },
1170
-
1171
- /**
1172
- * Sets loader to pulse type.
1173
- */
1174
- pulse: {
1175
- type: Boolean,
1176
- reflect: true
1177
- },
1178
-
1179
- /**
1180
- * Sets loader to ringworm type.
1181
- */
1182
- ringworm: {
1183
- type: Boolean,
1184
- reflect: true
1185
- }
1186
- };
1187
- }
1188
-
1189
- static get styles() {
1190
- return [
1191
- i$3`${styleCss}`,
1192
- i$3`${colorCss}`,
1193
- i$3`${tokensCss}`
1194
- ];
1195
- }
1196
-
1197
- /**
1198
- * This will register this element with the browser.
1199
- * @param {string} [name="auro-loader"] - The name of element that you want to register to.
1200
- *
1201
- * @example
1202
- * AuroLoader.register("custom-loader") // this will register this element to <custom-loader/>
1203
- *
1204
- */
1205
- static register(name = "auro-loader") {
1206
- AuroLibraryRuntimeUtils.prototype.registerComponent(name, AuroLoader);
1207
- }
1208
-
1209
- firstUpdated() {
1210
- // Add the tag name as an attribute if it is different than the component name
1211
- this.runtimeUtils.handleComponentTagRename(this, 'auro-loader');
1212
- }
1213
-
1214
- connectedCallback() {
1215
- super.connectedCallback();
1216
- }
1217
-
1218
- /**
1219
- * @private
1220
- * @returns {Array} Numbered array for template map.
1221
- */
1222
- defineTemplate() {
1223
- let nodes = Array.from(Array(this.mdCount).keys());
1224
-
1225
- if (this.orbit || this.laser) {
1226
- nodes = Array.from(Array(this.smCount).keys());
1227
- } else if (this.ringworm) {
1228
- nodes = Array.from(Array(0).keys());
1229
- }
1230
-
1231
- return nodes;
1232
- }
1233
-
1234
- // When using auroElement, use the following attribute and function when hiding content from screen readers.
1235
- // aria-hidden="${this.hideAudible(this.hiddenAudible)}"
1236
-
1237
- // function that renders the HTML and CSS into the scope of the component
1238
- render() {
1239
- return x`
1240
- ${this.defineTemplate().map((idx) => x`
1241
- <span part="element" class="loader node-${idx}"></span>
1242
- `)}
1243
-
1244
- <div class="no-animation">Loading...</div>
1245
-
1246
- ${this.ringworm ? x`
1247
- <svg part="element" class="circular" viewBox="25 25 50 50">
1248
- <circle class="path" cx="50" cy="50" r="20" fill="none"/>
1249
- </svg>`
1250
- : ``
1251
- }
1252
- `;
1253
- }
1254
- }
1255
-
1256
- var loaderVersion = '5.0.0';
1257
-
1258
- /* eslint-disable max-lines */
1259
- // Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
1260
- // See LICENSE in the project root for license information.
1261
-
1262
-
1263
- /**
1264
- * @attr {Boolean} autofocus - This Boolean attribute lets you specify that the button should have input focus when the page loads, unless overridden by the user
1265
- * @attr {Boolean} disabled - If set to true, button will become disabled and not allow for interactions
1266
- * @attr {Boolean} iconOnly - If set to true, the button will contain an icon with no additional content
1267
- * @attr {Boolean} loading - If set to true button text will be replaced with `auro-loader` and become disabled
1268
- * @attr {String} loadingText - Sets custom loading text for the `aria-label` on a button in loading state. If not set, the default value of "Loading..." will be used.
1269
- * @attr {Boolean} onDark - Set value for on-dark version of auro-button
1270
- * @attr {Boolean} rounded - If set to true, the button will have a rounded shape
1271
- * @attr {Boolean} slim - Set value for slim version of auro-button
1272
- * @attr {Boolean} fluid - Alters the shape of the button to be full width of its parent container
1273
- * @attr {String} arialabel - Populates the `aria-label` attribute that is used to define a string that labels the current element. Use it in cases where a text label is not visible on the screen. If there is visible text labeling the element, use `aria-labelledby` instead.
1274
- * @attr {String} arialabelledby - Populates the `aria-labelledby` attribute that establishes relationships between objects and their label(s), and its value should be one or more element IDs, which refer to elements that have the text needed for labeling. List multiple element IDs in a space delimited fashion.
1275
- * @attr {Boolean} ariaexpanded - Populates the `aria-expanded` attribute that indicates whether the element, or another grouping element it controls, is currently expanded or collapsed. This is an optional attribute for buttons.
1276
- * @attr {String} id - Set the unique ID of an element.
1277
- * @attr {String} title - Sets title attribute. The information is most often shown as a tooltip text when the mouse moves over the element.
1278
- * @attr {String} type - The type of the button. Possible values are: `submit`, `reset`, `button`
1279
- * @attr {String} value - Defines the value associated with the button which is submitted with the form data.
1280
- * @attr {String} variant - Sets button variant option. Possible values are: `secondary`, `tertiary`
1281
- * @attr {Boolean} secondary - DEPRECATED
1282
- * @attr {Boolean} tertiary - DEPRECATED
1283
- * @prop {Boolean} ready - When false the component API should not be called.
1284
- * @event auroButton-ready - Notifies that the component has finished initializing.
1285
- * @slot - Default slot for the text of the button.
1286
- * @slot icon - Slot to provide auro-icon for the button.
1287
- * @csspart button - Apply CSS to HTML5 button.
1288
- * @csspart loader - Apply CSS to auro-loader.
1289
- * @csspart text - Apply CSS to text slot.
1290
- * @csspart icon - Apply CSS to icon slot.
1291
- */
1292
-
1293
- /* eslint-disable lit/no-invalid-html, lit/binding-positions */
1294
-
1295
- class AuroButton extends i$2 {
1296
-
1297
- /**
1298
- * Enables form association for this element.
1299
- * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/attachInternals
1300
- * @returns {boolean} - Returns true to enable form association.
1301
- */
1302
- static get formAssociated() {
1303
- return true;
1304
- }
1305
-
1306
- constructor() {
1307
- super();
1308
-
1309
- this.autofocus = false;
1310
- this.disabled = false;
1311
- this.iconOnly = false;
1312
- this.loading = false;
1313
- this.onDark = false;
1314
- this.ready = false;
1315
- this.secondary = false;
1316
- this.tertiary = false;
1317
- this.rounded = false;
1318
- this.slim = false;
1319
- this.fluid = false;
1320
- this.loadingText = this.loadingText || 'Loading...';
1321
-
1322
- // Support for HTML5 forms
1323
- if (typeof this.attachInternals === 'function') {
1324
- this.internals = this.attachInternals();
1325
- } else {
1326
- this.internals = null;
1327
-
1328
- // eslint-disable-next-line no-console
1329
- console.warn('This browser does not support form association features. Some form-related functionality may not work as expected. Consider using a polyfill or handling click events manually.');
1330
- }
1331
-
1332
- /**
1333
- * Generate unique names for dependency components.
1334
- */
1335
- const versioning = new AuroDependencyVersioning();
1336
-
1337
- /**
1338
- * @private
1339
- */
1340
- this.loaderTag = versioning.generateTag('auro-loader', loaderVersion, AuroLoader);
1341
- }
1342
-
1343
- static get styles() {
1344
- return [
1345
- tokensCss$1,
1346
- styleCss$1,
1347
- colorCss$1
1348
- ];
1349
- }
1350
-
1351
- static get properties() {
1352
- return {
1353
- autofocus: {
1354
- type: Boolean,
1355
- reflect: true
1356
- },
1357
- disabled: {
1358
- type: Boolean,
1359
- reflect: true
1360
- },
1361
- secondary: {
1362
- type: Boolean,
1363
- reflect: true
1364
- },
1365
- tertiary: {
1366
- type: Boolean,
1367
- reflect: true
1368
- },
1369
- fluid: {
1370
- type: Boolean,
1371
- reflect: true
1372
- },
1373
- iconOnly: {
1374
- type: Boolean,
1375
- reflect: true
1376
- },
1377
- loading: {
1378
- type: Boolean,
1379
- reflect: true
1380
- },
1381
- loadingText: {
1382
- type: String
1383
- },
1384
- onDark: {
1385
- type: Boolean,
1386
- reflect: true
1387
- },
1388
- rounded: {
1389
- type: Boolean,
1390
- reflect: true
1391
- },
1392
- slim: {
1393
- type: Boolean,
1394
- reflect: true
1395
- },
1396
- arialabel: {
1397
- type: String,
1398
- reflect: true
1399
- },
1400
- arialabelledby: {
1401
- type: String,
1402
- reflect: true
1403
- },
1404
- ariaexpanded: {
1405
- type: Boolean,
1406
- reflect: true
1407
- },
1408
- title: {
1409
- type: String,
1410
- reflect: true
1411
- },
1412
- type: {
1413
- type: String,
1414
- reflect: true
1415
- },
1416
- value: {
1417
- type: String,
1418
- reflect: true
1419
- },
1420
- variant: {
1421
- type: String,
1422
- reflect: true
1423
- },
1424
- ready: { type: Boolean },
1425
- };
1426
- }
1427
-
1428
- /**
1429
- * This will register this element with the browser.
1430
- * @param {string} [name="auro-button"] - The name of element that you want to register to.
1431
- *
1432
- * @example
1433
- * AuroButton.register("custom-button") // this will register this element to <custom-button/>
1434
- *
1435
- */
1436
- static register(name = "auro-button") {
1437
- AuroLibraryRuntimeUtils.prototype.registerComponent(name, AuroButton);
1438
- }
1439
-
1440
- /**
1441
- * Internal method to apply focus to the HTML5 button.
1442
- * @private
1443
- * @returns {void}
1444
- */
1445
- focus() {
1446
- this.renderRoot.querySelector('button').focus();
1447
- }
1448
-
1449
- /**
1450
- * Marks the component as ready and sends event.
1451
- * @private
1452
- * @returns {void}
1453
- */
1454
- notifyReady() {
1455
- this.ready = true;
1456
-
1457
- this.dispatchEvent(new CustomEvent('auroButton-ready', {
1458
- bubbles: true,
1459
- cancelable: false,
1460
- composed: true,
1461
- }));
1462
- }
1463
-
1464
- updated() {
1465
- // support the old `secondary` and `tertiary` attributes` that are deprecated
1466
- if (this.secondary) {
1467
- this.setAttribute('variant', 'secondary');
1468
- }
1469
-
1470
- if (this.tertiary) {
1471
- this.setAttribute('variant', 'tertiary');
1472
- }
1473
- }
1474
-
1475
- firstUpdated() {
1476
- this.notifyReady();
1477
- }
1478
-
1479
- /**
1480
- * Submits the form that this button is associated with.
1481
- * @private
1482
- * @returns {void}
1483
- */
1484
- surfaceSubmitEvent() {
1485
- if (this.form) {
1486
- this.form.requestSubmit();
1487
- }
1488
- }
1489
-
1490
- /**
1491
- * Returns the form element that this button is associated with.
1492
- * @private
1493
- * @returns {HTMLFormElement | null}
1494
- */
1495
- get form() {
1496
- return this.internals ? this.internals.form : null;
1497
- }
1498
-
1499
- render() {
1500
- const classes = {
1501
- 'util_insetLg--squish': true,
1502
- 'auro-button': true,
1503
- 'auroButton': true,
1504
- 'auro-button--rounded': this.rounded,
1505
- 'auro-button--slim': this.slim,
1506
- 'auro-button--iconOnly': this.iconOnly,
1507
- 'auro-button--iconOnlySlim': this.iconOnly && this.slim,
1508
- 'loading': this.loading
1509
- };
1510
-
1511
- return u`
1512
- <button
1513
- part="button"
1514
- aria-label="${o(this.loading ? this.loadingText : this.arialabel || undefined)}"
1515
- aria-labelledby="${o(this.arialabelledby ? this.arialabelledby : undefined)}"
1516
- aria-expanded="${o(this.ariaexpanded)}"
1517
- ?autofocus="${this.autofocus}"
1518
- class="${e(classes)}"
1519
- ?disabled="${this.disabled || this.loading}"
1520
- ?onDark="${this.onDark}"
1521
- title="${o(this.title ? this.title : undefined)}"
1522
- name="${o(this.name ? this.name : undefined)}"
1523
- type="${o(this.type ? this.type : undefined)}"
1524
- variant="${o(this.variant ? this.variant : undefined)}"
1525
- .value="${o(this.value ? this.value : undefined)}"
1526
- @click="${this.type === 'submit' ? this.surfaceSubmitEvent : undefined}"
1527
- >
1528
- ${o(this.loading ? u`<${this.loaderTag} pulse part="loader"></${this.loaderTag}>` : undefined)}
1529
-
1530
- <span class="contentWrapper">
1531
- <span class="textSlot" part="text">
1532
- ${this.iconOnly ? undefined : u`<slot></slot>`}
1533
- </span>
1534
-
1535
- <span part="icon">
1536
- <slot name="icon"></slot>
1537
- </span>
1538
- </span>
1539
- </button>
1540
- `;
1541
- }
1542
- }
1543
-
1544
- var buttonVersion = "9.3.3";
1545
-
1546
- // Copyright (c) 2020 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
1547
- // See LICENSE in the project root for license information.
1548
-
1549
-
1550
- /**
1551
- * @attr {Boolean} hidden - If present, the component will be hidden both visually and from screen readers
1552
- * @attr {Boolean} hiddenVisually - If present, the component will be hidden visually, but still read by screen readers
1553
- * @attr {Boolean} hiddenAudible - If present, the component will be hidden from screen readers, but seen visually
1554
- */
1555
-
1556
- class AuroElement extends i$2 {
1557
-
1558
- // function to define props used within the scope of this component
1559
- static get properties() {
1560
- return {
1561
- hidden: { type: Boolean,
1562
- reflect: true },
1563
- hiddenVisually: { type: Boolean,
1564
- reflect: true },
1565
- hiddenAudible: { type: Boolean,
1566
- reflect: true },
1567
- };
1568
- }
1569
-
1570
- /**
1571
- * @private Function that determines state of aria-hidden
1572
- */
1573
- hideAudible(value) {
1574
- if (value) {
1575
- return 'true'
1576
- }
1577
-
1578
- return 'false'
1579
- }
1580
- }
1581
-
1582
- var error = {"svg":"<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" aria-labelledby=\"error__desc\" class=\"ico_squareLarge\" data-deprecated=\"true\" role=\"img\" style=\"min-width:var(--auro-size-lg, var(--ds-size-300, 1.5rem));height:var(--auro-size-lg, var(--ds-size-300, 1.5rem));fill:currentColor\" viewBox=\"0 0 24 24\" part=\"svg\"><title/><desc id=\"error__desc\">Error alert indicator.</desc><path d=\"m13.047 5.599 6.786 11.586A1.207 1.207 0 0 1 18.786 19H5.214a1.207 1.207 0 0 1-1.047-1.815l6.786-11.586a1.214 1.214 0 0 1 2.094 0m-1.165.87a.23.23 0 0 0-.085.085L5.419 17.442a.232.232 0 0 0 .203.35h12.756a.234.234 0 0 0 .203-.35L12.203 6.554a.236.236 0 0 0-.321-.084M12 15.5a.75.75 0 1 1 0 1.5.75.75 0 0 1 0-1.5m-.024-6.22c.325 0 .589.261.589.583v4.434a.586.586 0 0 1-.589.583.586.586 0 0 1-.588-.583V9.863c0-.322.264-.583.588-.583\"/></svg>"};
1583
-
1584
- /* eslint-disable no-underscore-dangle, jsdoc/no-undefined-types, jsdoc/require-param-description */
1585
-
1586
- const _fetchMap = new Map();
1587
-
1588
- /**
1589
- * A callback to parse Response body.
1590
- *
1591
- * @callback ResponseParser
1592
- * @param {Fetch.Response} response
1593
- * @returns {Promise}
1594
- */
1595
-
1596
- /**
1597
- * A minimal in-memory map to de-duplicate Fetch API media requests.
1598
- *
1599
- * @param {String} uri
1600
- * @param {Object} [options={}]
1601
- * @param {ResponseParser} [options.responseParser=(response) => response.text()]
1602
- * @returns {Promise}
1603
- */
1604
- const cacheFetch = (uri, options = {}) => {
1605
- const responseParser = options.responseParser || ((response) => response.text());
1606
- if (!_fetchMap.has(uri)) {
1607
- _fetchMap.set(uri, fetch(uri).then(responseParser));
1608
- }
1609
- return _fetchMap.get(uri);
1610
- };
1611
-
1612
- // Copyright (c) 2020 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
1613
- // See LICENSE in the project root for license information.
1614
-
1615
-
1616
- // See https://git.io/JJ6SJ for "How to document your components using JSDoc"
1617
- /**
1618
- * @slot - Hidden from visibility, used for a11y if icon description is needed
1619
- */
1620
-
1621
- // build the component class
1622
- class BaseIcon extends AuroElement {
1623
- constructor() {
1624
- super();
1625
- this.onDark = false;
1626
- }
1627
-
1628
- // function to define props used within the scope of this component
1629
- static get properties() {
1630
- return {
1631
- ...super.properties,
1632
-
1633
- /**
1634
- * Set value for on-dark version of auro-icon.
1635
- */
1636
- onDark: {
1637
- type: Boolean,
1638
- reflect: true
1639
- },
1640
-
1641
- /**
1642
- * @private
1643
- */
1644
- svg: {
1645
- attribute: false,
1646
- reflect: true
1647
- }
1648
- };
1649
- }
1650
-
1651
- static get styles() {
1652
- return i$3`
1653
- ${styleCss$2}
1654
- `;
1655
- }
1656
-
1657
- /**
1658
- * Async function to fetch requested icon from npm CDN.
1659
- * @private
1660
- * @param {string} category - Icon category.
1661
- * @param {string} name - Icon name.
1662
- * @returns {SVGElement} DOM - Ready HTML to be appended.
1663
- */
1664
- async fetchIcon(category, name) {
1665
- let iconHTML = '';
1666
-
1667
- if (category === 'logos') {
1668
- iconHTML = await cacheFetch(`${this.uri}/${category}/${name}.svg`);
1669
- } else {
1670
- iconHTML = await cacheFetch(`${this.uri}/icons/${category}/${name}.svg`);
1671
- }
1672
-
1673
- const dom = new DOMParser().parseFromString(iconHTML, 'text/html');
1674
-
1675
- return dom.body.querySelector('svg');
1676
- }
1677
-
1678
- // lifecycle function
1679
- async firstUpdated() {
1680
- if (!this.customSvg) {
1681
- const svg = await this.fetchIcon(this.category, this.name);
1682
-
1683
- if (svg) {
1684
- this.svg = svg;
1685
- } else if (!svg) {
1686
- const penDOM = new DOMParser().parseFromString(error.svg, 'text/html');
1687
-
1688
- this.svg = penDOM.body.firstChild;
1689
- }
1690
- }
1691
- }
1692
- }
1693
-
1694
- // Copyright (c) 2025 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
1695
- // See LICENSE in the project root for license information.
1696
-
1697
-
1698
- class AuroIcon extends BaseIcon {
1699
- constructor() {
1700
- super();
1701
-
1702
- this.variant = undefined;
1703
- this.privateDefaults();
1704
- }
1705
-
1706
- /**
1707
- * Internal Defaults.
1708
- * @private
1709
- * @returns {void}
1710
- */
1711
- privateDefaults() {
1712
- this.uri = 'https://cdn.jsdelivr.net/npm/@alaskaairux/icons@latest/dist';
1713
- this.runtimeUtils = new AuroLibraryRuntimeUtils();
1714
- }
1715
-
1716
- // function to define props used within the scope of this component
1717
- static get properties() {
1718
- return {
1719
- ...super.properties,
1720
-
1721
- /**
1722
- * Set aria-hidden value. Default is `true`. Option is `false`.
1723
- */
1724
- ariaHidden: {
1725
- type: String,
1726
- reflect: true
1727
- },
1728
-
1729
- /**
1730
- * The category of the icon you are looking for. See https://auro.alaskaair.com/icons/usage.
1731
- */
1732
- category: {
1733
- type: String,
1734
- reflect: true
1735
- },
1736
-
1737
- /**
1738
- * Allows custom color to be set.
1739
- */
1740
- customColor: {
1741
- type: Boolean
1742
- },
1743
-
1744
- /**
1745
- * When true, auro-icon will render a custom SVG inside the default slot.
1746
- */
1747
- customSvg: {
1748
- type: Boolean
1749
- },
1750
-
1751
- /**
1752
- * Exposes content in slot as icon label.
1753
- */
1754
- label: {
1755
- type: Boolean,
1756
- reflect: true
1757
- },
1758
-
1759
- /**
1760
- * The name of the icon you are looking for without the file extension. See https://auro.alaskaair.com/icons/usage.
1761
- */
1762
- name: {
1763
- type: String,
1764
- reflect: true
1765
- },
1766
-
1767
- /**
1768
- * The style of the icon. The accepted variants are `accent1`, `disabled`, `muted`, `statusDefault`, `statusInfo`, `statusSuccess`, `statusWarning`, `statusError`, `statusInfoSubtle`, `statusSuccessSubtle`, `statusWarningSubtle`, `statusErrorSubtle`, `fareBasicEconomy`, `fareBusiness`, `fareEconomy`, `fareFirst`, `farePremiumEconomy`, `tierOneWorldEmerald`, `tierOneWorldSapphire`, `tierOneWorldRuby`.
1769
- */
1770
- variant: {
1771
- type: String,
1772
- reflect: true
1773
- }
1774
- };
1775
- }
1776
-
1777
- static get styles() {
1778
- return [
1779
- super.styles,
1780
- i$3`${tokensCss$2}`,
1781
- i$3`${styleCss$2}`,
1782
- i$3`${colorCss$2}`
1783
- ];
1784
- }
1785
-
1786
- /**
1787
- * This will register this element with the browser.
1788
- * @param {string} [name="auro-icon"] - The name of element that you want to register to.
1789
- *
1790
- * @example
1791
- * AuroIcon.register("custom-icon") // this will register this element to <custom-icon/>
1792
- *
1793
- */
1794
- static register(name = "auro-icon") {
1795
- AuroLibraryRuntimeUtils.prototype.registerComponent(name, AuroIcon);
1796
- }
1797
-
1798
- connectedCallback() {
1799
- super.connectedCallback();
1800
-
1801
- // Add the tag name as an attribute if it is different than the component name
1802
- this.runtimeUtils.handleComponentTagRename(this, 'auro-icon');
1803
- }
1804
-
1805
- /**
1806
- * @private
1807
- * @returns {void} Exposes CSS parts for styling from parent components.
1808
- */
1809
- exposeCssParts() {
1810
- this.setAttribute('exportparts', 'svg:iconSvg');
1811
- }
1812
-
1813
- async firstUpdated() {
1814
- await super.firstUpdated();
1815
-
1816
- // Removes the SVG description for screenreader if ariaHidden is set to true
1817
- if (!this.hasAttribute('ariaHidden') && this.svg) {
1818
- const svgDesc = this.svg.querySelector('desc');
1819
-
1820
- if (svgDesc) {
1821
- svgDesc.remove();
1822
- this.svg.removeAttribute('aria-labelledby');
1823
- }
1824
- }
1825
- }
1826
-
1827
- // function that renders the HTML and CSS into the scope of the component
1828
- render() {
1829
- const labelClasses = {
1830
- 'labelWrapper': true,
1831
- 'util_displayHiddenVisually': !this.label
1832
- };
1833
-
1834
- const svgClasses = {
1835
- 'svgWrapper': true,
1836
- };
1837
-
1838
- return x`
1839
- <div class="componentWrapper">
1840
- <div
1841
- class="${e(svgClasses)}"
1842
- title="${o(this.title || undefined)}">
1843
- <span aria-hidden="${o(this.ariaHidden || true)}" part="svg">
1844
- ${this.customSvg ? x`
1845
- <slot name="svg"></slot>
1846
- ` : x`
1847
- ${this.svg}
1848
- `
1849
- }
1850
- </span>
1851
- </div>
1852
-
1853
- <div class="${e(labelClasses)}">
1854
- <slot></slot>
1855
- </div>
1856
- </div>
1857
- `;
1858
- }
1859
- }
1860
-
1861
- var iconVersion = "8.0.2";
1862
-
1863
- var chevronLeft = {"svg":"<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" aria-labelledby=\"chevron-left__desc\" class=\"ico_squareLarge\" role=\"img\" style=\"min-width:var(--auro-size-lg, var(--ds-size-300, 1.5rem));height:var(--auro-size-lg, var(--ds-size-300, 1.5rem));fill:currentColor\" viewBox=\"0 0 24 24\" part=\"svg\"><title/><desc id=\"chevron-left__desc\">Directional indicator; left.</desc><path d=\"m14.395 6.345.084.073a.75.75 0 0 1 .072.977l-.072.084-4.47 4.47 4.47 4.47a.75.75 0 0 1 .072.976l-.072.084a.75.75 0 0 1-.977.072l-.084-.072-4.823-4.823a1 1 0 0 1 0-1.415l4.823-4.823a.75.75 0 0 1 .977-.073\"/></svg>"};
1864
-
1865
- var chevronRight = {"svg":"<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" aria-labelledby=\"chevron-right__desc\" class=\"ico_squareLarge\" role=\"img\" style=\"min-width:var(--auro-size-lg, var(--ds-size-300, 1.5rem));height:var(--auro-size-lg, var(--ds-size-300, 1.5rem));fill:currentColor\" viewBox=\"0 0 24 24\" part=\"svg\"><title/><desc id=\"chevron-right__desc\">Directional indicator; right.</desc><path d=\"m9.605 17.551-.084-.072a.75.75 0 0 1-.072-.977l.072-.084 4.47-4.47-4.47-4.47a.75.75 0 0 1-.072-.976l.072-.084a.75.75 0 0 1 .977-.073l.084.073 4.823 4.823a1 1 0 0 1 0 1.415l-4.823 4.823a.75.75 0 0 1-.977.072\"/></svg>"};
1866
-
1867
- var arrowDown = {"svg":"<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" aria-labelledby=\"arrow-down__desc\" class=\"ico_squareLarge\" role=\"img\" style=\"min-width:var(--auro-size-lg, var(--ds-size-300, 1.5rem));height:var(--auro-size-lg, var(--ds-size-300, 1.5rem));fill:currentColor\" viewBox=\"0 0 24 24\" part=\"svg\"><title/><desc id=\"arrow-down__desc\">Directional pointer; down.</desc><path d=\"m11.47 19.78-5.25-5.25a.75.75 0 0 1 .976-1.133l.084.073 3.97 3.97V4.75a.75.75 0 0 1 .648-.743L12 4a.75.75 0 0 1 .743.648l.007.102v12.69l3.97-3.97a.75.75 0 0 1 .976-.073l.084.073a.75.75 0 0 1 .073.976l-.073.084-5.25 5.25a.75.75 0 0 1-.976.073zl-5.25-5.25z\"/></svg>"};
1868
-
1869
- var arrowUp = {"svg":"<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" aria-labelledby=\"arrow-up__desc\" class=\"ico_squareLarge\" role=\"img\" style=\"min-width:var(--auro-size-lg, var(--ds-size-300, 1.5rem));height:var(--auro-size-lg, var(--ds-size-300, 1.5rem));fill:currentColor\" viewBox=\"0 0 24 24\" part=\"svg\"><title/><desc id=\"arrow-up__desc\">Directional pointer; up.</desc><path d=\"m12.53 4.22 5.25 5.25a.75.75 0 0 1-.976 1.133l-.084-.073-3.97-3.97v12.69a.75.75 0 0 1-.648.743L12 20a.75.75 0 0 1-.743-.648l-.007-.102V6.56l-3.97 3.97a.75.75 0 0 1-.976.073l-.084-.073a.75.75 0 0 1-.073-.976l.073-.084 5.25-5.25a.75.75 0 0 1 .976-.073zl5.25 5.25z\"/></svg>"};
1870
-
1871
- // Copyright (c) 2025 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
1872
- // See LICENSE in the project root for license information.
1873
-
1874
-
1875
- class AuroSlideshow extends i$2 {
1876
- constructor() {
1877
- super();
1878
-
1879
- this.autoplay = 7000;
1880
- this.pagination = false;
1881
- this.loop = false;
1882
- this.slidesPerView = "auto";
1883
- this.spaceBetweenSlides = 16;
1884
- this.variant = "slideshow";
1885
-
1886
- const versioning = new AuroDependencyVersioning();
1887
-
1888
- /**
1889
- * @private
1890
- */
1891
- this.isPlaying = true;
1892
-
1893
- /**
1894
- * @private
1895
- */
1896
- this.buttonTag = versioning.generateTag(
1897
- "auro-button",
1898
- buttonVersion,
1899
- AuroButton,
1900
- );
1901
-
1902
- /**
1903
- * @private
1904
- */
1905
- this.iconTag = versioning.generateTag("auro-icon", iconVersion, AuroIcon);
1906
- }
1907
-
1908
- /**
1909
- * Registers the custom element with the browser.
1910
- * @param {string} [name="auro-slideshow"] - Custom element name to register.
1911
- * @example
1912
- * AuroSlideshow.register("custom-slideshow") // registers <custom-slideshow/>
1913
- */
1914
- static register(name = "auro-slideshow") {
1915
- AuroLibraryRuntimeUtils.prototype.registerComponent(name, AuroSlideshow);
1916
- }
1917
-
1918
- static get styles() {
1919
- return [styleCss$3];
1920
- }
1921
-
1922
- static get properties() {
1923
- return {
1924
- /**
1925
- * The time in milliseconds between each slide change. Defaults to undefined.
1926
- */
1927
- autoplay: {
1928
- type: Number,
1929
- reflect: true,
1930
- },
1931
-
1932
- isPlaying: {
1933
- type: Boolean,
1934
- },
1935
-
1936
- /**
1937
- * If true, the slideshow will loop back to the first slide after reaching the last slide. Defaults to false.
1938
- */
1939
- loop: {
1940
- type: Boolean,
1941
- reflect: true,
1942
- },
1943
-
1944
- /**
1945
- * If true, the slideshow will display pagination bullets for each slide.
1946
- */
1947
- pagination: {
1948
- type: Boolean,
1949
- reflect: true,
1950
- },
1951
-
1952
- /**
1953
- * The number of slides per view. Defaults to 1.
1954
- */
1955
- slidesPerView: {
1956
- type: String,
1957
- reflect: true,
1958
- },
1959
-
1960
- /**
1961
- * The pixel distance between slides when multiple slides are in view.
1962
- */
1963
- spaceBetweenSlides: {
1964
- type: Number,
1965
- },
1966
-
1967
- /**
1968
- * 'slideshow': pagination indicators will be showing underneat with auto-play the progressbar
1969
- * `slider`: prev/next button will show on hover and there will be no pagination indicator
1970
- * @default 'slidershow'
1971
- */
1972
- variant: {
1973
- // 'slideshow', 'slider'
1974
- type: String,
1975
- reflect: true,
1976
- },
1977
- };
1978
- }
1979
-
1980
- firstUpdated() {
1981
- console.log("first updated");
1982
- this.handleHeaderSlotContent();
1983
-
1984
- const slot = this.shadowRoot.querySelector(
1985
- 'slot:not([name="header"]):not([name="subheader"])',
1986
- );
1987
-
1988
- // Listen for the slotchange event to handle updates to slot content
1989
- this.slotChangeListener = () => {
1990
- this.initializeSwiper();
1991
- };
1992
-
1993
- slot.addEventListener("slotchange", this.slotChangeListener);
1994
- }
1995
-
1996
- handleHeaderSlotContent() {
1997
- const container = this.shadowRoot.querySelector(".container");
1998
- const headerSlot = this.shadowRoot.querySelector('slot[name="header"]');
1999
- const subheaderSlot = this.shadowRoot.querySelector(
2000
- 'slot[name="subheader"]',
2001
- );
2002
-
2003
- const hasHeaderContent =
2004
- headerSlot && headerSlot.assignedNodes().length > 0;
2005
- const hasSubheaderContent =
2006
- subheaderSlot && subheaderSlot.assignedNodes().length > 0;
2007
-
2008
- if (hasHeaderContent && hasSubheaderContent) {
2009
- container.classList.add("has-both-headers");
2010
- } else if (hasHeaderContent) {
2011
- container.classList.add("has-header-only");
2012
- } else if (hasSubheaderContent) {
2013
- container.classList.add("has-subheader-only");
2014
- } else {
2015
- container.classList.add("has-no-headers");
2016
- }
2017
- }
2018
-
2019
- initializeSwiper() {
2020
- const swiperElement = this.shadowRoot.querySelector(".swiper");
2021
- const swiperWrapper = this.shadowRoot.querySelector(".swiper-wrapper");
2022
- const prevButton = this.shadowRoot.querySelector(".scroll-prev");
2023
- const nextButton = this.shadowRoot.querySelector(".scroll-next");
2024
- const playPauseButton = this.shadowRoot.querySelector(".play-pause");
2025
- const paginationEl = this.shadowRoot.querySelector(".swiper-pagination");
2026
- const slot = this.shadowRoot.querySelector(
2027
- 'slot:not([name="header"]):not([name="subheader"])',
2028
- );
2029
-
2030
- if (!slot) {
2031
- return;
2032
- }
2033
-
2034
- // Get the assigned slides from the slot
2035
- const assignedSlides = slot.assignedElements();
2036
-
2037
- // Avoid reinitializing Swiper if there are no slides or if the Swiper is already initialized
2038
- if (assignedSlides.length === 0) {
2039
- console.warn("No slides found inside slot.");
2040
- return; // Avoid initializing if no slides are present
2041
- }
2042
-
2043
- assignedSlides.forEach((slide) => {
2044
- slide.classList.add("swiper-slide");
2045
- slide.part = "slide";
2046
- });
2047
-
2048
- // Detach the slotchange listener to prevent it from firing while manipulating the slot content
2049
- slot.removeEventListener("slotchange", this.slotChangeListener);
2050
-
2051
- // Ensure we don't clear the swiper-wrapper content if the slides are updated dynamically
2052
- if (!this.swiper) {
2053
- // If no swiper instance exists, clear the swiper-wrapper and add the new slides
2054
- swiperWrapper.innerHTML = ""; // Clear the wrapper, only if needed
2055
- assignedSlides.forEach((slide) => {
2056
- swiperWrapper.appendChild(slide);
2057
- });
2058
- }
2059
-
2060
- const swiperConfig = {
2061
- modules: [Navigation, Pagination, Autoplay],
2062
- loop: this.loop,
2063
- slidesPerView: this.slidesPerView,
2064
- spaceBetween: this.spaceBetweenSlides,
2065
- centeredSlides: false,
2066
- autoplay: this.autoplay
2067
- ? {
2068
- delay: this.autoplay,
2069
- disableOnInteraction: false,
2070
- pauseOnMouseEnter: true,
2071
- }
2072
- : false,
2073
- pagination: {
2074
- el: paginationEl,
2075
- clickable: true,
2076
- renderBullet: (_, className) => {
2077
- return `
2078
- <span class="${className}" tabindex="0">
2079
- <div class="pagination-swiper-up__progress-bar-container">
2080
- <div class="pagination-swiper-up__progress"></div>
2081
- </div>
2082
- </span>
2083
- `;
2084
- },
2085
- },
2086
- };
2087
-
2088
- if (this.variant === "slider") {
2089
- swiperConfig.navigation = {
2090
- nextEl: nextButton,
2091
- prevEl: prevButton,
2092
- };
2093
- }
2094
-
2095
- if (this.autoplay) {
2096
- playPauseButton.addEventListener("click", () => {
2097
- if (this.swiper.autoplay.running) {
2098
- this.swiper.autoplay.stop();
2099
- this.isPlaying = false;
2100
- playPauseButton.setAttribute("aria-label", "play");
2101
- } else {
2102
- this.swiper.autoplay.start();
2103
- this.isPlaying = true;
2104
- playPauseButton.setAttribute("aria-label", "pause");
2105
- }
2106
- });
2107
- }
2108
-
2109
- // If the Swiper instance exists, just update it with the new slides
2110
- if (this.swiper) {
2111
- this.swiper.update();
2112
- } else {
2113
- this.swiper = new Swiper(swiperElement, swiperConfig);
2114
- }
2115
-
2116
- const allBullets = this.shadowRoot.querySelectorAll(
2117
- ".swiper-pagination-bullet",
2118
- );
2119
-
2120
- allBullets.forEach((bullet) => {
2121
- bullet.addEventListener("keydown", (event) => {
2122
- if (event.key === "Enter" || event.key === " ") {
2123
- event.preventDefault(); // Prevent scrolling if space is used
2124
- bullet.click(); // Simulate a click event
2125
- }
2126
- });
2127
- });
2128
-
2129
- // TODO: Add logic to the progress bar for pausing and playing the slideshow
2130
- this.swiper.on("slideChange", () => {
2131
- const activeBullet = this.shadowRoot.querySelector(
2132
- ".swiper-pagination-bullet-active",
2133
- );
2134
-
2135
- // Reset all progress bars
2136
- allBullets.forEach((bullet) => {
2137
- const progressBar = bullet.querySelector(
2138
- ".pagination-swiper-up__progress",
2139
- );
2140
- if (progressBar) {
2141
- progressBar.style.transition = "none"; // Disable transition for reset
2142
- progressBar.style.width = "0%"; // Reset width for all bullets
2143
- }
2144
- });
2145
-
2146
- // Animate the progress bar of the active bullet
2147
- if (activeBullet) {
2148
- const progressBar = activeBullet.querySelector(
2149
- ".pagination-swiper-up__progress",
2150
- );
2151
- if (progressBar) {
2152
- progressBar.style.transition = `width ${swiperConfig.autoplay.delay}ms linear`;
2153
- progressBar.style.width = "100%"; // Fill progress bar to 100%
2154
- }
2155
- }
2156
- });
2157
-
2158
- // Reattach the slotchange event listener after the swiper is initialized
2159
- slot.addEventListener("slotchange", this.slotChangeListener);
2160
- }
2161
-
2162
- /**
2163
- * Internal function to generate the HTML for the icon to use.
2164
- * @private
2165
- * @param {string} svgContent - The SVG content to be embedded.
2166
- * @param {boolean} hideIcon - Whether the icon should be hidden
2167
- * @returns {Element} The HTML element containing the SVG icon.
2168
- */
2169
- generateIconHtml(svgContent, hideIcon) {
2170
- const dom = new DOMParser().parseFromString(svgContent, "text/html");
2171
- const svg = dom.body.firstChild;
2172
-
2173
- svg.setAttribute("slot", "svg");
2174
-
2175
- const iconHtml = u`<${this.iconTag} customColor customSvg slot="icon" ?hidden="${hideIcon}">${svg}</${this.iconTag}>`;
2176
-
2177
- return iconHtml;
2178
- }
2179
-
2180
- render() {
2181
- return u`
2182
- <div class="container">
2183
- <slot name="header"></slot>
2184
- <slot name="subheader"></slot>
2185
- <div class="slideshow-wrapper">
2186
- <div class="swiper">
2187
- <div class="swiper-wrapper">
2188
- <slot></slot>
2189
- </div>
2190
- </div>
2191
-
2192
- <${this.buttonTag}
2193
- class="chevron-left"
2194
- arialabel="Previous Item"
2195
- rounded
2196
- iconOnly
2197
- @click=${() => this.swiper.slidePrev()}>
2198
- ${this.generateIconHtml(chevronLeft.svg)}
2199
- </${this.buttonTag}>
2200
- <${this.buttonTag}
2201
- class="chevron-right"
2202
- arialabel="Next Item"
2203
- rounded
2204
- iconOnly
2205
- @click=${() => this.swiper.slideNext()}>
2206
- ${this.generateIconHtml(chevronRight.svg)}
2207
- </${this.buttonTag}>
2208
-
2209
- </div>
2210
-
2211
- <div class="pagination-container">
2212
- <${this.buttonTag} arialabel="play-pause" iconOnly rounded class="play-pause">
2213
- ${this.generateIconHtml(arrowUp.svg, !this.isPlaying)}
2214
- ${this.generateIconHtml(arrowDown.svg, this.isPlaying)}
2215
- <span class="util_displayHiddenVisually">Play/Pause</span>
2216
- </${this.buttonTag}>
2217
- <div class="swiper-pagination"></div>
2218
- </div>
2219
- </div>
2220
- `;
2221
- }
2222
- }
1
+ import { A as AuroSlideshow } from './auro-slideshow.min.js';
2223
2
 
2224
3
  AuroSlideshow.register();
2225
4
  AuroSlideshow.register("custom-slideshow");