-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflowbite.js
3375 lines (2641 loc) · 125 KB
/
flowbite.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/******/ (() => { // webpackBootstrap
/******/ "use strict";
var __webpack_exports__ = {};
// UNUSED EXPORTS: default
;// CONCATENATED MODULE: ./src/components/accordion.js
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
var Default = {
alwaysOpen: false,
activeClasses: 'bg-gray-100 dark:bg-gray-800 text-gray-900 dark:text-white',
inactiveClasses: 'text-gray-500 dark:text-gray-400',
onOpen: function onOpen() {},
onClose: function onClose() {}
};
var Accordion = /*#__PURE__*/function () {
function Accordion() {
var items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
_classCallCheck(this, Accordion);
this._items = items;
this._options = _objectSpread(_objectSpread({}, Default), options);
this._init();
}
_createClass(Accordion, [{
key: "_init",
value: function _init() {
var _this = this;
if (this._items.length) {
// show accordion item based on click
this._items.map(function (item) {
if (item.active) {
_this.open(item.id);
}
item.triggerEl.addEventListener('click', function () {
_this.toggle(item.id);
});
});
}
}
}, {
key: "getItem",
value: function getItem(id) {
return this._items.filter(function (item) {
return item.id === id;
})[0];
}
}, {
key: "open",
value: function open(id) {
var _this2 = this,
_item$triggerEl$class,
_item$triggerEl$class2;
var item = this.getItem(id); // don't hide other accordions if always open
if (!this._options.alwaysOpen) {
this._items.map(function (i) {
if (i !== item) {
var _i$triggerEl$classLis, _i$triggerEl$classLis2;
(_i$triggerEl$classLis = i.triggerEl.classList).remove.apply(_i$triggerEl$classLis, _toConsumableArray(_this2._options.activeClasses.split(" ")));
(_i$triggerEl$classLis2 = i.triggerEl.classList).add.apply(_i$triggerEl$classLis2, _toConsumableArray(_this2._options.inactiveClasses.split(" ")));
i.targetEl.classList.add('hidden');
i.triggerEl.setAttribute('aria-expanded', false);
i.active = false; // rotate icon if set
if (i.iconEl) {
i.iconEl.classList.remove('rotate-180');
}
}
});
} // show active item
(_item$triggerEl$class = item.triggerEl.classList).add.apply(_item$triggerEl$class, _toConsumableArray(this._options.activeClasses.split(" ")));
(_item$triggerEl$class2 = item.triggerEl.classList).remove.apply(_item$triggerEl$class2, _toConsumableArray(this._options.inactiveClasses.split(" ")));
item.triggerEl.setAttribute('aria-expanded', true);
item.targetEl.classList.remove('hidden');
item.active = true; // rotate icon if set
if (item.iconEl) {
item.iconEl.classList.add('rotate-180');
} // callback function
this._options.onOpen(item);
}
}, {
key: "toggle",
value: function toggle(id) {
var item = this.getItem(id);
if (item.active) {
this.close(id);
} else {
this.open(id);
} // callback function
this._options.onToggle(item);
}
}, {
key: "close",
value: function close(id) {
var _item$triggerEl$class3, _item$triggerEl$class4;
var item = this.getItem(id);
(_item$triggerEl$class3 = item.triggerEl.classList).remove.apply(_item$triggerEl$class3, _toConsumableArray(this._options.activeClasses.split(" ")));
(_item$triggerEl$class4 = item.triggerEl.classList).add.apply(_item$triggerEl$class4, _toConsumableArray(this._options.inactiveClasses.split(" ")));
item.targetEl.classList.add('hidden');
item.triggerEl.setAttribute('aria-expanded', false);
item.active = false; // rotate icon if set
if (item.iconEl) {
item.iconEl.classList.remove('rotate-180');
} // callback function
this._options.onClose(item);
}
}]);
return Accordion;
}();
window.Accordion = Accordion;
document.addEventListener('DOMContentLoaded', function () {
document.querySelectorAll('[data-accordion]').forEach(function (accordionEl) {
var alwaysOpen = accordionEl.getAttribute('data-accordion');
var activeClasses = accordionEl.getAttribute('data-active-classes');
var inactiveClasses = accordionEl.getAttribute('data-inactive-classes');
var items = [];
accordionEl.querySelectorAll('[data-accordion-target]').forEach(function (el) {
var item = {
id: el.getAttribute('data-accordion-target'),
triggerEl: el,
targetEl: document.querySelector(el.getAttribute('data-accordion-target')),
iconEl: el.querySelector('[data-accordion-icon]'),
active: el.getAttribute('aria-expanded') === 'true' ? true : false
};
items.push(item);
});
new Accordion(items, {
alwaysOpen: alwaysOpen === 'open' ? true : false,
activeClasses: activeClasses ? activeClasses : Default.activeClasses,
inactiveClasses: inactiveClasses ? inactiveClasses : Default.inactiveClasses
});
});
});
/* harmony default export */ const accordion = (Accordion);
;// CONCATENATED MODULE: ./src/components/collapse.js
function collapse_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function collapse_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? collapse_ownKeys(Object(source), !0).forEach(function (key) { collapse_defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : collapse_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
function collapse_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function collapse_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function collapse_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function collapse_createClass(Constructor, protoProps, staticProps) { if (protoProps) collapse_defineProperties(Constructor.prototype, protoProps); if (staticProps) collapse_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
var collapse_Default = {
triggerEl: null,
onCollapse: function onCollapse() {},
onExpand: function onExpand() {},
onToggle: function onToggle() {}
};
var Collapse = /*#__PURE__*/function () {
function Collapse() {
var targetEl = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
var options = arguments.length > 1 ? arguments[1] : undefined;
collapse_classCallCheck(this, Collapse);
this._targetEl = targetEl;
this._triggerEl = options ? options.triggerEl : collapse_Default.triggerEl;
this._options = collapse_objectSpread(collapse_objectSpread({}, collapse_Default), options);
this._visible = false;
this._init();
}
collapse_createClass(Collapse, [{
key: "_init",
value: function _init() {
var _this = this;
if (this._triggerEl) {
if (this._triggerEl.hasAttribute('aria-expanded')) {
this._visible = this._triggerEl.getAttribute('aria-expanded') === 'true' ? true : false;
} else {
// fix until v2 not to break previous single collapses which became dismiss
this._visible = this._targetEl.classList.contains('hidden') ? false : true;
}
this._triggerEl.addEventListener('click', function () {
_this._visible ? _this.collapse() : _this.expand();
});
}
}
}, {
key: "collapse",
value: function collapse() {
this._targetEl.classList.add('hidden');
if (this._triggerEl) {
this._triggerEl.setAttribute('aria-expanded', 'false');
}
this._visible = false; // callback function
this._options.onCollapse();
}
}, {
key: "expand",
value: function expand() {
this._targetEl.classList.remove('hidden');
if (this._triggerEl) {
this._triggerEl.setAttribute('aria-expanded', 'true');
}
this._visible = true; // callback function
this._options.onExpand();
}
}, {
key: "toggle",
value: function toggle() {
if (this._visible) {
this.collapse();
} else {
this.expand();
}
}
}]);
return Collapse;
}();
window.Collapse = Collapse;
document.addEventListener('DOMContentLoaded', function () {
document.querySelectorAll('[data-collapse-toggle]').forEach(function (triggerEl) {
var targetEl = document.getElementById(triggerEl.getAttribute('data-collapse-toggle'));
new Collapse(targetEl, {
triggerEl: triggerEl
});
});
});
/* harmony default export */ const collapse = (Collapse);
;// CONCATENATED MODULE: ./src/components/carousel.js
function carousel_toConsumableArray(arr) { return carousel_arrayWithoutHoles(arr) || carousel_iterableToArray(arr) || carousel_unsupportedIterableToArray(arr) || carousel_nonIterableSpread(); }
function carousel_nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function carousel_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return carousel_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return carousel_arrayLikeToArray(o, minLen); }
function carousel_iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
function carousel_arrayWithoutHoles(arr) { if (Array.isArray(arr)) return carousel_arrayLikeToArray(arr); }
function carousel_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
function carousel_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function carousel_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? carousel_ownKeys(Object(source), !0).forEach(function (key) { carousel_defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : carousel_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
function carousel_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function carousel_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function carousel_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function carousel_createClass(Constructor, protoProps, staticProps) { if (protoProps) carousel_defineProperties(Constructor.prototype, protoProps); if (staticProps) carousel_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
var carousel_Default = {
defaultPosition: 0,
indicators: {
items: [],
activeClasses: 'bg-white dark:bg-gray-800',
inactiveClasses: 'bg-white/50 dark:bg-gray-800/50 hover:bg-white dark:hover:bg-gray-800'
},
interval: 3000,
onNext: function onNext() {},
onPrev: function onPrev() {},
onChange: function onChange() {}
};
var Carousel = /*#__PURE__*/function () {
function Carousel() {
var items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
carousel_classCallCheck(this, Carousel);
this._items = items;
this._options = carousel_objectSpread(carousel_objectSpread(carousel_objectSpread({}, carousel_Default), options), {}, {
indicators: carousel_objectSpread(carousel_objectSpread({}, carousel_Default.indicators), options.indicators)
});
this._activeItem = this.getItem(this._options.defaultPosition);
this._indicators = this._options.indicators.items;
this._interval = null;
this._init();
}
/**
* Initialise carousel and items based on active one
*/
carousel_createClass(Carousel, [{
key: "_init",
value: function _init() {
var _this = this;
this._items.map(function (item) {
item.el.classList.add('absolute', 'inset-0', 'transition-all', 'transform');
}); // if no active item is set then first position is default
if (this._getActiveItem()) {
this.slideTo(this._getActiveItem().position);
} else {
this.slideTo(0);
}
this._indicators.map(function (indicator, position) {
indicator.el.addEventListener('click', function () {
_this.slideTo(position);
});
});
}
}, {
key: "getItem",
value: function getItem(position) {
return this._items[position];
}
/**
* Slide to the element based on id
* @param {*} position
*/
}, {
key: "slideTo",
value: function slideTo(position) {
var nextItem = this._items[position];
var rotationItems = {
'left': nextItem.position === 0 ? this._items[this._items.length - 1] : this._items[nextItem.position - 1],
'middle': nextItem,
'right': nextItem.position === this._items.length - 1 ? this._items[0] : this._items[nextItem.position + 1]
};
this._rotate(rotationItems);
this._setActiveItem(nextItem.position);
if (this._interval) {
this.pause();
this.cycle();
}
this._options.onChange();
}
/**
* Based on the currently active item it will go to the next position
*/
}, {
key: "next",
value: function next() {
var activeItem = this._getActiveItem();
var nextItem = null; // check if last item
if (activeItem.position === this._items.length - 1) {
nextItem = this._items[0];
} else {
nextItem = this._items[activeItem.position + 1];
}
this.slideTo(nextItem.position); // callback function
this._options.onNext();
}
/**
* Based on the currently active item it will go to the previous position
*/
}, {
key: "prev",
value: function prev() {
var activeItem = this._getActiveItem();
var prevItem = null; // check if first item
if (activeItem.position === 0) {
prevItem = this._items[this._items.length - 1];
} else {
prevItem = this._items[activeItem.position - 1];
}
this.slideTo(prevItem.position); // callback function
this._options.onPrev();
}
/**
* This method applies the transform classes based on the left, middle, and right rotation carousel items
* @param {*} rotationItems
*/
}, {
key: "_rotate",
value: function _rotate(rotationItems) {
// reset
this._items.map(function (item) {
item.el.classList.add('hidden');
}); // left item (previously active)
rotationItems.left.el.classList.remove('-translate-x-full', 'translate-x-full', 'translate-x-0', 'hidden', 'z-20');
rotationItems.left.el.classList.add('-translate-x-full', 'z-10'); // currently active item
rotationItems.middle.el.classList.remove('-translate-x-full', 'translate-x-full', 'translate-x-0', 'hidden', 'z-10');
rotationItems.middle.el.classList.add('translate-x-0', 'z-20'); // right item (upcoming active)
rotationItems.right.el.classList.remove('-translate-x-full', 'translate-x-full', 'translate-x-0', 'hidden', 'z-20');
rotationItems.right.el.classList.add('translate-x-full', 'z-10');
}
/**
* Set an interval to cycle through the carousel items
*/
}, {
key: "cycle",
value: function cycle() {
var _this2 = this;
this._interval = setInterval(function () {
_this2.next();
}, this._options.interval);
}
/**
* Clears the cycling interval
*/
}, {
key: "pause",
value: function pause() {
clearInterval(this._interval);
}
/**
* Get the currently active item
*/
}, {
key: "_getActiveItem",
value: function _getActiveItem() {
return this._activeItem;
}
/**
* Set the currently active item and data attribute
* @param {*} position
*/
}, {
key: "_setActiveItem",
value: function _setActiveItem(position) {
var _this3 = this;
this._activeItem = this._items[position]; // update the indicators if available
if (this._indicators.length) {
var _this$_indicators$pos, _this$_indicators$pos2;
this._indicators.map(function (indicator) {
var _indicator$el$classLi, _indicator$el$classLi2;
indicator.el.setAttribute('aria-current', 'false');
(_indicator$el$classLi = indicator.el.classList).remove.apply(_indicator$el$classLi, carousel_toConsumableArray(_this3._options.indicators.activeClasses.split(" ")));
(_indicator$el$classLi2 = indicator.el.classList).add.apply(_indicator$el$classLi2, carousel_toConsumableArray(_this3._options.indicators.inactiveClasses.split(" ")));
});
(_this$_indicators$pos = this._indicators[position].el.classList).add.apply(_this$_indicators$pos, carousel_toConsumableArray(this._options.indicators.activeClasses.split(" ")));
(_this$_indicators$pos2 = this._indicators[position].el.classList).remove.apply(_this$_indicators$pos2, carousel_toConsumableArray(this._options.indicators.inactiveClasses.split(" ")));
this._indicators[position].el.setAttribute('aria-current', 'true');
}
}
}]);
return Carousel;
}();
window.Carousel = Carousel;
document.addEventListener('DOMContentLoaded', function () {
document.querySelectorAll('[data-carousel]').forEach(function (carouselEl) {
var interval = carouselEl.getAttribute('data-carousel-interval');
var slide = carouselEl.getAttribute('data-carousel') === 'slide' ? true : false;
var items = [];
var defaultPosition = 0;
if (carouselEl.querySelectorAll('[data-carousel-item]').length) {
carousel_toConsumableArray(carouselEl.querySelectorAll('[data-carousel-item]')).map(function (carouselItemEl, position) {
items.push({
position: position,
el: carouselItemEl
});
if (carouselItemEl.getAttribute('data-carousel-item') === 'active') {
defaultPosition = position;
}
});
}
var indicators = [];
if (carouselEl.querySelectorAll('[data-carousel-slide-to]').length) {
carousel_toConsumableArray(carouselEl.querySelectorAll('[data-carousel-slide-to]')).map(function (indicatorEl) {
indicators.push({
position: indicatorEl.getAttribute('data-carousel-slide-to'),
el: indicatorEl
});
});
}
var carousel = new Carousel(items, {
defaultPosition: defaultPosition,
indicators: {
items: indicators
},
interval: interval ? interval : carousel_Default.interval
});
if (slide) {
carousel.cycle();
} // check for controls
var carouselNextEl = carouselEl.querySelector('[data-carousel-next]');
var carouselPrevEl = carouselEl.querySelector('[data-carousel-prev]');
if (carouselNextEl) {
carouselNextEl.addEventListener('click', function () {
carousel.next();
});
}
if (carouselPrevEl) {
carouselPrevEl.addEventListener('click', function () {
carousel.prev();
});
}
});
});
/* harmony default export */ const carousel = (Carousel);
;// CONCATENATED MODULE: ./src/components/dismiss.js
function dismiss_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function dismiss_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? dismiss_ownKeys(Object(source), !0).forEach(function (key) { dismiss_defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : dismiss_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
function dismiss_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function dismiss_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function dismiss_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function dismiss_createClass(Constructor, protoProps, staticProps) { if (protoProps) dismiss_defineProperties(Constructor.prototype, protoProps); if (staticProps) dismiss_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
var dismiss_Default = {
triggerEl: null,
transition: 'transition-opacity',
duration: 300,
timing: 'ease-out',
onHide: function onHide() {}
};
var Dismiss = /*#__PURE__*/function () {
function Dismiss() {
var targetEl = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
dismiss_classCallCheck(this, Dismiss);
this._targetEl = targetEl;
this._triggerEl = options ? options.triggerEl : dismiss_Default.triggerEl;
this._options = dismiss_objectSpread(dismiss_objectSpread({}, dismiss_Default), options);
this._init();
}
dismiss_createClass(Dismiss, [{
key: "_init",
value: function _init() {
var _this = this;
if (this._triggerEl) {
this._triggerEl.addEventListener('click', function () {
_this.hide();
});
}
}
}, {
key: "hide",
value: function hide() {
var _this2 = this;
this._targetEl.classList.add(this._options.transition, "duration-".concat(this._options.duration), this._options.timing, 'opacity-0');
setTimeout(function () {
_this2._targetEl.classList.add('hidden');
}, this._options.duration); // callback function
this._options.onHide(this._targetEl);
}
}]);
return Dismiss;
}();
window.Dismiss = Dismiss;
document.addEventListener('DOMContentLoaded', function () {
document.querySelectorAll('[data-dismiss-target]').forEach(function (triggerEl) {
var targetEl = document.querySelector(triggerEl.getAttribute('data-dismiss-target'));
new Dismiss(targetEl, {
triggerEl: triggerEl
});
});
});
/* harmony default export */ const dismiss = (Dismiss);
;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/dom-utils/getWindow.js
function getWindow(node) {
if (node == null) {
return window;
}
if (node.toString() !== '[object Window]') {
var ownerDocument = node.ownerDocument;
return ownerDocument ? ownerDocument.defaultView || window : window;
}
return node;
}
;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/dom-utils/instanceOf.js
function isElement(node) {
var OwnElement = getWindow(node).Element;
return node instanceof OwnElement || node instanceof Element;
}
function isHTMLElement(node) {
var OwnElement = getWindow(node).HTMLElement;
return node instanceof OwnElement || node instanceof HTMLElement;
}
function isShadowRoot(node) {
// IE 11 has no ShadowRoot
if (typeof ShadowRoot === 'undefined') {
return false;
}
var OwnElement = getWindow(node).ShadowRoot;
return node instanceof OwnElement || node instanceof ShadowRoot;
}
;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/utils/math.js
var math_max = Math.max;
var math_min = Math.min;
var round = Math.round;
;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/dom-utils/getBoundingClientRect.js
function getBoundingClientRect(element, includeScale) {
if (includeScale === void 0) {
includeScale = false;
}
var rect = element.getBoundingClientRect();
var scaleX = 1;
var scaleY = 1;
if (isHTMLElement(element) && includeScale) {
var offsetHeight = element.offsetHeight;
var offsetWidth = element.offsetWidth; // Do not attempt to divide by 0, otherwise we get `Infinity` as scale
// Fallback to 1 in case both values are `0`
if (offsetWidth > 0) {
scaleX = round(rect.width) / offsetWidth || 1;
}
if (offsetHeight > 0) {
scaleY = round(rect.height) / offsetHeight || 1;
}
}
return {
width: rect.width / scaleX,
height: rect.height / scaleY,
top: rect.top / scaleY,
right: rect.right / scaleX,
bottom: rect.bottom / scaleY,
left: rect.left / scaleX,
x: rect.left / scaleX,
y: rect.top / scaleY
};
}
;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/dom-utils/getWindowScroll.js
function getWindowScroll(node) {
var win = getWindow(node);
var scrollLeft = win.pageXOffset;
var scrollTop = win.pageYOffset;
return {
scrollLeft: scrollLeft,
scrollTop: scrollTop
};
}
;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/dom-utils/getHTMLElementScroll.js
function getHTMLElementScroll(element) {
return {
scrollLeft: element.scrollLeft,
scrollTop: element.scrollTop
};
}
;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/dom-utils/getNodeScroll.js
function getNodeScroll(node) {
if (node === getWindow(node) || !isHTMLElement(node)) {
return getWindowScroll(node);
} else {
return getHTMLElementScroll(node);
}
}
;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/dom-utils/getNodeName.js
function getNodeName(element) {
return element ? (element.nodeName || '').toLowerCase() : null;
}
;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/dom-utils/getDocumentElement.js
function getDocumentElement(element) {
// $FlowFixMe[incompatible-return]: assume body is always available
return ((isElement(element) ? element.ownerDocument : // $FlowFixMe[prop-missing]
element.document) || window.document).documentElement;
}
;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/dom-utils/getWindowScrollBarX.js
function getWindowScrollBarX(element) {
// If <html> has a CSS width greater than the viewport, then this will be
// incorrect for RTL.
// Popper 1 is broken in this case and never had a bug report so let's assume
// it's not an issue. I don't think anyone ever specifies width on <html>
// anyway.
// Browsers where the left scrollbar doesn't cause an issue report `0` for
// this (e.g. Edge 2019, IE11, Safari)
return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
}
;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/dom-utils/getComputedStyle.js
function getComputedStyle(element) {
return getWindow(element).getComputedStyle(element);
}
;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/dom-utils/isScrollParent.js
function isScrollParent(element) {
// Firefox wants us to check `-x` and `-y` variations as well
var _getComputedStyle = getComputedStyle(element),
overflow = _getComputedStyle.overflow,
overflowX = _getComputedStyle.overflowX,
overflowY = _getComputedStyle.overflowY;
return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
}
;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/dom-utils/getCompositeRect.js
function isElementScaled(element) {
var rect = element.getBoundingClientRect();
var scaleX = round(rect.width) / element.offsetWidth || 1;
var scaleY = round(rect.height) / element.offsetHeight || 1;
return scaleX !== 1 || scaleY !== 1;
} // Returns the composite rect of an element relative to its offsetParent.
// Composite means it takes into account transforms as well as layout.
function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
if (isFixed === void 0) {
isFixed = false;
}
var isOffsetParentAnElement = isHTMLElement(offsetParent);
var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
var documentElement = getDocumentElement(offsetParent);
var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled);
var scroll = {
scrollLeft: 0,
scrollTop: 0
};
var offsets = {
x: 0,
y: 0
};
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
if (getNodeName(offsetParent) !== 'body' || // https://github.com/popperjs/popper-core/issues/1078
isScrollParent(documentElement)) {
scroll = getNodeScroll(offsetParent);
}
if (isHTMLElement(offsetParent)) {
offsets = getBoundingClientRect(offsetParent, true);
offsets.x += offsetParent.clientLeft;
offsets.y += offsetParent.clientTop;
} else if (documentElement) {
offsets.x = getWindowScrollBarX(documentElement);
}
}
return {
x: rect.left + scroll.scrollLeft - offsets.x,
y: rect.top + scroll.scrollTop - offsets.y,
width: rect.width,
height: rect.height
};
}
;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/dom-utils/getLayoutRect.js
// Returns the layout rect of an element relative to its offsetParent. Layout
// means it doesn't take into account transforms.
function getLayoutRect(element) {
var clientRect = getBoundingClientRect(element); // Use the clientRect sizes if it's not been transformed.
// Fixes https://github.com/popperjs/popper-core/issues/1223
var width = element.offsetWidth;
var height = element.offsetHeight;
if (Math.abs(clientRect.width - width) <= 1) {
width = clientRect.width;
}
if (Math.abs(clientRect.height - height) <= 1) {
height = clientRect.height;
}
return {
x: element.offsetLeft,
y: element.offsetTop,
width: width,
height: height
};
}
;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/dom-utils/getParentNode.js
function getParentNode(element) {
if (getNodeName(element) === 'html') {
return element;
}
return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle
// $FlowFixMe[incompatible-return]
// $FlowFixMe[prop-missing]
element.assignedSlot || // step into the shadow DOM of the parent of a slotted node
element.parentNode || ( // DOM Element detected
isShadowRoot(element) ? element.host : null) || // ShadowRoot detected
// $FlowFixMe[incompatible-call]: HTMLElement is a Node
getDocumentElement(element) // fallback
);
}
;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/dom-utils/getScrollParent.js
function getScrollParent(node) {
if (['html', 'body', '#document'].indexOf(getNodeName(node)) >= 0) {
// $FlowFixMe[incompatible-return]: assume body is always available
return node.ownerDocument.body;
}
if (isHTMLElement(node) && isScrollParent(node)) {
return node;
}
return getScrollParent(getParentNode(node));
}
;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/dom-utils/listScrollParents.js
/*
given a DOM element, return the list of all scroll parents, up the list of ancesors
until we get to the top window object. This list is what we attach scroll listeners
to, because if any of these parent elements scroll, we'll need to re-calculate the
reference element's position.
*/
function listScrollParents(element, list) {
var _element$ownerDocumen;
if (list === void 0) {
list = [];
}
var scrollParent = getScrollParent(element);
var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
var win = getWindow(scrollParent);
var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
var updatedList = list.concat(target);
return isBody ? updatedList : // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here
updatedList.concat(listScrollParents(getParentNode(target)));
}
;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/dom-utils/isTableElement.js
function isTableElement(element) {
return ['table', 'td', 'th'].indexOf(getNodeName(element)) >= 0;
}
;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/dom-utils/getOffsetParent.js
function getTrueOffsetParent(element) {
if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837
getComputedStyle(element).position === 'fixed') {
return null;
}
return element.offsetParent;
} // `.offsetParent` reports `null` for fixed elements, while absolute elements
// return the containing block
function getContainingBlock(element) {
var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') !== -1;
var isIE = navigator.userAgent.indexOf('Trident') !== -1;
if (isIE && isHTMLElement(element)) {